1 | <?php |
---|
2 | require_once("db.php"); |
---|
3 | require_once("class.killboard.php"); |
---|
4 | require_once("class.page.php"); |
---|
5 | require_once("class.tabbedform.php"); |
---|
6 | require_once("admin_menu.php"); |
---|
7 | |
---|
8 | $killboard = new Killboard(KB_SITE); |
---|
9 | $page = new Page("Administration - Generic"); |
---|
10 | $page->setAdmin(); |
---|
11 | |
---|
12 | $config = $killboard->getConfig(); |
---|
13 | if ($_POST['submit']) |
---|
14 | { |
---|
15 | $config->setStyleBanner($_POST['style_banner']); |
---|
16 | $config->setStyleName($_POST['style_name']); |
---|
17 | if ($_POST['kill_points'] == "on") |
---|
18 | { |
---|
19 | $killpoints = 1; |
---|
20 | } |
---|
21 | else |
---|
22 | { |
---|
23 | $killpoints = 0; |
---|
24 | } |
---|
25 | if ($_POST['least_active'] == "on") |
---|
26 | { |
---|
27 | $leastactive = 1; |
---|
28 | } |
---|
29 | else |
---|
30 | { |
---|
31 | $leastactive = 0; |
---|
32 | } |
---|
33 | $config->setKillPoints($killpoints); |
---|
34 | $config->setLeastActive($leastactive); |
---|
35 | if ($_POST['comments'] == "on") |
---|
36 | { |
---|
37 | require_once('autoupgrade.php'); |
---|
38 | check_commenttable(); |
---|
39 | $config->setConfig('comments', '1'); |
---|
40 | } |
---|
41 | else |
---|
42 | { |
---|
43 | $config->setConfig('comments', '0'); |
---|
44 | } |
---|
45 | if ($_POST['comments_pw'] == "on") |
---|
46 | { |
---|
47 | $config->setConfig('comments_pw', '1'); |
---|
48 | } |
---|
49 | else |
---|
50 | { |
---|
51 | $config->setConfig('comments_pw', '0'); |
---|
52 | } |
---|
53 | $config->setPostPassword($_POST['post_password']); |
---|
54 | $config->setPostMailto($_POST['post_mailto']); |
---|
55 | |
---|
56 | $html .= "Changes saved."; |
---|
57 | } |
---|
58 | |
---|
59 | $html .= "<form id=options name=options method=post action=?a=admin>"; |
---|
60 | $html .= "<div class=block-header2>Look and feel</div>"; |
---|
61 | $html .= "<table class=kb-subtable>"; |
---|
62 | $html .= "<tr><td width=120><b>Banner:</b></td><td><select id=style_banner name=style_banner>"; |
---|
63 | $dir = "img/banners/"; |
---|
64 | if (is_dir($dir)) |
---|
65 | { |
---|
66 | if ($dh = opendir($dir)) |
---|
67 | { |
---|
68 | while (($file = readdir($dh)) !== false) |
---|
69 | { |
---|
70 | $file = substr($file, 0, strpos($file, ".")); |
---|
71 | if (!is_dir($dir . $file)) |
---|
72 | { |
---|
73 | $html .= "<option value=\"" . $file . "\""; |
---|
74 | if ($file == $config->getStyleBanner()) |
---|
75 | $html .= " selected=\"selected\""; |
---|
76 | $html .= ">" . $file . "</option>"; |
---|
77 | } |
---|
78 | } |
---|
79 | closedir($dh); |
---|
80 | } |
---|
81 | } |
---|
82 | $html .= "<option value=\"custom\""; |
---|
83 | if ($config->getStyleBanner() == "custom") |
---|
84 | $html .= " selected=\"selected\""; |
---|
85 | $html .= ">custom</option></select></td></tr>"; |
---|
86 | $html .= "<tr><td width=120><b>Style:</b></td><td><select id=style_name name=style_name>"; |
---|
87 | $dir = "style/"; |
---|
88 | if (is_dir($dir)) |
---|
89 | { |
---|
90 | if ($dh = opendir($dir)) |
---|
91 | { |
---|
92 | while (($file = readdir($dh)) !== false) |
---|
93 | { |
---|
94 | if (is_dir($dir . $file)) |
---|
95 | { |
---|
96 | if ($file == "." || $file == ".." || $file == ".svn") |
---|
97 | continue; |
---|
98 | $html .= "<option value=\"" . $file . "\""; |
---|
99 | if ($file == $config->getStyleName()) |
---|
100 | $html .= " selected=\"selected\""; |
---|
101 | $html .= ">" . $file . "</option>"; |
---|
102 | } |
---|
103 | } |
---|
104 | closedir($dh); |
---|
105 | } |
---|
106 | } |
---|
107 | $html .= "</select></td></tr>"; |
---|
108 | $html .= "<tr><td></td></tr></table>"; |
---|
109 | |
---|
110 | $html .= "<div class=block-header2>Global options</div>"; |
---|
111 | $html .= "<table class=kb-subtable>"; |
---|
112 | $html .= "<tr><td width=120><b>Display killpoints:</b></td><td><input type=checkbox name=kill_points id=kill_points"; |
---|
113 | if ($config->getConfig('kill_points')) |
---|
114 | $html .= " checked=\"checked\""; |
---|
115 | $html .= "></td></tr>"; |
---|
116 | $html .= "<tr><td width=120><b>Enable Comments:</b></td><td><input type=checkbox name=comments id=comments"; |
---|
117 | if ($config->getConfig('comments')) |
---|
118 | $html .= " checked=\"checked\""; |
---|
119 | $html .= "></td></tr>"; |
---|
120 | $html .= "<tr><td width=120><b>Require password for Comments:</b></td><td><input type=checkbox name=comments_pw id=comments_pw"; |
---|
121 | if ($config->getConfig('comments_pw')) |
---|
122 | $html .= " checked=\"checked\""; |
---|
123 | $html .= "></td></tr>"; |
---|
124 | // $html .= "<tr><td width=120><b>Display least active:</b></td><td><input type=checkbox name=least_active id=least_active"; |
---|
125 | // if ( $config->getLeastActive() ) |
---|
126 | // $html .= " checked=\"checked\""; |
---|
127 | // $html .= "></td></tr>"; |
---|
128 | $html .= "<tr><td></td></tr></table>"; |
---|
129 | |
---|
130 | $html .= "<div class=block-header2>Posting</div>"; |
---|
131 | $html .= "<table class=kb-subtable>"; |
---|
132 | |
---|
133 | $html .= "<tr><td width=120><b>Post password:</b></td><td><input type=text name=post_password id=post_password size=20 maxlength=20 value=\"" . $config->getPostPassword() . "\"></td></tr>"; |
---|
134 | $html .= "<tr><td width=120><b>Killmail CC:</b></td><td><input type=text name=post_mailto id=post_mailto size=20 maxlength=80 value=\"" . $config->getPostMailto() . "\"> (e-mail address)</td></tr>"; |
---|
135 | $html .= "</table>"; |
---|
136 | |
---|
137 | $html .= "<div class=block-header2>Save changes</div>"; |
---|
138 | $html .= "<table class=kb-subtable>"; |
---|
139 | |
---|
140 | $html .= "<tr><td width=120></td><td><input type=submit name=submit value=\"Save\"></td></tr>"; |
---|
141 | $html .= "</table>"; |
---|
142 | |
---|
143 | $html .= "</form>"; |
---|
144 | |
---|
145 | $page->setContent($html); |
---|
146 | $page->addContext($menubox->generate()); |
---|
147 | $page->generate(); |
---|
148 | ?> |
---|