- new function db_pgsql() to replace lots of
"if ($CONF[database_type] == 'pgsql')) checks
- delete unused function boolconf()
several files:
- use db_pgsql() instead of checking $CONF[database_type]
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1582 a1433add-5e2c-0410-b055-b7f2511e0802
@ -235,7 +235,7 @@ if ($edit + $new == 0) { # display list
$res = db_query ("SELECT ".implode(",",escape_string(array_keys($fm_struct)))." FROM $table_fetchmail WHERE mailbox IN ($user_mailboxes_sql) ORDER BY mailbox,src_server,src_user");
if ($res['rows'] > 0) {
while ($row = db_array ($res['result'])) {
if ('pgsql'==$CONF['database_type']) {
if (db_pgsql()) {
//. at least in my database, $row['modified'] already looks like : 2009-04-11 21:38:10.75586+01,
// while gmstrftime expects an integer value. strtotime seems happy though.
@ -462,7 +462,7 @@ function create_page_browser($idxfield, $querypart) {
) idx WHERE MOD(idx.row, $page_size) IN (0,$page_size_zerobase) OR idx.row = $count_results
";
if ('pgsql'==$CONF['database_type']) {
if (db_pgsql()) {
$query = "
SELECT * FROM (
SELECT $idxfield AS label, nextval('rowcount') AS row $querypart
@ -493,7 +493,7 @@ function create_page_browser($idxfield, $querypart) {
}
}
if ('pgsql'==$CONF['database_type']) {
if (db_pgsql()) {
db_query ("DROP SEQUENCE rowcount");
}
@ -1233,7 +1233,7 @@ function db_connect ($ignore_errors = 0) {
} else {
$error_text .= "<p/>DEBUG INFORMATION:<br/>MySQL 4.1 functions not available! (php5-mysqli installed?)<br/>database_type = 'mysqli' in config.inc.php, are you using a different database? $DEBUG_TEXT";
}
} elseif ($CONF['database_type'] == "pgsql") {
} elseif (db_pgsql()) {
if (function_exists ("pg_pconnect")) {
if(!isset($CONF['database_port'])) {
$CONF['database_port'] = '5432';
@ -1276,14 +1276,13 @@ function db_get_boolean($bool) {
$query = "SELECT timestamp,username,domain,action,data FROM $table_log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10";
if ('pgsql'==$CONF['database_type'])
{
if (db_pgsql()) {
$query = "SELECT extract(epoch from timestamp) as timestamp,username,domain,action,data FROM $table_log WHERE domain='$fDomain' ORDER BY timestamp DESC LIMIT 10";