root/dev/common/admin.php @ 154

Revision 154, 8.5 KB (checked in by exi, 14 years ago)

Added option to enable readdition of dupes which can be handy to fix issues with that mail.
The old item_values mod will be forced to deactivate on the modspage.
Removed the call-by-reference functioncalls in admin_sync.php.
Added autoupgrade code to add some missing itemtypes.
Added code to killlist to set some more variables to the killclass.
Small fix to feed.php for older gzip compatibility.
The IGB techdemo has been added.
Module loss on kill_detail is now 0 for pods instead of null.
Added http-meta equiv refresh to the killmail importer.
Greatly improved related kills page, it now has a Battle Summary.
Changed portrait code to grab the 256x256px version from img.eve.is as 128px is deprecated.

Line 
1<?php
2require_once('db.php');
3require_once('class.killboard.php');
4require_once('class.page.php');
5require_once('class.tabbedform.php');
6require_once('admin_menu.php');
7require_once('autoupgrade.php');
8
9$killboard = new Killboard(KB_SITE);
10$page = new Page('Administration - Generic (Current version: '.KB_VERSION.' Build '.SVN_REV.')');
11$page->setAdmin();
12
13// check tables for validity and fields
14// todo: tidy this mess up!!!!!
15check_pilots();
16check_invdetail();
17check_contracts();
18check_index();
19check_tblstrct1();
20check_tblstrct2();
21check_tblstrct3();
22check_tblstrct4();
23check_tblstrct5();
24chk_kb3_items();
25
26if ($_POST['submit'])
27{
28    $config->setStyleBanner($_POST['style_banner']);
29    $config->setStyleName($_POST['style_name']);
30
31    // new function checkCheckbox, checks $_POST[arg] and inserts 0 if != 'on'
32    $config->checkCheckbox('kill_points');
33    $config->checkCheckbox('ship_values');
34    $config->checkCheckbox('least_active');
35    $config->checkCheckbox('adapt_items');
36    $config->checkCheckbox('show_standing');
37
38    if ($config->checkCheckbox('comments'))
39    {
40        check_commenttable();
41    }
42    $config->checkCheckbox('comments_pw');
43    $config->checkCheckbox('comments_count');
44        $config->checkCheckbox('item_values');
45        $config->checkCheckbox('readd_dupes');
46    $config->setPostPassword($_POST['post_password']);
47    $config->setPostMailto($_POST['post_mailto']);
48    $config->setConfig('mail_host', $_POST['post_mailhost']);
49
50    if ($_POST['filter_apply'] == "on")
51    {
52        $config->setConfig('filter_apply', '1');
53        $config->setConfig('filter_date', mktime(0, 0, 0, $_POST['filter_month'], ($_POST['filter_day'] > 31 ? 31 : $_POST['filter_day']), $_POST['filter_year']));
54    }
55    else
56    {
57        $config->setConfig('filter_apply', '0');
58        $config->setConfig('filter_date', 0);
59    }
60
61    $html .= "Changes saved.";
62}
63
64$html .= "<form id=options name=options method=post action=?a=admin>";
65$html .= "<div class=block-header2>Look and feel</div>";
66$html .= "<table class=kb-subtable>";
67$html .= "<tr><td width=120><b>Banner:</b></td><td><select id=style_banner name=style_banner>";
68
69$dir = "img/logo/";
70if (is_dir($dir))
71{
72    if ($dh = opendir($dir))
73    {
74        while (($file = readdir($dh)) !== false)
75        {
76            $file = substr($file, 0, strpos($file, "."));
77            if (!is_dir($dir.$file))
78            {
79                $html .= "<option value=\"".$file."\"";
80                if ($file == $config->getConfig('style_banner'))
81                {
82                    $html .= " selected=\"selected\"";
83                }
84                $html .= ">".$file."</option>";
85            }
86        }
87        closedir($dh);
88    }
89}
90$html .= "</td></tr>";
91$html .= "<tr><td width=120><b>Style:</b></td><td><select id=style_name name=style_name>";
92
93$dir = "style/";
94if (is_dir($dir))
95{
96    if ($dh = opendir($dir))
97    {
98        while (($file = readdir($dh)) !== false)
99        {
100            if (is_dir($dir.$file))
101            {
102                if ($file == "." || $file == ".." || $file == ".svn")
103                {
104                    continue;
105                }
106                $html .= "<option value=\"".$file."\"";
107                if ($file == $config->getConfig('style_name'))
108                {
109                    $html .= " selected=\"selected\"";
110                }
111                $html .= ">".$file."</option>";
112            }
113        }
114        closedir($dh);
115    }
116}
117$html .= "</select></td></tr>";
118$html .= "<tr><td></td></tr></table>";
119
120$html .= "<div class=block-header2>Global options</div>";
121$html .= "<table class=kb-subtable>";
122$html .= "<tr><td width=120><b>Display killpoints:</b></td><td><input type=checkbox name=kill_points id=kill_points";
123if ($config->getConfig('kill_points'))
124{
125    $html .= " checked=\"checked\"";
126}
127$html .= "></td></tr>";
128
129$html .= "<tr><td width=120><b>Enable Comments:</b></td><td><input type=checkbox name=comments id=comments";
130if ($config->getConfig('comments'))
131{
132    $html .= " checked=\"checked\"";
133}
134$html .= "></td></tr>";
135$html .= "<tr><td width=120><b>Require password for Comments:</b></td><td><input type=checkbox name=comments_pw id=comments_pw";
136if ($config->getConfig('comments_pw'))
137{
138        $html .= " checked=\"checked\"";
139}
140$html .= "></td></tr>";
141$html .= "<tr><td width=120><b>Display Comment Count on Killlists:</b></td><td><input type=checkbox name=comments_count id=comments_count";
142if ($config->getConfig('comments_count'))
143{
144    $html .= " checked=\"checked\"";
145}
146$html .= "></td></tr>";
147$html .= "<tr><td width=120><b>Display Standings:</b></td><td><input type=checkbox name=show_standing id=show_standing";
148if ($config->getConfig('show_standing'))
149{
150    $html .= " checked=\"checked\"";
151}
152$html .= "></td></tr>";
153
154$html .= "<tr><td width=120><b>Enable Lost Item Values</b></td><td><input type=checkbox name=item_values id=item_values";
155if ($config->getConfig('item_values'))
156{
157    $html .= " checked=\"checked\"";
158}
159$html .= "></td></tr>";
160$html .= "<tr><td width=120><b>Use custom shipvalues:</b></td><td><input type=checkbox name=ship_values id=ship_values";
161if ($config->getConfig('ship_values'))
162{
163    $html .= " checked=\"checked\"";
164}
165$html .= "></td></tr>";
166// $html .= "<tr><td width=120><b>Display least active:</b></td><td><input type=checkbox name=least_active id=least_active";
167// if ( $config->getLeastActive() )
168// $html .= " checked=\"checked\"";
169// $html .= "></td></tr>";
170$html .= "<tr><td></td></tr></table>";
171
172$html .= "<div class=block-header2>Posting</div>";
173$html .= "<table class=kb-subtable>";
174
175$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>";
176$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>";
177$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>";
178$html .= "<tr><td width=120><b>Disallow any killmails before:</b></td><td>".dateSelector($config->getConfig('filter_apply'), $config->getConfig('filter_date'))."</td></tr>";
179$html .= "<tr><td width=120><b>Enable auto-addition of unknown Items:</b></td><td><input type=checkbox name=adapt_items id=adapt_items";
180if ($config->getConfig('adapt_items'))
181{
182    $html .= " checked=\"checked\"";
183}
184$html .= "> (This is in case we can't supply a dump with the new items when Kali goes live)</td></tr>";
185$html .= "<tr><td width=120><b>ReAdd known killmails</b></td><td><input type=checkbox name=readd_dupes id=readd_dupes";
186if ($config->getConfig('readd_dupes'))
187{
188    $html .= " checked=\"checked\"";
189}
190$html .= "> (This internally reparses a dupe on submit)</td></tr>";
191$html .= "</table>";
192
193$html .= "<div class=block-header2>Save changes</div>";
194$html .= "<table class=kb-subtable>";
195
196$html .= "<tr><td width=120></td><td><input type=submit name=submit value=\"Save\"></td></tr>";
197$html .= "</table>";
198
199$html .= "</form>";
200
201$page->setContent($html);
202$page->addContext($menubox->generate());
203$page->generate();
204
205function dateSelector($apply, $date)
206{
207        if ($date > 0)
208    {
209                $date = getdate($date);
210        }
211    else
212    {
213                $date = getdate();
214        }
215        $html = "<input type=\"text\" name=\"filter_day\" id=\"filter_day\" style=\"width:20px\" value=\"{$date['mday']}\"/>&nbsp;";
216        $html .= "<select name=\"filter_month\" id=\"filter_month\">";
217        for ($i = 1; $i <= 12; $i++)
218    {
219                $t = mktime(0, 0, 0, $i, 1, 1980);
220                $month = date("M", $t);
221                if($date['mon'] == $i)
222        {
223            $selected = " selected=\"selected\"";
224        }
225        else
226        {
227            $selected = "";
228        }
229
230                $html .= "<option value=\"$i\"$selected>$month</option>";
231        }
232        $html .= "</select>&nbsp;";
233
234        $html .= "<select name=\"filter_year\" id=\"filter_year\">";
235        for ($i = date("Y")-7; $i <= date("Y"); $i++)
236    {
237                if ($date['year'] == $i)
238        {
239            $selected = " selected=\"selected\"";
240        }
241        else
242        {
243            $selected = "";
244        }
245                $html .= "<option value=\"$i\"$selected>$i</option>";
246        }
247        $html .= "</select>&nbsp;";
248        $html .= "<input type=checkbox name=filter_apply id=filter_apply";
249        if ($apply)
250    {
251        $html .= " checked=\"checked\"";
252    }
253        $html .= "/>Apply&nbsp;";
254        return $html;
255}
256?>
Note: See TracBrowser for help on using the browser.