function setPref($data_dir, $username, $string, $set_to) { global $prefs_cache; if (isset($prefs_cache[$string]) && $prefs_cache[$string] == $set_to) { return; } if ($set_to === '') { removePref($data_dir, $username, $string); return; } $db = new dbPrefs(); if (isset($db->error)) { $db->failQuery(); } $db->setKey($username, $string, $set_to); $prefs_cache[$string] = $set_to; assert_options(ASSERT_ACTIVE, 1); assert_options(ASSERT_BAIL, 1); assert('$set_to == $prefs_cache[$string]'); sqsession_register($prefs_cache, 'prefs_cache'); return; }
/** * Sets the desired preference setting ($pref_name) to whatever is in $value * @ignore */ function setPref($data_dir, $username, $pref_name, $value) { global $prefs_cache; if (isset($prefs_cache[$pref_name]) && $prefs_cache[$pref_name] == $value) { return; } if ($value === '') { removePref($data_dir, $username, $pref_name); return; } $db = new dbPrefs(); if (isset($db->error)) { $db->failQuery(); } $db->setKey($username, $pref_name, $value); $prefs_cache[$pref_name] = $value; assert_options(ASSERT_ACTIVE, 1); assert_options(ASSERT_BAIL, 1); assert('$value == $prefs_cache[$pref_name]'); sqsession_register($prefs_cache, 'prefs_cache'); return; }