1 | <?php |
---|
2 | require_once('common/includes/class.http.php'); |
---|
3 | require_once('common/admin/admin_menu.php'); |
---|
4 | |
---|
5 | $page = new Page(); |
---|
6 | $page->setAdmin(); |
---|
7 | $page->setTitle('Administration - Mapoptions'); |
---|
8 | |
---|
9 | if ($_POST['submit']) |
---|
10 | { |
---|
11 | config::checkCheckbox('map_map_showlines'); |
---|
12 | config::checkCheckbox('map_reg_showlines'); |
---|
13 | config::checkCheckbox('map_region_cache'); |
---|
14 | config::checkCheckbox('map_con_showlines'); |
---|
15 | config::checkCheckbox('map_con_shownames'); |
---|
16 | config::checkCheckbox('map_map_security'); |
---|
17 | config::checkCheckbox('map_reg_security'); |
---|
18 | config::checkCheckbox('map_con_security'); |
---|
19 | |
---|
20 | foreach ($_POST as $key => $value) |
---|
21 | { |
---|
22 | if (strpos($key, '_cl_')) |
---|
23 | { |
---|
24 | if ($value) |
---|
25 | { |
---|
26 | if (substr($value,0,1) == '#') |
---|
27 | { |
---|
28 | $value = 'x'.substr($value, 1, 2).',x'.substr($value, 3, 2).',x'.substr($value, 5, 2); |
---|
29 | } |
---|
30 | $value = preg_replace('/[^a-fA-F0-9,x]/', '', $value); |
---|
31 | $tmp = explode(',', $value); |
---|
32 | if (count($tmp) != 3) |
---|
33 | { |
---|
34 | continue; |
---|
35 | } |
---|
36 | $val = array(); |
---|
37 | for ($i = 0; $i < 3; $i++) |
---|
38 | { |
---|
39 | if (preg_match('/[a-fA-Fx]/', $tmp[$i])) |
---|
40 | { |
---|
41 | $tmp[$i] = str_replace('x', '', $tmp[$i]); |
---|
42 | $tmp[$i] = base_convert($tmp[$i], 16, 10); |
---|
43 | } |
---|
44 | $val[$i] = min(max($tmp[$i], 0), 255); |
---|
45 | } |
---|
46 | $string = implode(',', $val); |
---|
47 | config::set($key, $string); |
---|
48 | } |
---|
49 | else |
---|
50 | { |
---|
51 | config::del($key); |
---|
52 | } |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | // on submit delete all region cache files |
---|
57 | $dir = opendir('cache/map'); |
---|
58 | while ($file = readdir($dir)) |
---|
59 | { |
---|
60 | if (strpos($file, '.png')) |
---|
61 | { |
---|
62 | @unlink('cache/map/'.$file); |
---|
63 | } |
---|
64 | } |
---|
65 | } |
---|
66 | |
---|
67 | $options = array(); |
---|
68 | $options[0]['name'] = 'Region Options'; |
---|
69 | $options[0]['option'][] = array('descr' => 'Show Lines', 'name' => 'map_map_showlines'); |
---|
70 | $options[0]['option'][] = array('descr' => 'Paint Security', 'name' => 'map_map_security'); |
---|
71 | $options[0]['color'][] = array('descr' => 'Linecolor', 'name' => 'map_map_cl_line'); |
---|
72 | $options[0]['color'][] = array('descr' => 'Captioncolor', 'name' => 'map_map_cl_capt'); |
---|
73 | $options[0]['color'][] = array('descr' => 'Backgroundcolor', 'name' => 'map_map_cl_bg'); |
---|
74 | $options[0]['color'][] = array('descr' => 'Normalcolor', 'name' => 'map_map_cl_normal'); |
---|
75 | $options[0]['color'][] = array('descr' => 'Highlightcolor', 'name' => 'map_map_cl_hl'); |
---|
76 | |
---|
77 | $options[1]['name'] = 'Constellation Options'; |
---|
78 | $options[1]['option'][] = array('descr' => 'Cache const maps', 'name' => 'map_region_cache'); |
---|
79 | $options[1]['option'][] = array('descr' => 'Show Lines', 'name' => 'map_reg_showlines'); |
---|
80 | $options[1]['option'][] = array('descr' => 'Paint Security', 'name' => 'map_reg_security'); |
---|
81 | $options[1]['color'][] = array('descr' => 'Linecolor', 'name' => 'map_reg_cl_line'); |
---|
82 | $options[1]['color'][] = array('descr' => 'Captioncolor', 'name' => 'map_reg_cl_capt'); |
---|
83 | $options[1]['color'][] = array('descr' => 'Backgroundcolor', 'name' => 'map_reg_cl_bg'); |
---|
84 | $options[1]['color'][] = array('descr' => 'Normalcolor', 'name' => 'map_reg_cl_normal'); |
---|
85 | $options[1]['color'][] = array('descr' => 'Highlightcolor', 'name' => 'map_reg_cl_hl'); |
---|
86 | |
---|
87 | $options[2]['name'] = 'System Options'; |
---|
88 | $options[2]['option'][] = array('descr' => 'Show Lines', 'name' => 'map_con_showlines'); |
---|
89 | $options[2]['option'][] = array('descr' => 'Show Sytem Names', 'name' => 'map_con_shownames'); |
---|
90 | $options[2]['option'][] = array('descr' => 'Paint Security', 'name' => 'map_con_security'); |
---|
91 | $options[2]['color'][] = array('descr' => 'Linecolor', 'name' => 'map_con_cl_line'); |
---|
92 | $options[2]['color'][] = array('descr' => 'Captioncolor', 'name' => 'map_con_cl_capt'); |
---|
93 | $options[2]['color'][] = array('descr' => 'Backgroundcolor', 'name' => 'map_con_cl_bg'); |
---|
94 | $options[2]['color'][] = array('descr' => 'Normalcolor', 'name' => 'map_con_cl_normal'); |
---|
95 | $options[2]['color'][] = array('descr' => 'Highlightcolor', 'name' => 'map_con_cl_hl'); |
---|
96 | |
---|
97 | $smarty->assign_by_ref('config', $config); |
---|
98 | $smarty->assign_by_ref('options', $options); |
---|
99 | $html = $smarty->fetch(get_tpl('admin_mapoptions')); |
---|
100 | |
---|
101 | $page->addContext($menubox->generate()); |
---|
102 | $page->setContent($html); |
---|
103 | $page->generate(); |
---|
104 | ?> |
---|