function saveUserSettings($uid, $settings) { if (!isset($uid)) { return false; } // Messy - a not exists would prob work better. but would have to be done // on every key/value pair so lots of extra-statements. deleteUserSettings($uid); // insert new settings foreach ($settings as $key => $value) { insertUserSettingPair($uid, $key, $value); } return true; }
function saveUserSettings($uid, $settings) { global $cfg; // Messy - a not exists would prob work better. but would have to be done // on every key/value pair so lots of extra-statements. deleteUserSettings($uid); // load global settings + overwrite per-user settings loadSettings('tf_settings'); // insert new settings foreach ($settings as $key => $value) { if (in_array($key, $cfg['validUserSettingsKeys'])) { insertUserSettingPair($uid, $key, $value); } else { AuditAction($cfg["constants"]["error"], "ILLEGAL SETTING: " . $cfg["user"] . " tried to insert " . $value . " for key " . $key); } } // flush session-cache cacheFlush($cfg["user"]); // return return true; }