Upgrade config saving
parent
7ec96655c3
commit
e2f32ab091
|
@ -48,18 +48,24 @@ if ( $action == 'delete' ) {
|
|||
}
|
||||
|
||||
} else if ( $action == 'options' && isset($_REQUEST['tab']) ) {
|
||||
$configCat = $configCats[$_REQUEST['tab']];
|
||||
$changed = false;
|
||||
foreach ( $configCat as $name=>$value ) {
|
||||
unset($newValue);
|
||||
if ( $value['Type'] == 'boolean' && empty($_REQUEST['newConfig'][$name]) ) {
|
||||
$newValue = 0;
|
||||
} else if ( isset($_REQUEST['newConfig'][$name]) ) {
|
||||
$newValue = preg_replace("/\r\n/", "\n", stripslashes($_REQUEST['newConfig'][$name]));
|
||||
|
||||
$result = dbQuery('SELECT Name,Value,Type FROM Config WHERE Category=? ORDER BY Id ASC', array($_REQUEST['tab']));
|
||||
if ( !$result ) {
|
||||
echo mysql_error();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset($newValue) && ($newValue != $value['Value']) ) {
|
||||
dbQuery('UPDATE Config SET Value=? WHERE Name=?', array($newValue, $name));
|
||||
$changed = false;
|
||||
while( $config = dbFetchNext($result) ) {
|
||||
unset($newValue);
|
||||
if ( $config['Type'] == 'boolean' && empty($_REQUEST['newConfig'][$config['Name']]) ) {
|
||||
$newValue = 0;
|
||||
} else if ( isset($_REQUEST['newConfig'][$config['Name']]) ) {
|
||||
$newValue = preg_replace("/\r\n/", "\n", stripslashes($_REQUEST['newConfig'][$config['Name']]));
|
||||
}
|
||||
|
||||
if ( isset($newValue) && ($newValue != $config['Value']) ) {
|
||||
dbQuery('UPDATE Config SET Value=? WHERE Name=?', array($newValue, $config['Name']));
|
||||
$changed = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue