Id() ) userLogout(); } } else if ( $action == 'options' && isset($_REQUEST['tab']) ) { $result = dbQuery('SELECT Name,Value,Type,`System` FROM Config WHERE Category=? ORDER BY Id ASC', array($_REQUEST['tab'])); if (!$result) { echo mysql_error(); return; } $changed = false; while ($config = dbFetchNext($result)) { unset($newValue); if ( ($config['Type'] == 'boolean') and empty($_REQUEST['newConfig'][$config['Name']]) ) { $newValue = 0; } else if (isset($_REQUEST['newConfig'][$config['Name']])) { $newValue = preg_replace('/\r\n/', '\n', $_REQUEST['newConfig'][$config['Name']]); } if (isset($newValue) && ($newValue != $config['Value'])) { # Handle special cases first if ($config['Name'] == 'ZM_LANG_DEFAULT') { # Verify that the language file exists in the lang directory. if (!file_exists(ZM_PATH_WEB.'/lang/'.$newValue.'.php')) { $error_message .= 'Error setting ' . $config['Name'].'. New value ' .$newValue.' not saved because '.ZM_PATH_WEB.'/lang/'.$newValue.'.php doesn\'t exist.
'; ZM\Error($error_message); continue; } } dbQuery('UPDATE Config SET Value=? WHERE Name=?', array($newValue, $config['Name'])); $changed = true; } # end if value changed } # end foreach config entry if ( $changed ) { switch ( $_REQUEST['tab'] ) { case 'system' : case 'config' : $restartWarning = true; break; case 'API': case 'web' : case 'tools' : break; case 'logging' : case 'network' : case 'mail' : case 'upload' : $restartWarning = true; break; case 'highband' : case 'medband' : case 'lowband' : break; } $redirect = '?view=options&tab='.$_REQUEST['tab']; loadConfig(false); # Might need to update auth hash # This doesn't work because the config are constants and won't really be loaded until the next refresh. #generateAuthHash(ZM_AUTH_HASH_IPS, true); } return; } // end if object vs action ?>