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