r63: Updated initial copyright year from 2003 to 2002
[bugdar.git] / admin / options.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Renapsus [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2002-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2002 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
10 || ################################################################### ||
11 \*=====================================================================*/
12
13 require_once('./global.php');
14 require_once('./includes/settings.php');
15 require_once('./includes/functions_datastore.php');
16
17 if (!can_perform('canadmintools'))
18 {
19 admin_login();
20 }
21
22 // ###################################################################
23
24 if (empty($_REQUEST['do']))
25 {
26 $_REQUEST['do'] = 'modify';
27 }
28
29 // ###################################################################
30
31 if ($_POST['do'] == 'update')
32 {
33 $settings = $_POST['setting'];
34
35 foreach ($settings AS $varname => $value)
36 {
37 $DB_sql->query("REPLACE INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('" . addslasheslike(trim($varname)) . "', '" . addslasheslike(trim($value)) . "')");
38 }
39
40 build_settings();
41
42 $admin->redirect('options.php');
43 }
44
45 // ###################################################################
46
47 if ($_REQUEST['do'] == 'modify')
48 {
49 $admin->page_start('Options');
50
51 $admin->form_start('options.php', 'update');
52
53 $settings = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "setting ");
54 while ($setting = $DB_sql->fetch_array($settings))
55 {
56 $options["$setting[varname]"] = $setting['value'];
57 }
58
59 $IS_SETTINGS = true;
60
61 unset($settings, $setting);
62
63 foreach ($config AS $varname => $setting)
64 {
65 $settings["$setting[0]"][] = $setting;
66 }
67
68 // Don't let them normal folk see what's going on ;-)
69 if (!DEVDEBUG)
70 {
71 unset($settings['untouchables'], $define['untouchables']);
72 }
73
74 unset($config);
75
76 foreach ($define AS $group)
77 {
78 $admin->table_start();
79 $admin->table_head(phrase('settinggroup_' . $group));
80 foreach ($settings["$group"] AS $opt)
81 {
82 $admin->row_span('<span' . iff(DEVDEBUG, ' title="$bugsys->options[\'' . $opt[1] . '\']"') . "><strong>" . phrase('setting_' . $opt[1] . '_title') . "</strong></span>", 'thead');
83 switch ($opt[2])
84 {
85 case 'textbox':
86 $admin->row_input(phrase('setting_' . $opt[1] . '_desc'), 'setting[' . $opt[1] . ']', $options["$opt[1]"]);
87 break;
88
89 case 'yesno':
90 if (!isset($options["$opt[1]"]))
91 {
92 $options["$opt[1]"] = $opt[3];
93 }
94
95 $admin->list_item(phrase('yes'), '1', iff($options["$opt[1]"], true, false));
96 $admin->list_item(phrase('no'), '0', iff($options["$opt[1]"], false, true));
97 $admin->row_list(phrase('setting_' . $opt[1] . '_desc'), 'setting[' . $opt[1] . ']', false);
98 break;
99
100 default:
101 eval('$optcode = "' . $opt[2] . '";');
102 $admin->row_text(phrase('setting_' . $opt[1] . '_desc'), $optcode);
103 break;
104 }
105 }
106 $admin->table_end();
107 }
108
109 $admin->table_start();
110 $admin->row_submit();
111 $admin->table_end();
112 $admin->form_end();
113
114 $admin->page_end();
115 }
116
117 /*=====================================================================*\
118 || ###################################################################
119 || # $HeadURL$
120 || # $Id$
121 || ###################################################################
122 \*=====================================================================*/
123 ?>