1 | <?php |
---|
2 | /* |
---|
3 | * This file contains the generic admin options in the new format |
---|
4 | * look here for some examples. |
---|
5 | */ |
---|
6 | |
---|
7 | options::cat('Appearance', 'Generic', 'Look and feel'); |
---|
8 | options::fadd('Banner', 'style_banner', 'select', array('admin_generic', 'createSelectBanner')); |
---|
9 | options::fadd('Style', 'style_name', 'select', array('admin_generic', 'createSelectStyle')); |
---|
10 | |
---|
11 | options::cat('Appearance', 'Generic', 'Global Options'); |
---|
12 | options::fadd('Display killpoints', 'kill_points', 'checkbox'); |
---|
13 | options::fadd('Display losspoints', 'loss_points', 'checkbox'); |
---|
14 | options::fadd('Display totalpoints', 'total_points', 'checkbox'); |
---|
15 | options::fadd('Enable Comments', 'comments', 'checkbox'); |
---|
16 | options::fadd('Require password for Comments', 'comments_pw', 'checkbox'); |
---|
17 | options::fadd('Display Standings', 'show_standings', 'checkbox'); |
---|
18 | options::fadd('Enable Lost Item Values', 'item_values', 'checkbox'); |
---|
19 | options::fadd('Use custom shipvalues', 'ship_values', 'checkbox'); |
---|
20 | options::fadd('Display a link instead of POD on Battlesummary', 'bs_podlink', 'checkbox'); |
---|
21 | options::fadd('Split up fitted items on Killmails', 'kill_splitfit', 'checkbox'); |
---|
22 | options::fadd('Use gmdate instead of date', 'date_gmtime', 'checkbox'); |
---|
23 | options::fadd('Classify kills for hours:', 'kill_classified', 'edit:size:4', '', '', '0 to disable, 1-24hrs'); |
---|
24 | |
---|
25 | options::cat('Appearance', 'Generic', 'Posting'); |
---|
26 | options::fadd('Post password', 'post_password', 'edit'); |
---|
27 | options::fadd('Killmail CC', 'post_mailto', 'edit'); |
---|
28 | options::fadd('Mailhost', 'post_mailhost', 'edit'); |
---|
29 | options::fadd('Mailserver', 'post_mailserver', 'edit', '', '', 'This is the server where php connects to send the mail.'); |
---|
30 | options::fadd('Disallow any killmails before', 'filter_date', 'custom', array('admin_generic', 'dateSelector'), array('admin_generic', 'postDateSelector')); |
---|
31 | options::fadd('Forbid posting', 'post_forbid', 'checkbox'); |
---|
32 | options::fadd('Enable auto-addition of unknown Items', 'adapt_items', 'checkbox'); |
---|
33 | options::fadd('ReAdd known killmails', 'readd_dupes', 'checkbox'); |
---|
34 | |
---|
35 | options::cat('Appearance', 'Generic', 'Killlists'); |
---|
36 | options::fadd('Display Comment Count on Killlists', 'comments_count', 'checkbox'); |
---|
37 | options::fadd('Display Alliance Logos on killlists', 'killlist_alogo', 'checkbox'); |
---|
38 | |
---|
39 | options::cat('Appearance', 'Generic', 'Killdetail'); |
---|
40 | options::fadd('Include dropped value into total loss', 'kd_droptototal', 'checkbox'); |
---|
41 | |
---|
42 | options::cat('Appearance', 'Generic', 'Killsummarytables'); |
---|
43 | options::fadd('Stats Row Count', 'summarytable_rowcount', 'edit:size:2'); |
---|
44 | options::fadd('Display a summary line below a killsummarytable', 'summarytable_summary', 'checkbox'); |
---|
45 | |
---|
46 | options::cat('Appearance', 'Generic', 'Public-Mode v0.2'); |
---|
47 | options::fadd('Only Kills in SummaryTables', 'public_summarytable', 'checkbox','','','CORP_ID and ALLIANCE_ID in config has to be 0 to work "public"'); |
---|
48 | options::fadd('Remove Losses Page', 'public_losses', 'checkbox'); |
---|
49 | options::fadd('Stats Page', 'public_stats', 'select',array('admin_generic', 'createSelectStats')); |
---|
50 | |
---|
51 | class admin_generic |
---|
52 | { |
---|
53 | function createSelectBanner() |
---|
54 | { |
---|
55 | $options = array(); |
---|
56 | $dir = "img/logo/"; |
---|
57 | if (is_dir($dir)) |
---|
58 | { |
---|
59 | if ($dh = opendir($dir)) |
---|
60 | { |
---|
61 | while (($file = readdir($dh)) !== false) |
---|
62 | { |
---|
63 | $file = substr($file, 0, strpos($file, ".")); |
---|
64 | if (!is_dir($dir.$file)) |
---|
65 | { |
---|
66 | if (config::get('style_banner') == $file) |
---|
67 | { |
---|
68 | $state = 1; |
---|
69 | } |
---|
70 | else |
---|
71 | { |
---|
72 | $state = 0; |
---|
73 | } |
---|
74 | |
---|
75 | $options[] = array('value' => $file, 'descr' => $file, 'state' => $state); |
---|
76 | } |
---|
77 | } |
---|
78 | closedir($dh); |
---|
79 | } |
---|
80 | } |
---|
81 | return $options; |
---|
82 | } |
---|
83 | |
---|
84 | function createSelectStyle() |
---|
85 | { |
---|
86 | $dir = "style/"; |
---|
87 | if (is_dir($dir)) |
---|
88 | { |
---|
89 | if ($dh = opendir($dir)) |
---|
90 | { |
---|
91 | while (($file = readdir($dh)) !== false) |
---|
92 | { |
---|
93 | if (is_dir($dir.$file)) |
---|
94 | { |
---|
95 | if ($file == "." || $file == ".." || $file == ".svn") |
---|
96 | { |
---|
97 | continue; |
---|
98 | } |
---|
99 | if (config::get('style_name') == $file) |
---|
100 | { |
---|
101 | $state = 1; |
---|
102 | } |
---|
103 | else |
---|
104 | { |
---|
105 | $state = 0; |
---|
106 | } |
---|
107 | |
---|
108 | $options[] = array('value' => $file, 'descr' => $file, 'state' => $state); |
---|
109 | } |
---|
110 | } |
---|
111 | closedir($dh); |
---|
112 | } |
---|
113 | } |
---|
114 | return $options; |
---|
115 | } |
---|
116 | |
---|
117 | function createSelectStats() |
---|
118 | { |
---|
119 | $options = array(); |
---|
120 | if (config::get('public_stats') == 'none') |
---|
121 | { |
---|
122 | $state = 1; |
---|
123 | } |
---|
124 | else |
---|
125 | { |
---|
126 | $state = 0; |
---|
127 | } |
---|
128 | $options[] = array('value' => 'do nothing', 'descr' => 'do nothing', 'state' => $state); |
---|
129 | |
---|
130 | if (config::get('public_stats') == 'remove') |
---|
131 | { |
---|
132 | $state = 1; |
---|
133 | } |
---|
134 | else |
---|
135 | { |
---|
136 | $state = 0; |
---|
137 | } |
---|
138 | $options[] = array('value' => 'remove', 'descr' => 'remove', 'state' => $state); |
---|
139 | |
---|
140 | if (config::get('public_stats') == 'replace') |
---|
141 | { |
---|
142 | $state = 1; |
---|
143 | } |
---|
144 | else |
---|
145 | { |
---|
146 | $state = 0; |
---|
147 | } |
---|
148 | $options[] = array('value' => 'replace', 'descr' => 'replace (not rdy yet)', 'state' => $state); |
---|
149 | |
---|
150 | return $options; |
---|
151 | } |
---|
152 | |
---|
153 | function dateSelector() |
---|
154 | { |
---|
155 | $apply = config::get('filter_apply'); |
---|
156 | $date = config::get('filter_date'); |
---|
157 | |
---|
158 | if ($date > 0) |
---|
159 | { |
---|
160 | $date = getdate($date); |
---|
161 | } |
---|
162 | else |
---|
163 | { |
---|
164 | $date = getdate(); |
---|
165 | } |
---|
166 | $html = "<input type=\"text\" name=\"option[filter_day]\" id=\"option[filter_day]\" style=\"width:20px\" value=\"{$date['mday']}\"/> "; |
---|
167 | $html .= "<select name=\"option[filter_month]\" id=\"option[filter_month]\">"; |
---|
168 | for ($i = 1; $i <= 12; $i++) |
---|
169 | { |
---|
170 | $t = mktime(0, 0, 0, $i, 1, 1980); |
---|
171 | $month = gmdate("M", $t); |
---|
172 | if($date['mon'] == $i) |
---|
173 | { |
---|
174 | $selected = " selected=\"selected\""; |
---|
175 | } |
---|
176 | else |
---|
177 | { |
---|
178 | $selected = ""; |
---|
179 | } |
---|
180 | |
---|
181 | $html .= "<option value=\"$i\"$selected>$month</option>"; |
---|
182 | } |
---|
183 | $html .= "</select> "; |
---|
184 | |
---|
185 | $html .= "<select name=\"option[filter_year]\" id=\"option[filter_year]\">"; |
---|
186 | for ($i = gmdate("Y")-7; $i <= gmdate("Y"); $i++) |
---|
187 | { |
---|
188 | if ($date['year'] == $i) |
---|
189 | { |
---|
190 | $selected = " selected=\"selected\""; |
---|
191 | } |
---|
192 | else |
---|
193 | { |
---|
194 | $selected = ""; |
---|
195 | } |
---|
196 | $html .= "<option value=\"$i\"$selected>$i</option>"; |
---|
197 | } |
---|
198 | $html .= "</select> "; |
---|
199 | $html .= "<input type=\"checkbox\" name=\"option[filter_apply]\" id=\"option[filter_apply]\""; |
---|
200 | if ($apply) |
---|
201 | { |
---|
202 | $html .= " checked=\"checked\""; |
---|
203 | } |
---|
204 | $html .= "/>Apply "; |
---|
205 | return $html; |
---|
206 | } |
---|
207 | |
---|
208 | function postDateSelector() |
---|
209 | { |
---|
210 | if ($_POST['option']['filter_apply'] == 'on') |
---|
211 | { |
---|
212 | config::set('filter_apply', '1'); |
---|
213 | config::set('filter_date', mktime(0, 0, 0, $_POST['option']['filter_month'], ($_POST['option']['filter_day'] > 31 ? 31 : $_POST['option']['filter_day']), $_POST['option']['filter_year'])); |
---|
214 | } |
---|
215 | else |
---|
216 | { |
---|
217 | config::set('filter_apply', '0'); |
---|
218 | config::set('filter_date', 0); |
---|
219 | } |
---|
220 | |
---|
221 | } |
---|
222 | } |
---|
223 | ?> |
---|