0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-20 03:36:20 +02:00

fetchmail.php: PostgreSQL does not need the next autoincrement value to be asigned fo rit

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@351 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
David Goodwin 2008-04-26 21:55:16 +00:00
parent c4ff134c5a
commit 2814fd2ff7

View File

@ -153,6 +153,10 @@ if ($cancel) { # cancel $new or $edit
}
}
$formvars['id'] = $edit; # results in 0 on $new
if($CONF['database_type'] == 'pgsql' && $new) {
// skip - shouldn't need to specify this as it will default to the next available value anyway.
unset($formvars['id']);
}
if (!in_array($formvars['mailbox'], $fm_defaults['mailbox'])) {
flash_error($PALANG['pFetchmail_invalid_mailbox']);
@ -173,8 +177,8 @@ if ($cancel) { # cancel $new or $edit
}
if ($save) {
if ($new) {
$sql="INSERT fetchmail (".implode(",",escape_string(array_keys($formvars))).") VALUES ('".implode("','",escape_string($formvars))."')";
if ($new) {
$sql="INSERT INTO fetchmail (".implode(",",escape_string(array_keys($formvars))).") VALUES ('".implode("','",escape_string($formvars))."')";
} else { # $edit
foreach(array_keys($formvars) as $key) {
$formvars[$key] = escape_string($key) . "='" . escape_string($formvars[$key]) . "'";
@ -221,7 +225,7 @@ function _inp_num($val){
}
function _inp_bool($val){
return $val?db_get_boolean(true):db_get_boolean(false);
return $val ? db_get_boolean(true): db_get_boolean(false);
}
function _inp_password($val){