userdata["acclevel"] < 100) die ("Access denied!"); function whichStyle() { global $db; $result = $db->query("SELECT value FROM hlstats_Options WHERE keyname = 'style'"); $data = $db->fetch_row($result); return $data['0']; } class OptionGroup { var $title = ""; var $options = array(); function OptionGroup ($title) { $this->title = $title; } function draw () { global $g_options; ?> title; ?>
">
options as $opt) { $opt->draw(); } ?>

options as $opt) { $optval = $HTTP_POST_VARS[$opt->name]; $result = $db->query(" SELECT value FROM hlstats_Options WHERE keyname='$opt->name' "); if ($db->num_rows($result) == 1) { $result = $db->query(" UPDATE hlstats_Options SET value='$optval' WHERE keyname='$opt->name' "); } else { $result = $db->query(" INSERT INTO hlstats_Options ( keyname, value ) VALUES ( '$opt->name', '$optval' ) "); } } } function changeStyle($style) { global $db; $result = $db->query("SELECT keyname, `$style` FROM hlstats_Style"); while($rowdata = $db->fetch_row($result)) { $key = $rowdata[0]; $data = $rowdata[1]; $db->query("UPDATE hlstats_Options SET value='$data' WHERE keyname='$key'"); } $db->query("UPDATE hlstats_Options SET value = '$style' WHERE keyname = 'style' "); } } class Option { var $name; var $title; var $type; function Option ($name, $title, $type) { $this->name = $name; $this->title = $title; $this->type = $type; } function draw () { global $g_options, $optiondata; $styletype = whichStyle(); if (!$g_options['hideAwards']) { $n = ' selected="selected"'; } else { $y = ' selected="selected"'; } if($styletype == "grey") { $gr = "selected"; } elseif($styletype == "black") { $bl = "selected"; } elseif($styletype == "light_blue") { $lb = "selected"; } elseif($styletype == "ua_style") { $ua = "selected"; } elseif($styletype == "red") { $red = "selected"; } elseif($styletype == "light_grey") { $lg = "selected"; } elseif($styletype == "white") { $wh = "selected"; } else { $def = "selected"; } ?> ">title . ":"; echo $g_options["fontend_normal"]; ?> ">type) { case "textarea": echo ""; break; case "select": echo ""; break; case "bool": echo ''; break; default: echo "name\" size=35 value=\""; echo htmlspecialchars($optiondata[$this->name]); echo "\" class=\"textbox\" maxlength=255>"; } ?> options[] = new Option("sitename", "Site Name", "text"); $optiongroups[1]->options[] = new Option("siteurl", "Site URL", "text"); $optiongroups[1]->options[] = new Option("contact", "Contact URL", "text"); $optiongroups[1]->options[] = new Option("hideAwards", "Hide Daily Awards", "bool"); $optiongroups[2] = new OptionGroup("Paths"); $optiongroups[2]->options[] = new Option("imgdir", "Image Directory URL", "text"); $optiongroups[2]->options[] = new Option("imgpath", "Image Directory Filesystem Path", "text"); $optiongroups[2]->options[] = new Option("map_dlurl", "Map Download URL
(%MAP% = map, %GAME% = gamecode)", "text"); $optiongroups[3] = new OptionGroup("Body Style"); $optiongroups[3]->options[] = new Option("body_background", "Background Image", "text"); $optiongroups[3]->options[] = new Option("body_bgcolor", "Background Colour", "text"); $optiongroups[3]->options[] = new Option("body_text", "Text Colour", "text"); $optiongroups[3]->options[] = new Option("body_link", "Link Colour", "text"); $optiongroups[3]->options[] = new Option("body_vlink", "Visited Link Colour", "text"); $optiongroups[3]->options[] = new Option("body_alink", "Active Link Colour", "text"); $optiongroups[3]->options[] = new Option("body_leftmargin", "Left/Right Margin", "text"); $optiongroups[3]->options[] = new Option("body_topmargin", "Top/Bottom Margin", "text"); $optiongroups[4] = new OptionGroup("Location Bar Style"); $optiongroups[4]->options[] = new Option("location_bgcolor", "Background Colour", "text"); $optiongroups[4]->options[] = new Option("location_text", "Text Colour", "text"); $optiongroups[4]->options[] = new Option("location_link", "Link Colour", "text"); $optiongroups[5] = new OptionGroup("Table Style"); $optiongroups[5]->options[] = new Option("table_border", "Border Colour", "text"); $optiongroups[5]->options[] = new Option("table_bgcolor1", "Cell Background Colour (1)", "text"); $optiongroups[5]->options[] = new Option("table_bgcolor2", "Cell Background Colour (2)", "text"); $optiongroups[5]->options[] = new Option("table_wpnbgcolor", "Weapon Background Colour", "text"); $optiongroups[5]->options[] = new Option("table_head_bgcolor", "Head Background Colour", "text"); $optiongroups[5]->options[] = new Option("table_head_text", "Head Text Colour", "text"); $optiongroups[6] = new OptionGroup("Fonts"); $optiongroups[6]->options[] = new Option("font_normal", "Normal Font Tag(s)", "textarea"); $optiongroups[6]->options[] = new Option("fontend_normal", "Normal Font Closing Tag(s)", "textarea"); $optiongroups[6]->options[] = new Option("font_small", "Small Font Tag(s)", "textarea"); $optiongroups[6]->options[] = new Option("fontend_small", "Small Font Closing Tag(s)", "textarea"); $optiongroups[6]->options[] = new Option("font_title", "Title Font Tag(s)", "textarea"); $optiongroups[6]->options[] = new Option("fontend_title", "Title Font Closing Tag(s)", "textarea"); $optiongroups[7] = new OptionGroup("Preset Styles"); $optiongroups[7]->options[] = new Option("style", "Load Preset Style", "select"); if ($HTTP_POST_VARS) { $styletype = whichStyle(); $style = $HTTP_POST_VARS['style']; if($styletype != $style) { foreach ($optiongroups as $og) { $og->changeStyle($style); } message("success", "Options updated successfully."); } else { foreach ($optiongroups as $og) { $og->update(); } message("success", "Options updated successfully."); } } $result = $db->query("SELECT keyname, value FROM hlstats_Options"); while ($rowdata = $db->fetch_row($result)) { $optiondata[$rowdata[0]] = $rowdata[1]; } foreach ($optiongroups as $og) { $og->draw(); } ?>