48 | | $config->checkCheckbox('comments_pw'); |
49 | | $config->checkCheckbox('comments_count'); |
50 | | $config->checkCheckbox('item_values'); |
51 | | $config->checkCheckbox('readd_dupes'); |
52 | | $config->setPostPassword($_POST['post_password']); |
53 | | $config->setPostMailto($_POST['post_mailto']); |
54 | | $config->setConfig('mail_host', $_POST['post_mailhost']); |
55 | | |
56 | | if ($_POST['filter_apply'] == "on") |
57 | | { |
58 | | $config->setConfig('filter_apply', '1'); |
59 | | $config->setConfig('filter_date', mktime(0, 0, 0, $_POST['filter_month'], ($_POST['filter_day'] > 31 ? 31 : $_POST['filter_day']), $_POST['filter_year'])); |
60 | | } |
61 | | else |
62 | | { |
63 | | $config->setConfig('filter_apply', '0'); |
64 | | $config->setConfig('filter_date', 0); |
65 | | } |
66 | | |
67 | | $html .= "Changes saved."; |
68 | | } |
69 | | |
70 | | $html .= "<form id=options name=options method=post action=?a=admin>"; |
71 | | $html .= "<div class=block-header2>Look and feel</div>"; |
72 | | $html .= "<table class=kb-subtable>"; |
73 | | $html .= "<tr><td width=120><b>Banner:</b></td><td><select id=style_banner name=style_banner>"; |
74 | | |
75 | | $dir = "img/logo/"; |
76 | | if (is_dir($dir)) |
77 | | { |
78 | | if ($dh = opendir($dir)) |
79 | | { |
80 | | while (($file = readdir($dh)) !== false) |
81 | | { |
82 | | $file = substr($file, 0, strpos($file, ".")); |
83 | | if (!is_dir($dir.$file)) |
84 | | { |
85 | | $html .= "<option value=\"".$file."\""; |
86 | | if ($file == $config->getConfig('style_banner')) |
87 | | { |
88 | | $html .= " selected=\"selected\""; |
89 | | } |
90 | | $html .= ">".$file."</option>"; |
91 | | } |
92 | | } |
93 | | closedir($dh); |
94 | | } |
95 | | } |
96 | | $html .= "</td></tr>"; |
97 | | $html .= "<tr><td width=120><b>Style:</b></td><td><select id=style_name name=style_name>"; |
98 | | |
99 | | $dir = "style/"; |
100 | | if (is_dir($dir)) |
101 | | { |
102 | | if ($dh = opendir($dir)) |
103 | | { |
104 | | while (($file = readdir($dh)) !== false) |
105 | | { |
106 | | if (is_dir($dir.$file)) |
107 | | { |
108 | | if ($file == "." || $file == ".." || $file == ".svn") |
109 | | { |
110 | | continue; |
111 | | } |
112 | | $html .= "<option value=\"".$file."\""; |
113 | | if ($file == $config->getConfig('style_name')) |
114 | | { |
115 | | $html .= " selected=\"selected\""; |
116 | | } |
117 | | $html .= ">".$file."</option>"; |
118 | | } |
119 | | } |
120 | | closedir($dh); |
121 | | } |
122 | | } |
123 | | $html .= "</select></td></tr>"; |
124 | | $html .= "<tr><td></td></tr></table>"; |
125 | | |
126 | | $html .= "<div class=block-header2>Global options</div>"; |
127 | | $html .= "<table class=kb-subtable>"; |
128 | | $html .= "<tr><td width=120><b>Display killpoints:</b></td><td><input type=checkbox name=kill_points id=kill_points"; |
129 | | if ($config->getConfig('kill_points')) |
130 | | { |
131 | | $html .= " checked=\"checked\""; |
132 | | } |
133 | | $html .= "></td></tr>"; |
134 | | $html .= "<tr><td width=120><b>Display losspoints:</b></td><td><input type=checkbox name=loss_points id=loss_points"; |
135 | | if ($config->getConfig('loss_points')) |
136 | | { |
137 | | $html .= " checked=\"checked\""; |
138 | | } |
139 | | $html .= "></td></tr>"; |
140 | | $html .= "<tr><td width=120><b>Display totalpoints:</b></td><td><input type=checkbox name=total_points id=total_points"; |
141 | | if ($config->getConfig('total_points')) |
142 | | { |
143 | | $html .= " checked=\"checked\""; |
144 | | } |
145 | | $html .= "></td></tr>"; |
146 | | |
147 | | $html .= "<tr><td width=120><b>Enable Comments:</b></td><td><input type=checkbox name=comments id=comments"; |
148 | | if ($config->getConfig('comments')) |
149 | | { |
150 | | $html .= " checked=\"checked\""; |
151 | | } |
152 | | $html .= "></td></tr>"; |
153 | | $html .= "<tr><td width=120><b>Require password for Comments:</b></td><td><input type=checkbox name=comments_pw id=comments_pw"; |
154 | | if ($config->getConfig('comments_pw')) |
155 | | { |
156 | | $html .= " checked=\"checked\""; |
157 | | } |
158 | | $html .= "></td></tr>"; |
159 | | $html .= "<tr><td width=120><b>Display Comment Count on Killlists:</b></td><td><input type=checkbox name=comments_count id=comments_count"; |
160 | | if ($config->getConfig('comments_count')) |
161 | | { |
162 | | $html .= " checked=\"checked\""; |
163 | | } |
164 | | $html .= "></td></tr>"; |
165 | | $html .= "<tr><td width=120><b>Display Standings:</b></td><td><input type=checkbox name=show_standing id=show_standing"; |
166 | | if ($config->getConfig('show_standing')) |
167 | | { |
168 | | $html .= " checked=\"checked\""; |
169 | | } |
170 | | $html .= "></td></tr>"; |
171 | | |
172 | | $html .= "<tr><td width=120><b>Enable Lost Item Values</b></td><td><input type=checkbox name=item_values id=item_values"; |
173 | | if ($config->getConfig('item_values')) |
174 | | { |
175 | | $html .= " checked=\"checked\""; |
176 | | } |
177 | | $html .= "></td></tr>"; |
178 | | $html .= "<tr><td width=120><b>Use custom shipvalues:</b></td><td><input type=checkbox name=ship_values id=ship_values"; |
179 | | if ($config->getConfig('ship_values')) |
180 | | { |
181 | | $html .= " checked=\"checked\""; |
182 | | } |
183 | | $html .= "></td></tr>"; |
184 | | $html .= "<tr><td width=120><b>Display a link instead of POD on Battlesummary:</b></td><td><input type=checkbox name=bs_podlink id=bs_podlink"; |
185 | | if ($config->getConfig('bs_podlink')) |
186 | | { |
187 | | $html .= " checked=\"checked\""; |
188 | | } |
189 | | $html .= "></td></tr>"; |
190 | | // $html .= "<tr><td width=120><b>Display least active:</b></td><td><input type=checkbox name=least_active id=least_active"; |
191 | | // if ( $config->getLeastActive() ) |
192 | | // $html .= " checked=\"checked\""; |
193 | | // $html .= "></td></tr>"; |
194 | | $html .= "<tr><td></td></tr></table>"; |
195 | | |
196 | | $html .= "<div class=block-header2>Posting</div>"; |
197 | | $html .= "<table class=kb-subtable>"; |
198 | | |
199 | | $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>"; |
200 | | $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>"; |
201 | | $html .= "<tr><td width=120><b>Mailhost:</b></td><td><input type=text name=post_mailhost id=post_mailhost size=20 maxlength=80 value=\"".$config->getConfig('mail_host')."\"></td></tr>"; |
202 | | $html .= "<tr><td width=120><b>Disallow any killmails before:</b></td><td>".dateSelector($config->getConfig('filter_apply'), $config->getConfig('filter_date'))."</td></tr>"; |
203 | | $html .= "<tr><td width=120><b>Forbid posting</b></td><td><input type=checkbox name=post_forbid id=post_forbid"; |
204 | | if ($config->getConfig('post_forbid')) |
205 | | { |
206 | | $html .= " checked=\"checked\""; |
207 | | } |
208 | | $html .= "> (Checking this option disables mailposting)</td></tr>"; |
209 | | $html .= "<tr><td width=120><b>Enable auto-addition of unknown Items:</b></td><td><input type=checkbox name=adapt_items id=adapt_items"; |
210 | | if ($config->getConfig('adapt_items')) |
211 | | { |
212 | | $html .= " checked=\"checked\""; |
213 | | } |
214 | | $html .= "> (This is in case we can't supply a dump with the new items when Kali goes live)</td></tr>"; |
215 | | $html .= "<tr><td width=120><b>ReAdd known killmails</b></td><td><input type=checkbox name=readd_dupes id=readd_dupes"; |
216 | | if ($config->getConfig('readd_dupes')) |
217 | | { |
218 | | $html .= " checked=\"checked\""; |
219 | | } |
220 | | $html .= "> (This internally reparses a dupe on submit)</td></tr>"; |
221 | | $html .= "</table>"; |
222 | | |
223 | | $html .= "<div class=block-header2>Save changes</div>"; |
224 | | $html .= "<table class=kb-subtable>"; |
225 | | |
226 | | $html .= "<tr><td width=120></td><td><input type=submit name=submit value=\"Save\"></td></tr>"; |
227 | | $html .= "</table>"; |
228 | | |
229 | | $html .= "</form>"; |
230 | | |
231 | | $page->setContent($html); |
232 | | $page->addContext($menubox->generate()); |
233 | | $page->generate(); |
234 | | |
235 | | function dateSelector($apply, $date) |
236 | | { |
237 | | if ($date > 0) |
238 | | { |
239 | | $date = getdate($date); |
240 | | } |
241 | | else |
242 | | { |
243 | | $date = getdate(); |
244 | | } |
245 | | $html = "<input type=\"text\" name=\"filter_day\" id=\"filter_day\" style=\"width:20px\" value=\"{$date['mday']}\"/> "; |
246 | | $html .= "<select name=\"filter_month\" id=\"filter_month\">"; |
247 | | for ($i = 1; $i <= 12; $i++) |
248 | | { |
249 | | $t = mktime(0, 0, 0, $i, 1, 1980); |
250 | | $month = date("M", $t); |
251 | | if($date['mon'] == $i) |
252 | | { |
253 | | $selected = " selected=\"selected\""; |
254 | | } |
255 | | else |
256 | | { |
257 | | $selected = ""; |
258 | | } |
259 | | |
260 | | $html .= "<option value=\"$i\"$selected>$month</option>"; |
261 | | } |
262 | | $html .= "</select> "; |
263 | | |
264 | | $html .= "<select name=\"filter_year\" id=\"filter_year\">"; |
265 | | for ($i = date("Y")-7; $i <= date("Y"); $i++) |
266 | | { |
267 | | if ($date['year'] == $i) |
268 | | { |
269 | | $selected = " selected=\"selected\""; |
270 | | } |
271 | | else |
272 | | { |
273 | | $selected = ""; |
274 | | } |
275 | | $html .= "<option value=\"$i\"$selected>$i</option>"; |
276 | | } |
277 | | $html .= "</select> "; |
278 | | $html .= "<input type=checkbox name=filter_apply id=filter_apply"; |
279 | | if ($apply) |
280 | | { |
281 | | $html .= " checked=\"checked\""; |
282 | | } |
283 | | $html .= "/>Apply "; |
284 | | return $html; |
| 41 | $page->setContent(options::genOptionsPage()); |
| 42 | $page->addContext(options::genAdminMenu()); |
| 43 | $page->generate(); |