diff -r e3d7322305bf -r 5e1f1e916419 punbb/admin/options.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/punbb/admin/options.php Sat Apr 05 23:56:45 2008 -0400 @@ -0,0 +1,1177 @@ + $_ ) +{ + $$key =& $GLOBALS[$key]; +} + +($hook = get_hook('aop_start')) ? eval($hook) : null; + +if ($session->user_level < USER_LEVEL_ADMIN) + message($lang_common['No permission']); + +// Load the admin.php language file +require PUN_ROOT.'lang/'.$pun_user['language'].'/admin.php'; +$GLOBALS['lang_admin'] = $lang_admin; + +$section = isset($_GET['section']) ? $_GET['section'] : null; + + +if (isset($_POST['form_sent'])) +{ + $form = array_map('trim', $_POST['form']); + + ($hook = get_hook('aop_form_submitted')) ? eval($hook) : null; + + // Validate input depending on section + switch ($section) + { + case 'setup': + { + ($hook = get_hook('aop_setup_validation')) ? eval($hook) : null; + + if ($form['board_title'] == '') + message($lang_admin['Error no board title']); + + // Clean default_lang, default_style, and sef + $form['default_style'] = preg_replace('#[\.\\\/]#', '', $form['default_style']); + $form['default_lang'] = preg_replace('#[\.\\\/]#', '', $form['default_lang']); + $form['sef'] = preg_replace('#[\.\\\/]#', '', $form['sef']); + + // Make sure default_lang and default_style exist + if (!file_exists(PUN_ROOT.'style/'.$form['default_style'].'/'.$form['default_style'].'.css')) + message($lang_common['Bad request']); + if (!file_exists(PUN_ROOT.'lang/'.$form['default_lang'].'/common.php')) + message($lang_common['Bad request']); + + $form['timeout_visit'] = intval($form['timeout_visit']); + $form['timeout_online'] = intval($form['timeout_online']); + $form['redirect_delay'] = intval($form['redirect_delay']); + + if ($form['timeout_online'] >= $form['timeout_visit']) + message($lang_admin['Error timeout value']); + + $form['disp_topics_default'] = (intval($form['disp_topics_default']) > 0) ? intval($form['disp_topics_default']) : 1; + $form['disp_posts_default'] = (intval($form['disp_posts_default']) > 0) ? intval($form['disp_posts_default']) : 1; + + if ($form['additional_navlinks'] != '') + $form['additional_navlinks'] = trim(pun_linebreaks($form['additional_navlinks'])); + + break; + } + + case 'features': + { + ($hook = get_hook('aop_features_validation')) ? eval($hook) : null; + + if (!isset($form['search_all_forums']) || $form['search_all_forums'] != '1') $form['search_all_forums'] = '0'; + if (!isset($form['ranks']) || $form['ranks'] != '1') $form['ranks'] = '0'; + if (!isset($form['censoring']) || $form['censoring'] != '1') $form['censoring'] = '0'; + if (!isset($form['quickjump']) || $form['quickjump'] != '1') $form['quickjump'] = '0'; + if (!isset($form['show_version']) || $form['show_version'] != '1') $form['show_version'] = '0'; + if (!isset($form['users_online']) || $form['users_online'] != '1') $form['users_online'] = '0'; + + if (!isset($form['quickpost']) || $form['quickpost'] != '1') $form['quickpost'] = '0'; + if (!isset($form['subscriptions']) || $form['subscriptions'] != '1') $form['subscriptions'] = '0'; + if (!isset($form['force_guest_email']) || $form['force_guest_email'] != '1') $form['force_guest_email'] = '0'; + if (!isset($form['show_dot']) || $form['show_dot'] != '1') $form['show_dot'] = '0'; + if (!isset($form['topic_views']) || $form['topic_views'] != '1') $form['topic_views'] = '0'; + if (!isset($form['show_post_count']) || $form['show_post_count'] != '1') $form['show_post_count'] = '0'; + if (!isset($form['show_user_info']) || $form['show_user_info'] != '1') $form['show_user_info'] = '0'; + + if (!isset($form['message_bbcode']) || $form['message_bbcode'] != '1') $form['message_bbcode'] = '0'; + if (!isset($form['message_img_tag']) || $form['message_img_tag'] != '1') $form['message_img_tag'] = '0'; + if (!isset($form['smilies']) || $form['smilies'] != '1') $form['smilies'] = '0'; + if (!isset($form['make_links']) || $form['make_links'] != '1') $form['make_links'] = '0'; + if (!isset($form['message_all_caps']) || $form['message_all_caps'] != '1') $form['message_all_caps'] = '0'; + if (!isset($form['subject_all_caps']) || $form['subject_all_caps'] != '1') $form['subject_all_caps'] = '0'; + $form['indent_num_spaces'] = intval($form['indent_num_spaces']); + + if (!isset($form['signatures']) || $form['signatures'] != '1') $form['signatures'] = '0'; + if (!isset($form['sig_bbcode']) || $form['sig_bbcode'] != '1') $form['sig_bbcode'] = '0'; + if (!isset($form['sig_img_tag']) || $form['sig_img_tag'] != '1') $form['sig_img_tag'] = '0'; + if (!isset($form['sig_all_caps']) || $form['sig_all_caps'] != '1') $form['sig_all_caps'] = '0'; + + if (!isset($form['avatars']) || $form['avatars'] != '1') $form['avatars'] = '0'; + + // Clean avatars_dir + $form['avatars_dir'] = str_replace("\0", '', $form['avatars_dir']); + + // Make sure avatars_dir doesn't end with a slash + if (substr($form['avatars_dir'], -1) == '/') + $form['avatars_dir'] = substr($form['avatars_dir'], 0, -1); + + $form['avatars_width'] = intval($form['avatars_width']); + $form['avatars_height'] = intval($form['avatars_height']); + $form['avatars_size'] = intval($form['avatars_size']); + + if (!isset($form['check_for_updates']) || $form['check_for_updates'] != '1') $form['check_for_updates'] = '0'; + if (!isset($form['gzip']) || $form['gzip'] != '1') $form['gzip'] = '0'; + + if (!isset($form['announcement']) || $form['announcement'] != '1') $form['announcement'] = '0'; + + if ($form['announcement_message'] != '') + $form['announcement_message'] = pun_linebreaks($form['announcement_message']); + else + $form['announcement_message'] = $lang_admin['Announcement message default']; + + break; + } + + case 'email': + { + ($hook = get_hook('aop_email_validation')) ? eval($hook) : null; + + require PUN_ROOT.'include/email.php'; + + $form['admin_email'] = strtolower($form['admin_email']); + if (!is_valid_email($form['admin_email'])) + message($lang_admin['Error invalid admin e-mail']); + + $form['webmaster_email'] = strtolower($form['webmaster_email']); + if (!is_valid_email($form['webmaster_email'])) + message($lang_admin['Error invalid web e-mail']); + + if (!isset($form['smtp_ssl']) || $form['smtp_ssl'] != '1') $form['smtp_ssl'] = '0'; + + break; + } + + case 'registration': + { + ($hook = get_hook('aop_registration_validation')) ? eval($hook) : null; + + if (!isset($form['regs_allow']) || $form['regs_allow'] != '1') $form['regs_allow'] = '0'; + if (!isset($form['regs_verify']) || $form['regs_verify'] != '1') $form['regs_verify'] = '0'; + if (!isset($form['allow_banned_email']) || $form['allow_banned_email'] != '1') $form['allow_banned_email'] = '0'; + if (!isset($form['allow_dupe_email']) || $form['allow_dupe_email'] != '1') $form['allow_dupe_email'] = '0'; + if (!isset($form['regs_report']) || $form['regs_report'] != '1') $form['regs_report'] = '0'; + + if (!isset($form['rules']) || $form['rules'] != '1') $form['rules'] = '0'; + + if ($form['rules_message'] != '') + $form['rules_message'] = pun_linebreaks($form['rules_message']); + else + $form['rules_message'] = $lang_admin['Rules default']; + + break; + } + + case 'maintenance': + { + ($hook = get_hook('aop_maintenance_validation')) ? eval($hook) : null; + + if (!isset($form['maintenance']) || $form['maintenance'] != '1') $form['maintenance'] = '0'; + + if ($form['maintenance_message'] != '') + $form['maintenance_message'] = pun_linebreaks($form['maintenance_message']); + else + $form['maintenance_message'] = $lang_admin['Maintenance message default']; + + break; + } + + default: + { + ($hook = get_hook('aop_new_section_validation')) ? eval($hook) : null; + break; + } + } + + ($hook = get_hook('aop_pre_update_configuration')) ? eval($hook) : null; + + while (list($key, $input) = @each($form)) + { + // Only update permission values that have changed + if (array_key_exists('p_'.$key, $pun_config) && $pun_config['p_'.$key] != $input) + { + $query = array( + 'UPDATE' => 'config', + 'SET' => 'conf_value='.$input, + 'WHERE' => 'conf_name=\'p_'.$pun_db->escape($key).'\'' + ); + + ($hook = get_hook('aop_qr_update_permission_conf')) ? eval($hook) : null; + $pun_db->query_build($query) or error(__FILE__, __LINE__); + } + + // Only update option values that have changed + if (array_key_exists('o_'.$key, $pun_config) && $pun_config['o_'.$key] != $input) + { + if ($input != '' || is_int($input)) + $value = '\''.$pun_db->escape($input).'\''; + else + $value = 'NULL'; + + $query = array( + 'UPDATE' => 'config', + 'SET' => 'conf_value='.$value, + 'WHERE' => 'conf_name=\'o_'.$pun_db->escape($key).'\'' + ); + + ($hook = get_hook('aop_qr_update_permission_option')) ? eval($hook) : null; + $pun_db->query_build($query) or error(__FILE__, __LINE__); + } + } + + // Regenerate the config cache + require_once PUN_ROOT.'include/cache.php'; + generate_config_cache(); + + pun_redirect(pun_link($pun_url['admin_options_'.$section]), $lang_admin['Options updated'].' '.$lang_admin['Redirect']); +} + + +if (!$section || $section == 'setup') +{ + // Setup the form + $pun_page['fld_count'] = $pun_page['set_count'] = $pun_page['part_count'] = 0; + + // Setup breadcrumbs + $pun_page['crumbs'] = array( + array($pun_config['o_board_title'], pun_link($pun_url['index'])), + array($lang_admin['Forum administration'], pun_link($pun_url['admin_index'])), + $lang_admin['Setup'] + ); + + ($hook = get_hook('aop_setup_pre_header_load')) ? eval($hook) : null; + + define('PUN_PAGE_SECTION', 'options'); + define('PUN_PAGE', 'admin-options-setup'); + require PUN_ROOT.'header.php'; + +?> +
+ + + + +
+

{ }

+
+ +
+
+

+
+
+ + +
+

+
+ +
+ +
+
+ +
+
+ +
+ +
+
+ +
+

+
+ +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+

+
+ +
+ +
+
+ +
+
+ +
+ +
+
+ +
+

+
+ +
+ +
+
+ +
+
+ +
+ +
+
+ +
+

+
+ +
+ +
+
+
+
+ +
+
+ +
+

+
+

+
+
+ +
+ +
+ +
+
+ +
+

+
+

+
+
+ +
+ +
+ +
+
+
+ +
+
+
+ +
+ +
+ + + +
+

{ }

+
+ +
+
+

+
+
+ + +
+

'.strtolower($lang_admin['Censoring']).'') ?>

+
+ +
+
+
+
+
+
+ +
+
+ +
+

+
+ +
+
+
+
+
+
+
+ +
+
+ +
+

+
+ +
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+ +
+
+ +
+

+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+ +
+
+ +
+

+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+

+
+

+
+
+ +
+ +
+ +
+
+ +
+

+
+

+
+
+ +
+ +
+ +
+
+ +
+

+
+ +
+
+ +
+
+ +
+ +
+
+
+ +
+
+
+ +
+ +
+ + + +
+

{ }

+
+ +
+
+

+
+
+ + +
+

+
+

+
+
+ +
+ +
+
+ +
+
+ +
+
+
+
+ +
+ +
+
+ +
+

+
+

+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+
+ +
+ +
+ + + +
+

{ }

+
+ +
+
+

+
+
+ +
+

+

+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+ + + +
+

{ }

+
+ +
+
+

+
+
+ + +
+

+
+ +
+ +
+
+ +
+
+
+ +
+ +
+ +
+
+ +
+

+
+

+
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+ +
+
+
+ +
+