r1048: Converting all $lang->string() stuff to use the gettext call
[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 $value = implode(',', $value);
51 }
52
53 $db->query("REPLACE INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('" . $bugsys->escape($varname) . "', '" . $bugsys->escape($value) . "')");
54 }
55
56 build_settings();
57
58 $admin->redirect('setting.php');
59 }
60
61 // ###################################################################
62
63 if ($_REQUEST['do'] == 'modify')
64 {
65 $admin->page_start(_('Settings'));
66
67 $admin->form_start('setting.php', 'update');
68
69 $IS_SETTINGS = true;
70
71 // Don't let them normal folk see what's going on ;-)
72 if (!DEVDEBUG)
73 {
74 unset($settings['untouchables']);
75 }
76
77 $firstloop = true;
78 foreach ($settings AS $group => $values)
79 {
80 foreach ($values AS $key => $options)
81 {
82 if ($key == ':lang')
83 {
84 if (!$firstloop)
85 {
86 $admin->table_end();
87 }
88 $admin->table_start();
89 $admin->table_head($options);
90 }
91 else
92 {
93 $admin->row_span('<span' . ((DEVDEBUG) ? ' title="$bugsys->options[\'' . $key . '\']"' : '') . "><strong>" . $options[3] . "</strong></span>", 'thead');
94 switch ($options[0])
95 {
96 case 'textbox':
97 $admin->row_input($options[4], 'setting[' . $key . ']', $bugsys->options["$key"]);
98 break;
99
100 case 'textarea':
101 $admin->row_textarea($options[4], 'setting[' . $key . ']', $bugsys->options["$key"]);
102 break;
103
104 case 'yesno':
105 $admin->list_item(_('Yes'), '1', ($bugsys->options["$key"] ? true : false));
106 $admin->list_item(_('No'), '0', ($bugsys->options["$key"] ? false : true));
107 $admin->row_list($options[4], 'setting[' . $key . ']', false);
108 break;
109
110 default:
111 eval('$optcode = "' . $options[0] . '";');
112 $admin->row_text($options[4], $optcode);
113 break;
114 }
115 }
116 }
117 }
118 $admin->table_end();
119
120 $admin->table_start();
121 $admin->row_submit();
122 $admin->table_end();
123 $admin->form_end();
124
125 $admin->page_end();
126 }
127
128 /*=====================================================================*\
129 || ###################################################################
130 || # $HeadURL$
131 || # $Id$
132 || ###################################################################
133 \*=====================================================================*/
134 ?>