24 |
24 |
25 |
25 |
26 // Tell header.php to use the admin template |
26 // Tell header.php to use the admin template |
27 define('PUN_ADMIN_CONSOLE', 1); |
27 define('PUN_ADMIN_CONSOLE', 1); |
28 |
28 |
29 define('PUN_ROOT', './'); |
29 //define('PUN_ROOT', './'); |
30 require PUN_ROOT.'include/common.php'; |
30 //require PUN_ROOT.'include/common.php'; |
|
31 |
|
32 global $pun_db, $pun_user, $pun_config, $lang_common; |
|
33 |
31 require PUN_ROOT.'include/common_admin.php'; |
34 require PUN_ROOT.'include/common_admin.php'; |
32 |
35 |
33 |
36 |
34 if ($pun_user['g_id'] > PUN_ADMIN) |
37 if ($pun_user['g_id'] < PUN_ADMIN) |
35 message($lang_common['No permission']); |
38 message($lang_common['No permission']); |
36 |
39 |
37 |
40 |
38 if (isset($_POST['form_sent'])) |
41 if (isset($_POST['form_sent'])) |
39 { |
42 { |
124 { |
127 { |
125 // Only update values that have changed |
128 // Only update values that have changed |
126 if (array_key_exists('o_'.$key, $pun_config) && $pun_config['o_'.$key] != $input) |
129 if (array_key_exists('o_'.$key, $pun_config) && $pun_config['o_'.$key] != $input) |
127 { |
130 { |
128 if ($input != '' || is_int($input)) |
131 if ($input != '' || is_int($input)) |
129 $value = '\''.$db->escape($input).'\''; |
132 $value = '\''.$pun_db->escape($input).'\''; |
130 else |
133 else |
131 $value = 'NULL'; |
134 $value = 'NULL'; |
132 |
135 |
133 $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$value.' WHERE conf_name=\'o_'.$db->escape($key).'\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error()); |
136 $pun_db->query('UPDATE '.$pun_db->prefix.'config SET conf_value='.$value.' WHERE conf_name=\'o_'.$pun_db->escape($key).'\'') or error('Unable to update board config', __FILE__, __LINE__, $pun_db->error()); |
134 } |
137 } |
135 } |
138 } |
136 |
139 |
137 // Regenerate the config cache |
140 // Regenerate the config cache |
138 require_once PUN_ROOT.'include/cache.php'; |
141 require_once PUN_ROOT.'include/cache.php'; |
139 generate_config_cache(); |
142 generate_config_cache(); |
140 |
143 |
141 redirect('admin_options.php', 'Options updated. Redirecting …'); |
144 pun_redirect('admin_options.php', 'Options updated. Redirecting …'); |
142 } |
145 } |
143 |
146 |
144 |
147 |
145 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Options'; |
148 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Options'; |
146 $form_name = 'update_options'; |
149 $form_name = 'update_options'; |