isLoggedIn()) { errorpage("You must be logged in to edit preferences"); exit; } // we come from the administration to edit an user if($_SESSION['current']->hasPriv("admin") && is_numeric($_REQUEST['userId']) && is_numeric($_REQUEST['iLimit']) && in_array($_REQUEST['sOrderBy'],array("email","realname","created")) ) { $oUser = new User($_REQUEST['userId']); } else { $oUser = &$_SESSION['current']; } function build_prefs_list() { global $oUser; $result = query_appdb("SELECT * FROM prefs_list ORDER BY id"); while($result && $r = mysql_fetch_object($result)) { //skip admin options //TODO: add a field to prefs_list to flag the user level for the pref if(!$_SESSION['current']->hasPriv("admin")) { if($r->name == "query:mode") continue; if($r->name == "sidebar") continue; if($r->name == "window:query") continue; if($r->name == "query:hide_header") continue; if($r->name == "query:hide_sidebar") continue; if($r->name == "debug") continue; } $input = html_select("pref_$r->name", explode('|', $r->value_list), $oUser->getpref($r->name, $r->def_value)); echo html_tr(array(" $r->description", $input)); } } function show_user_fields() { global $oUser; $ext_realname = $oUser->sRealname; $ext_email = $oUser->sEmail; $CVSrelease = $oUser->sWineRelease; if($oUser->hasPriv("admin")) $ext_hasadmin = 'checked="true"'; else $ext_hasadmin = ""; include(BASE."include/form_edit.php"); echo "