root/dev/common/admin/admin_mods.php @ 190

Revision 190, 2.1 KB (checked in by exi, 16 years ago)

This is a big update...
Moved all admin scripts to common/admin.
Moved all includes and classes to common/includes.
Edited all include-paths to reflect the movement.
Fixed a bug with the session system allowing every registered user to access admin pages.
Replaced calls to date() to use a wrapper so gmdate can be used.
Replaced some calls to $config with calls to the static object.
Fixed a big which caused the portrait_grab to not download a new picute.
Added a classified-state to kills.
Removed the sync_server server script in this tree.
Added code to help modules find the includes to index.php.

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