1 | <?php |
---|
2 | require_once('common/admin/admin_menu.php'); |
---|
3 | |
---|
4 | $page = new Page('Administration - Mods'); |
---|
5 | $killboard = new Killboard(KB_SITE); |
---|
6 | $page->setAdmin(); |
---|
7 | |
---|
8 | if ($_POST['set_mods'] != '') |
---|
9 | { |
---|
10 | foreach($_POST as $key => $val) |
---|
11 | { |
---|
12 | if (substr($key, 0, 4) == "mod_" && $val == "on") |
---|
13 | { |
---|
14 | if (substr($key, 4, strlen($key)-4) != 'item_values') |
---|
15 | { |
---|
16 | $activemods .= substr($key, 4, strlen($key)-4).","; |
---|
17 | } |
---|
18 | } |
---|
19 | } |
---|
20 | $activemods = substr($activemods, 0, strlen($activemods)-1); |
---|
21 | config::set("mods_active", $activemods); |
---|
22 | } |
---|
23 | $activemods = explode(",", config::get("mods_active")); |
---|
24 | $html = <<<HTML |
---|
25 | <form action="?a=admin_mods" method="post"> |
---|
26 | <input type="hidden" name="set_mods" value="1"/> |
---|
27 | <table class=kb-table width="99%" align=center cellspacing="1"> |
---|
28 | <tr class=kb-table-header> |
---|
29 | <td class=kb-table-header>Name</td> |
---|
30 | <td class=kb-table-header align="center">Active</td> |
---|
31 | </tr> |
---|
32 | HTML; |
---|
33 | if ($handle = opendir('mods')) |
---|
34 | { |
---|
35 | while ($file = readdir($handle)) |
---|
36 | { |
---|
37 | if (is_dir("mods/$file") && $file != ".." &$file != "." &$file != ".svn") |
---|
38 | { |
---|
39 | $html .= "<tr class=kb-table-row-odd style=\"height: 34px;\">"; |
---|
40 | $id = $file; |
---|
41 | |
---|
42 | if (in_array($id, $activemods)) |
---|
43 | { |
---|
44 | $checked = "checked=\"checked\""; |
---|
45 | } |
---|
46 | else |
---|
47 | { |
---|
48 | $checked = ""; |
---|
49 | } |
---|
50 | if (file_exists("mods/$file/settings.php")) |
---|
51 | { |
---|
52 | $file .= " [<a href=\"?a=settings_$file\">settings</a>]"; |
---|
53 | } |
---|
54 | $html .= "<td>$file</td><td align=center><input name=\"mod_$id\" type=\"checkbox\"$checked/></td></tr>"; |
---|
55 | } |
---|
56 | } |
---|
57 | closedir($handle); |
---|
58 | } |
---|
59 | $html .= "<tr><td colspan=2 align=center><input type=submit name=submit value=\"Save\"></table></form>"; |
---|
60 | $page->setContent($html); |
---|
61 | $page->addContext($menubox->generate()); |
---|
62 | $page->generate(); |
---|
63 | ?> |
---|