$tz) { $timezones[$tz] = $tz; } $cfg = array(); $q = $mysqli->query("SELECT * FROM config WHERE category!='system' ORDER BY category,`order`,var"); while($r = $q->fetch_assoc()) { if(!array_key_exists($r['category'], $cfg)) $cfg[$r['category']] = array(); $cfg[$r['category']][$r['var']] = $r; } $cfg_tab_names = array(); foreach($cfg as $k=>&$v) { $cfg_tab_names[$k] = str_replace(' ', '_', $k); //$ksort($v); } //ksort($cfg); $action = array_key_exists('action', $_POST) ? $_POST['action'] : ''; switch($action) { case 'save': $need_update_divisional = False; /* Scan everythign that was just saved */ foreach($_POST as $p=>$v) { if(substr($p, 0, 4) == 'cfg_') { $var = substr($p, 4); $val = $mysqli->real_escape_string($v); $mysqli->real_query("UPDATE config SET `val`='$val' WHERE `var`='$var'"); /* Do variable-dependent things when a variable is saved */ switch($var) { case 'judge_divisional_prizes': $need_update_divisional = True; break; } } } /* Reload config */ sfiab_load_config($mysqli); /* Do any additional updates with the new config */ if($need_update_divisional) { debug("config judge_divisional_prizes was saved, running award_update_divisional()\n"); award_update_divisional($mysqli); } form_ajax_response(0); exit(); } $page_id = 'c_config_variables'; $help = '

SFIAB Configuration'; sfiab_page_begin($u, "SFIAB Configuration", $page_id, $help); ?>

Don't change these unless you know what you're doing!

&$v) { ?>

&$d) { switch($d['type']) { case 'yesno': form_yesno($form_id, 'cfg_'.$d['var'], $d['var'], $d['val']); break; case 'timezone': form_select($form_id, 'cfg_'.$d['var'], $d['var'], $timezones, $d['val']); break; case 'select': $l = explode('|', $d['type_values']); $opts = array(); foreach($l as $item) { $item_l = explode('=', $item, 2); if(count($item_l) == 2) { $opts[$item_l[0]] = $item_l[1]; } else { $opts[$item_l[0]] = $item_l[0]; } } // print_r($opts); form_select($form_id, 'cfg_'.$d['var'], $d['var'], $opts, $d['val']); break; default: form_text($form_id, 'cfg_'.$d['var'], $d['var'], $d['val']); break; } } form_submit($form_id, 'save', "Save", "Saved"); form_end($form_id); ?>


Help

&$d) { ?>
: