]> src.bluestatic.org Git - bugdar.git/blob - admin/setting.php
r1384: It was actually bug 66...
[bugdar.git] / admin / setting.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 require_once('./global.php');
23 require_once('./includes/settings.php');
24 require_once('./includes/functions_datastore.php');
25
26 NavLinks::optionsPages();
27 $navigator->set_focus('tab', 'options', null);
28 $navigator->set_focus('link', 'options-pages-settings', 'options-pages');
29
30 if (!can_perform('canadmintools'))
31 {
32 admin_login();
33 }
34
35 // ###################################################################
36
37 if (empty($_REQUEST['do']))
38 {
39 $_REQUEST['do'] = 'modify';
40 }
41
42 // ###################################################################
43
44 if ($_POST['do'] == 'update')
45 {
46 foreach ($bugsys->in['setting'] AS $varname => $value)
47 {
48 if (is_array($value))
49 {
50 if ($varname == 'columnoptions')
51 {
52 $value = serialize($value);
53 }
54 else
55 {
56 $value = implode(',', $value);
57 }
58 }
59
60 $db->query("REPLACE INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('" . $bugsys->escape($varname) . "', '" . $bugsys->escape($value) . "')");
61 }
62
63 build_settings();
64
65 $admin->redirect('setting.php');
66 }
67
68 // ###################################################################
69
70 if ($_REQUEST['do'] == 'modify')
71 {
72 $admin->page_start(_('Settings'));
73
74 $admin->form_start('setting.php', 'update');
75
76 $IS_SETTINGS = true;
77
78 // Don't let them normal folk see what's going on ;-)
79 if (!DEVDEBUG)
80 {
81 unset($settings['untouchables']);
82 }
83
84 $firstloop = true;
85 foreach ($settings AS $group => $values)
86 {
87 foreach ($values AS $key => $options)
88 {
89 if ($key == ':lang')
90 {
91 if (!$firstloop)
92 {
93 $admin->table_end();
94 }
95 $admin->table_start();
96 $admin->table_head($options);
97 }
98 else
99 {
100 $admin->row_span('<span' . ((DEVDEBUG) ? ' title="$bugsys->options[\'' . $key . '\']"' : '') . "><strong>" . $options[3] . "</strong></span>", 'thead');
101 switch ($options[0])
102 {
103 case 'textbox':
104 $admin->row_input($options[4], 'setting[' . $key . ']', $bugsys->options["$key"]);
105 break;
106
107 case 'textarea':
108 $admin->row_textarea($options[4], 'setting[' . $key . ']', $bugsys->options["$key"]);
109 break;
110
111 case 'yesno':
112 $admin->list_item(_('Yes'), '1', ($bugsys->options["$key"] ? true : false));
113 $admin->list_item(_('No'), '0', ($bugsys->options["$key"] ? false : true));
114 $admin->row_list($options[4], 'setting[' . $key . ']', false);
115 break;
116
117 default:
118 eval('$optcode = "' . $options[0] . '";');
119 $admin->row_text($options[4], $optcode);
120 break;
121 }
122 }
123 }
124 }
125 $admin->table_end();
126
127 $admin->table_start();
128 $admin->row_submit();
129 $admin->table_end();
130 $admin->form_end();
131
132 $admin->page_end();
133 }
134
135 /*=====================================================================*\
136 || ###################################################################
137 || # $HeadURL$
138 || # $Id$
139 || ###################################################################
140 \*=====================================================================*/
141 ?>