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 Comment Count on Killlists', 'comments_count', 'checkbox'); |
---|
18 | options::fadd('Display Standings', 'show_standings', 'checkbox'); |
---|
19 | options::fadd('Enable Lost Item Values', 'item_values', 'checkbox'); |
---|
20 | options::fadd('Use custom shipvalues', 'ship_values', 'checkbox'); |
---|
21 | options::fadd('Display a link instead of POD on Battlesummary', 'bs_podlink', 'checkbox'); |
---|
22 | |
---|
23 | options::cat('Appearance', 'Generic', 'Posting'); |
---|
24 | options::fadd('Post password', 'post_password', 'edit'); |
---|
25 | options::fadd('Killmail CC', 'post_mailto', 'edit'); |
---|
26 | options::fadd('Mailhost', 'post_mailhost', 'edit'); |
---|
27 | options::fadd('Mailserver', 'post_mailserver', 'edit', '', '', 'This is the server where php connects to send the mail.'); |
---|
28 | options::fadd('Disallow any killmails before', 'filter_date', 'custom', array('admin_generic', 'dateSelector'), array('admin_generic', 'postDateSelector')); |
---|
29 | options::fadd('Forbid posting', 'post_forbid', 'checkbox'); |
---|
30 | options::fadd('Enable auto-addition of unknown Items', 'adapt_items', 'checkbox'); |
---|
31 | options::fadd('ReAdd known killmails', 'readd_dupes', 'checkbox'); |
---|
32 | |
---|
33 | class admin_generic |
---|
34 | { |
---|
35 | function createSelectBanner() |
---|
36 | { |
---|
37 | global $config; |
---|
38 | |
---|
39 | $options = array(); |
---|
40 | $dir = "img/logo/"; |
---|
41 | if (is_dir($dir)) |
---|
42 | { |
---|
43 | if ($dh = opendir($dir)) |
---|
44 | { |
---|
45 | while (($file = readdir($dh)) !== false) |
---|
46 | { |
---|
47 | $file = substr($file, 0, strpos($file, ".")); |
---|
48 | if (!is_dir($dir.$file)) |
---|
49 | { |
---|
50 | if ($config->getConfig('style_banner') == $file) |
---|
51 | { |
---|
52 | $state = 1; |
---|
53 | } |
---|
54 | else |
---|
55 | { |
---|
56 | $state = 0; |
---|
57 | } |
---|
58 | |
---|
59 | $options[] = array('value' => $file, 'descr' => $file, 'state' => $state); |
---|
60 | } |
---|
61 | } |
---|
62 | closedir($dh); |
---|
63 | } |
---|
64 | } |
---|
65 | return $options; |
---|
66 | } |
---|
67 | |
---|
68 | function createSelectStyle() |
---|
69 | { |
---|
70 | global $config; |
---|
71 | |
---|
72 | $dir = "style/"; |
---|
73 | if (is_dir($dir)) |
---|
74 | { |
---|
75 | if ($dh = opendir($dir)) |
---|
76 | { |
---|
77 | while (($file = readdir($dh)) !== false) |
---|
78 | { |
---|
79 | if (is_dir($dir.$file)) |
---|
80 | { |
---|
81 | if ($file == "." || $file == ".." || $file == ".svn") |
---|
82 | { |
---|
83 | continue; |
---|
84 | } |
---|
85 | if ($config->getConfig('style_name') == $file) |
---|
86 | { |
---|
87 | $state = 1; |
---|
88 | } |
---|
89 | else |
---|
90 | { |
---|
91 | $state = 0; |
---|
92 | } |
---|
93 | |
---|
94 | $options[] = array('value' => $file, 'descr' => $file, 'state' => $state); |
---|
95 | } |
---|
96 | } |
---|
97 | closedir($dh); |
---|
98 | } |
---|
99 | } |
---|
100 | return $options; |
---|
101 | } |
---|
102 | |
---|
103 | function dateSelector() |
---|
104 | { |
---|
105 | global $config; |
---|
106 | $apply = $config->getConfig('filter_apply'); |
---|
107 | $date = $config->getConfig('filter_date'); |
---|
108 | |
---|
109 | if ($date > 0) |
---|
110 | { |
---|
111 | $date = getdate($date); |
---|
112 | } |
---|
113 | else |
---|
114 | { |
---|
115 | $date = getdate(); |
---|
116 | } |
---|
117 | $html = "<input type=\"text\" name=\"option[filter_day]\" id=\"option[filter_day]\" style=\"width:20px\" value=\"{$date['mday']}\"/> "; |
---|
118 | $html .= "<select name=\"option[filter_month]\" id=\"option[filter_month]\">"; |
---|
119 | for ($i = 1; $i <= 12; $i++) |
---|
120 | { |
---|
121 | $t = mktime(0, 0, 0, $i, 1, 1980); |
---|
122 | $month = gmdate("M", $t); |
---|
123 | if($date['mon'] == $i) |
---|
124 | { |
---|
125 | $selected = " selected=\"selected\""; |
---|
126 | } |
---|
127 | else |
---|
128 | { |
---|
129 | $selected = ""; |
---|
130 | } |
---|
131 | |
---|
132 | $html .= "<option value=\"$i\"$selected>$month</option>"; |
---|
133 | } |
---|
134 | $html .= "</select> "; |
---|
135 | |
---|
136 | $html .= "<select name=\"option[filter_year]\" id=\"option[filter_year]\">"; |
---|
137 | for ($i = gmdate("Y")-7; $i <= gmdate("Y"); $i++) |
---|
138 | { |
---|
139 | if ($date['year'] == $i) |
---|
140 | { |
---|
141 | $selected = " selected=\"selected\""; |
---|
142 | } |
---|
143 | else |
---|
144 | { |
---|
145 | $selected = ""; |
---|
146 | } |
---|
147 | $html .= "<option value=\"$i\"$selected>$i</option>"; |
---|
148 | } |
---|
149 | $html .= "</select> "; |
---|
150 | $html .= "<input type=\"checkbox\" name=\"option[filter_apply]\" id=\"option[filter_apply]\""; |
---|
151 | if ($apply) |
---|
152 | { |
---|
153 | $html .= " checked=\"checked\""; |
---|
154 | } |
---|
155 | $html .= "/>Apply "; |
---|
156 | return $html; |
---|
157 | } |
---|
158 | |
---|
159 | function postDateSelector() |
---|
160 | { |
---|
161 | global $config; |
---|
162 | |
---|
163 | if ($_POST['options']['filter_apply'] == "on") |
---|
164 | { |
---|
165 | $config->setConfig('filter_apply', '1'); |
---|
166 | $config->setConfig('filter_date', mktime(0, 0, 0, $_POST['options']['filter_month'], ($_POST['options']['filter_day'] > 31 ? 31 : $_POST['options']['filter_day']), $_POST['options']['filter_year'])); |
---|
167 | } |
---|
168 | else |
---|
169 | { |
---|
170 | $config->setConfig('filter_apply', '0'); |
---|
171 | $config->setConfig('filter_date', 0); |
---|
172 | } |
---|
173 | |
---|
174 | } |
---|
175 | } |
---|
176 | ?> |
---|