コード例 #1
0
 /**
  * Display config page
  *
  * @return null
  */
 public function display_config()
 {
     // Output relevant page
     foreach ($this->display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $this->template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($this->user->lang[$vars]) ? $this->user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($this->user->lang[$vars['lang_explain']]) ? $this->user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($this->user->lang[$vars['lang'] . '_EXPLAIN']) ? $this->user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $this->template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($this->user->lang[$vars['lang']]) ? $this->user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars)));
         unset($this->display_vars['vars'][$config_key]);
     }
 }
コード例 #2
0
ファイル: acp_pbwow2.php プロジェクト: gonzo1247/hitman_roa
 function main($id, $mode)
 {
     global $db, $user, $template, $cache;
     global $config, $pbwow_config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
     // Some basic includes
     if (!function_exists('db_theme_data')) {
         include $phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx;
     }
     if (!class_exists('phpbb_db_tools')) {
         include $phpbb_root_path . 'includes/db/db_tools.' . $phpEx;
     }
     $db_tool = new phpbb_db_tools($db);
     $user->add_lang('mods/lang_pbwow_acp');
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->tpl_name = 'acp_pbwow2';
     // Some constants
     $module_version = '2.0.9';
     $dbtable = defined('PBWOW2_CONFIG_TABLE') ? PBWOW2_CONFIG_TABLE : '';
     $legacy_dbtable = defined('PBWOW_CONFIG_TABLE') ? PBWOW_CONFIG_TABLE : '';
     $topics_table = TOPICS_TABLE;
     $chars_table = defined('PBWOW2_CHARS_TABLE') ? PBWOW2_CHARS_TABLE : '';
     $allow_fopen = ini_get('allow_url_fopen') ? true : false;
     $constantsokay = $dbokay = $legacy_constants = $legacy_db_active = $legacy_topics_mod = false;
     $style_version = $imageset_version = $template_version = $theme_version = '';
     // Check if constants have been set correctly
     // if yes, check if the config table exists
     // if yes, load the config variables
     if ($dbtable == $table_prefix . 'pbwow2_config') {
         $constantsokay = true;
         if ($db_tool->sql_table_exists($dbtable)) {
             $dbokay = true;
             $pbwow_config = $this->get_pbwow_config();
             $this->new_config = $pbwow_config;
             if (!isset($pbwow_config['pbwow2_version'])) {
                 if (isset($config['pbwow2_version']) && !empty($config['pbwow2_version'])) {
                     $pbwow_config['pbwow2_version'] = $config['pbwow2_version'];
                 }
             }
         }
     }
     if ($chars_table == $table_prefix . 'pbwow2_chars') {
         $chars_constokay = true;
         if ($db_tool->sql_table_exists($chars_table)) {
             $chars_dbokay = true;
         }
     }
     if ($mode == 'overview') {
         $cpflist = $this->get_cpf_list();
         $style_root = $phpbb_root_path . 'styles/pbwow2/';
         if (file_exists($style_root . 'style.cfg')) {
             $values = parse_cfg_file($style_root . 'style.cfg');
             $style_version = isset($values['version']) ? $values['version'] : '';
         }
         if (file_exists($style_root . 'imageset/imageset.cfg')) {
             $values = parse_cfg_file($style_root . 'imageset/imageset.cfg');
             $imageset_version = isset($values['version']) ? $values['version'] : '';
         }
         if (file_exists($style_root . 'template/template.cfg')) {
             $values = parse_cfg_file($style_root . 'template/template.cfg');
             $template_version = isset($values['version']) ? $values['version'] : '';
         }
         if (file_exists($style_root . 'theme/theme.cfg')) {
             $values = parse_cfg_file($style_root . 'theme/theme.cfg');
             $theme_version = isset($values['version']) ? $values['version'] : '';
         }
         $versions = $this->obtain_pbwow_version_info(request_var('versioncheck_force', false), true);
         // Check if old constants are still being used
         if (!empty($legacy_dbtable)) {
             $legacy_constants = true;
         }
         // Check if old table still exists
         if ($db_tool->sql_table_exists($legacy_dbtable) || $db_tool->sql_table_exists($table_prefix . 'pbwow_config')) {
             $legacy_db_active = true;
         }
         // Check if topics table has been modded
         if ($db_tool->sql_column_exists(TOPICS_TABLE, 'topic_first_poster_rank_img') || $db_tool->sql_column_exists(TOPICS_TABLE, 'topic_first_poster_rank_title')) {
             $legacy_topics_mod = true;
         }
     }
     /**
      *	Validation types are:
      *		string, int, bool,
      *		script_path (absolute path in url - beginning with / and no trailing slash),
      *		rpath (relative), rwpath (realtive, writeable), path (relative path, but able to escape the root), wpath (writeable)
      */
     switch ($mode) {
         case 'overview':
             $display_vars = array('title' => 'ACP_PBWOW2_OVERVIEW_TITLE', 'vars' => array());
             break;
         case 'config':
             $display_vars = array('title' => 'ACP_PBWOW_CONFIG_TITLE', 'vars' => array('legend1' => 'ACP_PBWOW_LOGO', 'logo_size_width' => array('lang' => 'PBWOW_LOGO_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'logo_size_height' => array('lang' => 'PBWOW_LOGO_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'logo_enable' => array('lang' => 'PBWOW_LOGO_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'logo_src' => array('lang' => 'PBWOW_LOGO_SRC', 'validate' => 'string', 'type' => 'text:20:255', 'explain' => true), 'logo_size' => array('lang' => 'PBWOW_LOGO_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'logo_margins' => array('lang' => 'PBWOW_LOGO_MARGINS', 'validate' => 'string', 'type' => 'text:20:20', 'explain' => true), 'legend2' => 'ACP_PBWOW_TOPBAR', 'topbar_enable' => array('lang' => 'PBWOW_TOPBAR_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'topbar_code' => array('lang' => 'PBWOW_TOPBAR_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'topbar_fixed' => array('lang' => 'PBWOW_TOPBAR_FIXED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'ACP_PBWOW_HEADERLINKS', 'headerlinks_enable' => array('lang' => 'PBWOW_HEADERLINKS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'headerlinks_code' => array('lang' => 'PBWOW_HEADERLINKS_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend4' => 'ACP_PBWOW_NAVMENU', 'navmenu_enable' => array('lang' => 'PBWOW_NAVMENU_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'legend5' => 'ACP_PBWOW_IE6MESSAGE', 'ie6message_enable' => array('lang' => 'PBWOW_IE6MESSAGE_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'ie6message_code' => array('lang' => 'PBWOW_IE6MESSAGE_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend6' => 'ACP_PBWOW_VIDEOBG', 'videobg_enable' => array('lang' => 'PBWOW_VIDEOBG_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'videobg_allpages' => array('lang' => 'PBWOW_VIDEOBG_ALLPAGES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'bg_fixed' => array('lang' => 'PBWOW_BG_FIXED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend7' => 'ACP_PBWOW_BNETCHARS', 'bnetchars_enable' => array('lang' => 'PBWOW_BNETCHARS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'bnetchars_cachetime' => array('lang' => 'PBWOW_BNETCHARS_CACHETIME', 'validate' => 'int:0', 'type' => 'text:6:6', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'bnetchars_timeout' => array('lang' => 'PBWOW_BNETCHARS_TIMEOUT', 'validate' => 'int:0', 'type' => 'text:1:1', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'legend8' => 'ACP_PBWOW_TOOLTIPS', 'wowtips_script' => array('lang' => 'PBWOW_WOWTIPS_SCRIPT', 'validate' => 'int', 'type' => 'custom', 'explain' => true, 'method' => 'select_single'), 'd3tips_script' => array('lang' => 'PBWOW_D3TIPS_SCRIPT', 'validate' => 'int', 'type' => 'custom', 'explain' => true, 'method' => 'select_single'), 'zamtips_enable' => array('lang' => 'PBWOW_ZAMTIPS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'tooltips_region' => array('lang' => 'PBWOW_TOOLTIPS_REGION', 'validate' => 'int', 'type' => 'custom', 'explain' => true, 'method' => 'select_single'), 'tooltips_footer' => array('lang' => 'PBWOW_TOOLTIPS_FOOTER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'tooltips_local' => array('lang' => 'PBWOW_TOOLTIPS_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true)));
             break;
         case 'poststyling':
             $display_vars = array('title' => 'ACP_PBWOW_POSTSTYLING_TITLE', 'vars' => array('legend1' => 'ACP_PBWOW_BLIZZ', 'blizz_enable' => array('lang' => 'PBWOW_BLIZZ_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'blizz_ranks' => array('lang' => 'PBWOW_BLIZZ_RANKS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_ranks'), 'blizz_color' => array('lang' => 'PBWOW_BLIZZ_COLOR', 'validate' => 'string', 'type' => 'text:7:7', 'explain' => true), 'legend2' => 'ACP_PBWOW_PROPASS', 'propass_enable' => array('lang' => 'PBWOW_PROPASS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'propass_ranks' => array('lang' => 'PBWOW_PROPASS_RANKS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_ranks'), 'propass_color' => array('lang' => 'PBWOW_PROPASS_COLOR', 'validate' => 'string', 'type' => 'text:7:7', 'explain' => true), 'legend3' => 'ACP_PBWOW_RED', 'red_enable' => array('lang' => 'PBWOW_RED_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'red_ranks' => array('lang' => 'PBWOW_RED_RANKS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_ranks'), 'red_color' => array('lang' => 'PBWOW_RED_COLOR', 'validate' => 'string', 'type' => 'text:7:7', 'explain' => true), 'legend4' => 'ACP_PBWOW_GREEN', 'green_enable' => array('lang' => 'PBWOW_GREEN_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'green_ranks' => array('lang' => 'PBWOW_GREEN_RANKS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_ranks'), 'green_color' => array('lang' => 'PBWOW_GREEN_COLOR', 'validate' => 'string', 'type' => 'text:7:7', 'explain' => true)));
             break;
         case 'ads':
             $display_vars = array('title' => 'ACP_PBWOW_ADS_TITLE', 'vars' => array('legend1' => 'ACP_PBWOW_ADS_INDEX', 'ads_index_enable' => array('lang' => 'PBWOW_ADS_INDEX_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'ads_index_code' => array('lang' => 'PBWOW_ADS_INDEX_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend2' => 'ACP_PBWOW_ADS_TOP', 'ads_top_enable' => array('lang' => 'PBWOW_ADS_TOP_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'ads_top_code' => array('lang' => 'PBWOW_ADS_TOP_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend3' => 'ACP_PBWOW_ADS_BOTTOM', 'ads_bottom_enable' => array('lang' => 'PBWOW_ADS_BOTTOM_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'ads_bottom_code' => array('lang' => 'PBWOW_ADS_BOTTOM_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend4' => 'ACP_PBWOW_ADS_SIDE', 'ads_side_enable' => array('lang' => 'PBWOW_ADS_SIDE_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'ads_side_code' => array('lang' => 'PBWOW_ADS_SIDE_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend5' => 'ACP_PBWOW_TRACKING', 'tracking_enable' => array('lang' => 'PBWOW_TRACKING_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'tracking_code' => array('lang' => 'PBWOW_TRACKING_CODE', 'type' => 'textarea:6:6', 'explain' => true)));
             break;
     }
     $action = request_var('action', '');
     $submit = isset($_POST['submit']) ? true : false;
     $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if we want
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... and then write to config
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             $this->set_pbwow_config($config_name, $config_value);
         }
     }
     if ($submit) {
         if ($action == 'refresh_topic_ranks' && $legacy_topics_mod == true) {
             $this->refresh_topic_ranks();
             $cache->purge();
         }
         if ($action == 'create_topic_ranks' && $legacy_topics_mod == false) {
             $db_tool->sql_column_add($topics_table, 'topic_first_poster_rank_img', array('VCHAR', ''));
             $db_tool->sql_column_add($topics_table, 'topic_first_poster_rank_title', array('VCHAR', ''));
             add_log('admin', 'Topics MOD installed', $user->lang['ACP_PBWOW2_' . strtoupper($mode)]);
             trigger_error('Topics MOD installed' . adm_back_link($this->u_action));
         }
         if (($action == 'drop_topic_ranks' || $action == 'remove_legacy') && $legacy_topics_mod == true) {
             $db_tool->sql_column_remove($topics_table, 'topic_first_poster_rank_img');
             $db_tool->sql_column_remove($topics_table, 'topic_first_poster_rank_title');
             add_log('admin', 'Topics MOD uninstalled', $user->lang['ACP_PBWOW2_' . strtoupper($mode)]);
             trigger_error('Topics MOD uninstalled' . adm_back_link($this->u_action));
         }
         if ($action == 'refresh_all_themes') {
             $this->refresh_all_themes();
             $cache->purge();
             add_log('admin', 'LOG_THEME_REFRESHED', $user->lang['ACP_PBWOW2_' . strtoupper($mode)]);
             trigger_error('All theme data refreshed' . adm_back_link($this->u_action));
         }
         // Get data from select boxes and store in DB
         if ($mode == 'poststyling') {
             $this->store_select_options('blizz_ranks');
             $this->store_select_options('propass_ranks');
             $this->store_select_options('red_ranks');
             $this->store_select_options('green_ranks');
             add_log('admin', 'LOG_PBWOW_CONFIG', $user->lang['ACP_PBWOW2_' . strtoupper($mode)]);
             $cache->purge();
             trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
         }
         if ($mode == ('config' || 'ads')) {
             $this->store_select_options('wowtips_script');
             $this->store_select_options('d3tips_script');
             $this->store_select_options('tooltips_region');
             add_log('admin', 'LOG_PBWOW_CONFIG', $user->lang['ACP_PBWOW2_' . strtoupper($mode)]);
             $cache->purge();
             trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
         }
     }
     $this->page_title = $display_vars['title'];
     $title_explain = $user->lang[$display_vars['title'] . '_EXPLAIN'];
     $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $title_explain, 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'S_CONSTANTSOKAY' => $constantsokay ? true : false, 'PBWOW_DBTABLE' => $dbtable, 'S_DBOKAY' => $dbokay ? true : false, 'L_PBWOW_DB_GOOD' => sprintf($user->lang['PBWOW_DB_GOOD'], $dbtable), 'L_PBWOW_DB_BAD' => sprintf($user->lang['PBWOW_DB_BAD'], $dbtable), 'L_PBWOW_RANKS_CREATE_EXPLAIN' => sprintf($user->lang['PBWOW_RANKS_CREATE_EXPLAIN'], $topics_table, $topics_table), 'L_PBWOW_CHARSDB_GOOD' => sprintf($user->lang['PBWOW_CHARSDB_GOOD'], $chars_table), 'L_PBWOW_CHARSDB_BAD' => sprintf($user->lang['PBWOW_CHARSDB_BAD'], $chars_table), 'TOPICS_TABLE' => $topics_table, 'U_ACTION' => $this->u_action));
     if ($mode == 'overview') {
         $template->assign_vars(array('S_INDEX' => true, 'DB_VERSION' => isset($pbwow_config['pbwow2_version']) ? $pbwow_config['pbwow2_version'] : '', 'MODULE_VERSION' => isset($module_version) ? $module_version : '', 'STYLE_VERSION' => $style_version, 'IMAGESET_VERSION' => $imageset_version, 'TEMPLATE_VERSION' => $template_version, 'THEME_VERSION' => $theme_version, 'S_CHECK_V' => empty($versions) ? false : true, 'DB_VERSION_V' => isset($versions['db_version']['version']) ? $versions['db_version']['version'] : '', 'MODULE_VERSION_V' => isset($versions['module_version']['version']) ? $versions['module_version']['version'] : '', 'ATEMPLATE_VERSION_V' => isset($versions['atemplate_version']['version']) ? $versions['atemplate_version']['version'] : '', 'STYLE_VERSION_V' => isset($versions['style_version']['version']) ? $versions['style_version']['version'] : '', 'IMAGESET_VERSION_V' => isset($versions['imageset_version']['version']) ? $versions['imageset_version']['version'] : '', 'TEMPLATE_VERSION_V' => isset($versions['template_version']['version']) ? $versions['template_version']['version'] : '', 'THEME_VERSION_V' => isset($versions['theme_version']['version']) ? $versions['theme_version']['version'] : '', 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&amp;versioncheck_force=1'), 'S_ALLOW_FOPEN' => $allow_fopen, 'S_CPF_ON_MEMBERLIST' => $config['load_cpf_memberlist'] == 1 ? true : false, 'S_CPF_ON_VIEWPROFILE' => $config['load_cpf_viewprofile'] == 1 ? true : false, 'S_CPF_ON_VIEWTOPIC' => $config['load_cpf_viewtopic'] == 1 ? true : false, 'S_CPF_PBGUILD' => isset($cpflist['pbguild']) && $cpflist['pbguild']['field_no_view'] == 0 ? true : false, 'S_CPF_PBREALM' => isset($cpflist['pbrealm']) && $cpflist['pbrealm']['field_no_view'] == 0 ? true : false, 'S_CPF_PBLEVEL' => isset($cpflist['pblevel']) && $cpflist['pblevel']['field_no_view'] == 0 ? true : false, 'S_CPF_PBRACE' => isset($cpflist['pbrace']) && $cpflist['pbrace']['field_no_view'] == 0 ? true : false, 'S_CPF_PBGENDER' => isset($cpflist['pbgender']) && $cpflist['pbgender']['field_no_view'] == 0 ? true : false, 'S_CPF_PBCLASS' => isset($cpflist['pbclass']) && $cpflist['pbclass']['field_no_view'] == 0 ? true : false, 'S_CPF_PBPVPRANK' => isset($cpflist['pbpvprank']) && $cpflist['pbpvprank']['field_no_view'] == 0 ? true : false, 'S_CPF_PBARMORYCHARLINK' => isset($cpflist['pbarmorycharlink']) && $cpflist['pbarmorycharlink']['field_no_view'] == 0 ? true : false, 'S_CPF_PBARMORYGUILDLINK' => isset($cpflist['pbarmoryguildlink']) && $cpflist['pbarmoryguildlink']['field_no_view'] == 0 ? true : false, 'S_CPF_PBDCLASS' => isset($cpflist['pbdclass']) && $cpflist['pbguild']['pbdclass'] == 0 ? true : false, 'S_CPF_PBDGENDER' => isset($cpflist['pbdgender']) && $cpflist['pbguild']['pbdgender'] == 0 ? true : false, 'S_CPF_PBDFOLLOWER' => isset($cpflist['pbdfollower']) && $cpflist['pbguild']['pbdfollower'] == 0 ? true : false, 'S_BNETCHARS_ACTIVE' => isset($pbwow_config['bnetchars_enable']) && $pbwow_config['bnetchars_enable'] ? true : false, 'S_BNETCHARS_CONSTOKAY' => $chars_constokay ? true : false, 'S_BNETCHARS_DBOKAY' => $chars_dbokay ? true : false, 'S_CPF_PBBNETHOST' => isset($cpflist['pbbnethost']) && $cpflist['pbbnethost']['field_no_view'] == 0 ? true : false, 'S_CPF_PBBNETREALM' => isset($cpflist['pbbnetrealm']) && $cpflist['pbbnetrealm']['field_no_view'] == 0 ? true : false, 'S_CPF_PBBNETNAME' => isset($cpflist['pbbnetname']) && $cpflist['pbbnetname']['field_no_view'] == 0 ? true : false, 'S_CPF_PBNETAVATAR' => isset($cpflist['pbbnetavatar']) && $cpflist['pbbnetavatar']['field_no_view'] == 0 ? true : false, 'S_LEGACY_CONSTANTS' => $legacy_constants, 'S_LEGACY_DB_ACTIVE' => $legacy_db_active, 'S_LEGACY_TOPICS_MOD' => $legacy_topics_mod));
     }
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #3
0
ファイル: ajaxchat_module.php プロジェクト: Reaper88/ajaxchat
 /**
  * Abstracted method to generate acp configuration pages out of a list of display vars, using
  * the function build_cfg_template().
  * Build configuration template for acp configuration pages
  *
  * @param array $display_vars The display vars for this acp site
  */
 protected function generate_stuff_for_cfg_template($display_vars)
 {
     $this->new_config = $this->config;
     $cfg_array = $this->request->is_set('config') ? $this->request->variable('config', ['' => ''], true) : $this->new_config;
     $error = isset($error) ? $error : [];
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $this->template->assign_block_vars('options', ['S_LEGEND' => true, 'LEGEND' => isset($this->user->lang[$vars]) ? $this->user->lang[$vars] : $vars]);
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($this->user->lang[$vars['lang_explain']]) ? $this->user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($this->user->lang[$vars['lang'] . '_EXPLAIN']) ? $this->user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $this->template->assign_block_vars('options', ['KEY' => $config_key, 'TITLE' => isset($this->user->lang[$vars['lang']]) ? $this->user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content]);
         //unset($display_vars['vars'][$config_key]);
     }
     $this->template->assign_vars(['S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action]);
 }
コード例 #4
0
ファイル: acp_attachments.php プロジェクト: jvinhit/php
    function main($id, $mode)
    {
        global $db, $user, $auth, $template, $cache;
        global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
        $user->add_lang(array('posting', 'viewtopic', 'acp/attachments'));
        $error = $notify = array();
        $submit = isset($_POST['submit']) ? true : false;
        $action = request_var('action', '');
        $form_key = 'acp_attach';
        add_form_key($form_key);
        if ($submit && !check_form_key($form_key)) {
            trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
        }
        switch ($mode) {
            case 'attach':
                $l_title = 'ACP_ATTACHMENT_SETTINGS';
                break;
            case 'extensions':
                $l_title = 'ACP_MANAGE_EXTENSIONS';
                break;
            case 'ext_groups':
                $l_title = 'ACP_EXTENSION_GROUPS';
                break;
            case 'orphan':
                $l_title = 'ACP_ORPHAN_ATTACHMENTS';
                break;
            default:
                trigger_error('NO_MODE', E_USER_ERROR);
                break;
        }
        $this->tpl_name = 'acp_attachments';
        $this->page_title = $l_title;
        $template->assign_vars(array('L_TITLE' => $user->lang[$l_title], 'L_TITLE_EXPLAIN' => $user->lang[$l_title . '_EXPLAIN'], 'U_ACTION' => $this->u_action));
        switch ($mode) {
            case 'attach':
                include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
                $sql = 'SELECT group_name, cat_id
					FROM ' . EXTENSION_GROUPS_TABLE . '
					WHERE cat_id > 0
					ORDER BY cat_id';
                $result = $db->sql_query($sql);
                $s_assigned_groups = array();
                while ($row = $db->sql_fetchrow($result)) {
                    $s_assigned_groups[$row['cat_id']][] = $row['group_name'];
                }
                $db->sql_freeresult($result);
                $l_legend_cat_images = $user->lang['SETTINGS_CAT_IMAGES'] . ' [' . $user->lang['ASSIGNED_GROUP'] . ': ' . (!empty($s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE]) ? implode(', ', $s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE]) : $user->lang['NO_EXT_GROUP']) . ']';
                $display_vars = array('title' => 'ACP_ATTACHMENT_SETTINGS', 'vars' => array('legend1' => 'ACP_ATTACHMENT_SETTINGS', 'img_max_width' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'img_max_height' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'img_link_width' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'img_link_height' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'upload_path' => array('lang' => 'UPLOAD_DIR', 'validate' => 'wpath', 'type' => 'text:25:100', 'explain' => true), 'display_order' => array('lang' => 'DISPLAY_ORDER', 'validate' => 'bool', 'type' => 'custom', 'method' => 'display_order', 'explain' => true), 'attachment_quota' => array('lang' => 'ATTACH_QUOTA', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), 'max_filesize' => array('lang' => 'ATTACH_MAX_FILESIZE', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), 'max_filesize_pm' => array('lang' => 'ATTACH_MAX_PM_FILESIZE', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), 'max_attachments' => array('lang' => 'MAX_ATTACHMENTS', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => false), 'max_attachments_pm' => array('lang' => 'MAX_ATTACHMENTS_PM', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => false), 'secure_downloads' => array('lang' => 'SECURE_DOWNLOADS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'secure_allow_deny' => array('lang' => 'SECURE_ALLOW_DENY', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_allow_deny', 'explain' => true), 'secure_allow_empty_referer' => array('lang' => 'SECURE_EMPTY_REFERRER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'check_attachment_content' => array('lang' => 'CHECK_CONTENT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => $l_legend_cat_images, 'img_display_inlined' => array('lang' => 'DISPLAY_INLINED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'img_create_thumbnail' => array('lang' => 'CREATE_THUMBNAIL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'img_max_thumb_width' => array('lang' => 'MAX_THUMB_WIDTH', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' px'), 'img_min_thumb_filesize' => array('lang' => 'MIN_THUMB_FILESIZE', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), 'img_imagick' => array('lang' => 'IMAGICK_PATH', 'validate' => 'string', 'type' => 'text:20:200', 'explain' => true, 'append' => '&nbsp;&nbsp;<span>[ <a href="' . $this->u_action . '&amp;action=imgmagick">' . $user->lang['SEARCH_IMAGICK'] . '</a> ]</span>'), 'img_max' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' px'), 'img_link' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' px')));
                $this->new_config = $config;
                $cfg_array = isset($_REQUEST['config']) ? request_var('config', array('' => '')) : $this->new_config;
                $error = array();
                // We validate the complete config if whished
                validate_config_vars($display_vars['vars'], $cfg_array, $error);
                // Do not write values if there is an error
                if (sizeof($error)) {
                    $submit = false;
                }
                // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
                foreach ($display_vars['vars'] as $config_name => $null) {
                    if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
                        continue;
                    }
                    $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
                    if (in_array($config_name, array('attachment_quota', 'max_filesize', 'max_filesize_pm'))) {
                        $size_var = request_var($config_name, '');
                        $this->new_config[$config_name] = $config_value = $size_var == 'kb' ? round($config_value * 1024) : ($size_var == 'mb' ? round($config_value * 1048576) : $config_value);
                    }
                    if ($submit) {
                        set_config($config_name, $config_value);
                    }
                }
                $this->perform_site_list();
                if ($submit) {
                    add_log('admin', 'LOG_CONFIG_ATTACH');
                    // Check Settings
                    $this->test_upload($error, $this->new_config['upload_path'], false);
                    if (!sizeof($error)) {
                        trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
                    }
                }
                $template->assign_var('S_ATTACHMENT_SETTINGS', true);
                if ($action == 'imgmagick') {
                    $this->new_config['img_imagick'] = $this->search_imagemagick();
                }
                // We strip eventually manual added convert program, we only want the patch
                if ($this->new_config['img_imagick']) {
                    // Change path separator
                    $this->new_config['img_imagick'] = str_replace('\\', '/', $this->new_config['img_imagick']);
                    $this->new_config['img_imagick'] = str_replace(array('convert', '.exe'), array('', ''), $this->new_config['img_imagick']);
                    // Check for trailing slash
                    if (substr($this->new_config['img_imagick'], -1) !== '/') {
                        $this->new_config['img_imagick'] .= '/';
                    }
                }
                $supported_types = get_supported_image_types();
                // Check Thumbnail Support
                if (!$this->new_config['img_imagick'] && (!isset($supported_types['format']) || !sizeof($supported_types['format']))) {
                    $this->new_config['img_create_thumbnail'] = 0;
                }
                $template->assign_vars(array('U_SEARCH_IMAGICK' => $this->u_action . '&amp;action=imgmagick', 'S_THUMBNAIL_SUPPORT' => !$this->new_config['img_imagick'] && (!isset($supported_types['format']) || !sizeof($supported_types['format'])) ? false : true));
                // Secure Download Options - Same procedure as with banning
                $allow_deny = $this->new_config['secure_allow_deny'] ? 'ALLOWED' : 'DISALLOWED';
                $sql = 'SELECT *
					FROM ' . SITELIST_TABLE;
                $result = $db->sql_query($sql);
                $defined_ips = '';
                $ips = array();
                while ($row = $db->sql_fetchrow($result)) {
                    $value = $row['site_ip'] ? $row['site_ip'] : $row['site_hostname'];
                    if ($value) {
                        $defined_ips .= '<option' . ($row['ip_exclude'] ? ' class="sep"' : '') . ' value="' . $row['site_id'] . '">' . $value . '</option>';
                        $ips[$row['site_id']] = $value;
                    }
                }
                $db->sql_freeresult($result);
                $template->assign_vars(array('S_SECURE_DOWNLOADS' => $this->new_config['secure_downloads'], 'S_DEFINED_IPS' => $defined_ips != '' ? true : false, 'S_WARNING' => sizeof($error) ? true : false, 'WARNING_MSG' => implode('<br />', $error), 'DEFINED_IPS' => $defined_ips, 'L_SECURE_TITLE' => $user->lang['DEFINE_' . $allow_deny . '_IPS'], 'L_IP_EXCLUDE' => $user->lang['EXCLUDE_FROM_' . $allow_deny . '_IP'], 'L_REMOVE_IPS' => $user->lang['REMOVE_' . $allow_deny . '_IPS']));
                // Output relevant options
                foreach ($display_vars['vars'] as $config_key => $vars) {
                    if (!is_array($vars) && strpos($config_key, 'legend') === false) {
                        continue;
                    }
                    if (strpos($config_key, 'legend') !== false) {
                        $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
                        continue;
                    }
                    $type = explode(':', $vars['type']);
                    $l_explain = '';
                    if ($vars['explain'] && isset($vars['lang_explain'])) {
                        $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
                    } else {
                        if ($vars['explain']) {
                            $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
                        }
                    }
                    $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
                    if (empty($content)) {
                        continue;
                    }
                    $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => $user->lang[$vars['lang']], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
                    unset($display_vars['vars'][$config_key]);
                }
                break;
            case 'extensions':
                if ($submit || isset($_POST['add_extension_check'])) {
                    if ($submit) {
                        // Change Extensions ?
                        $extension_change_list = request_var('extension_change_list', array(0));
                        $group_select_list = request_var('group_select', array(0));
                        // Generate correct Change List
                        $extensions = array();
                        for ($i = 0, $size = sizeof($extension_change_list); $i < $size; $i++) {
                            $extensions[$extension_change_list[$i]]['group_id'] = $group_select_list[$i];
                        }
                        $sql = 'SELECT *
							FROM ' . EXTENSIONS_TABLE . '
							ORDER BY extension_id';
                        $result = $db->sql_query($sql);
                        while ($row = $db->sql_fetchrow($result)) {
                            if ($row['group_id'] != $extensions[$row['extension_id']]['group_id']) {
                                $sql = 'UPDATE ' . EXTENSIONS_TABLE . '
									SET group_id = ' . (int) $extensions[$row['extension_id']]['group_id'] . '
									WHERE extension_id = ' . $row['extension_id'];
                                $db->sql_query($sql);
                                add_log('admin', 'LOG_ATTACH_EXT_UPDATE', $row['extension']);
                            }
                        }
                        $db->sql_freeresult($result);
                        // Delete Extension?
                        $extension_id_list = request_var('extension_id_list', array(0));
                        if (sizeof($extension_id_list)) {
                            $sql = 'SELECT extension
								FROM ' . EXTENSIONS_TABLE . '
								WHERE ' . $db->sql_in_set('extension_id', $extension_id_list);
                            $result = $db->sql_query($sql);
                            $extension_list = '';
                            while ($row = $db->sql_fetchrow($result)) {
                                $extension_list .= $extension_list == '' ? $row['extension'] : ', ' . $row['extension'];
                            }
                            $db->sql_freeresult($result);
                            $sql = 'DELETE
								FROM ' . EXTENSIONS_TABLE . '
								WHERE ' . $db->sql_in_set('extension_id', $extension_id_list);
                            $db->sql_query($sql);
                            add_log('admin', 'LOG_ATTACH_EXT_DEL', $extension_list);
                        }
                    }
                    // Add Extension?
                    $add_extension = strtolower(request_var('add_extension', ''));
                    $add_extension_group = request_var('add_group_select', 0);
                    $add = isset($_POST['add_extension_check']) ? true : false;
                    if ($add_extension && $add) {
                        if (!sizeof($error)) {
                            $sql = 'SELECT extension_id
								FROM ' . EXTENSIONS_TABLE . "\n\t\t\t\t\t\t\t\tWHERE extension = '" . $db->sql_escape($add_extension) . "'";
                            $result = $db->sql_query($sql);
                            if ($row = $db->sql_fetchrow($result)) {
                                $error[] = sprintf($user->lang['EXTENSION_EXIST'], $add_extension);
                            }
                            $db->sql_freeresult($result);
                            if (!sizeof($error)) {
                                $sql_ary = array('group_id' => $add_extension_group, 'extension' => $add_extension);
                                $db->sql_query('INSERT INTO ' . EXTENSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                                add_log('admin', 'LOG_ATTACH_EXT_ADD', $add_extension);
                            }
                        }
                    }
                    if (!sizeof($error)) {
                        $notify[] = $user->lang['EXTENSIONS_UPDATED'];
                    }
                    $cache->destroy('_extensions');
                }
                $template->assign_vars(array('S_EXTENSIONS' => true, 'ADD_EXTENSION' => isset($add_extension) ? $add_extension : '', 'GROUP_SELECT_OPTIONS' => isset($_POST['add_extension_check']) ? $this->group_select('add_group_select', $add_extension_group, 'extension_group') : $this->group_select('add_group_select', false, 'extension_group')));
                $sql = 'SELECT *
					FROM ' . EXTENSIONS_TABLE . '
					ORDER BY group_id, extension';
                $result = $db->sql_query($sql);
                if ($row = $db->sql_fetchrow($result)) {
                    $old_group_id = $row['group_id'];
                    do {
                        $s_spacer = false;
                        $current_group_id = $row['group_id'];
                        if ($old_group_id != $current_group_id) {
                            $s_spacer = true;
                            $old_group_id = $current_group_id;
                        }
                        $template->assign_block_vars('extensions', array('S_SPACER' => $s_spacer, 'EXTENSION_ID' => $row['extension_id'], 'EXTENSION' => $row['extension'], 'GROUP_OPTIONS' => $this->group_select('group_select[]', $row['group_id'])));
                    } while ($row = $db->sql_fetchrow($result));
                }
                $db->sql_freeresult($result);
                break;
            case 'ext_groups':
                $template->assign_var('S_EXTENSION_GROUPS', true);
                if ($submit) {
                    $action = request_var('action', '');
                    $group_id = request_var('g', 0);
                    if ($action != 'add' && $action != 'edit') {
                        trigger_error('NO_MODE', E_USER_ERROR);
                    }
                    if (!$group_id && $action == 'edit') {
                        trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING);
                    }
                    if ($group_id) {
                        $sql = 'SELECT *
							FROM ' . EXTENSION_GROUPS_TABLE . "\n\t\t\t\t\t\t\tWHERE group_id = {$group_id}";
                        $result = $db->sql_query($sql);
                        $ext_row = $db->sql_fetchrow($result);
                        $db->sql_freeresult($result);
                        if (!$ext_row) {
                            trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING);
                        }
                    } else {
                        $ext_row = array();
                    }
                    $group_name = utf8_normalize_nfc(request_var('group_name', '', true));
                    $new_group_name = $action == 'add' ? $group_name : ($ext_row['group_name'] != $group_name ? $group_name : '');
                    if (!$group_name) {
                        $error[] = $user->lang['NO_EXT_GROUP_NAME'];
                    }
                    // Check New Group Name
                    if ($new_group_name) {
                        $sql = 'SELECT group_id
							FROM ' . EXTENSION_GROUPS_TABLE . "\n\t\t\t\t\t\t\tWHERE LOWER(group_name) = '" . $db->sql_escape(utf8_strtolower($new_group_name)) . "'";
                        $result = $db->sql_query($sql);
                        if ($db->sql_fetchrow($result)) {
                            $error[] = sprintf($user->lang['EXTENSION_GROUP_EXIST'], $new_group_name);
                        }
                        $db->sql_freeresult($result);
                    }
                    if (!sizeof($error)) {
                        // Ok, build the update/insert array
                        $upload_icon = request_var('upload_icon', 'no_image');
                        $size_select = request_var('size_select', 'b');
                        $forum_select = request_var('forum_select', false);
                        $allowed_forums = request_var('allowed_forums', array(0));
                        $allow_in_pm = isset($_POST['allow_in_pm']) ? true : false;
                        $max_filesize = request_var('max_filesize', 0);
                        $max_filesize = $size_select == 'kb' ? round($max_filesize * 1024) : ($size_select == 'mb' ? round($max_filesize * 1048576) : $max_filesize);
                        $allow_group = isset($_POST['allow_group']) ? true : false;
                        if ($max_filesize == $config['max_filesize']) {
                            $max_filesize = 0;
                        }
                        if (!sizeof($allowed_forums)) {
                            $forum_select = false;
                        }
                        $group_ary = array('group_name' => $group_name, 'cat_id' => request_var('special_category', ATTACHMENT_CATEGORY_NONE), 'allow_group' => $allow_group ? 1 : 0, 'upload_icon' => $upload_icon == 'no_image' ? '' : $upload_icon, 'max_filesize' => $max_filesize, 'allowed_forums' => $forum_select ? serialize($allowed_forums) : '', 'allow_in_pm' => $allow_in_pm ? 1 : 0);
                        if ($action == 'add') {
                            $group_ary['download_mode'] = INLINE_LINK;
                        }
                        $sql = $action == 'add' ? 'INSERT INTO ' . EXTENSION_GROUPS_TABLE . ' ' : 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' SET ';
                        $sql .= $db->sql_build_array($action == 'add' ? 'INSERT' : 'UPDATE', $group_ary);
                        $sql .= $action == 'edit' ? " WHERE group_id = {$group_id}" : '';
                        $db->sql_query($sql);
                        if ($action == 'add') {
                            $group_id = $db->sql_nextid();
                        }
                        add_log('admin', 'LOG_ATTACH_EXTGROUP_' . strtoupper($action), $group_name);
                    }
                    $extension_list = request_var('extensions', array(0));
                    if ($action == 'edit' && sizeof($extension_list)) {
                        $sql = 'UPDATE ' . EXTENSIONS_TABLE . "\n\t\t\t\t\t\t\tSET group_id = 0\n\t\t\t\t\t\t\tWHERE group_id = {$group_id}";
                        $db->sql_query($sql);
                    }
                    if (sizeof($extension_list)) {
                        $sql = 'UPDATE ' . EXTENSIONS_TABLE . "\n\t\t\t\t\t\t\tSET group_id = {$group_id}\n\t\t\t\t\t\t\tWHERE " . $db->sql_in_set('extension_id', $extension_list);
                        $db->sql_query($sql);
                    }
                    $cache->destroy('_extensions');
                    if (!sizeof($error)) {
                        $notify[] = $user->lang['SUCCESS_EXTENSION_GROUP_' . strtoupper($action)];
                    }
                }
                $cat_lang = array(ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], ATTACHMENT_CATEGORY_WM => $user->lang['CAT_WM_FILES'], ATTACHMENT_CATEGORY_RM => $user->lang['CAT_RM_FILES'], ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'], ATTACHMENT_CATEGORY_QUICKTIME => $user->lang['CAT_QUICKTIME_FILES']);
                $group_id = request_var('g', 0);
                $action = isset($_POST['add']) ? 'add' : $action;
                switch ($action) {
                    case 'delete':
                        if (confirm_box(true)) {
                            $sql = 'SELECT group_name
								FROM ' . EXTENSION_GROUPS_TABLE . "\n\t\t\t\t\t\t\t\tWHERE group_id = {$group_id}";
                            $result = $db->sql_query($sql);
                            $group_name = (string) $db->sql_fetchfield('group_name');
                            $db->sql_freeresult($result);
                            $sql = 'DELETE
								FROM ' . EXTENSION_GROUPS_TABLE . "\n\t\t\t\t\t\t\t\tWHERE group_id = {$group_id}";
                            $db->sql_query($sql);
                            // Set corresponding Extensions to a pending Group
                            $sql = 'UPDATE ' . EXTENSIONS_TABLE . "\n\t\t\t\t\t\t\t\tSET group_id = 0\n\t\t\t\t\t\t\t\tWHERE group_id = {$group_id}";
                            $db->sql_query($sql);
                            add_log('admin', 'LOG_ATTACH_EXTGROUP_DEL', $group_name);
                            $cache->destroy('_extensions');
                            trigger_error($user->lang['EXTENSION_GROUP_DELETED'] . adm_back_link($this->u_action));
                        } else {
                            confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('i' => $id, 'mode' => $mode, 'group_id' => $group_id, 'action' => 'delete')));
                        }
                        break;
                    case 'edit':
                        if (!$group_id) {
                            trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING);
                        }
                        $sql = 'SELECT *
							FROM ' . EXTENSION_GROUPS_TABLE . "\n\t\t\t\t\t\t\tWHERE group_id = {$group_id}";
                        $result = $db->sql_query($sql);
                        $ext_group_row = $db->sql_fetchrow($result);
                        $db->sql_freeresult($result);
                        $forum_ids = !$ext_group_row['allowed_forums'] ? array() : unserialize(trim($ext_group_row['allowed_forums']));
                        // no break;
                    // no break;
                    case 'add':
                        if ($action == 'add') {
                            $ext_group_row = array('group_name' => utf8_normalize_nfc(request_var('group_name', '', true)), 'cat_id' => 0, 'allow_group' => 1, 'allow_in_pm' => 1, 'upload_icon' => '', 'max_filesize' => 0);
                            $forum_ids = array();
                        }
                        $extensions = array();
                        $sql = 'SELECT *
							FROM ' . EXTENSIONS_TABLE . "\n\t\t\t\t\t\t\tWHERE group_id = {$group_id}\n\t\t\t\t\t\t\t\tOR group_id = 0\n\t\t\t\t\t\t\tORDER BY extension";
                        $result = $db->sql_query($sql);
                        $extensions = $db->sql_fetchrowset($result);
                        $db->sql_freeresult($result);
                        if ($ext_group_row['max_filesize'] == 0) {
                            $ext_group_row['max_filesize'] = (int) $config['max_filesize'];
                        }
                        $size_format = $ext_group_row['max_filesize'] >= 1048576 ? 'mb' : ($ext_group_row['max_filesize'] >= 1024 ? 'kb' : 'b');
                        $ext_group_row['max_filesize'] = get_formatted_filesize($ext_group_row['max_filesize'], false);
                        $img_path = $config['upload_icons_path'];
                        $filename_list = '';
                        $no_image_select = false;
                        $imglist = filelist($phpbb_root_path . $img_path);
                        if (sizeof($imglist)) {
                            $imglist = array_values($imglist);
                            $imglist = $imglist[0];
                            foreach ($imglist as $key => $img) {
                                if (!$ext_group_row['upload_icon']) {
                                    $no_image_select = true;
                                    $selected = '';
                                } else {
                                    $selected = $ext_group_row['upload_icon'] == $img ? ' selected="selected"' : '';
                                }
                                if (strlen($img) > 255) {
                                    continue;
                                }
                                $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . htmlspecialchars($img) . '</option>';
                            }
                        }
                        $i = 0;
                        $assigned_extensions = '';
                        foreach ($extensions as $num => $row) {
                            if ($row['group_id'] == $group_id && $group_id) {
                                $assigned_extensions .= $i ? ', ' . $row['extension'] : $row['extension'];
                                $i++;
                            }
                        }
                        $s_extension_options = '';
                        foreach ($extensions as $row) {
                            $s_extension_options .= '<option' . (!$row['group_id'] ? ' class="disabled"' : '') . ' value="' . $row['extension_id'] . '"' . ($row['group_id'] == $group_id && $group_id ? ' selected="selected"' : '') . '>' . $row['extension'] . '</option>';
                        }
                        $template->assign_vars(array('PHPBB_ROOT_PATH' => $phpbb_root_path, 'IMG_PATH' => $img_path, 'ACTION' => $action, 'GROUP_ID' => $group_id, 'GROUP_NAME' => $ext_group_row['group_name'], 'ALLOW_GROUP' => $ext_group_row['allow_group'], 'ALLOW_IN_PM' => $ext_group_row['allow_in_pm'], 'UPLOAD_ICON_SRC' => $phpbb_root_path . $img_path . '/' . $ext_group_row['upload_icon'], 'EXTGROUP_FILESIZE' => $ext_group_row['max_filesize'], 'ASSIGNED_EXTENSIONS' => $assigned_extensions, 'S_CATEGORY_SELECT' => $this->category_select('special_category', $group_id, 'category'), 'S_EXT_GROUP_SIZE_OPTIONS' => size_select_options($size_format), 'S_EXTENSION_OPTIONS' => $s_extension_options, 'S_FILENAME_LIST' => $filename_list, 'S_EDIT_GROUP' => true, 'S_NO_IMAGE' => $no_image_select, 'S_FORUM_IDS' => sizeof($forum_ids) ? true : false, 'U_EXTENSIONS' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i={$id}&amp;mode=extensions"), 'U_BACK' => $this->u_action, 'L_LEGEND' => $user->lang[strtoupper($action) . '_EXTENSION_GROUP']));
                        $s_forum_id_options = '';
                        /** @todo use in-built function **/
                        $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id
							FROM ' . FORUMS_TABLE . '
							ORDER BY left_id ASC';
                        $result = $db->sql_query($sql, 600);
                        $right = $cat_right = $padding_inc = 0;
                        $padding = $forum_list = $holding = '';
                        $padding_store = array('0' => '');
                        while ($row = $db->sql_fetchrow($result)) {
                            if ($row['forum_type'] == FORUM_CAT && $row['left_id'] + 1 == $row['right_id']) {
                                // Non-postable forum with no subforums, don't display
                                continue;
                            }
                            if (!$auth->acl_get('f_list', $row['forum_id'])) {
                                // if the user does not have permissions to list this forum skip
                                continue;
                            }
                            if ($row['left_id'] < $right) {
                                $padding .= '&nbsp; &nbsp;';
                                $padding_store[$row['parent_id']] = $padding;
                            } else {
                                if ($row['left_id'] > $right + 1) {
                                    $padding = empty($padding_store[$row['parent_id']]) ? '' : $padding_store[$row['parent_id']];
                                }
                            }
                            $right = $row['right_id'];
                            $selected = in_array($row['forum_id'], $forum_ids) ? ' selected="selected"' : '';
                            if ($row['left_id'] > $cat_right) {
                                // make sure we don't forget anything
                                $s_forum_id_options .= $holding;
                                $holding = '';
                            }
                            if ($row['right_id'] - $row['left_id'] > 1) {
                                $cat_right = max($cat_right, $row['right_id']);
                                $holding .= '<option value="' . $row['forum_id'] . '"' . ($row['forum_type'] == FORUM_POST ? ' class="sep"' : '') . $selected . '>' . $padding . $row['forum_name'] . '</option>';
                            } else {
                                $s_forum_id_options .= $holding . '<option value="' . $row['forum_id'] . '"' . ($row['forum_type'] == FORUM_POST ? ' class="sep"' : '') . $selected . '>' . $padding . $row['forum_name'] . '</option>';
                                $holding = '';
                            }
                        }
                        if ($holding) {
                            $s_forum_id_options .= $holding;
                        }
                        $db->sql_freeresult($result);
                        unset($padding_store);
                        $template->assign_vars(array('S_FORUM_ID_OPTIONS' => $s_forum_id_options));
                        break;
                }
                $sql = 'SELECT *
					FROM ' . EXTENSION_GROUPS_TABLE . '
					ORDER BY allow_group DESC, allow_in_pm DESC, group_name';
                $result = $db->sql_query($sql);
                $old_allow_group = $old_allow_pm = 1;
                while ($row = $db->sql_fetchrow($result)) {
                    $s_add_spacer = $old_allow_group != $row['allow_group'] || $old_allow_pm != $row['allow_in_pm'] ? true : false;
                    $template->assign_block_vars('groups', array('S_ADD_SPACER' => $s_add_spacer, 'S_ALLOWED_IN_PM' => $row['allow_in_pm'] ? true : false, 'S_GROUP_ALLOWED' => $row['allow_group'] ? true : false, 'U_EDIT' => $this->u_action . "&amp;action=edit&amp;g={$row['group_id']}", 'U_DELETE' => $this->u_action . "&amp;action=delete&amp;g={$row['group_id']}", 'GROUP_NAME' => $row['group_name'], 'CATEGORY' => $cat_lang[$row['cat_id']]));
                    $old_allow_group = $row['allow_group'];
                    $old_allow_pm = $row['allow_in_pm'];
                }
                $db->sql_freeresult($result);
                break;
            case 'orphan':
                if ($submit) {
                    $delete_files = isset($_POST['delete']) ? array_keys(request_var('delete', array('' => 0))) : array();
                    $add_files = isset($_POST['add']) ? array_keys(request_var('add', array('' => 0))) : array();
                    $post_ids = request_var('post_id', array('' => 0));
                    if (sizeof($delete_files)) {
                        $sql = 'SELECT *
							FROM ' . ATTACHMENTS_TABLE . '
							WHERE ' . $db->sql_in_set('attach_id', $delete_files) . '
								AND is_orphan = 1';
                        $result = $db->sql_query($sql);
                        $delete_files = array();
                        while ($row = $db->sql_fetchrow($result)) {
                            phpbb_unlink($row['physical_filename'], 'file');
                            if ($row['thumbnail']) {
                                phpbb_unlink($row['physical_filename'], 'thumbnail');
                            }
                            $delete_files[$row['attach_id']] = $row['real_filename'];
                        }
                        $db->sql_freeresult($result);
                    }
                    if (sizeof($delete_files)) {
                        $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . '
							WHERE ' . $db->sql_in_set('attach_id', array_keys($delete_files));
                        $db->sql_query($sql);
                        add_log('admin', 'LOG_ATTACH_ORPHAN_DEL', implode(', ', $delete_files));
                        $notify[] = sprintf($user->lang['LOG_ATTACH_ORPHAN_DEL'], implode(', ', $delete_files));
                    }
                    $upload_list = array();
                    foreach ($add_files as $attach_id) {
                        if (!isset($delete_files[$attach_id]) && !empty($post_ids[$attach_id])) {
                            $upload_list[$attach_id] = $post_ids[$attach_id];
                        }
                    }
                    unset($add_files);
                    if (sizeof($upload_list)) {
                        $template->assign_var('S_UPLOADING_FILES', true);
                        $sql = 'SELECT forum_id, forum_name
							FROM ' . FORUMS_TABLE;
                        $result = $db->sql_query($sql);
                        $forum_names = array();
                        while ($row = $db->sql_fetchrow($result)) {
                            $forum_names[$row['forum_id']] = $row['forum_name'];
                        }
                        $db->sql_freeresult($result);
                        $sql = 'SELECT forum_id, topic_id, post_id, poster_id
							FROM ' . POSTS_TABLE . '
							WHERE ' . $db->sql_in_set('post_id', $upload_list);
                        $result = $db->sql_query($sql);
                        $post_info = array();
                        while ($row = $db->sql_fetchrow($result)) {
                            $post_info[$row['post_id']] = $row;
                        }
                        $db->sql_freeresult($result);
                        // Select those attachments we want to change...
                        $sql = 'SELECT *
							FROM ' . ATTACHMENTS_TABLE . '
							WHERE ' . $db->sql_in_set('attach_id', array_keys($upload_list)) . '
								AND is_orphan = 1';
                        $result = $db->sql_query($sql);
                        $files_added = $space_taken = 0;
                        while ($row = $db->sql_fetchrow($result)) {
                            $post_row = $post_info[$upload_list[$row['attach_id']]];
                            $template->assign_block_vars('upload', array('FILE_INFO' => sprintf($user->lang['UPLOADING_FILE_TO'], $row['real_filename'], $post_row['post_id']), 'S_DENIED' => !$auth->acl_get('f_attach', $post_row['forum_id']) ? true : false, 'L_DENIED' => !$auth->acl_get('f_attach', $post_row['forum_id']) ? sprintf($user->lang['UPLOAD_DENIED_FORUM'], $forum_names[$row['forum_id']]) : ''));
                            if (!$auth->acl_get('f_attach', $post_row['forum_id'])) {
                                continue;
                            }
                            // Adjust attachment entry
                            $sql_ary = array('in_message' => 0, 'is_orphan' => 0, 'poster_id' => $post_row['poster_id'], 'post_msg_id' => $post_row['post_id'], 'topic_id' => $post_row['topic_id']);
                            $sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
								SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
								WHERE attach_id = ' . $row['attach_id'];
                            $db->sql_query($sql);
                            $sql = 'UPDATE ' . POSTS_TABLE . '
								SET post_attachment = 1
								WHERE post_id = ' . $post_row['post_id'];
                            $db->sql_query($sql);
                            $sql = 'UPDATE ' . TOPICS_TABLE . '
								SET topic_attachment = 1
								WHERE topic_id = ' . $post_row['topic_id'];
                            $db->sql_query($sql);
                            $space_taken += $row['filesize'];
                            $files_added++;
                            add_log('admin', 'LOG_ATTACH_FILEUPLOAD', $post_row['post_id'], $row['real_filename']);
                        }
                        $db->sql_freeresult($result);
                        if ($files_added) {
                            set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true);
                            set_config('num_files', $config['num_files'] + $files_added, true);
                        }
                    }
                }
                $template->assign_vars(array('S_ORPHAN' => true));
                // Just get the files with is_orphan set and older than 3 hours
                $sql = 'SELECT *
					FROM ' . ATTACHMENTS_TABLE . '
					WHERE is_orphan = 1
						AND filetime < ' . (time() - 3 * 60 * 60) . '
					ORDER BY filetime DESC';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $template->assign_block_vars('orphan', array('FILESIZE' => get_formatted_filesize($row['filesize']), 'FILETIME' => $user->format_date($row['filetime']), 'REAL_FILENAME' => basename($row['real_filename']), 'PHYSICAL_FILENAME' => basename($row['physical_filename']), 'ATTACH_ID' => $row['attach_id'], 'POST_IDS' => !empty($post_ids[$row['attach_id']]) ? $post_ids[$row['attach_id']] : '', 'U_FILE' => append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'mode=view&amp;id=' . $row['attach_id'])));
                }
                $db->sql_freeresult($result);
                break;
        }
        if (sizeof($error)) {
            $template->assign_vars(array('S_WARNING' => true, 'WARNING_MSG' => implode('<br />', $error)));
        }
        if (sizeof($notify)) {
            $template->assign_vars(array('S_NOTIFY' => true, 'NOTIFY_MSG' => implode('<br />', $notify)));
        }
    }
コード例 #5
0
ファイル: acp_thanks_reput.php プロジェクト: jsib/intranet
 function main($id, $mode)
 {
     global $db, $user, $auth, $template;
     global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
     $action = request_var('action', '');
     $submit = isset($_POST['submit']) ? true : false;
     $form_key = 'acp_thanks_reput';
     add_form_key($form_key);
     /**
      *	Validation types are:
      *		string, int, bool,
      *		script_path (absolute path in url - beginning with / and no trailing slash),
      *		rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
      */
     $display_vars = array('title' => 'ACP_THANKS_REPUT_SETTINGS', 'vars' => array('legend' => 'GENERAL_OPTIONS', 'thanks_post_reput_view' => array('lang' => 'THANKS_POST_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'thanks_topic_reput_view' => array('lang' => 'THANKS_TOPIC_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'thanks_topic_reput_view_column' => array('lang' => 'THANKS_TOPIC_REPUT_VIEW_COLUMN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'thanks_forum_reput_view' => array('lang' => 'THANKS_FORUM_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'thanks_forum_reput_view_column' => array('lang' => 'THANKS_FORUM_REPUT_VIEW_COLUMN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'thanks_number_digits' => array('lang' => 'THANKS_NUMBER_DIGITS', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => false), 'thanks_number_row_reput' => array('lang' => 'THANKS_NUMBER_ROW_REPUT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true), 'legend1' => 'GRAPHIC_OPTIONS', 'thanks_reput_graphic' => array('lang' => 'THANKS_REPUT_GRAPHIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'thanks_reput_height' => array('lang' => 'THANKS_REPUT_HEIGHT', 'validate' => 'int:1:25', 'type' => 'text:4:6', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'thanks_reput_level' => array('lang' => 'THANKS_REPUT_LEVEL', 'validate' => 'int:4:13', 'type' => 'text:4:4', 'explain' => false), 'thanks_reput_image' => array('lang' => 'THANKS_REPUT_IMAGE', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true, 'append' => '<br /><img src="' . ($config['thanks_reput_image'] ? $phpbb_root_path . $config['thanks_reput_image'] : '') . '" alt="' . $user->lang['THANKS_REPUT_IMAGE'] . '"/>'), 'thanks_reput_image_back' => array('lang' => 'THANKS_REPUT_IMAGE_BACK', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true, 'append' => '<br /><img src="' . ($config['thanks_reput_image_back'] ? $phpbb_root_path . $config['thanks_reput_image_back'] : '') . '" alt="' . $user->lang['THANKS_REPUT_IMAGE_BACK'] . '"/>'), 'legend2' => 'GRAPHIC_DEFAULT'));
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if whished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     if (!empty($cfg_array['thanks_reput_image']) && !file_exists($phpbb_root_path . $config['thanks_reput_image'])) {
         $error[] = $user->lang['THANKS_REPUT_IMAGE_NOEXIST'];
     }
     if (!empty($cfg_array['thanks_reput_image_back']) && !file_exists($phpbb_root_path . $config['thanks_reput_image_back'])) {
         $error[] = $user->lang['THANKS_REPUT_IMAGE_BACK_NOEXIST'];
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             set_config($config_name, $config_value);
         }
     }
     if ($submit) {
         add_log('admin', 'LOG_CONFIG_' . strtoupper($mode));
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     $this->tpl_name = 'acp_thanks_reput';
     $this->page_title = $display_vars['title'];
     $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'GRAPHIC_STAR_BLUE_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_STAR_BLUE'], 'GRAPHIC_STAR_GOLD_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_STAR_GOLD'], 'GRAPHIC_STAR_BACK_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_STAR_BACK'], 'GRAPHIC_BLOCK_RED_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_BLOCK_RED'], 'GRAPHIC_BLOCK_BACK_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_BLOCK_BACK'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #6
0
 /**
  * Assign "complex option to template.
  *
  * @param string $name		Option name.
  * @param array $data		Option data.
  *
  * @return null
  */
 protected function assign_complex_option($name, $data)
 {
     $l_explain = '';
     if ($data['explain']) {
         $l_explain = isset($data['lang_explain']) ? $data['lang_explain'] : $data['lang'] . '_EXPLAIN';
         $l_explain = $this->user->lang($l_explain);
     }
     $properties = explode(':', $data['type']);
     $content = build_cfg_template($properties, $name, $data);
     if (!empty($content)) {
         $this->template->assign_block_vars('options', array('KEY' => $name, 'TITLE' => $this->user->lang($vars['lang']), 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content['tpl']));
     }
 }
コード例 #7
0
 /**
  * @param $field
  * @param array $db_settings
  * @param array $vars
  * @return string
  */
 private function _get_field_template($field, array &$db_settings, array &$vars)
 {
     $vars['lang_explain'] = $this->_explain_field($vars);
     $vars['append'] = $this->_append_field($vars);
     $type = explode(':', $vars['type']);
     $method = '_prep_' . $type[0] . '_field_for_display';
     if (is_callable(array($this, $method))) {
         $this->_set_params($field, $vars, $db_settings);
         $this->{$method}($vars, $type, $field, $db_settings);
     }
     return build_cfg_template($type, $field, $db_settings, $field, $vars);
 }
コード例 #8
0
 function main($id, $mode)
 {
     global $config, $request, $template, $user;
     $this->page_title = 'ACP_POSTS_MERGING';
     $this->tpl_name = 'acp_posts_merging';
     $submit = isset($_POST['submit']) ? true : false;
     $form_key = 'config_posts_merging';
     add_form_key($form_key);
     $display_vars = array('title' => 'ACP_POSTS_MERGING', 'vars' => array('legend1' => 'ACP_POSTS_MERGING', 'merge_interval' => array('lang' => 'MERGE_INTERVAL', 'validate' => 'int', 'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['HOURS']), 'merge_no_forums' => array('lang' => 'MERGE_NO_FORUMS', 'validate' => 'string', 'type' => 'text:5:255', 'explain' => true), 'merge_no_topics' => array('lang' => 'MERGE_NO_TOPICS', 'validate' => 'string', 'type' => 'text:5:255', 'explain' => true), 'legend2' => 'ACP_SUBMIT_CHANGES'));
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if wished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             $config->set($config_name, $config_value);
         }
     }
     if ($submit) {
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #9
0
 /**
  * Display the options a user can configure for this extension
  *
  * @return null
  * @access public
  */
 public function display_settings()
 {
     // Create a form key for preventing CSRF attacks
     add_form_key('acp_video');
     // Is the form being submitted to us?
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key('acp_video')) {
             trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
         }
         // Set the options the user configured
         $this->set_options();
         // Add option settings change action to the admin log
         $this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'ACP_VIDEO_SETTINGS');
     }
     // Set the options the user configured
     $display_vars = array('vars' => array('legend1' => 'ACP_VIDEO_GENERAL_SETTINGS', 'video_width' => array('lang' => 'ACP_VIDEO_WIDTH', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true, 'append' => ' ' . $this->user->lang['PIXEL']), 'video_height' => array('lang' => 'ACP_VIDEO_HEIGHT', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true, 'append' => ' ' . $this->user->lang['PIXEL']), 'google_api_key' => array('lang' => 'ACP_GOOGLE_KEY', 'validate' => 'string', 'type' => 'text:40:40', 'explain' => true), 'enable_video_statics_on_index' => array('lang' => 'ACP_ENABLE_VIDEO_STATICS_ON_INDEX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_comments' => array('lang' => 'ACP_ENABLE_COMMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'comments_per_page' => array('lang' => 'ACP_COMMENTS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => true), 'legend5' => 'ACP_SUBMIT_CHANGES'));
     $this->new_config = $this->config;
     $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc($this->request->variable('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     if (sizeof($error)) {
         $submit = false;
     }
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     $submit = isset($_POST['submit']) ? true : false;
     $form_name = 'acp_video';
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             if (!$this->config->set($config_name, $config_value)) {
                 $error = true;
             }
         }
     }
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $this->template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($this->user->lang[$vars]) ? $this->user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($this->user->lang[$vars['lang_explain']]) ? $this->user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($this->user->lang[$vars['lang'] . '_EXPLAIN']) ? $this->user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $this->template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($this->user->lang[$vars['lang']]) ? $this->user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #10
0
 function main($id, $mode)
 {
     global $cache, $config, $request, $template, $user;
     global $phpbb_log, $phpbb_root_path, $table_prefix, $phpbb_container;
     $db_tools = $phpbb_container->get('dbal.tools');
     $this->fields_table = $phpbb_container->getParameter('tables.profile_fields');
     $this->pbwow_config_table = $phpbb_container->getParameter('tables.pbwow3_config');
     $this->pbwow_chars_table = $phpbb_container->getParameter('tables.pbwow3_chars');
     $user->add_lang('acp/board');
     $this->tpl_name = 'acp_pbwow3';
     $allow_curl = function_exists('curl_init');
     $legacy_dbtable1 = defined('PBWOW_CONFIG_TABLE') ? PBWOW_CONFIG_TABLE : '';
     $legacy_dbtable2 = defined('PBWOW2_CONFIG_TABLE') ? PBWOW2_CONFIG_TABLE : '';
     $constantsokay = $dbokay = $legacy_constants = $legacy_db_active = $chars_constokay = $chars_dbokay = $new_config = $ext_version = false;
     // Check if constants have been set correctly
     // if yes, check if the config table exists
     // if yes, load the config variables
     if ($this->pbwow_config_table == $table_prefix . 'pbwow3_config') {
         $constantsokay = true;
         if ($db_tools->sql_table_exists($this->pbwow_config_table)) {
             $dbokay = true;
             $this->get_pbwow_config();
             $new_config = $this->pbwow_config;
         }
     }
     if ($this->pbwow_chars_table == $table_prefix . 'pbwow3_chars') {
         $chars_constokay = true;
         if ($db_tools->sql_table_exists($this->pbwow_chars_table)) {
             $chars_dbokay = true;
         }
     }
     // Detect if a game has been enabled/disabled in the overview. This must be done before we retrieve the $cplist
     $cpf_game_toggle = $request->variable('game', '');
     if (!empty($cpf_game_toggle)) {
         $activate = $request->variable('enable', '');
         $this->toggle_game_cpf($cpf_game_toggle, $activate);
     }
     // Detect Battle.net characters table flush
     $charsdb_flush = $request->variable('charsdb_flush', '');
     if ($charsdb_flush && $chars_dbokay) {
         $this->charsdb_flush();
     }
     if ($mode == 'overview') {
         // Get the PBWoW extension version from the composer.json file
         $ext_manager = $phpbb_container->get('ext.manager');
         $ext_meta_manager = $ext_manager->create_extension_metadata_manager('paybas/pbwow', $template);
         $ext_meta_data = $ext_meta_manager->get_metadata('version');
         $ext_version = isset($ext_meta_data['version']) ? $ext_meta_data['version'] : '';
         $cpflist = $this->get_profile_fields_list();
         $style_root = $phpbb_root_path . 'styles/pbwow3/';
         // Get the PBWoW style version from the style.cfg file
         if (file_exists($style_root . 'style.cfg')) {
             $values = parse_cfg_file($style_root . 'style.cfg');
             $style_version = isset($values['style_version']) ? $values['style_version'] : '';
         }
         $versions = $this->obtain_remote_version($request->variable('versioncheck_force', false), true);
         // Check if old constants are still being used
         if (!empty($legacy_dbtable1) || !empty($legacy_dbtable2)) {
             $legacy_constants = true;
         }
         // Check if old table still exists
         if ($db_tools->sql_table_exists($legacy_dbtable1) || $db_tools->sql_table_exists($table_prefix . 'pbwow_config') || $db_tools->sql_table_exists($legacy_dbtable2) || $db_tools->sql_table_exists($table_prefix . 'pbwow2_config')) {
             $legacy_db_active = true;
         }
     }
     /**
      *    Config vars
      */
     switch ($mode) {
         case 'overview':
             $display_vars = array('title' => 'PBWOW_OVERVIEW_TITLE', 'vars' => array());
             break;
         case 'config':
             $display_vars = array('title' => 'PBWOW_CONFIG_TITLE', 'vars' => array('legend1' => 'PBWOW_LOGO', 'logo_size_width' => array('lang' => 'PBWOW_LOGO_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'logo_size_height' => array('lang' => 'PBWOW_LOGO_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'logo_enable' => array('lang' => 'PBWOW_LOGO_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'logo_src' => array('lang' => 'PBWOW_LOGO_SRC', 'validate' => 'string', 'type' => 'text:20:255', 'explain' => true), 'logo_size' => array('lang' => 'PBWOW_LOGO_SIZE', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'logo_margins' => array('lang' => 'PBWOW_LOGO_MARGINS', 'validate' => 'string', 'type' => 'text:20:20', 'explain' => true), 'legend2' => 'PBWOW_TOPBAR', 'topbar_enable' => array('lang' => 'PBWOW_TOPBAR_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'topbar_code' => array('lang' => 'PBWOW_TOPBAR_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'topbar_fixed' => array('lang' => 'PBWOW_TOPBAR_FIXED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'PBWOW_HEADERLINKS', 'headerlinks_enable' => array('lang' => 'PBWOW_HEADERLINKS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'headerlinks_code' => array('lang' => 'PBWOW_HEADERLINKS_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend4' => 'PBWOW_VIDEOBG', 'videobg_enable' => array('lang' => 'PBWOW_VIDEOBG_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'videobg_allpages' => array('lang' => 'PBWOW_VIDEOBG_ALLPAGES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'fixedbg' => array('lang' => 'PBWOW_FIXEDBG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend5' => 'PBWOW_AVATARS', 'avatars_enable' => array('lang' => 'PBWOW_AVATARS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'avatars_path' => array('lang' => 'PBWOW_AVATARS_PATH', 'validate' => 'string', 'type' => 'text:20:255', 'explain' => true), 'smallranks_enable' => array('lang' => 'PBWOW_SMALLRANKS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'legend6' => 'PBWOW_BNETCHARS', 'bnetchars_enable' => array('lang' => 'PBWOW_BNETCHARS_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'bnet_apikey' => array('lang' => 'PBWOW_BNET_APIKEY', 'validate' => 'string', 'type' => 'text:32:64', 'explain' => true), 'bnetchars_cachetime' => array('lang' => 'PBWOW_BNETCHARS_CACHETIME', 'validate' => 'int:0', 'type' => 'text:6:6', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'bnetchars_timeout' => array('lang' => 'PBWOW_BNETCHARS_TIMEOUT', 'validate' => 'int:0', 'type' => 'text:1:1', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'legend7' => 'PBWOW_ADS_INDEX', 'ads_index_enable' => array('lang' => 'PBWOW_ADS_INDEX_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'ads_index_code' => array('lang' => 'PBWOW_ADS_INDEX_CODE', 'type' => 'textarea:6:6', 'explain' => true)));
             break;
         default:
             $display_vars = array('title' => 'ACP_PBWOW3_CATEGORY', 'vars' => array());
             break;
     }
     $submit = $request->is_set_post('submit');
     $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $new_config;
     $error = array();
     // We validate the complete config if we want
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... and then write to config
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             $this->set_pbwow_config($config_name, $config_value);
             // Enable/disable Battle.net profile fields when the API is enabled/disabled
             if ($config_name == 'bnetchars_enable') {
                 $this->toggle_game_cpf('bnet', $config_value);
             }
         }
     }
     if ($submit) {
         if ($mode != 'overview') {
             $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PBWOW_CONFIG');
             $cache->purge();
             trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
         }
     }
     $this->page_title = $display_vars['title'];
     $title_explain = $user->lang[$display_vars['title'] . '_EXPLAIN'];
     $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $title_explain, 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'S_CONSTANTSOKAY' => $constantsokay ? true : false, 'PBWOW_DBTABLE' => $this->pbwow_config_table, 'S_DBOKAY' => $dbokay ? true : false, 'S_CURL_DANGER' => isset($this->pbwow_config['bnetchars_enable']) && $this->pbwow_config['bnetchars_enable'] && !$allow_curl, 'L_PBWOW_DB_GOOD' => sprintf($user->lang['PBWOW_DB_GOOD'], $this->pbwow_config_table), 'L_PBWOW_DB_BAD' => sprintf($user->lang['PBWOW_DB_BAD'], $this->pbwow_config_table), 'L_PBWOW_CHARSDB_GOOD' => sprintf($user->lang['PBWOW_CHARSDB_GOOD'], $this->pbwow_chars_table), 'L_PBWOW_CHARSDB_BAD' => sprintf($user->lang['PBWOW_CHARSDB_BAD'], $this->pbwow_chars_table), 'U_ACTION' => $this->u_action));
     if ($mode == 'overview') {
         $pb_bnet_host = isset($cpflist['pb_bnet_host']) && $cpflist['pb_bnet_host']['field_active'] && !$cpflist['pb_bnet_host']['field_no_view'] ? true : false;
         $pb_bnet_realm = isset($cpflist['pb_bnet_realm']) && $cpflist['pb_bnet_realm']['field_active'] && !$cpflist['pb_bnet_realm']['field_no_view'] ? true : false;
         $pb_bnet_name = isset($cpflist['pb_bnet_name']) && $cpflist['pb_bnet_name']['field_active'] && !$cpflist['pb_bnet_name']['field_no_view'] ? true : false;
         $pb_bnet_url = isset($cpflist['pb_bnet_url']) && $cpflist['pb_bnet_url']['field_active'] && !$cpflist['pb_bnet_url']['field_no_view'] ? true : false;
         $pb_bnet_avatar = isset($cpflist['pb_bnet_avatar']) && $cpflist['pb_bnet_avatar']['field_active'] && !$cpflist['pb_bnet_avatar']['field_no_view'] ? true : false;
         $pb_wow_race = isset($cpflist['pb_wow_race']) && $cpflist['pb_wow_race']['field_active'] && !$cpflist['pb_wow_race']['field_no_view'] ? true : false;
         $pb_wow_gender = isset($cpflist['pb_wow_gender']) && $cpflist['pb_wow_gender']['field_active'] && !$cpflist['pb_wow_gender']['field_no_view'] ? true : false;
         $pb_wow_class = isset($cpflist['pb_wow_class']) && $cpflist['pb_wow_class']['field_active'] && !$cpflist['pb_wow_class']['field_no_view'] ? true : false;
         $pb_wow_level = isset($cpflist['pb_wow_level']) && $cpflist['pb_wow_level']['field_active'] && !$cpflist['pb_wow_level']['field_no_view'] ? true : false;
         $pb_wow_guild = isset($cpflist['pb_wow_guild']) && $cpflist['pb_wow_guild']['field_active'] && !$cpflist['pb_wow_guild']['field_no_view'] ? true : false;
         $pb_diablo_class = isset($cpflist['pb_diablo_class']) && $cpflist['pb_diablo_class']['field_active'] && !$cpflist['pb_diablo_class']['field_no_view'] ? true : false;
         $pb_diablo_gender = isset($cpflist['pb_diablo_gender']) && $cpflist['pb_diablo_gender']['field_active'] && !$cpflist['pb_diablo_gender']['field_no_view'] ? true : false;
         $pb_diablo_follower = isset($cpflist['pb_diablo_follower']) && $cpflist['pb_diablo_follower']['field_active'] && !$cpflist['pb_diablo_follower']['field_no_view'] ? true : false;
         $pb_wildstar_race = isset($cpflist['pb_wildstar_race']) && $cpflist['pb_wildstar_race']['field_active'] && !$cpflist['pb_wildstar_race']['field_no_view'] ? true : false;
         $pb_wildstar_gender = isset($cpflist['pb_wildstar_gender']) && $cpflist['pb_wildstar_gender']['field_active'] && !$cpflist['pb_wildstar_gender']['field_no_view'] ? true : false;
         $pb_wildstar_class = isset($cpflist['pb_wildstar_class']) && $cpflist['pb_wildstar_class']['field_active'] && !$cpflist['pb_wildstar_class']['field_no_view'] ? true : false;
         $pb_wildstar_path = isset($cpflist['pb_wildstar_path']) && $cpflist['pb_wildstar_path']['field_active'] && !$cpflist['pb_wildstar_path']['field_no_view'] ? true : false;
         $pb_wow_enabled = $pb_wow_race && $pb_wow_gender && $pb_wow_class && $pb_wow_level && $pb_wow_guild;
         $pb_diablo_enabled = $pb_diablo_class && $pb_diablo_gender && $pb_diablo_follower;
         $pb_wildstar_enabled = $pb_wildstar_race && $pb_wildstar_gender && $pb_wildstar_class && $pb_wildstar_path;
         $pb_wow_activate_url = $this->u_action . '&game=wow&enable=' . ($pb_wow_enabled ? '0' : '1');
         $pb_diablo_activate_url = $this->u_action . '&game=diablo&enable=' . ($pb_diablo_enabled ? '0' : '1');
         $pb_wildstar_activate_url = $this->u_action . '&game=wildstar&enable=' . ($pb_wildstar_enabled ? '0' : '1');
         $pb_charsdb_flush_url = $this->u_action . '&charsdb_flush=1';
         $template->assign_vars(array('S_INDEX' => true, 'S_CHECK_V' => empty($versions) ? false : true, 'EXT_VERSION' => $ext_version, 'EXT_VERSION_V' => isset($versions['ext_version']['version']) ? $versions['ext_version']['version'] : '', 'STYLE_VERSION' => isset($style_version) ? $style_version : '', 'STYLE_VERSION_V' => isset($versions['style_version']['version']) ? $versions['style_version']['version'] : '', 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&amp;versioncheck_force=1'), 'S_ALLOW_CURL' => $allow_curl, 'S_CPF_ON_MEMBERLIST' => $config['load_cpf_memberlist'] == 1 ? true : false, 'S_CPF_ON_VIEWPROFILE' => $config['load_cpf_viewprofile'] == 1 ? true : false, 'S_CPF_ON_VIEWTOPIC' => $config['load_cpf_viewtopic'] == 1 ? true : false, 'S_PB_WOW' => $pb_wow_enabled, 'S_PB_DIABLO' => $pb_diablo_enabled, 'S_PB_WILDSTAR' => $pb_wildstar_enabled, 'U_PB_WOW' => $pb_wow_activate_url, 'U_PB_DIABLO' => $pb_diablo_activate_url, 'U_PB_WILDSTAR' => $pb_wildstar_activate_url, 'S_BNETCHARS_ACTIVE' => isset($this->pbwow_config['bnetchars_enable']) && $this->pbwow_config['bnetchars_enable'] ? true : false, 'S_BNETCHARS_CONSTOKAY' => $chars_constokay ? true : false, 'S_BNETCHARS_DBOKAY' => $chars_dbokay ? true : false, 'BNET_APIKEY' => isset($this->pbwow_config['bnet_apikey']) ? $this->pbwow_config['bnet_apikey'] : false, 'U_CHARSDB_FLUSH' => $pb_charsdb_flush_url, 'S_PB_BNET_HOST' => $pb_bnet_host, 'S_PB_BNET_REALM' => $pb_bnet_realm, 'S_PB_BNET_NAME' => $pb_bnet_name, 'S_PB_BNET_URL' => $pb_bnet_url, 'S_PB_BNET_AVATAR' => $pb_bnet_avatar, 'S_PB_WOW_RACE' => $pb_wow_race, 'S_PB_WOW_GENDER' => $pb_wow_gender, 'S_PB_WOW_CLASS' => $pb_wow_class, 'S_PB_WOW_LEVEL' => $pb_wow_level, 'S_PB_WOW_GUILD' => $pb_wow_guild, 'S_PB_DIABLO_CLASS' => $pb_diablo_class, 'S_PB_DIABLO_GENDER' => $pb_diablo_gender, 'S_PB_DIABLO_FOLLOWER' => $pb_diablo_follower, 'S_PB_WILDSTAR_RACE' => $pb_wildstar_race, 'S_PB_WILDSTAR_GENDER' => $pb_wildstar_gender, 'S_PB_WILDSTAR_CLASS' => $pb_wildstar_class, 'S_PB_WILDSTAR_PATH' => $pb_wildstar_path, 'S_LEGACY_CONSTANTS' => $legacy_constants, 'S_LEGACY_DB_ACTIVE' => $legacy_db_active));
     }
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #11
0
 function settings($id, $mode)
 {
     global $config, $db, $user, $auth, $template;
     global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
     $submit = isset($_POST['submit']) ? true : false;
     $action = request_var('action', '');
     $this->tpl_name = 'acp_board';
     $this->page_title = $user->lang['ACP_BLOGS'];
     blog_plugins::plugin_do('acp_main_start');
     $settings = array('legend0' => 'VERSION', 'user_blog_version' => array('lang' => 'VERSION', 'type' => 'custom', 'method' => 'blog_version', 'explain' => false), 'legend1' => 'BLOG_SETTINGS', 'user_blog_enable' => array('lang' => 'ENABLE_USER_BLOG', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_enable_plugins' => array('lang' => 'ENABLE_USER_BLOG_PLUGINS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_subscription_enabled' => array('lang' => 'ENABLE_SUBSCRIPTIONS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_enable_zebra' => array('lang' => 'BLOG_ENABLE_ZEBRA', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_seo' => array('lang' => 'BLOG_ENABLE_SEO', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_search' => array('lang' => 'BLOG_ENABLE_SEARCH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_user_permissions' => array('lang' => 'BLOG_ENABLE_USER_PERMISSIONS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_enable_ratings' => array('lang' => 'BLOG_ENABLE_RATINGS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_enable_attachments' => array('lang' => 'BLOG_ENABLE_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'user_blog_enable_feeds' => array('lang' => 'BLOG_ENABLE_FEEDS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => false), 'legend2' => 'BLOG_POST_VIEW_SETTINGS', 'user_blog_guest_captcha' => array('lang' => 'BLOG_GUEST_CAPTCHA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'user_blog_custom_profile_enable' => array('lang' => 'ENABLE_BLOG_CUSTOM_PROFILES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'user_blog_links_output_block' => array('lang' => 'OUTPUT_CPLINKS_BLOCK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'user_blog_always_show_blog_url' => array('lang' => 'BLOG_ALWAYS_SHOW_URL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'user_blog_text_limit' => array('lang' => 'DEFAULT_TEXT_LIMIT', 'validate' => 'int', 'type' => 'text:5:5', 'explain' => true), 'user_blog_user_text_limit' => array('lang' => 'USER_TEXT_LIMIT', 'validate' => 'int', 'type' => 'text:5:5', 'explain' => true), 'user_blog_inform' => array('lang' => 'BLOG_INFORM', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => true), 'user_blog_message_from' => array('lang' => 'BLOG_MESSAGE_FROM', 'validate' => 'string', 'type' => 'text:5:5', 'explain' => true), 'user_blog_min_rating' => array('lang' => 'BLOG_MIN_RATING', 'validate' => 'int', 'type' => 'text:5:5', 'explain' => true), 'user_blog_max_rating' => array('lang' => 'BLOG_MAX_RATING', 'validate' => 'int', 'type' => 'text:5:5', 'explain' => true), 'user_blog_quick_reply' => array('lang' => 'BLOG_QUICK_REPLY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'BLOG_ATTACHMENT_SETTINGS', 'user_blog_max_attachments' => array('lang' => 'BLOG_MAX_ATTACHMENTS', 'validate' => 'int', 'type' => 'text:5:5', 'explain' => true));
     blog_plugins::plugin_do_ref('acp_main_settings', $settings);
     $this->new_config = $config;
     $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if whished
     validate_config_vars($settings, $cfg_array, $error);
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     $template->assign_vars(array('L_TITLE' => $user->lang['BLOG_SETTINGS'], 'L_TITLE_EXPLAIN' => $user->lang['BLOG_SETTINGS_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
     foreach ($settings as $config_key => $vars) {
         if ($submit) {
             if (!isset($cfg_array[$config_key]) || strpos($config_key, 'legend') !== false) {
                 continue;
             }
             $this->new_config[$config_key] = $config_value = $cfg_array[$config_key];
             set_config($config_key, $config_value);
         } else {
             if ((!is_array($vars) || !isset($this->new_config[$config_key])) && strpos($config_key, 'legend') === false) {
                 continue;
             }
             if (strpos($config_key, 'legend') !== false) {
                 $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
                 continue;
             }
             $type = explode(':', $vars['type']);
             $l_explain = '';
             if ($vars['explain'] && isset($vars['lang_explain'])) {
                 $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
             } else {
                 if ($vars['explain']) {
                     $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
                 }
             }
             $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars)));
         }
     }
     if ($submit) {
         add_log('admin', 'LOG_BLOG_CONFIG');
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
 }
コード例 #12
0
 function saveConfig($display_vars)
 {
     global $db, $user, $auth, $template, $config, $error;
     if (!is_array($error)) {
         $error = array();
     }
     $submit = request_var('submit', '');
     $form_key = 'acp_raidattendance';
     add_form_key($form_key);
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     $cfg_array = request_var('config', array('' => ''));
     $cfg_array = sizeof($cfg_array) > 1 ? utf8_normalize_nfc($cfg_array) : $this->new_config;
     // We validate the complete config if whished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     // Add the "names"...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         if ($config_name == 'auth_method') {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             set_config($config_name, $config_value);
         }
     }
     // Save non-"normal" configs
     if ($submit) {
         for ($ix = 0; $ix < 10; ++$ix) {
             $config_name = 'raidattendance_raider_rank' . $ix . '_name';
             $config_value = $cfg_array[$config_name];
             set_config($config_name, $config_value);
         }
         // save the raids
         $this->saveRaidSetup();
         add_log('admin', 'LOG_CONFIG_RAIDATTENDANCE_SETTINGS');
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     $this->page_title = $display_vars['title'];
     $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #13
0
ファイル: acp_portal.php プロジェクト: gonzo1247/hitman_roa
    public function main($id, $mode)
    {
        $submit = isset($_POST['submit']) ? true : false;
        $form_key = 'acp_portal';
        add_form_key($form_key);
        /**
         *	Validation types are:
         *		string, int, bool,
         *		script_path (absolute path in url - beginning with / and no trailing slash),
         *		rpath (relative), rwpath (realtive, writeable), path (relative path, but able to escape the root), wpath (writeable)
         */
        switch ($mode) {
            case 'config':
                $display_vars = array('title' => 'ACP_PORTAL_GENERAL_TITLE', 'vars' => array('legend1' => 'ACP_PORTAL_CONFIG_INFO', 'board3_enable' => array('lang' => 'PORTAL_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_left_column' => array('lang' => 'PORTAL_LEFT_COLUMN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_right_column' => array('lang' => 'PORTAL_RIGHT_COLUMN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_version_check' => array('lang' => 'PORTAL_VERSION_CHECK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'board3_phpbb_menu' => array('lang' => 'PORTAL_PHPBB_MENU', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_display_jumpbox' => array('lang' => 'PORTAL_DISPLAY_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'ACP_PORTAL_COLUMN_WIDTH_SETTINGS', 'board3_left_column_width' => array('lang' => 'PORTAL_LEFT_COLUMN_WIDTH', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_right_column_width' => array('lang' => 'PORTAL_RIGHT_COLUMN_WIDTH', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true)));
                $module_id = request_var('module_id', 0);
                if ($module_id) {
                    $sql = 'SELECT *
						FROM ' . PORTAL_MODULES_TABLE . '
						WHERE module_id = ' . (int) $module_id;
                    $result = $this->db->sql_query_limit($sql, 1);
                    $module_data = $this->db->sql_fetchrow($result);
                    $this->db->sql_freeresult($result);
                    if ($module_data !== false) {
                        $class = 'portal_' . $module_data['module_classname'] . '_module';
                        if (!class_exists($class)) {
                            include $this->phpbb_root_path . 'portal/modules/portal_' . $module_data['module_classname'] . '.' . $this->php_ex;
                        }
                        if (!class_exists($class)) {
                            trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
                        }
                        $this->c_class = new $class();
                        if ($this->c_class->language) {
                            $this->user->add_lang('mods/portal/' . $this->c_class->language);
                        }
                        $module_name = $this->user->lang[$this->c_class->name];
                        $display_vars = $this->c_class->get_template_acp($module_id);
                        $this->template->assign_vars(array('MODULE_NAME' => isset($this->c_class->hide_name) && $this->c_class->hide_name == true ? '' : $module_data['module_name'], 'MODULE_IMAGE' => $module_data['module_image_src'], 'MODULE_IMAGE_WIDTH' => $module_data['module_image_width'], 'MODULE_IMAGE_HEIGHT' => $module_data['module_image_height'], 'MODULE_IMAGE_SRC' => $module_data['module_image_src'] ? $this->phpbb_root_path . 'styles/' . $this->user->theme['theme_path'] . '/theme/images/portal/' . $module_data['module_image_src'] : '', 'MODULE_ENABLED' => $module_data['module_status'] ? true : false, 'MODULE_SHOW_IMAGE' => in_array(column_num_string($module_data['module_column']), array('center', 'top', 'bottom')) ? false : true));
                        if ($module_data['module_classname'] != 'custom') {
                            $groups_ary = explode(',', $module_data['module_group_ids']);
                            // get group info from database and assign the block vars
                            $sql = 'SELECT group_id, group_name 
									FROM ' . GROUPS_TABLE . '
									ORDER BY group_id ASC';
                            $result = $this->db->sql_query($sql);
                            while ($row = $this->db->sql_fetchrow($result)) {
                                $this->template->assign_block_vars('permission_setting', array('SELECTED' => in_array($row['group_id'], $groups_ary) ? true : false, 'GROUP_NAME' => isset($this->user->lang['G_' . $row['group_name']]) ? $this->user->lang['G_' . $row['group_name']] : $row['group_name'], 'GROUP_ID' => $row['group_id']));
                            }
                            $this->db->sql_freeresult($result);
                        }
                        $this->template->assign_var('SHOW_MODULE_OPTIONS', true);
                    }
                } else {
                    // only show the mod version check if we are on the General Settings page
                    mod_version_check();
                }
                $this->new_config = $this->config;
                $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
                $error = array();
                // We validate the complete config if whished
                validate_config_vars($display_vars['vars'], $cfg_array, $error);
                if ($submit && !check_form_key($form_key)) {
                    $error[] = $this->user->lang['FORM_INVALID'];
                }
                // Do not write values if there is an error
                if (sizeof($error)) {
                    $submit = false;
                }
                // Reset module
                $reset_module = request_var('module_reset', 0);
                if ($reset_module) {
                    $this->reset_module($id, $mode, $module_id, $module_data);
                }
                // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
                foreach ($display_vars['vars'] as $config_name => $null) {
                    if ($submit && (isset($null['type']) && $null['type'] == 'custom' || isset($null['submit_type']) && $null['submit_type'] == 'custom')) {
                        $func = array($this->c_class, $null['submit']);
                        if (method_exists($this->c_class, $null['submit'])) {
                            $args = $module_id != 0 ? array($config_name, $module_id) : $config_name;
                            call_user_func_array($func, $args);
                        } else {
                            $args = $module_id != 0 ? array($cfg_array[$config_name], $config_name, $module_id) : $config_name;
                            call_user_func_array($null['submit'], $args);
                        }
                    }
                    if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
                        continue;
                    }
                    if (isset($null['type']) && $null['type'] == 'custom') {
                        continue;
                    }
                    $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
                    if ($submit) {
                        set_config($config_name, $config_value);
                    }
                }
                if ($submit) {
                    $module_permission = request_var('permission-setting', array(0 => ''));
                    $groups_ary = array();
                    $img_error = '';
                    // get groups and check if the selected groups actually exist
                    $sql = 'SELECT group_id
							FROM ' . GROUPS_TABLE . '
							ORDER BY group_id ASC';
                    $result = $this->db->sql_query($sql);
                    while ($row = $this->db->sql_fetchrow($result)) {
                        $groups_ary[] = $row['group_id'];
                    }
                    $this->db->sql_freeresult($result);
                    $module_permission = array_intersect($module_permission, $groups_ary);
                    $module_permission = implode(',', $module_permission);
                    $sql_ary = array('module_image_src' => request_var('module_image', ''), 'module_image_width' => request_var('module_img_width', 0), 'module_image_height' => request_var('module_img_height', 0), 'module_group_ids' => $module_permission, 'module_status' => request_var('module_status', B3_MODULE_ENABLED));
                    if (!(isset($this->c_class->hide_name) && $this->c_class->hide_name == true)) {
                        $sql_ary['module_name'] = utf8_normalize_nfc(request_var('module_name', '', true));
                    }
                    // check if module image file actually exists
                    $img_error = check_file_src($sql_ary['module_image_src'], '', $module_id, false);
                    $sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
						SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
						WHERE module_id = ' . (int) $module_id;
                    $this->db->sql_query($sql);
                    $this->cache->destroy('portal_modules');
                    $this->cache->destroy('sql', CONFIG_TABLE);
                    if (isset($module_name)) {
                        if ($module_data['module_classname'] !== 'custom') {
                            add_log('admin', 'LOG_PORTAL_CONFIG', $module_name);
                        }
                    } else {
                        add_log('admin', 'LOG_PORTAL_CONFIG', $this->user->lang['ACP_PORTAL_' . strtoupper($mode) . '_INFO']);
                    }
                    trigger_error($this->user->lang['CONFIG_UPDATED'] . (!empty($img_error) ? '<br /><br />' . $this->user->lang['MODULE_IMAGE_ERROR'] . '<br />' . $img_error : '') . adm_back_link($module_id ? append_sid("{$this->phpbb_root_path}adm/index.{$this->php_ex}", 'i=portal&amp;mode=modules') : $this->u_action));
                }
                // show custom HTML files on the settings page of the modules instead of the standard board3 portal one, if chosen by module
                if (!isset($this->c_class->custom_acp_tpl) || empty($this->c_class->custom_acp_tpl)) {
                    $this->tpl_name = 'portal/acp_portal_config';
                } else {
                    $this->tpl_name = 'portal/' . $this->c_class->custom_acp_tpl;
                }
                $this->page_title = $display_vars['title'];
                $this->template->assign_vars(array('L_TITLE' => $this->user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => isset($this->user->lang[$display_vars['title'] . '_EXP']) ? $this->user->lang[$display_vars['title'] . '_EXP'] : '', 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action . ($module_id ? '&amp;module_id=' . $module_id : '')));
                // Output relevant page
                foreach ($display_vars['vars'] as $config_key => $vars) {
                    if (!is_array($vars) && strpos($config_key, 'legend') === false) {
                        continue;
                    }
                    if (strpos($config_key, 'legend') !== false) {
                        $this->template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($this->user->lang[$vars]) ? $this->user->lang[$vars] : $vars));
                        continue;
                    }
                    $this->new_config[$config_key] = $this->config[$config_key];
                    $type = explode(':', $vars['type']);
                    $l_explain = '';
                    if ($vars['explain']) {
                        $l_explain = isset($this->user->lang[$vars['lang'] . '_EXP']) ? $this->user->lang[$vars['lang'] . '_EXP'] : '';
                    }
                    if ($vars['type'] != 'custom') {
                        $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
                    } else {
                        $args = array($this->new_config[$config_key], $config_key, $module_id);
                        if (!is_array($vars['method'])) {
                            $func = array($this->c_class, $vars['method']);
                        } else {
                            $func = $vars['method'];
                        }
                        $content = call_user_func_array($func, $args);
                    }
                    if (empty($content)) {
                        continue;
                    }
                    $this->template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($this->user->lang[$vars['lang']]) ? $this->user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
                    unset($display_vars['vars'][$config_key]);
                }
                break;
            case 'modules':
                $action = request_var('action', '');
                $module_id = request_var('module_id', '');
                // Create an array of already installed modules
                $portal_modules = obtain_portal_modules();
                $installed_modules = $module_column = array();
                foreach ($portal_modules as $cur_module) {
                    $installed_modules[] = $cur_module['module_classname'];
                    // Create an array with the columns the module is in
                    $module_column[$cur_module['module_classname']][] = column_num_string($cur_module['module_column']);
                }
                if ($action == 'move_up') {
                    $this->move_module_up($module_id);
                } elseif ($action == 'move_down') {
                    $this->move_module_down($module_id);
                } elseif ($action == 'move_right') {
                    $this->move_module_right($module_id);
                } elseif ($action == 'move_left') {
                    $this->move_module_left($module_id);
                } elseif ($action == 'delete') {
                    $this->module_delete($id, $mode, $action, $module_id);
                }
                $add_module = key(request_var('add', array('' => '')));
                $add_column = request_var('add_column', column_string_num($add_module));
                if ($add_column) {
                    $submit = isset($_POST['submit']) ? true : false;
                    $directory = $this->phpbb_root_path . 'portal/modules/';
                    if ($submit) {
                        $module_classname = request_var('module_classname', '');
                        $class = 'portal_' . $module_classname . '_module';
                        $column_string = column_num_string($add_column);
                        // do we want to add the module to the side columns or to the center columns?
                        if (in_array($column_string, array('left', 'right'))) {
                            // does the module already exist in the side columns?
                            if (isset($module_column[$module_classname]) && (in_array('left', $module_column[$module_classname]) || in_array('right', $module_column[$module_classname]))) {
                                $submit = false;
                            }
                        } elseif (in_array($column_string, array('center', 'top', 'bottom'))) {
                            // does the module already exist in the center columns?
                            if (isset($module_column[$module_classname]) && (in_array('center', $module_column[$module_classname]) || in_array('top', $module_column[$module_classname]) || in_array('bottom', $module_column[$module_classname]))) {
                                $submit = false;
                            }
                        }
                        // do not install if module already exists in that column
                        if (!$submit && $module_classname != 'custom') {
                            trigger_error($this->user->lang['MODULE_ADD_ONCE'] . adm_back_link($this->u_action), E_USER_WARNING);
                        }
                        if (!class_exists($class)) {
                            include $directory . 'portal_' . $module_classname . '.' . $this->php_ex;
                        }
                        if (!class_exists($class)) {
                            trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
                        }
                        $sql = 'SELECT module_order
							FROM ' . PORTAL_MODULES_TABLE . '
							WHERE module_column = ' . $add_column . '
							ORDER BY module_order DESC';
                        $result = $this->db->sql_query_limit($sql, 1);
                        $module_order = 1 + (int) $this->db->sql_fetchfield('module_order');
                        $this->db->sql_freeresult($result);
                        $this->c_class = new $class();
                        $sql_ary = array('module_classname' => $module_classname, 'module_column' => $add_column, 'module_order' => $module_order, 'module_name' => $this->c_class->name, 'module_image_src' => $this->c_class->image_src, 'module_group_ids' => '', 'module_image_height' => 16, 'module_image_width' => 16, 'module_status' => B3_MODULE_ENABLED);
                        $sql = 'INSERT INTO ' . PORTAL_MODULES_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
                        $this->db->sql_query($sql);
                        $module_id = $this->db->sql_nextid();
                        $error = $this->c_class->install($module_id);
                        $this->cache->purge();
                        // make sure we don't get errors after re-adding a module
                        // if something went wrong, handle the errors accordingly and undo the above query
                        if (sizeof($error) && $error != true) {
                            if (is_array($error)) {
                                foreach ($error as $cur_error) {
                                    $error_output = $cur_error . '<br />';
                                }
                            } else {
                                $error_output = $error;
                            }
                            $sql = 'DELETE FROM ' . PORTAL_MODULES_TABLE . ' WHERE module_id = ' . (int) $module_id;
                            trigger_error($error_output . adm_back_link($this->u_action));
                        }
                        meta_refresh(3, append_sid("{$this->phpbb_admin_path}index.{$this->php_ex}", 'i=portal&amp;mode=config&amp;module_id=' . $module_id));
                        trigger_error($this->user->lang['SUCCESS_ADD'] . adm_back_link($this->u_action));
                    }
                    $this->template->assign_var('S_EDIT', true);
                    $fileinfo = array();
                    $dh = @opendir($directory);
                    if (!$dh) {
                        return $fileinfo;
                    }
                    while (($file = readdir($dh)) !== false) {
                        // Is module?
                        if (preg_match('/^portal_.+\\.' . $this->php_ex . '$/', $file)) {
                            $class = str_replace(".{$this->php_ex}", '', $file) . '_module';
                            $module_class = str_replace(array('portal_', ".{$this->php_ex}"), '', $file);
                            $column_string = column_num_string($add_column);
                            // do we want to add the module to the side columns or to the center columns?
                            if ($module_class != 'custom') {
                                if (in_array($column_string, array('left', 'right'))) {
                                    // does the module already exist in the side columns?
                                    if (isset($module_column[$module_class]) && (in_array('left', $module_column[$module_class]) || in_array('right', $module_column[$module_class]))) {
                                        continue;
                                    }
                                } elseif (in_array($column_string, array('center', 'top', 'bottom'))) {
                                    // does the module already exist in the center columns?
                                    if (isset($module_column[$module_class]) && (in_array('center', $module_column[$module_class]) || in_array('top', $module_column[$module_class]) || in_array('bottom', $module_column[$module_class]))) {
                                        continue;
                                    }
                                }
                            }
                            if (!class_exists($class)) {
                                include $directory . $file;
                            }
                            // Get module title tag
                            if (class_exists($class)) {
                                $this->c_class = new $class();
                                if ($this->c_class->columns & column_string_const($add_module)) {
                                    if ($this->c_class->language) {
                                        $this->user->add_lang('mods/portal/' . $this->c_class->language);
                                    }
                                    $fileinfo[] = array('module' => substr($class, 7, -7), 'name' => $this->user->lang[$this->c_class->name]);
                                }
                            }
                        }
                    }
                    closedir($dh);
                    // we sort the $fileinfo array by the name of the modules
                    foreach ($fileinfo as $key => $cur_file) {
                        $name_ary[$key] = $cur_file['name'];
                    }
                    array_multisort($name_ary, SORT_REGULAR, $fileinfo);
                    $options = '';
                    foreach ($fileinfo as $module) {
                        $options .= '<option value="' . $module['module'] . '">' . $module['name'] . '</option>';
                    }
                    $s_hidden_fields = build_hidden_fields(array('add_column' => column_string_num($add_module)));
                    $this->template->assign_vars(array('S_MODULE_NAMES' => $options, 'S_HIDDEN_FIELDS' => $s_hidden_fields));
                } else {
                    $directory = $this->phpbb_root_path . 'portal/modules/';
                    $portal_modules = obtain_portal_modules();
                    foreach ($portal_modules as $row) {
                        $class = 'portal_' . $row['module_classname'] . '_module';
                        if (!class_exists($class)) {
                            include $directory . 'portal_' . $row['module_classname'] . '.' . $this->php_ex;
                        }
                        if (!class_exists($class)) {
                            trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
                        }
                        $this->c_class = new $class();
                        if ($this->c_class->language) {
                            $this->user->add_lang('mods/portal/' . $this->c_class->language);
                        }
                        $template_column = column_num_string($row['module_column']);
                        // find out of we can move modules to the left or right
                        if ($this->c_class->columns & column_string_const(column_num_string($row['module_column'] + 1)) || $this->c_class->columns & column_string_const(column_num_string($row['module_column'] + 2)) && $row['module_column'] != 2) {
                            /**
                             * check if we can actually move
                             * this only applies to modules in the center column as the side modules
                             * will automatically skip the center column when moving if they need to
                             */
                            if ($row['module_classname'] != 'custom') {
                                $column_string = column_num_string($row['module_column'] + 1);
                                // move 1 right
                                if ($column_string == 'right' && isset($module_column[$row['module_classname']]) && (in_array('left', $module_column[$row['module_classname']]) || in_array('right', $module_column[$row['module_classname']]))) {
                                    $move_right = false;
                                } else {
                                    $move_right = true;
                                }
                            } else {
                                $move_right = true;
                            }
                        } else {
                            $move_right = false;
                        }
                        if ($this->c_class->columns & column_string_const(column_num_string($row['module_column'] - 1)) || $this->c_class->columns & column_string_const(column_num_string($row['module_column'] - 2)) && $row['module_column'] != 2) {
                            /**
                             * check if we can actually move
                             * this only applies to modules in the center column as the side modules
                             * will automatically skip the center column when moving if they need to
                             */
                            if ($row['module_classname'] != 'custom') {
                                $column_string = column_num_string($row['module_column'] - 1);
                                // move 1 left
                                if ($column_string == 'left' && isset($module_column[$row['module_classname']]) && (in_array('left', $module_column[$row['module_classname']]) || in_array('right', $module_column[$row['module_classname']]))) {
                                    $move_left = false;
                                } else {
                                    $move_left = true;
                                }
                            } else {
                                $move_left = true;
                            }
                        } else {
                            $move_left = false;
                        }
                        $this->template->assign_block_vars('modules_' . $template_column, array('MODULE_NAME' => isset($this->user->lang[$row['module_name']]) ? $this->user->lang[$row['module_name']] : $row['module_name'], 'MODULE_IMAGE' => $row['module_image_src'] ? '<img src="' . $this->phpbb_root_path . 'styles/' . $this->user->theme['theme_path'] . '/theme/images/portal/' . $row['module_image_src'] . '" alt="' . $row['module_name'] . '" />' : '', 'MODULE_ENABLED' => $row['module_status'] ? true : false, 'U_DELETE' => $this->u_action . '&amp;module_id=' . $row['module_id'] . '&amp;module_classname=' . $row['module_classname'] . '&amp;action=delete', 'U_EDIT' => append_sid("{$this->phpbb_admin_path}index.{$this->php_ex}", 'i=portal&amp;mode=config&amp;module_id=' . $row['module_id']), 'U_MOVE_UP' => $this->u_action . '&amp;module_id=' . $row['module_id'] . '&amp;action=move_up', 'U_MOVE_DOWN' => $this->u_action . '&amp;module_id=' . $row['module_id'] . '&amp;action=move_down', 'U_MOVE_RIGHT' => $move_right ? $this->u_action . '&amp;module_id=' . $row['module_id'] . '&amp;action=move_right' : '', 'U_MOVE_LEFT' => $move_left ? $this->u_action . '&amp;module_id=' . $row['module_id'] . '&amp;action=move_left' : ''));
                    }
                    $this->template->assign_vars(array('ICON_MOVE_LEFT' => '<img src="' . $this->phpbb_admin_path . 'images/icon_left.gif" alt="' . $this->user->lang['MOVE_LEFT'] . '" title="' . $this->user->lang['MOVE_LEFT'] . '" />', 'ICON_MOVE_LEFT_DISABLED' => '<img src="' . $this->phpbb_admin_path . 'images/icon_left_disabled.gif" alt="' . $this->user->lang['MOVE_LEFT'] . '" title="' . $this->user->lang['MOVE_LEFT'] . '" />', 'ICON_MOVE_RIGHT' => '<img src="' . $this->phpbb_admin_path . 'images/icon_right.gif" alt="' . $this->user->lang['MOVE_RIGHT'] . '" title="' . $this->user->lang['MOVE_RIGHT'] . '" />', 'ICON_MOVE_RIGHT_DISABLED' => '<img src="' . $this->phpbb_admin_path . 'images/icon_right_disabled.gif" alt="' . $this->user->lang['MOVE_RIGHT'] . '" title="' . $this->user->lang['MOVE_RIGHT'] . '" />'));
                }
                $this->tpl_name = 'portal/acp_portal_modules';
                $this->page_title = 'ACP_PORTAL_MODULES';
                break;
            case 'upload_module':
                $error = array();
                if ($submit) {
                    if (!check_form_key('acp_portal_module_upload')) {
                        trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
                    }
                    include $this->phpbb_root_path . 'portal/includes/functions_upload.' . $this->php_ex;
                    // Default upload path is portal/upload/
                    $upload_path = $this->phpbb_root_path . 'portal/upload/';
                    $portal_upload = new portal_upload($upload_path, $this->u_action);
                    $this->tpl_name = 'portal/acp_portal_upload_module';
                    $this->page_title = $this->user->lang['ACP_PORTAL_UPLOAD'];
                } else {
                    // start the page
                    $this->template->assign_vars(array('U_UPLOAD' => $this->u_action, 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"'));
                    add_form_key('acp_portal_module_upload');
                    $this->tpl_name = 'portal/acp_portal_upload_module';
                    $this->page_title = $this->user->lang['ACP_PORTAL_UPLOAD'];
                    $this->template->assign_vars(array('L_TITLE' => $this->user->lang['ACP_PORTAL_UPLOAD'], 'L_TITLE_EXPLAIN' => '', 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
                }
                break;
            default:
                trigger_error('NO_MODE', E_USER_ERROR);
                break;
        }
    }
コード例 #14
0
 function main($id, $mode)
 {
     global $db, $user, $auth, $template, $request, $phpbb_log;
     global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
     // Set up general vars
     $action = $request->variable('action', '');
     $submit = isset($_POST['submit']) ? true : false;
     $this->tpl_name = 'acp_hidebbcode';
     $form_key = 'acp_hidebbcode';
     add_form_key($form_key);
     switch ($mode) {
         case 'settings':
             $display_vars = array('title' => 'HIDEBB_SETTINGS', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'hidebbcode_unhide_reply' => array('lang' => 'HIDEBB_REPLY_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'hidebbcode_unhide_tfp' => array('lang' => 'HIDEBB_TFP_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'hidebbcode_hide_attach' => array('lang' => 'HIDEBB_HIDE_ATTACH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'legend2' => 'ACP_SUBMIT_CHANGES'));
             break;
         default:
             trigger_error('NO_MODE', E_USER_ERROR);
             break;
     }
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if whished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     // Lets check if the path entered isn't valid and if we're gonna complain
     if ($submit && $mode == 'settings') {
         // Checks
     }
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             $config->set($config_name, $config_value);
         }
     }
     if (sizeof($error)) {
         $submit = false;
     }
     if ($submit) {
         $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_HIDEBBCODE');
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     $this->page_title = $display_vars['title'];
     $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error)));
     $template->assign_var('U_ACTION', $this->u_action);
     // Output relevant page set in $display_vars
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #15
0
 public function infraction_general()
 {
     global $auth, $db, $user, $template;
     global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path;
     $action = request_var('action', '');
     $submit = isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable']) ? true : false;
     $form_key = 'acp_infractions';
     add_form_key($form_key);
     $display_vars = array('title' => 'ACP_INFRACTION_GENERAL', 'vars' => array('legend1' => 'ACP_INFRACTION_GENERAL', 'infractions_hard_delete' => array('lang' => 'INFRACTION_DELETE_TYPE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'infractions_deleted_keep_time' => array('lang' => 'INFRACTION_DELETE_KEEP_TIME', 'validate' => 'int', 'type' => 'text:40:40', 'explain' => true), 'infractions_pm_sig' => array('lang' => 'INFRACTION_PM_SIG', 'validate' => 'string', 'type' => 'textarea:4:40', 'explain' => true)));
     // ---------
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if whished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id') {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($config_name == 'email_function_name') {
             $this->new_config['email_function_name'] = trim(str_replace(array('(', ')'), array('', ''), $this->new_config['email_function_name']));
             $this->new_config['email_function_name'] = empty($this->new_config['email_function_name']) || !function_exists($this->new_config['email_function_name']) ? 'mail' : $this->new_config['email_function_name'];
             $config_value = $this->new_config['email_function_name'];
         }
         if ($submit) {
             set_config($config_name, $config_value);
             if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable'])) {
                 enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2));
             }
         }
     }
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
     if ($submit) {
         add_log('admin', 'INFRACTION_LOG_UPDATED');
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
 }
コード例 #16
0
 /**
  * @dataProvider build_cfg_template_select_data
  */
 public function test_build_cfg_template_select($tpl_type, $key, $new, $config_key, $vars, $expected)
 {
     global $module, $user, $phpbb_dispatcher;
     $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
     $user = new phpbb_mock_user();
     $user->lang = new phpbb_mock_lang();
     $user->module = $this;
     $module = $user;
     $this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars));
 }
コード例 #17
0
ファイル: ulogin_module.php プロジェクト: mike-a-b/crossfit
 function main($id, $mode)
 {
     global $config, $request, $template, $user, $db;
     $this->page_title = 'ACP_ULOGIN_TITLE';
     $this->tpl_name = 'acp_ulogin';
     $submit = isset($_POST['submit']) ? true : false;
     $form_key = 'config_ulogin';
     add_form_key($form_key);
     $display_vars = array('title' => 'ACP_ULOGIN_TITLE', 'vars' => array('legend1' => 'ACP_ULOGIN_ID', 'ulogin_id1' => array('lang' => 'ULOGIN_ID1', 'validate' => 'string', 'type' => 'text:8:8', 'explain' => true), 'ulogin_id2' => array('lang' => 'ULOGIN_ID2', 'validate' => 'string', 'type' => 'text:8:8', 'explain' => true), 'legend2' => 'ACP_ULOGIN_GROUP', 'ulogin_group_id' => array('lang' => 'ULOGIN_GROUP_ID', 'validate' => 'int', 'type' => 'custom', 'method' => 'get_groups', 'explain' => true), 'legend3' => 'ACP_SUBMIT_CHANGES'));
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if wished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             $config->set($config_name, $config_value);
         }
     }
     if ($submit) {
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     $this->page_title = $display_vars['title'];
     $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error)));
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #18
0
 /**
  * Constructor
  */
 function main($id, $mode)
 {
     global $config, $db, $user, $auth, $template, $cache;
     global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $phpbb_seo, $_action_types;
     require_once $phpbb_root_path . 'gym_sitemaps/includes/gym_common.' . $phpEx;
     // Start the phpbb_seo class
     if (!is_object($phpbb_seo)) {
         if (file_exists($phpbb_root_path . 'phpbb_seo/phpbb_seo_class.' . $phpEx)) {
             require_once $phpbb_root_path . 'phpbb_seo/phpbb_seo_class.' . $phpEx;
         } else {
             require_once $phpbb_root_path . 'gym_sitemaps/includes/phpbb_seo_class_light.' . $phpEx;
         }
         $phpbb_seo = new phpbb_seo();
     }
     $user->add_lang('gym_sitemaps/acp/gym_common');
     // action=(module|cache|modrewrite...)&amp;module=(main|forum| ...)
     $action = request_var('action', 'main');
     $module = request_var('module', 'main');
     // maction =(settings|maintenance|save)&amp;action=(module|cache|modrewrite...)&amp;module=(main|forum| ...)
     $maction = request_var('maction', '');
     $mactions = array('settings', 'maintenance', 'install');
     $maction = in_array($maction, $mactions) ? $maction : '';
     $submit = isset($_POST['submit']) ? true : false;
     $this->modes = $_action_types;
     $this->override_type = $_override_types;
     $this->override = array();
     // Filter allowed modes
     $this->mode = $mode;
     $this->module = $module;
     $this->action = $action;
     $this->maction = $maction;
     $this->set_phpbb_seo_links();
     // Get gym config
     obtain_gym_config('main', $this->gym_config);
     $this->new_config = $this->gym_config;
     // define common validation arrays
     $this->dyn_select['modrtype'] = array(0 => 'GYM_MODREWRITE_NONE', 1 => 'GYM_MODREWRITE_SIMPLE', 2 => 'GYM_MODREWRITE_MIXED', 3 => 'GYM_MODREWRITE_ADVANCED');
     $this->dyn_select['gzip_level'] = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9);
     $this->dyn_select['sort'] = array('DESC' => 'GYM_DESC', 'ASC' => 'GYM_ASC');
     $this->dyn_select['override'] = array(OVERRIDE_GLOBAL => 'GYM_OVERRIDE_GLOBAL', OVERRIDE_OTYPE => 'GYM_OVERRIDE_OTYPE', OVERRIDE_MODULE => 'GYM_OVERRIDE_MODULE');
     $this->dyn_select['sumarize_method'] = array('chars' => 'GYM_METHOD_CHARS', 'words' => 'GYM_METHOD_WORDS', 'lines' => 'GYM_METHOD_LINES');
     $this->dyn_select['gym_auth'] = array('admin' => 'GYM_AUTH_ADMIN', 'globalmod' => 'GYM_AUTH_GLOBALMOD', 'reg' => 'GYM_AUTH_REG', 'guest' => 'GYM_AUTH_GUEST', 'all' => 'GYM_AUTH_ALL', 'none' => 'GYM_AUTH_NONE');
     $this->dyn_select['rss_linking_types'] = array('n' => 'RSS_LINKING_NEWS', 'nd' => 'RSS_LINKING_NEWS_DIGEST', 'r' => 'RSS_LINKING_REGULAR', 'rd' => 'RSS_LINKING_REGULAR_DIGEST');
     // Get the module list
     // Populate the $this->gym_modules[$mode][$module] array
     $this->gym_get_modules($mode);
     // Load the relevant modules acp options
     // Populate the $this->gym_modules_acp[$mode][$module] array
     $this->gym_module_acp($mode, $module);
     // Acp options array for this case
     $display_vars = $error = array();
     // salt the form
     $form_key = 'acp_gym';
     add_form_key($form_key);
     // check form salt
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
         $submit = false;
     }
     // Cache management
     if ($maction === 'maintenance') {
         $display_vars = $this->gym_maintenance($mode, $module, $action, $submit);
         $submit = false;
     } elseif ($maction === 'settings') {
         // settings management
         $display_vars = $this->gym_set_default($mode, $module, $action, $submit);
         $submit = false;
     } elseif ($maction === 'install') {
         // module install
         $display_vars = $this->gym_install($mode, $module, $action, $submit);
         $submit = false;
     } else {
         if (!in_array($mode, $this->modes) || !in_array($module, $this->gym_modules[$mode])) {
             trigger_error('NO_MODE', E_USER_ERROR);
         } else {
             $script_to_check = array();
             if (empty($this->gym_modules_acp[$mode][$module][$action]['display_vars'])) {
                 $action = $this->action = 'main';
             }
             // here we'll check if the GYM script urls are consistent
             if (!$submit) {
                 $this->check_scripts($error, $this->gym_config, $mode);
             }
             $display_vars = $this->gym_modules_acp[$mode][$module][$action]['display_vars'];
             // Check if we do not have a new module needing a new config key
             $clear_cache = false;
             foreach ($display_vars['vars'] as $key => $value) {
                 if (!isset($this->gym_config[$key]) && strpos($key, 'legend') === false) {
                     $clear_cache = true;
                     if (isset($this->gym_modules_acp[$mode][$module][$action]['default'][$key])) {
                         $this->new_config[$key] = $this->gym_modules_acp[$mode][$module][$action]['default'][$key];
                         set_gym_config($key, $this->new_config[$key], $mode, $this->gym_config);
                     }
                 }
             }
             if ($clear_cache) {
                 $this->remove_cache('config');
             }
         }
     }
     // Load the module's language files
     foreach ($this->gym_modules_acp[$mode] as $active_modules => $null) {
         if (!empty($this->gym_modules_acp[$mode][$active_modules]['info']['lang_file'])) {
             $user->add_lang('gym_sitemaps/acp/' . $this->gym_modules_acp[$mode][$active_modules]['info']['lang_file']);
         }
     }
     $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
     // We validate the complete config if whished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     // check script urls if necessary
     if ($submit && isset($cfg_array[$mode . '_url'])) {
         // will enforce trailing slashes automatically
         $this->check_scripts($error, $cfg_array, $mode);
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $cfg_setup) {
         if (!isset($cfg_array[$config_name]) && @$cfg_setup['method'] != 'select_multiple_string' || strpos($config_name, 'legend') !== false) {
             continue;
         }
         // Handle multiple select options
         if (!empty($cfg_setup['method']) && $cfg_setup['method'] == 'select_multiple_string') {
             if (isset($_POST['multiple_' . $config_name])) {
                 $m_values = utf8_normalize_nfc(request_var('multiple_' . $config_name, array('' => '')));
                 $validate_int = $cfg_setup['multiple_validate'] == 'int' ? true : false;
                 foreach ($m_values as $k => $v) {
                     if ($validate_int) {
                         $v = (int) $v;
                     }
                     if (empty($v)) {
                         unset($m_values[$k]);
                     } else {
                         $m_values[$k] = $v;
                     }
                 }
                 sort($m_values);
                 $this->new_config[$config_name] = $m_values;
                 $config_value = implode(',', $m_values);
                 if (strlen($config_value) > 255) {
                     $error[] = sprintf($user->lang['SETTING_TOO_LONG'], $user->lang[$cfg_setup['lang']], 255);
                 }
                 $submit = empty($error);
             } else {
                 if ($submit) {
                     $this->new_config[$config_name] = array();
                     $config_value = '';
                 } else {
                     $config_value = $this->new_config[$config_name];
                     $this->new_config[$config_name] = !empty($config_value) ? explode(',', $config_value) : array();
                 }
             }
         } else {
             $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         }
         if ($submit) {
             set_gym_config($config_name, $config_value, $mode, $this->gym_config);
         }
     }
     if ($submit) {
         $this->remove_cache('config');
         add_log('admin', 'GYM_LOG_CONFIG_' . strtoupper($mode));
         trigger_error($user->lang['CONFIG_UPDATED'] . $this->back_to_prev());
     }
     $this->tpl_name = 'acp_gym_sitemaps';
     $this->page_title = $display_vars['title'];
     // add the maitenance links
     $maintenance_links = '';
     $maintenance_links .= '<a href="' . $this->u_action . '&amp;maction=maintenance&amp;action=' . $action . '&amp;module=' . $module . '"><b style="color:red;">' . $user->lang['GYM_MAINTENANCE'] . '</b></a><b> &bull; </b>';
     $maintenance_links .= '<a href="' . $this->u_action . '&amp;maction=settings&amp;action=' . $action . '&amp;module=' . $module . '"><b style="color:red;">' . $user->lang['GYM_SETTINGS'] . '</b></a>';
     $install_link = $mode !== 'main' ? '<b> &bull; </b><a href="' . $this->u_action . '&amp;maction=install&amp;action=' . $action . '&amp;module=' . $module . '"><b style="color:red;">' . $user->lang['GYM_INSTALL'] . '</b></a>' : '';
     if ($action === 'gzip') {
         // Adjust language variable a bit
         $user->lang['GYM_GZIP_EXPLAIN'] = sprintf($user->lang['GYM_GZIP_EXPLAIN'], $config['gzip_compress'] ? $user->lang['GYM_GZIP_FORCED'] : $user->lang['GYM_GZIP_CONFIGURABLE']);
     }
     $lang_key = 'GYM_' . strtoupper($mode);
     $l_mode_title = $this->safe_lang($lang_key);
     $l_mode_title_explain = $this->safe_lang($lang_key . '_EXPLAIN');
     $lang_key = $this->gym_modules_acp[$mode][$module]['info']['title_lang'];
     $l_module_title = $this->safe_lang($lang_key);
     $l_module_title_explain = $this->safe_lang($lang_key . '_EXPLAIN');
     $l_title = $this->safe_lang($display_vars['title']);
     $l_title_explain = $this->safe_lang($display_vars['title'] . '_EXPLAIN');
     $l_title_explain .= $action === 'cache' && $mode !== 'html' ? $this->check_cache_folder($phpbb_root_path . 'gym_sitemaps/cache') : '';
     $template->assign_vars(array('L_MODE_TITLE' => $l_mode_title, 'L_MODE_ITLE_EXPLAIN' => $l_mode_title_explain, 'L_MODULE_TITLE' => $l_module_title, 'L_MODULE_ITLE_EXPLAIN' => $l_module_title_explain, 'L_TITLE' => $l_title, 'L_TITLE_EXPLAIN' => $l_title_explain, 'GYM_VERSION' => $this->gym_config['gym_version'], 'INSTALL_LINK' => $install_link, 'MAINTENANCE_LINKS' => $maintenance_links, 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'S_SUBMIT_BUTTON' => !empty($this->gym_modules_acp[$mode][$module][$action]['default']), 'U_ACTION' => $this->u_action . '&amp;maction=' . $maction . '&amp;action=' . $action . '&amp;module=' . $module));
     $this->gym_module_menu($mode, $module, $action);
     $this->gym_menu($mode, $module, $action);
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => $this->safe_lang($vars)));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = $this->safe_lang($vars['lang_explain']);
         } elseif ($vars['explain']) {
             $l_explain = $this->safe_lang($vars['lang'] . '_EXPLAIN');
         }
         // Add overriding infos
         $form = true;
         if (isset($vars['overriding']) && $vars['overriding']) {
             $vars['append'] = $this->is_overriden($mode, $module, $action, $config_key, $vars);
             //$form = $vars['append'] == $this->safe_lang('GYM_COULD_OVERRIDE') ? true : false;
         }
         $content = '';
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => $this->safe_lang($vars['lang']), 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $form ? build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars) : $vars['append']));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #19
0
ファイル: tfa_module.php プロジェクト: paul999/phpbb_2fa
 public function main($id, $mode)
 {
     global $user, $template, $request;
     global $config, $phpbb_dispatcher, $phpbb_log;
     $user->add_lang_ext('paul999/tfa', 'acp_tfa');
     $user->add_lang('acp/board');
     $submit = $request->is_set('submit');
     $form_key = 'acp_tfa';
     add_form_key($form_key);
     $display_vars = array('title' => 'ACP_TFA_SETTINGS', 'vars' => array('legend1' => 'ACP_TFA_SETTINGS', 'tfa_mode' => array('lang' => 'TFA_MODE', 'validate' => 'int', 'type' => 'select', 'method' => 'select_tfa_method', 'explain' => true), 'legend4' => 'ACP_SUBMIT_CHANGES'));
     /**
      * Event to add and/or modify acp_board configurations
      *
      * @event paul999.tfa.tfa_config_edit_add
      * @var	array	display_vars	Array of config values to display and process
      * @var	string	mode			Mode of the config page we are displaying
      * @var	boolean	submit			Do we display the form or process the submission
      * @since 1.0.0-b2
      */
     $vars = array('display_vars', 'mode', 'submit');
     extract($phpbb_dispatcher->trigger_event('paul999.tfa.tfa_config_edit_add', compact($vars)));
     $this->new_config = $config;
     // Copied from acp_board.php
     $cfg_array = $request->is_set('config') ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if wished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang('FORM_INVALID');
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             $config->set($config_name, $config_value);
         }
     }
     if ($submit) {
         $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_TFA_CONFIG_' . strtoupper($mode));
         $message = $user->lang('CONFIG_UPDATED');
         $message_type = E_USER_NOTICE;
         trigger_error($message . adm_back_link($this->u_action), $message_type);
     }
     if (!$request->is_secure()) {
         $error[] = $user->lang('TFA_REQUIRES_SSL');
     }
     $this->tpl_name = 'acp_board';
     $this->page_title = $display_vars['title'];
     $template->assign_vars(array('L_TITLE' => $user->lang($display_vars['title']), 'L_TITLE_EXPLAIN' => $user->lang($display_vars['title'] . '_EXPLAIN'), 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => array_key_exists($vars, $user->lang) ? $user->lang($vars) : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && array_key_exists($vars['lang'] . '_EXPLAIN', $user->lang)) {
             $l_explain = $user->lang($vars['lang'] . '_EXPLAIN');
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => array_key_exists($vars['lang'], $user->lang) ? $user->lang($vars['lang']) : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #20
0
ファイル: acp_pbwow.php プロジェクト: BACKUPLIB/mwenhanced
 function main($id, $mode)
 {
     global $db, $user, $template;
     global $config, $pbwow_config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
     if (!function_exists('db_theme_data')) {
         include $phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx;
     }
     $user->add_lang('mods/lang_pbwow_acp');
     $constantsokay = false;
     $dbtable = PBWOW_CONFIG_TABLE;
     $dbokay = false;
     if ($dbtable != 'PBWOW_CONFIG_TABLE') {
         $constantsokay = true;
         if ($this->sql_table_exists($dbtable)) {
             $pbwow_config = $this->obtain_pbwow_config();
             $this->new_config = $pbwow_config;
             $dbokay = true;
         }
     }
     $topics_table_modded = false;
     $topics_table = TOPICS_TABLE;
     $topics_field1 = 'topic_first_poster_rank_img';
     $topics_field2 = 'topic_first_poster_rank_title';
     if ($this->sql_field_exists($topics_table, $topics_field1) && $this->sql_field_exists($topics_table, $topics_field2)) {
         $topics_table_modded = true;
     }
     $action = request_var('action', '');
     $submit = isset($_POST['submit']) ? true : false;
     /**
      *	Validation types are:
      *		string, int, bool,
      *		script_path (absolute path in url - beginning with / and no trailing slash),
      *		rpath (relative), rwpath (realtive, writeable), path (relative path, but able to escape the root), wpath (writeable)
      */
     switch ($mode) {
         case 'index':
             $display_vars = array('title' => 'ACP_PBWOW_INDEX_TITLE', 'vars' => array());
             break;
         case 'config':
             $display_vars = array('title' => 'ACP_PBWOW_CONFIG_TITLE', 'vars' => array('legend1' => 'ACP_PBWOW_TOPNAV', 'pbwow_topnav_code' => array('lang' => 'PBWOW_TOPNAV_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend2' => 'ACP_PBWOW_IE6MESSAGE', 'pbwow_ie6message_enable' => array('lang' => 'PBWOW_IE6MESSAGE_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'pbwow_ie6message_code' => array('lang' => 'PBWOW_IE6MESSAGE_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend3' => 'ACP_PBWOW_BLIZZ', 'pbwow_blizz_enable' => array('lang' => 'PBWOW_BLIZZ_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'pbwow_blizz_ranks' => array('lang' => 'PBWOW_BLIZZ_RANKS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_ranks'), 'legend4' => 'ACP_PBWOW_PROPASS', 'pbwow_propass_enable' => array('lang' => 'PBWOW_PROPASS_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'pbwow_propass_ranks' => array('lang' => 'PBWOW_PROPASS_RANKS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_ranks')));
             break;
         case 'ads':
             $display_vars = array('title' => 'ACP_PBWOW_ADS_TITLE', 'vars' => array('legend1' => 'ACP_PBWOW_ADS_INDEX', 'pbwow_ads_index_enable' => array('lang' => 'PBWOW_ADS_INDEX_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'pbwow_ads_index_code' => array('lang' => 'PBWOW_ADS_INDEX_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend2' => 'ACP_PBWOW_ADS_TOP', 'pbwow_ads_top_enable' => array('lang' => 'PBWOW_ADS_TOP_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'pbwow_ads_top_code' => array('lang' => 'PBWOW_ADS_TOP_CODE', 'type' => 'textarea:6:6', 'explain' => true), 'legend3' => 'ACP_PBWOW_ADS_SIDE', 'pbwow_ads_side_enable' => array('lang' => 'PBWOW_ADS_SIDE_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'pbwow_ads_side_code' => array('lang' => 'PBWOW_ADS_SIDE_CODE', 'type' => 'textarea:6:6', 'explain' => true)));
             break;
     }
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if whished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') || ($mode == 'links' && strpos($config_name, 'portal_link_')) !== false) {
             continue;
         }
         if ($config_name == 'portal_attachments_filetype' || $config_name == 'portal_news_forum' || $config_name == 'portal_global_announcements_forum' || $config_name == 'portal_recent_forum' || $config_name == 'portal_attachments_forum_ids' || $config_name == 'portal_poll_topic_id') {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             $this->set_pbwow_config($config_name, $config_value);
         }
     }
     if ($submit) {
         if ($action == 'refresh_topic_ranks' && $topics_table_modded == true) {
             $this->refresh_topic_ranks();
         }
         if ($action == 'create_topic_ranks' && $topics_table_modded == false) {
             $this->sql_field_add($topics_table, $topics_field1);
             $this->sql_field_add($topics_table, $topics_field2);
         }
         if ($action == 'create_config_table' && $constantsokay == true && $dbokay == false) {
             $this->install_pbwow($dbtable);
         }
         if ($action == 'refresh_all_themes') {
             $this->refresh_all_themes();
         }
         // Get data from select boxes and store in DB
         switch ($mode) {
             case 'config':
                 $this->store_selected_ranks('pbwow_blizz_ranks');
                 $this->store_selected_ranks('pbwow_propass_ranks');
                 break;
             default:
         }
         add_log('admin', 'LOG_PBWOW_CONFIG', $user->lang['ACP_PBWOW_' . strtoupper($mode) . '_INFO']);
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     ##################################################
     ##################################################
     ##################################################
     ##################################################
     ##################################################
     $this->tpl_name = 'acp_pbwow';
     $this->page_title = $display_vars['title'];
     $allCPF = $this->getAllCPF();
     $title_explain = $user->lang[$display_vars['title'] . '_EXPLAIN'];
     $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $title_explain, 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'S_VERSIONCHECK' => $display_vars['title'] == 'ACP_PBWOW_INDEX_TITLE' ? true : false, 'S_CONSTANTSOKAY' => $constantsokay ? true : false, 'PBWOW_DBTABLE' => $dbtable, 'S_DBOKAY' => $dbokay ? true : false, 'PBWOW_VERSION' => isset($pbwow_config['pbwow_version']) ? $pbwow_config['pbwow_version'] : 'No version value found in database!', 'S_TOPICS_MODDED' => $topics_table_modded ? true : false, 'TOPICS_TABLE' => $topics_table, 'S_CPF_PBGUILD' => in_array('pbguild', $allCPF) ? true : false, 'S_CPF_PBREALM' => in_array('pbrealm', $allCPF) ? true : false, 'S_CPF_PBLEVEL' => in_array('pblevel', $allCPF) ? true : false, 'S_CPF_PBRACE' => in_array('pbrace', $allCPF) ? true : false, 'S_CPF_PBGENDER' => in_array('pbgender', $allCPF) ? true : false, 'S_CPF_PBCLASS' => in_array('pbclass', $allCPF) ? true : false, 'S_CPF_PBPVPRANK' => in_array('pbpvprank', $allCPF) ? true : false, 'S_CPF_PBARMORYCHARLINK' => in_array('pbarmorycharlink', $allCPF) ? true : false, 'S_CPF_PBARMORYGUILDLINK' => in_array('pbarmoryguildlink', $allCPF) ? true : false, 'U_ACTION' => $this->u_action));
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars)));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #21
0
ファイル: acp_board.php プロジェクト: hgchen/phpbb
 function main($id, $mode)
 {
     global $db, $user, $auth, $template, $request;
     global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
     global $cache, $phpbb_container, $phpbb_dispatcher, $phpbb_log;
     $user->add_lang('acp/board');
     $action = $request->variable('action', '');
     $submit = isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable']) ? true : false;
     $form_key = 'acp_board';
     add_form_key($form_key);
     /**
      *	Validation types are:
      *		string, int, bool,
      *		script_path (absolute path in url - beginning with / and no trailing slash),
      *		rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
      */
     switch ($mode) {
         case 'settings':
             $display_vars = array('title' => 'ACP_BOARD_SETTINGS', 'vars' => array('legend1' => 'ACP_BOARD_SETTINGS', 'sitename' => array('lang' => 'SITE_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), 'site_desc' => array('lang' => 'SITE_DESC', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), 'site_home_url' => array('lang' => 'SITE_HOME_URL', 'validate' => 'string', 'type' => 'url:40:255', 'explain' => true), 'site_home_text' => array('lang' => 'SITE_HOME_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), 'board_index_text' => array('lang' => 'BOARD_INDEX_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), 'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true), 'board_disable_msg' => false, 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'timezone', 'type' => 'custom', 'method' => 'timezone_select', 'explain' => true), 'legend2' => 'BOARD_STYLE', 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => true), 'guest_style' => array('lang' => 'GUEST_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array($this->guest_style_get(), false), 'explain' => true), 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'WARNINGS', 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'legend4' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'features':
             $display_vars = array('title' => 'ACP_BOARD_FEATURES', 'vars' => array('legend1' => 'ACP_BOARD_FEATURES', 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_board_notifications' => array('lang' => 'ALLOW_BOARD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'display_last_subject' => array('lang' => 'DISPLAY_LAST_SUBJECT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), 'legend2' => 'ACP_LOAD_SETTINGS', 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_pm' => array('lang' => 'LOAD_CPF_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'avatar':
             /* @var $phpbb_avatar_manager \phpbb\avatar\manager */
             $phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
             $avatar_drivers = $phpbb_avatar_manager->get_all_drivers();
             $avatar_vars = array();
             foreach ($avatar_drivers as $current_driver) {
                 $driver = $phpbb_avatar_manager->get_driver($current_driver, false);
                 /*
                  * First grab the settings for enabling/disabling the avatar
                  * driver and afterwards grab additional settings the driver
                  * might have.
                  */
                 $avatar_vars += $phpbb_avatar_manager->get_avatar_settings($driver);
                 $avatar_vars += $driver->prepare_form_acp($user);
             }
             $display_vars = array('title' => 'ACP_AVATAR_SETTINGS', 'vars' => array('legend1' => 'ACP_AVATAR_SETTINGS', 'avatar_min_width' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'avatar_min_height' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'avatar_max_width' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL'])));
             if (!empty($avatar_vars)) {
                 $display_vars['vars'] += $avatar_vars;
             }
             break;
         case 'message':
             $display_vars = array('title' => 'ACP_MESSAGE_SETTINGS', 'lang' => 'ucp', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'validate' => 'int', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true), 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'pm_max_recipients' => array('lang' => 'PM_MAX_RECIPIENTS', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), 'legend2' => 'GENERAL_OPTIONS', 'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'auth_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'auth_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_pm' => array('lang' => 'ALLOW_SIG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'print_pm' => array('lang' => 'ALLOW_PRINT_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'forward_pm' => array('lang' => 'ALLOW_FORWARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'auth_flash_pm' => array('lang' => 'ALLOW_FLASH_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'post':
             $display_vars = array('title' => 'ACP_POST_SETTINGS', 'vars' => array('legend1' => 'GENERAL_OPTIONS', 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_post_flash' => array('lang' => 'ALLOW_POST_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_post_links' => array('lang' => 'ALLOW_POST_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), 'legend2' => 'POSTING', 'bump_type' => false, 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'delete_time' => array('lang' => 'DELETE_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0:9999999999', 'type' => 'number:0:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true), 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), 'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), 'smilies_per_page' => array('lang' => 'SMILIES_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'number:2:127', 'explain' => false), 'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0:999999', 'type' => 'number:0:999999', 'explain' => true), 'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:1:999999', 'type' => 'number:1:999999', 'explain' => true), 'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'), 'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'signature':
             $display_vars = array('title' => 'ACP_SIGNATURE_SETTINGS', 'vars' => array('legend1' => 'GENERAL_OPTIONS', 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_bbcode' => array('lang' => 'ALLOW_SIG_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_img' => array('lang' => 'ALLOW_SIG_IMG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_flash' => array('lang' => 'ALLOW_SIG_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_smilies' => array('lang' => 'ALLOW_SIG_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_links' => array('lang' => 'ALLOW_SIG_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'GENERAL_SETTINGS', 'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 'max_sig_urls' => array('lang' => 'MAX_SIG_URLS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 'max_sig_font_size' => array('lang' => 'MAX_SIG_FONT_SIZE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'), 'max_sig_smilies' => array('lang' => 'MAX_SIG_SMILIES', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'registration':
             $display_vars = array('title' => 'ACP_REGISTER_SETTINGS', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'max_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false), 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false), 'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'select', 'method' => 'select_acc_activation', 'explain' => true), 'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'number:0:255', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']), 'new_member_group_default' => array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true), 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), 'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_username_chars', 'explain' => true), 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'legend2' => 'GENERAL_OPTIONS', 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_confirm' => array('lang' => 'VISUAL_CONFIRM_REG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true), 'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 'legend3' => 'COPPA', 'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'coppa_mail' => array('lang' => 'COPPA_MAIL', 'validate' => 'string', 'type' => 'textarea:5:40', 'explain' => true), 'coppa_fax' => array('lang' => 'COPPA_FAX', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => false), 'legend4' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'feed':
             $display_vars = array('title' => 'ACP_FEED_MANAGEMENT', 'vars' => array('legend1' => 'ACP_FEED_GENERAL', 'feed_enable' => array('lang' => 'ACP_FEED_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_item_statistics' => array('lang' => 'ACP_FEED_ITEM_STATISTICS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_http_auth' => array('lang' => 'ACP_FEED_HTTP_AUTH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'legend2' => 'ACP_FEED_POST_BASED', 'feed_limit_post' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5:9999', 'type' => 'number:5:9999', 'explain' => true), 'feed_overall' => array('lang' => 'ACP_FEED_OVERALL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'legend3' => 'ACP_FEED_TOPIC_BASED', 'feed_limit_topic' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5:9999', 'type' => 'number:5:9999', 'explain' => true), 'feed_topics_new' => array('lang' => 'ACP_FEED_TOPICS_NEW', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_topics_active' => array('lang' => 'ACP_FEED_TOPICS_ACTIVE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true), 'legend4' => 'ACP_FEED_SETTINGS_OTHER', 'feed_overall_forums' => array('lang' => 'ACP_FEED_OVERALL_FORUMS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true)));
             break;
         case 'cookie':
             $display_vars = array('title' => 'ACP_COOKIE_SETTINGS', 'vars' => array('legend1' => 'ACP_COOKIE_SETTINGS', 'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => false), 'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => false), 'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => false), 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:disabled_enabled', 'explain' => true)));
             break;
         case 'load':
             $display_vars = array('title' => 'ACP_LOAD_SETTINGS', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'limit_load' => array('lang' => 'LIMIT_LOAD', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60:9999999999', 'type' => 'number:60:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'read_notification_expire_days' => array('lang' => 'READ_NOTIFICATION_EXPIRE_DAYS', 'validate' => 'int:0', 'type' => 'number:0', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'legend2' => 'GENERAL_OPTIONS', 'load_notifications' => array('lang' => 'LOAD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_anon_lastread' => array('lang' => 'YES_ANON_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_online' => array('lang' => 'YES_ONLINE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_unreads_search' => array('lang' => 'YES_UNREAD_SEARCH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_tplcompile' => array('lang' => 'RECOMPILE_STYLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_cdn' => array('lang' => 'ALLOW_CDN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_live_searches' => array('lang' => 'ALLOW_LIVE_SEARCHES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'CUSTOM_PROFILE_FIELDS', 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_pm' => array('lang' => 'LOAD_CPF_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'legend4' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'auth':
             $display_vars = array('title' => 'ACP_AUTH_SETTINGS', 'vars' => array('legend1' => 'ACP_AUTH_SETTINGS', 'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select:1:toggable', 'method' => 'select_auth_method', 'explain' => false)));
             break;
         case 'server':
             $display_vars = array('title' => 'ACP_SERVER_SETTINGS', 'vars' => array('legend1' => 'ACP_SERVER_SETTINGS', 'gzip_compress' => array('lang' => 'ENABLE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'use_system_cron' => array('lang' => 'USE_SYSTEM_CRON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'PATH_SETTINGS', 'enable_mod_rewrite' => array('lang' => 'MOD_REWRITE_ENABLE', 'validate' => 'bool', 'type' => 'custom', 'method' => 'enable_mod_rewrite', 'explain' => true), 'smilies_path' => array('lang' => 'SMILIES_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 'icons_path' => array('lang' => 'ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 'ranks_path' => array('lang' => 'RANKS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 'legend3' => 'SERVER_URL_SETTINGS', 'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true), 'server_name' => array('lang' => 'SERVER_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), 'server_port' => array('lang' => 'SERVER_PORT', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), 'script_path' => array('lang' => 'SCRIPT_PATH', 'validate' => 'script_path', 'type' => 'text::255', 'explain' => true), 'legend4' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'security':
             $display_vars = array('title' => 'ACP_SECURITY_SETTINGS', 'vars' => array('legend1' => 'ACP_SECURITY_SETTINGS', 'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_password_reset' => array('lang' => 'ALLOW_PASSWORD_RESET', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true), 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'referer_validation' => array('lang' => 'REFERRER_VALID', 'validate' => 'int:0:3', 'type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false), 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true), 'ip_login_limit_max' => array('lang' => 'IP_LOGIN_LIMIT_MAX', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true), 'ip_login_limit_time' => array('lang' => 'IP_LOGIN_LIMIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'ip_login_limit_use_forwarded' => array('lang' => 'IP_LOGIN_LIMIT_USE_FORWARDED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'tpl_allow_php' => array('lang' => 'TPL_ALLOW_PHP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'form_token_lifetime' => array('lang' => 'FORM_TIME_MAX', 'validate' => 'int:-1:99999', 'type' => 'number:-1:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'form_token_sid_guests' => array('lang' => 'FORM_SID_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true)));
             break;
         case 'email':
             $display_vars = array('title' => 'ACP_EMAIL_SETTINGS', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'validate' => 'string', 'type' => 'text:20:50', 'explain' => true), 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'number:0:99999', 'explain' => true), 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), 'board_contact_name' => array('lang' => 'CONTACT_EMAIL_NAME', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true), 'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'SMTP_SETTINGS', 'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => false), 'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true), 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true), 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         default:
             trigger_error('NO_MODE', E_USER_ERROR);
             break;
     }
     /**
      * Event to add and/or modify acp_board configurations
      *
      * @event core.acp_board_config_edit_add
      * @var	array	display_vars	Array of config values to display and process
      * @var	string	mode			Mode of the config page we are displaying
      * @var	boolean	submit			Do we display the form or process the submission
      * @since 3.1.0-a4
      */
     $vars = array('display_vars', 'mode', 'submit');
     extract($phpbb_dispatcher->trigger_event('core.acp_board_config_edit_add', compact($vars)));
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     $cfg_array = isset($_REQUEST['config']) ? $request->variable('config', array('' => ''), true) : $this->new_config;
     $error = array();
     // We validate the complete config if wished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $data) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id') {
             continue;
         }
         if ($config_name == 'guest_style') {
             if (isset($cfg_array[$config_name])) {
                 $this->guest_style_set($cfg_array[$config_name]);
             }
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($config_name == 'email_function_name') {
             $this->new_config['email_function_name'] = trim(str_replace(array('(', ')'), array('', ''), $this->new_config['email_function_name']));
             $this->new_config['email_function_name'] = empty($this->new_config['email_function_name']) || !function_exists($this->new_config['email_function_name']) ? 'mail' : $this->new_config['email_function_name'];
             $config_value = $this->new_config['email_function_name'];
         }
         if ($submit) {
             if (strpos($data['type'], 'password') === 0 && $config_value === '********') {
                 // Do not update password fields if the content is ********,
                 // because that is the password replacement we use to not
                 // send the password to the output
                 continue;
             }
             $config->set($config_name, $config_value);
             if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable'])) {
                 enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2));
             }
         }
     }
     // Store news and exclude ids
     if ($mode == 'feed' && $submit) {
         $cache->destroy('_feed_news_forum_ids');
         $cache->destroy('_feed_excluded_forum_ids');
         $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id');
         $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id');
     }
     if ($mode == 'auth') {
         // Retrieve a list of auth plugins and check their config values
         /* @var $auth_providers \phpbb\auth\provider_collection */
         $auth_providers = $phpbb_container->get('auth.provider_collection');
         $updated_auth_settings = false;
         $old_auth_config = array();
         foreach ($auth_providers as $provider) {
             /** @var \phpbb\auth\provider\provider_interface $provider */
             if ($fields = $provider->acp()) {
                 // Check if we need to create config fields for this plugin and save config when submit was pressed
                 foreach ($fields as $field) {
                     if (!isset($config[$field])) {
                         $config->set($field, '');
                     }
                     if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false) {
                         continue;
                     }
                     if (substr($field, -9) === '_password' && $cfg_array[$field] === '********') {
                         // Do not update password fields if the content is ********,
                         // because that is the password replacement we use to not
                         // send the password to the output
                         continue;
                     }
                     $old_auth_config[$field] = $this->new_config[$field];
                     $config_value = $cfg_array[$field];
                     $this->new_config[$field] = $config_value;
                     if ($submit) {
                         $updated_auth_settings = true;
                         $config->set($field, $config_value);
                     }
                 }
             }
             unset($fields);
         }
         if ($submit && ($cfg_array['auth_method'] != $this->new_config['auth_method'] || $updated_auth_settings)) {
             $method = basename($cfg_array['auth_method']);
             if (array_key_exists('auth.provider.' . $method, $auth_providers)) {
                 $provider = $auth_providers['auth.provider.' . $method];
                 if ($error = $provider->init()) {
                     foreach ($old_auth_config as $config_name => $config_value) {
                         $config->set($config_name, $config_value);
                     }
                     trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING);
                 }
                 $config->set('auth_method', basename($cfg_array['auth_method']));
             } else {
                 trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR);
             }
         }
     }
     if ($submit) {
         $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_' . strtoupper($mode));
         $message = $user->lang('CONFIG_UPDATED');
         $message_type = E_USER_NOTICE;
         if (!$config['email_enable'] && in_array($mode, array('email', 'registration')) && in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN))) {
             $message .= '<br /><br />' . $user->lang('ACC_ACTIVATION_WARNING');
             $message_type = E_USER_WARNING;
         }
         trigger_error($message . adm_back_link($this->u_action), $message_type);
     }
     $this->tpl_name = 'acp_board';
     $this->page_title = $display_vars['title'];
     $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
     if ($mode == 'auth') {
         $template->assign_var('S_AUTH', true);
         foreach ($auth_providers as $provider) {
             $auth_tpl = $provider->get_acp_template($this->new_config);
             if ($auth_tpl) {
                 if (array_key_exists('BLOCK_VAR_NAME', $auth_tpl)) {
                     foreach ($auth_tpl['BLOCK_VARS'] as $block_vars) {
                         $template->assign_block_vars($auth_tpl['BLOCK_VAR_NAME'], $block_vars);
                     }
                 }
                 $template->assign_vars($auth_tpl['TEMPLATE_VARS']);
                 $template->assign_block_vars('auth_tpl', array('TEMPLATE_FILE' => $auth_tpl['TEMPLATE_FILE']));
             }
         }
     }
 }
コード例 #22
0
ファイル: index.php プロジェクト: napus/support-toolkit
             continue;
         }
         if (strpos($name, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $name, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $name, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content['tpl'], 'S_FIND_USER' => isset($content['find_user']) ? true : false, 'U_FIND_USER' => isset($content['find_user']) ? append_sid(PHPBB_ROOT_PATH . 'memberlist.' . PHP_EXT, array('mode' => 'searchuser', 'form' => 'select_user', 'field' => 'username', 'select_single' => 'true', 'form' => 'stk', 'field' => $content['find_user_field'])) : ''));
     }
     $template->set_filenames(array('body' => 'tool_options.html'));
     page_footer();
 } else {
     if (is_string($options)) {
         if (confirm_box(true)) {
             $tool->run_tool();
         } else {
             confirm_box(false, $options, '', 'confirm_body.html', STK_DIR_NAME . '/index.' . PHP_EXT . $plugin->url_arg(true));
         }
     } else {
コード例 #23
0
ファイル: pmwelcome_module.php プロジェクト: Galixte/apwa
 function main($id, $mode)
 {
     global $config, $user, $template, $request, $phpbb_container;
     $this->user = $user;
     $this->tpl_name = 'acp_board';
     $this->page_title = 'ACP_PMWELCOME_SETTINGS';
     $submit = $request->is_set_post('submit');
     $form_key = 'pmwelcome';
     add_form_key($form_key);
     $display_vars = array('title' => 'ACP_PMWELCOME', 'vars' => array('legend1' => 'ACP_PMWELCOME_SETTINGS', 'pmwelcome_user' => array('lang' => 'ACP_PMWELCOME_USER', 'validate' => 'int:0:255', 'type' => 'number:0:255', 'explain' => true), 'pmwelcome_subject' => array('lang' => 'ACP_PMWELCOME_SUBJECT', 'validate' => 'string', 'type' => 'text:50:250', 'explain' => false), 'pmwelcome_post_text' => array('lang' => 'ACP_PMWELCOME_TEXT', 'validate' => '', 'type' => 'textarea:15:30', 'explain' => true), 'legend2' => 'ACP_SUBMIT_CHANGES'));
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     $cfg_array = $request->is_set('config') ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if wished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     /* config text class && Anvar */
     $config_text = $phpbb_container->get('config_text');
     $text_ary = array('pmwelcome_post_text');
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             /* Add config text && Anvar */
             if (in_array($config_name, $text_ary)) {
                 $config_text->set($config_name, $config_value);
             } else {
                 $config->set($config_name, $config_value);
             }
         }
     }
     if ($submit) {
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     $this->page_title = $display_vars['title'];
     $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         /* Get config text && Anvar */
         if (in_array($config_key, $text_ary)) {
             $this->new_config[$config_key] = $config_text->get($config_key);
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #24
0
ファイル: acp_board.php プロジェクト: puring0815/OpenKore
 function main($id, $mode)
 {
     global $db, $user, $auth, $template;
     global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
     $user->add_lang('acp/board');
     $action = request_var('action', '');
     $submit = isset($_POST['submit']) ? true : false;
     $form_key = 'acp_board';
     add_form_key($form_key);
     /**
      *	Validation types are:
      *		string, int, bool,
      *		script_path (absolute path in url - beginning with / and no trailing slash),
      *		rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
      */
     switch ($mode) {
         case 'settings':
             $display_vars = array('title' => 'ACP_BOARD_SETTINGS', 'vars' => array('legend1' => 'ACP_BOARD_SETTINGS', 'sitename' => array('lang' => 'SITE_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), 'site_desc' => array('lang' => 'SITE_DESC', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), 'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true), 'board_disable_msg' => false, 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'string', 'type' => 'select', 'function' => 'tz_select', 'params' => array('{CONFIG_VALUE}', 1), 'explain' => false), 'board_dst' => array('lang' => 'SYSTEM_DST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => false), 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'WARNINGS', 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int', 'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'features':
             $display_vars = array('title' => 'ACP_BOARD_FEATURES', 'vars' => array('legend1' => 'ACP_BOARD_FEATURES', 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board_trashcan' => array('lang' => 'BOARD_TRASHCAN', 'validate' => 'int', 'type' => 'select', 'explain' => true, 'function' => 'make_forum_select'), 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'ACP_LOAD_SETTINGS', 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_global_announcements_home' => array('lang' => 'LOAD_GLOBAL_ANNOUNCEMENTS_HOME', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_global_announcements_topic' => array('lang' => 'LOAD_GLOBAL_ANNOUNCEMENTS_TOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'avatar':
             $display_vars = array('title' => 'ACP_AVATAR_SETTINGS', 'vars' => array('legend1' => 'ACP_AVATAR_SETTINGS', 'avatar_min_width' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'avatar_min_height' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'avatar_max_width' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_avatar_remote_upload' => array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rwpath', 'type' => 'text:20:255', 'explain' => true), 'avatar_gallery_path' => array('lang' => 'AVATAR_GALLERY_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true)));
             break;
         case 'message':
             $display_vars = array('title' => 'ACP_MESSAGE_SETTINGS', 'lang' => 'ucp', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'validate' => 'int', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true), 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'pm_max_recipients' => array('lang' => 'PM_MAX_RECIPIENTS', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), 'legend2' => 'GENERAL_OPTIONS', 'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'auth_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'auth_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_pm' => array('lang' => 'ALLOW_SIG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'print_pm' => array('lang' => 'ALLOW_PRINT_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'forward_pm' => array('lang' => 'ALLOW_FORWARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'auth_flash_pm' => array('lang' => 'ALLOW_FLASH_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'post':
             $display_vars = array('title' => 'ACP_POST_SETTINGS', 'vars' => array('legend1' => 'GENERAL_OPTIONS', 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_post_flash' => array('lang' => 'ALLOW_POST_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_post_links' => array('lang' => 'ALLOW_POST_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'POSTING', 'bump_type' => false, 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'delete_time' => array('lang' => 'DELETE_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true), 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), 'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), 'smilies_per_page' => array('lang' => 'SMILIES_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0', 'type' => 'text:3:4', 'explain' => true), 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'text:4:4', 'explain' => false), 'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true), 'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true), 'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), 'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'), 'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'signature':
             $display_vars = array('title' => 'ACP_SIGNATURE_SETTINGS', 'vars' => array('legend1' => 'GENERAL_OPTIONS', 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_bbcode' => array('lang' => 'ALLOW_SIG_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_img' => array('lang' => 'ALLOW_SIG_IMG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_flash' => array('lang' => 'ALLOW_SIG_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_smilies' => array('lang' => 'ALLOW_SIG_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_links' => array('lang' => 'ALLOW_SIG_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'GENERAL_SETTINGS', 'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), 'max_sig_urls' => array('lang' => 'MAX_SIG_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), 'max_sig_font_size' => array('lang' => 'MAX_SIG_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'), 'max_sig_smilies' => array('lang' => 'MAX_SIG_SMILIES', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), 'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'registration':
             $display_vars = array('title' => 'ACP_REGISTER_SETTINGS', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'max_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false), 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false), 'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_acc_activation', 'explain' => true), 'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'text:4:4', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']), 'new_member_group_default' => array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true), 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), 'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_username_chars', 'explain' => true), 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'legend2' => 'GENERAL_OPTIONS', 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_confirm' => array('lang' => 'VISUAL_CONFIRM_REG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true), 'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'legend3' => 'COPPA', 'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'coppa_mail' => array('lang' => 'COPPA_MAIL', 'validate' => 'string', 'type' => 'textarea:5:40', 'explain' => true), 'coppa_fax' => array('lang' => 'COPPA_FAX', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => false), 'legend4' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'feed':
             $display_vars = array('title' => 'ACP_FEED_MANAGEMENT', 'vars' => array('legend1' => 'ACP_FEED_GENERAL', 'feed_enable' => array('lang' => 'ACP_FEED_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_item_statistics' => array('lang' => 'ACP_FEED_ITEM_STATISTICS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_limit' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => true), 'feed_overall_forums' => array('lang' => 'ACP_FEED_OVERALL_FORUMS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_overall_forums_limit' => array('lang' => 'ACP_FEED_OVERALL_FORUMS_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => false), 'feed_overall_topics' => array('lang' => 'ACP_FEED_OVERALL_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_overall_topics_limit' => array('lang' => 'ACP_FEED_OVERALL_TOPIC_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => false), 'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true), 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true)));
             break;
         case 'cookie':
             $display_vars = array('title' => 'ACP_COOKIE_SETTINGS', 'vars' => array('legend1' => 'ACP_COOKIE_SETTINGS', 'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => false), 'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => false), 'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => false), 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:disabled_enabled', 'explain' => true)));
             break;
         case 'load':
             $display_vars = array('title' => 'ACP_LOAD_SETTINGS', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'limit_load' => array('lang' => 'LIMIT_LOAD', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true), 'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60', 'type' => 'text:5:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0', 'type' => 'text:4:3', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'legend2' => 'GENERAL_OPTIONS', 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_anon_lastread' => array('lang' => 'YES_ANON_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_online' => array('lang' => 'YES_ONLINE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_tplcompile' => array('lang' => 'RECOMPILE_STYLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'CUSTOM_PROFILE_FIELDS', 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'legend4' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'auth':
             $display_vars = array('title' => 'ACP_AUTH_SETTINGS', 'vars' => array('legend1' => 'ACP_AUTH_SETTINGS', 'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'select_auth_method', 'explain' => false)));
             break;
         case 'server':
             $display_vars = array('title' => 'ACP_SERVER_SETTINGS', 'vars' => array('legend1' => 'ACP_SERVER_SETTINGS', 'gzip_compress' => array('lang' => 'ENABLE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'PATH_SETTINGS', 'smilies_path' => array('lang' => 'SMILIES_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 'icons_path' => array('lang' => 'ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 'ranks_path' => array('lang' => 'RANKS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 'legend3' => 'SERVER_URL_SETTINGS', 'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true), 'server_name' => array('lang' => 'SERVER_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), 'server_port' => array('lang' => 'SERVER_PORT', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), 'script_path' => array('lang' => 'SCRIPT_PATH', 'validate' => 'script_path', 'type' => 'text::255', 'explain' => true), 'legend4' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'security':
             $display_vars = array('title' => 'ACP_SECURITY_SETTINGS', 'vars' => array('legend1' => 'ACP_SECURITY_SETTINGS', 'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true), 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'referer_validation' => array('lang' => 'REFERER_VALID', 'validate' => 'int:0:3', 'type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true), 'tpl_allow_php' => array('lang' => 'TPL_ALLOW_PHP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'form_token_lifetime' => array('lang' => 'FORM_TIME_MAX', 'validate' => 'int:-1', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'form_token_sid_guests' => array('lang' => 'FORM_SID_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true)));
             break;
         case 'email':
             $display_vars = array('title' => 'ACP_EMAIL_SETTINGS', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'validate' => 'string', 'type' => 'text:20:50', 'explain' => true), 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => true), 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => true), 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true), 'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'SMTP_SETTINGS', 'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => false), 'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0', 'type' => 'text:4:5', 'explain' => true), 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true), 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true), 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         default:
             trigger_error('NO_MODE', E_USER_ERROR);
             break;
     }
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if whished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id') {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($config_name == 'email_function_name') {
             $this->new_config['email_function_name'] = trim(str_replace(array('(', ')'), array('', ''), $this->new_config['email_function_name']));
             $this->new_config['email_function_name'] = empty($this->new_config['email_function_name']) || !function_exists($this->new_config['email_function_name']) ? 'mail' : $this->new_config['email_function_name'];
             $config_value = $this->new_config['email_function_name'];
         }
         if ($submit) {
             set_config($config_name, $config_value);
         }
     }
     // Store news and exclude ids
     if ($mode == 'feed' && $submit) {
         $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id');
         $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id');
     }
     if ($mode == 'auth') {
         // Retrieve a list of auth plugins and check their config values
         $auth_plugins = array();
         $dp = @opendir($phpbb_root_path . 'includes/auth');
         if ($dp) {
             while (($file = readdir($dp)) !== false) {
                 if (preg_match('#^auth_(.*?)\\.' . $phpEx . '$#', $file)) {
                     $auth_plugins[] = basename(preg_replace('#^auth_(.*?)\\.' . $phpEx . '$#', '\\1', $file));
                 }
             }
             closedir($dp);
             sort($auth_plugins);
         }
         $updated_auth_settings = false;
         $old_auth_config = array();
         foreach ($auth_plugins as $method) {
             if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) {
                 include_once $phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx;
                 $method = 'acp_' . $method;
                 if (function_exists($method)) {
                     if ($fields = $method($this->new_config)) {
                         // Check if we need to create config fields for this plugin and save config when submit was pressed
                         foreach ($fields['config'] as $field) {
                             if (!isset($config[$field])) {
                                 set_config($field, '');
                             }
                             if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false) {
                                 continue;
                             }
                             $old_auth_config[$field] = $this->new_config[$field];
                             $config_value = $cfg_array[$field];
                             $this->new_config[$field] = $config_value;
                             if ($submit) {
                                 $updated_auth_settings = true;
                                 set_config($field, $config_value);
                             }
                         }
                     }
                     unset($fields);
                 }
             }
         }
         if ($submit && ($cfg_array['auth_method'] != $this->new_config['auth_method'] || $updated_auth_settings)) {
             $method = basename($cfg_array['auth_method']);
             if ($method && in_array($method, $auth_plugins)) {
                 include_once $phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx;
                 $method = 'init_' . $method;
                 if (function_exists($method)) {
                     if ($error = $method()) {
                         foreach ($old_auth_config as $config_name => $config_value) {
                             set_config($config_name, $config_value);
                         }
                         trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING);
                     }
                 }
                 set_config('auth_method', basename($cfg_array['auth_method']));
             } else {
                 trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR);
             }
         }
     }
     if ($submit) {
         add_log('admin', 'LOG_CONFIG_' . strtoupper($mode));
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     $this->tpl_name = 'acp_board';
     $this->page_title = $display_vars['title'];
     $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
     if ($mode == 'auth') {
         $template->assign_var('S_AUTH', true);
         foreach ($auth_plugins as $method) {
             if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) {
                 $method = 'acp_' . $method;
                 if (function_exists($method)) {
                     $fields = $method($this->new_config);
                     if ($fields['tpl']) {
                         $template->assign_block_vars('auth_tpl', array('TPL' => $fields['tpl']));
                     }
                     unset($fields);
                 }
             }
         }
     }
 }
コード例 #25
0
ファイル: acp_board.php プロジェクト: corycubbage/ShadoWorld
 function main($id, $mode)
 {
     global $db, $user, $auth, $template;
     global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
     global $cache;
     $user->add_lang('acp/board');
     $action = request_var('action', '');
     $submit = isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable']) ? true : false;
     $form_key = 'acp_board';
     add_form_key($form_key);
     /**
      * 	Validation types are:
      * 		string, int, bool,
      * 		script_path (absolute path in url - beginning with / and no trailing slash),
      * 		rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
      */
     switch ($mode) {
         case 'settings':
             $display_vars = array('title' => 'ACP_BOARD_SETTINGS', 'vars' => array('legend1' => 'ACP_BOARD_SETTINGS', 'sitename' => array('lang' => 'SITE_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), 'site_desc' => array('lang' => 'SITE_DESC', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), 'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true), 'board_disable_msg' => false, 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'string', 'type' => 'select', 'function' => 'tz_select', 'params' => array('{CONFIG_VALUE}', 1), 'explain' => true), 'board_dst' => array('lang' => 'SYSTEM_DST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => false), 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'WARNINGS', 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int', 'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'features':
             $display_vars = array('title' => 'ACP_BOARD_FEATURES', 'vars' => array('legend1' => 'ACP_BOARD_FEATURES', 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), 'legend2' => 'ACP_LOAD_SETTINGS', 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'avatar':
             $display_vars = array('title' => 'ACP_AVATAR_SETTINGS', 'vars' => array('legend1' => 'ACP_AVATAR_SETTINGS', 'avatar_min_width' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'avatar_min_height' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'avatar_max_width' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_avatar_remote_upload' => array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rwpath', 'type' => 'text:20:255', 'explain' => true), 'avatar_gallery_path' => array('lang' => 'AVATAR_GALLERY_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true)));
             break;
         case 'message':
             $display_vars = array('title' => 'ACP_MESSAGE_SETTINGS', 'lang' => 'ucp', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'validate' => 'int', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true), 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'pm_max_recipients' => array('lang' => 'PM_MAX_RECIPIENTS', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), 'legend2' => 'GENERAL_OPTIONS', 'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'auth_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'auth_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_pm' => array('lang' => 'ALLOW_SIG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'print_pm' => array('lang' => 'ALLOW_PRINT_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'forward_pm' => array('lang' => 'ALLOW_FORWARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'auth_flash_pm' => array('lang' => 'ALLOW_FLASH_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'post':
             $display_vars = array('title' => 'ACP_POST_SETTINGS', 'vars' => array('legend1' => 'GENERAL_OPTIONS', 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_post_flash' => array('lang' => 'ALLOW_POST_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_post_links' => array('lang' => 'ALLOW_POST_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), 'legend2' => 'POSTING', 'bump_type' => false, 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'delete_time' => array('lang' => 'DELETE_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true), 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), 'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), 'smilies_per_page' => array('lang' => 'SMILIES_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0', 'type' => 'text:3:4', 'explain' => true), 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'text:4:4', 'explain' => false), 'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true), 'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:1', 'type' => 'text:4:6', 'explain' => true), 'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), 'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'), 'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             //-- MOD : AOS Who Visited a Topic - Start -----------------------------------------------//
             include $phpbb_root_path . 'includes/who_visited_a_topic.' . $phpEx;
             aos_display_acp_options($display_vars);
             //-- MOD : AOS Who Visited a Topic - End -------------------------------------------------//
             break;
         case 'signature':
             $display_vars = array('title' => 'ACP_SIGNATURE_SETTINGS', 'vars' => array('legend1' => 'GENERAL_OPTIONS', 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_bbcode' => array('lang' => 'ALLOW_SIG_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_img' => array('lang' => 'ALLOW_SIG_IMG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_flash' => array('lang' => 'ALLOW_SIG_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_smilies' => array('lang' => 'ALLOW_SIG_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_sig_links' => array('lang' => 'ALLOW_SIG_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'GENERAL_SETTINGS', 'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), 'max_sig_urls' => array('lang' => 'MAX_SIG_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), 'max_sig_font_size' => array('lang' => 'MAX_SIG_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'), 'max_sig_smilies' => array('lang' => 'MAX_SIG_SMILIES', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), 'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'legend3' => 'EDIT_VARIABLE_SETTINGS', 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'string', 'type' => 'select', 'function' => 'tz_select1', 'params' => array('{CONFIG_VALUE}', 1), 'explain' => true), 'current_hit' => array('lang' => 'MAX_SIG_VARIABLE_CURRENT_HIT', 'validate' => 'string', 'type' => 'custom', 'method' => 'current_hit', 'explain' => true), 'maximum_hit' => array('lang' => 'MAX_SIG_VARIABLE_MAXIMUM_HIT', 'validate' => 'string', 'type' => 'custom', 'method' => 'maximum_hit', 'explain' => true), 'change_good_condition' => array('lang' => 'MAX_SIG_VARIABLE_GOOD_CONDITION', 'validate' => 'string', 'type' => 'custom', 'method' => 'change_good_condition', 'explain' => true), 'change_bad_condition' => array('lang' => 'MAX_SIG_VARIABLE_BAD_CONDITION', 'validate' => 'string', 'type' => 'custom', 'method' => 'change_bad_condition', 'explain' => true), 'change_gear' => array('lang' => 'MAX_SIG_VARIABLE_GEAR', 'validate' => 'string', 'type' => 'custom', 'method' => 'change_gear', 'explain' => true), 'change_level' => array('lang' => 'MAX_SIG_VARIABLE_LAVEL', 'validate' => 'string', 'type' => 'custom', 'method' => 'change_level', 'explain' => true), 'change_min_level' => array('lang' => 'MAX_SIG_VARIABLE_LAVEL_MIN', 'validate' => 'string', 'type' => 'custom', 'method' => 'change_min_level', 'explain' => true), 'change_max_level' => array('lang' => 'MAX_SIG_VARIABLE_LAVEL_MAX', 'validate' => 'string', 'type' => 'custom', 'method' => 'change_max_level', 'explain' => true), 'change_min_ability' => array('lang' => 'MAX_SIG_VARIABLE_MIN_ABILITY', 'validate' => 'string', 'type' => 'custom', 'method' => 'change_min_ability', 'explain' => true), 'change_max_ability' => array('lang' => 'MAX_SIG_VARIABLE_MAX_ABILITY', 'validate' => 'string', 'type' => 'custom', 'method' => 'change_max_ability', 'explain' => true), 'change_gear' => array('lang' => 'MAX_SIG_VARIABLE_GEAR', 'validate' => 'string', 'type' => 'custom', 'method' => 'change_gear', 'explain' => true), 'change_spell' => array('lang' => 'MAX_SIG_VARIABLE_SPELL', 'validate' => 'string', 'type' => 'custom', 'method' => 'change_spell', 'explain' => true), 'legend4' => 'NEW_VARIABLE_SETTINGS', 'new_current_hit' => array('lang' => 'MAX_SIG_NEW_VARIABLE_CURRENT_HIT', 'validate' => '', 'type' => 'text:5:4', 'explain' => true), 'new_maximum_hit' => array('lang' => 'MAX_SIG_NEW_VARIABLE_MAXIMUM_HIT', 'validate' => '', 'type' => 'text:5:4', 'explain' => true), 'new_good_condition' => array('lang' => 'MAX_SIG_NEW_VARIABLE_GOOD_CONDITION', 'validate' => '', 'type' => 'text:5:15', 'explain' => true), 'new_bad_condition' => array('lang' => 'MAX_SIG_NEW_VARIABLE_BAD_CONDITION', 'validate' => '', 'type' => 'text:5:15', 'explain' => true), 'new_level' => array('lang' => 'MAX_SIG_NEW_VARIABLE_NEW_LEVEL', 'validate' => '', 'type' => 'text:5:4', 'explain' => true), 'new_minimum_level' => array('lang' => 'MAX_SIG_NEW_VARIABLE_NEW_LEVEL_MIN', 'validate' => '', 'type' => 'text:5:4', 'explain' => true), 'new_maximum_level' => array('lang' => 'MAX_SIG_NEW_VARIABLE_NEW_LEVEL_MAX', 'validate' => '', 'type' => 'text:5:15', 'explain' => true), 'new_minimum_ability' => array('lang' => 'MAX_SIG_NEW_VARIABLE_MINIMUM_ABILITY', 'validate' => '', 'type' => 'text:5:15', 'explain' => true), 'new_maximum_ability' => array('lang' => 'MAX_SIG_NEW_VARIABLE_MAXIMUM_ABILITY', 'validate' => '', 'type' => 'text:5:15', 'explain' => true), 'new_gear' => array('lang' => 'MAX_SIG_NEW_VARIABLE_GEAR', 'validate' => '', 'type' => 'text:5:15', 'explain' => true), 'new_spell' => array('lang' => 'MAX_ADD_NEW_SPELL', 'validate' => '', 'type' => 'text:5:15', 'explain' => true), 'legend6' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'registration':
             $display_vars = array('title' => 'ACP_REGISTER_SETTINGS', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'max_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false), 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false), 'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'select', 'method' => 'select_acc_activation', 'explain' => true), 'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'text:4:4', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']), 'new_member_group_default' => array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true), 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), 'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_username_chars', 'explain' => true), 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'legend2' => 'GENERAL_OPTIONS', 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_confirm' => array('lang' => 'VISUAL_CONFIRM_REG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true), 'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'legend3' => 'COPPA', 'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'coppa_mail' => array('lang' => 'COPPA_MAIL', 'validate' => 'string', 'type' => 'textarea:5:40', 'explain' => true), 'coppa_fax' => array('lang' => 'COPPA_FAX', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => false), 'legend4' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'feed':
             $display_vars = array('title' => 'ACP_FEED_MANAGEMENT', 'vars' => array('legend1' => 'ACP_FEED_GENERAL', 'feed_enable' => array('lang' => 'ACP_FEED_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_item_statistics' => array('lang' => 'ACP_FEED_ITEM_STATISTICS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_http_auth' => array('lang' => 'ACP_FEED_HTTP_AUTH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'legend2' => 'ACP_FEED_POST_BASED', 'feed_limit_post' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => true), 'feed_overall' => array('lang' => 'ACP_FEED_OVERALL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'legend3' => 'ACP_FEED_TOPIC_BASED', 'feed_limit_topic' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => true), 'feed_topics_new' => array('lang' => 'ACP_FEED_TOPICS_NEW', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_topics_active' => array('lang' => 'ACP_FEED_TOPICS_ACTIVE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true), 'legend4' => 'ACP_FEED_SETTINGS_OTHER', 'feed_overall_forums' => array('lang' => 'ACP_FEED_OVERALL_FORUMS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true)));
             break;
         case 'cookie':
             $display_vars = array('title' => 'ACP_COOKIE_SETTINGS', 'vars' => array('legend1' => 'ACP_COOKIE_SETTINGS', 'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => false), 'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => false), 'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => false), 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:disabled_enabled', 'explain' => true)));
             break;
         case 'load':
             $display_vars = array('title' => 'ACP_LOAD_SETTINGS', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'limit_load' => array('lang' => 'LIMIT_LOAD', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true), 'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60', 'type' => 'text:5:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0', 'type' => 'text:4:3', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 'legend2' => 'GENERAL_OPTIONS', 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_anon_lastread' => array('lang' => 'YES_ANON_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_online' => array('lang' => 'YES_ONLINE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_unreads_search' => array('lang' => 'YES_UNREAD_SEARCH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_tplcompile' => array('lang' => 'RECOMPILE_STYLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'CUSTOM_PROFILE_FIELDS', 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'legend4' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'auth':
             $display_vars = array('title' => 'ACP_AUTH_SETTINGS', 'vars' => array('legend1' => 'ACP_AUTH_SETTINGS', 'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'select_auth_method', 'explain' => false)));
             break;
         case 'server':
             $display_vars = array('title' => 'ACP_SERVER_SETTINGS', 'vars' => array('legend1' => 'ACP_SERVER_SETTINGS', 'gzip_compress' => array('lang' => 'ENABLE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'PATH_SETTINGS', 'smilies_path' => array('lang' => 'SMILIES_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 'icons_path' => array('lang' => 'ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 'ranks_path' => array('lang' => 'RANKS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 'legend3' => 'SERVER_URL_SETTINGS', 'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true), 'server_name' => array('lang' => 'SERVER_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), 'server_port' => array('lang' => 'SERVER_PORT', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), 'script_path' => array('lang' => 'SCRIPT_PATH', 'validate' => 'script_path', 'type' => 'text::255', 'explain' => true), 'legend4' => 'ACP_SUBMIT_CHANGES'));
             break;
         case 'security':
             $display_vars = array('title' => 'ACP_SECURITY_SETTINGS', 'vars' => array('legend1' => 'ACP_SECURITY_SETTINGS', 'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true), 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'referer_validation' => array('lang' => 'REFERER_VALID', 'validate' => 'int:0:3', 'type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false), 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true), 'ip_login_limit_max' => array('lang' => 'IP_LOGIN_LIMIT_MAX', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true), 'ip_login_limit_time' => array('lang' => 'IP_LOGIN_LIMIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'ip_login_limit_use_forwarded' => array('lang' => 'IP_LOGIN_LIMIT_USE_FORWARDED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'tpl_allow_php' => array('lang' => 'TPL_ALLOW_PHP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'form_token_lifetime' => array('lang' => 'FORM_TIME_MAX', 'validate' => 'int:-1', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'form_token_sid_guests' => array('lang' => 'FORM_SID_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true)));
             break;
         case 'email':
             $display_vars = array('title' => 'ACP_EMAIL_SETTINGS', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'validate' => 'string', 'type' => 'text:20:50', 'explain' => true), 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'text:25:100', 'explain' => true), 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'text:25:100', 'explain' => true), 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true), 'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'SMTP_SETTINGS', 'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => false), 'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0', 'type' => 'text:4:5', 'explain' => true), 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true), 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true), 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true), 'legend3' => 'ACP_SUBMIT_CHANGES'));
             break;
         default:
             trigger_error('NO_MODE', E_USER_ERROR);
             break;
     }
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     //$cfg_array = (isset(request_var('config',''))) ? utf8_normalize_nfc(request_var('config',''), array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if whished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     $cout = 1;
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id') {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($config_name == 'email_function_name') {
             $this->new_config['email_function_name'] = trim(str_replace(array('(', ')'), array('', ''), $this->new_config['email_function_name']));
             $this->new_config['email_function_name'] = empty($this->new_config['email_function_name']) || !function_exists($this->new_config['email_function_name']) ? 'mail' : $this->new_config['email_function_name'];
             $config_value = $this->new_config['email_function_name'];
         }
         if ($submit) {
             set_config($config_name, $config_value);
             if ($cout == 1) {
                 set_for_new_variables();
                 set_good_bad_new_condition();
                 set_new_level_ability();
                 set_config_for_change_variables();
                 set_chnage_good_bad_condition();
                 set_chnage_levels();
                 set_chnage_ability();
                 set_chnage_gear();
                 set_chnage_spell();
                 $cout++;
             }
             if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable'])) {
                 enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2));
             }
         }
     }
     // Store news and exclude ids
     if ($mode == 'feed' && $submit) {
         $cache->destroy('_feed_news_forum_ids');
         $cache->destroy('_feed_excluded_forum_ids');
         $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id');
         $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id');
     }
     if ($mode == 'auth') {
         // Retrieve a list of auth plugins and check their config values
         $auth_plugins = array();
         $dp = @opendir($phpbb_root_path . 'includes/auth');
         if ($dp) {
             while (($file = readdir($dp)) !== false) {
                 if (preg_match('#^auth_(.*?)\\.' . $phpEx . '$#', $file)) {
                     $auth_plugins[] = basename(preg_replace('#^auth_(.*?)\\.' . $phpEx . '$#', '\\1', $file));
                 }
             }
             closedir($dp);
             sort($auth_plugins);
         }
         $updated_auth_settings = false;
         $old_auth_config = array();
         foreach ($auth_plugins as $method) {
             if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) {
                 include_once $phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx;
                 $method = 'acp_' . $method;
                 if (function_exists($method)) {
                     if ($fields = $method($this->new_config)) {
                         // Check if we need to create config fields for this plugin and save config when submit was pressed
                         foreach ($fields['config'] as $field) {
                             if (!isset($config[$field])) {
                                 set_config($field, '');
                             }
                             if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false) {
                                 continue;
                             }
                             $old_auth_config[$field] = $this->new_config[$field];
                             $config_value = $cfg_array[$field];
                             $this->new_config[$field] = $config_value;
                             if ($submit) {
                                 $updated_auth_settings = true;
                                 set_config($field, $config_value);
                             }
                         }
                     }
                     unset($fields);
                 }
             }
         }
         if ($submit && ($cfg_array['auth_method'] != $this->new_config['auth_method'] || $updated_auth_settings)) {
             $method = basename($cfg_array['auth_method']);
             if ($method && in_array($method, $auth_plugins)) {
                 include_once $phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx;
                 $method = 'init_' . $method;
                 if (function_exists($method)) {
                     if ($error = $method()) {
                         foreach ($old_auth_config as $config_name => $config_value) {
                             set_config($config_name, $config_value);
                         }
                         trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING);
                     }
                 }
                 set_config('auth_method', basename($cfg_array['auth_method']));
             } else {
                 trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR);
             }
         }
     }
     if ($submit) {
         add_log('admin', 'LOG_CONFIG_' . strtoupper($mode));
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     $this->tpl_name = 'acp_board';
     $this->page_title = $display_vars['title'];
     //archi11 code starts :)
     global $user;
     global $db;
     $select_variables = "SELECT * from " . USER_VARIABLES_TABLE . " INNER JOIN " . USERS_TABLE . " ON " . USER_VARIABLES_TABLE . ".user_id = " . USERS_TABLE . ".user_id GROUP BY phpbb_user_variable.user_id ";
     $result1 = $db->sql_query($select_variables);
     $variable = '';
     $count = 0;
     $table = '<table><tr><th>Player Name</th><th>Player Information</th><th>Edit</th></tr>';
     $tableend = '</table>';
     while ($row = $db->sql_fetchrow($result1)) {
         $id = $row['id'];
         $player_id = $row['user_id'];
         $player_name = $row['username'];
         $image = $row['user_avatar'];
         $img = '';
         if ($image) {
             $img = "<img src='./download/file.php?avatar=" . $image . "' height=34px>";
         }
         $selected_current_hit = $row['selected_current_hit'];
         $selected_maximum_hit = $row['selected_maximum_hit'];
         $seleted_non_lethal = $row['seleted_non_lethal'];
         if (($selected_current_hit == 0 or !($selected_current_hit == '')) && ($selected_maximum_hit == 0 or !($selected_maximum_hit == '')) && ($seleted_non_lethal == 0 or !($seleted_non_lethal == ''))) {
             $brh = '[<font color="#138600">';
             if ($selected_current_hit == 0 or !($selected_current_hit == '')) {
                 if (!($selected_current_hit == '')) {
                     $brh .= 'HP:&nbsp;' . $selected_current_hit . '/' . $selected_maximum_hit;
                 }
             }
             if ($seleted_non_lethal == 0 or !($seleted_non_lethal == '')) {
                 if (!($seleted_non_lethal == '')) {
                     $brh .= ', NL:&nbsp;';
                 }
                 $brh .= $seleted_non_lethal;
             }
             if (!($seleted_non_lethal == '') or !($selected_current_hit == '')) {
                 $brh .= '</font>]';
             }
         }
         //bad good condition
         $good_condition = $row['seleted_good_condition'];
         $bad_condition = $row['seleted_bad_condition'];
         $sgc = json_decode($good_condition, true);
         $sbc = json_decode($bad_condition, true);
         if (count($sbc) > 1) {
             $seleted_bad_condition = '';
             for ($bc = 0; $bc < count($sbc); $bc++) {
                 if ($bc != count($sbc) - 1) {
                     $seleted_bad_condition .= $sbc[$bc] . ",&nbsp;";
                 } else {
                     $seleted_bad_condition .= $sbc[$bc];
                 }
             }
         } elseif (count($sbc) == 1) {
             $seleted_bad_condition .= $sbc[0];
         } elseif ($sbc == null) {
             $seleted_bad_condition = '';
         }
         //seleted good condition
         if (count($sgc) > 1) {
             $seleted_good_condition = '';
             for ($gc = 0; $gc < count($sgc); $gc++) {
                 if ($gc != count($sgc) - 1) {
                     $seleted_good_condition .= $sgc[$gc] . ",&nbsp;";
                 } else {
                     $seleted_good_condition .= $sgc[$gc];
                 }
             }
         } elseif (count($sgc) == 1) {
             $seleted_good_condition .= $sgc[0];
         } elseif ($sgc == null) {
             $seleted_good_condition = '';
         }
         if ($seleted_good_condition or $seleted_good_condition == '' or $seleted_bad_condition or $seleted_bad_condition == '') {
             if (!($seleted_good_condition == '') or !($seleted_bad_condition == '')) {
                 $con = '[';
             }
             if ($seleted_good_condition or $seleted_good_condition == '') {
                 $con .= '<font color="#0070CA ">' . $seleted_good_condition . '</font>';
             }
             if (!($seleted_good_condition == '') and !($seleted_bad_condition == '')) {
                 $con .= ',&nbsp;';
             }
             if ($seleted_bad_condition or $seleted_bad_condition == '') {
                 $con .= '<font color="#FF0000 ">' . $seleted_bad_condition . '</font>';
                 if (!($seleted_good_condition == '') or !($seleted_bad_condition == '')) {
                     $con .= ']';
                 }
             }
         }
         //sleted level or levels
         $level = json_decode($row['level'], true);
         $level_min = json_decode($row['level_min'], true);
         $level_max = json_decode($row['level_max'], true);
         $l = 'L';
         if (count($level) > 1 && $level != null) {
             $levels = '';
             for ($lvs = 0; $lvs < count($level); $lvs++) {
                 if ($lvs != count($level) - 1) {
                     $levels .= $l . "" . $level[$lvs] . ": " . $level_min[$lvs] . "/" . $level_max[$lvs] . ",&nbsp";
                 } else {
                     $levels .= $l . $level[$lvs] . ": " . $level_min[$lvs] . "/" . $level_max[$lvs];
                 }
             }
         } elseif ($level != null && count($level) == 1) {
             $levels = $l . $level[0] . ": " . $level_min[0] . "/" . $level_max[0];
         } else {
             $levels = '';
         }
         $lvls = '';
         if ($levels and $levels != 'L : /') {
             $lvls .= '[<font color="#5F497A ">' . $levels . '</font>]';
         }
         if ($levels == 'L: /') {
             $lvls = '';
         }
         //seleted ability or abilities
         $ability_name = json_decode($row['ability_name'], true);
         $min_ability = json_decode($row['min_ability'], true);
         $max_ability = json_decode($row['max_ability'], true);
         if (count($ability_name) > 1 && $ability_name != null) {
             $ability = '';
             for ($a = 0; $a < count($ability_name); $a++) {
                 if ($a != count($ability_name) - 1) {
                     $ability .= $ability_name[$a] . ": " . $min_ability[$a] . "/" . $max_ability[$a] . ",&nbsp";
                 } else {
                     $ability .= $ability_name[$a] . ": " . $min_ability[$a] . "/" . $max_ability[$a];
                 }
             }
         } elseif ($ability_name[0] != "" && count($ability_name) == 1) {
             $ability .= $ability_name[0] . ": " . $min_ability[0] . "/" . $max_ability[0];
         } else {
             $ability = '';
         }
         $ablity = '';
         if ($ability) {
             $ablity .= '[<font color="#5F497A ">' . $ability . '</font>]';
         }
         //$variable .= '<tr><td>'.$img.'</td><td><font color="#0658B0" size=3px>' . $row['username'] . '</font></td><td>: ' . $brh.$con.$lvls.$ablity.'</td></tr>';
         $variable .= '<tr><td><font color="#0658B0" size=3px>' . $row['username'] . '</font></td><td>: ' . $brh . $con . $lvls . $ablity . '</td><td><a href=./index.php?sid=' . request_var('sid', '') . '&i=board&mode=signature&player=' . $player_id . '&id=' . $id . '&playername=' . $player_name . '><img title="Edit" alt="Edit" src="./images/icon_edit.gif"></a></td></tr>';
         unset($ability);
         unset($con);
         unset($brh);
         unset($lvls);
     }
     $variabls = $table . $variable . $tableend;
     $tableid = request_var('id', '');
     if (request_var('player', '')) {
         $players_id = request_var('player', '');
         $player_name = request_var('playername', '');
         $tableid = request_var('id', '');
         $s = "SELECT * from " . USER_VARIABLES_TABLE . " where user_id=" . $players_id . " and id=" . $tableid;
         $result_post_data = $db->sql_query($s);
         while ($row = $db->sql_fetchrow($result_post_data)) {
             $selected_current_hit = $row['selected_current_hit'];
             $selected_maximum_hit = $row['selected_maximum_hit'];
             $seleted_non_lethal = $row['seleted_non_lethal'];
             $seleted_bad_condition = $row['seleted_bad_condition'];
             $seleted_good_condition = $row['seleted_good_condition'];
             $levels = $row['level'];
             $levels_min = $row['level_min'];
             $levels_max = $row['level_max'];
             $ability_namey = $row['ability_name'];
             $min_abilityy = $row['min_ability'];
             $max_abilityy = $row['max_ability'];
             $seleted_gear = $row['gear'];
             $heropoint = $row['hero_point'];
             $quick_stats = $row['quick_stats'];
             $quick_skill = $row['quick_skill'];
             $attack = $row['attack'];
             $damage = $row['damage'];
             $critical_multiplier = $row['critical_multiplier'];
             $off_range = $row['off_range'];
             $type = $row['type'];
             $weapon_name = $row['weapon_name'];
             $user_spell = $row['spell'];
         }
         $select_hit = "SELECT * from " . VARIABLES_TABLE;
         $result1 = $db->sql_query($select_hit);
         $variables = array();
         while ($row = $db->sql_fetchrow($result1)) {
             $hit_current = $row['current'];
             $hit_maximum = $row['maximum'];
             $negative_condition = $row['negative_condition'];
             $positive_condition = $row['positive_condition'];
             $level = $row['level'];
             $level_min = $row['level_min'];
             $level_max = $row['level_max'];
             $min_ability = $row['min_ability'];
             $max_ability = $row['max_ability'];
             $gear = $row['gear'];
             $non_lethal = $row['non_lethal'];
             $hero_points = $row['hero_point'];
             $quick_skill1 = $row['quick_skill'];
             $spells = $row['spell'];
         }
         $hit_current_data = json_decode($hit_current, true);
         $hit_maximum_data = json_decode($hit_maximum, true);
         sort($hit_current_data);
         sort($hit_maximum_data);
         $hit_current_data_count = count($hit_current_data);
         $hit_maximum_data_count = count($hit_maximum_data);
         $negative_condition_data1 = json_decode($negative_condition, true);
         $positive_condition_data1 = json_decode($positive_condition, true);
         $negative_condition_data = array_map('ucfirst', $negative_condition_data1);
         $positive_condition_data = array_map('ucfirst', $positive_condition_data1);
         sort($negative_condition_data);
         sort($positive_condition_data);
         $negative_condition_data_count = count($negative_condition_data);
         $positive_condition_data_count = count($positive_condition_data);
         $level_data = json_decode($level, true);
         sort($level_data);
         $level_count = count($level_data);
         $level_min_data = json_decode($level_min, true);
         sort($level_min_data);
         $level_min_data_count = count($level_min_data);
         $level_max_data = json_decode($level_max, true);
         sort($level_max_data);
         $level_max_data_count = count($level_max_data);
         $min_ability_data = json_decode($min_ability, true);
         sort($min_ability_data);
         $min_ability_data_count = count($min_ability_data);
         $max_ability_data = json_decode($max_ability, true);
         sort($max_ability_data);
         $max_ability_data_count = count($max_ability_data);
         $gear_data1 = json_decode($gear, true);
         $gear_data = array_map('ucfirst', $gear_data1);
         sort($gear_data);
         $gear_data_count = count($gear_data);
         $non_lethal_data = json_decode($non_lethal, true);
         sort($non_lethal_data);
         $non_lethal_data_count = count($non_lethal_data);
         $quick_s1 = json_decode($quick_skill1, true);
         $quick_skill_data = @array_map('ucfirst', $quick_s1);
         @sort($quick_skill_data);
         $quick_skill_data_count = count($quick_skill_data);
         $quick_skill_varr = json_decode($quick_skill, true);
         $quick_skill_var = @array_map('ucfirst', $quick_skill_varr);
         $s_quick_skill_data = '';
         $sel_skill = array();
         $sel_skill_val = array();
         for ($ss = 0; $ss < count($quick_skill_var); $ss++) {
             $exp = explode('(', $quick_skill_var[$ss]);
             $sel_skill[] = $exp[0];
             $sel_skill_val[] = $exp[1];
         }
         $increment = 0;
         $arr_merge = @array_merge($quick_skill_data, $sel_skill);
         $unique = @array_unique($arr_merge);
         $values = @array_values($unique);
         $ar = array();
         $ar = @array_diff($values, $sel_skill);
         for ($gg = 0; $gg < count($values); $gg++) {
             if ($ar) {
                 foreach ($ar as $key => $val) {
                     if ($values[$gg] == $val) {
                         $selected = 'deselected="deselected"';
                         break;
                     }
                 }
             }
             foreach ($sel_skill as $key => $val) {
                 if ($val == $values[$gg]) {
                     if ($sel_skill_val[$increment] != '') {
                         $value1 = $val . '(' . $sel_skill_val[$increment];
                     } else {
                         $value1 = $val;
                     }
                     $increment++;
                     $values[$gg] = $value1;
                     $selected = 'selected="selected"';
                     break;
                 }
             }
             $s_quick_skill_data .= "<option value=\"{$values[$gg]}\" {$selected} >{$values[$gg]}</option>";
             unset($value1);
         }
         $selected;
         $s_hit_current_data = '';
         for ($i = 0; $i < $hit_current_data_count; $i++) {
             if ($hit_current_data[$i] == $selected_current_hit) {
                 $selected = 'selected="selected"';
             } else {
                 $selected = '';
             }
             $s_hit_current_data .= "<option value=\"{$hit_current_data[$i]}\" {$selected} >{$hit_current_data[$i]}</option>";
         }
         $s_hit_maximum_data = '';
         for ($i = 0; $i < $hit_maximum_data_count; $i++) {
             if ($hit_maximum_data[$i] == $selected_maximum_hit) {
                 $selected = ' selected="selected"';
             } else {
                 $selected = '';
             }
             $s_hit_maximum_data .= "<option value=\"{$hit_maximum_data[$i]}\"{$selected}>{$hit_maximum_data[$i]}</option>";
         }
         $s_non_lethal_data = '';
         for ($i = 0; $i < $non_lethal_data_count; $i++) {
             if ($non_lethal_data[$i] == $seleted_non_lethal) {
                 $selected = ' selected="selected"';
             } else {
                 $selected = '';
             }
             $s_non_lethal_data .= "<option value=\"{$non_lethal_data[$i]}\"{$selected}>{$non_lethal_data[$i]}</option>";
         }
         $hero_points_data = json_decode($hero_points, true);
         @sort($hero_points_data);
         $s_hero_points_data = '';
         for ($hr = 0; $hr < count($hero_points_data); $hr++) {
             if ($hero_points_data[$hr] == $heropoint) {
                 $selected = 'selected="selected"';
             } else {
                 $selected = '';
             }
             $s_hero_points_data .= "<option value=\"{$hero_points_data[$hr]}\" {$selected} >{$hero_points_data[$hr]}</option>";
         }
         $s_critical_multiplier = "<select name='critical_multiplier'  id='critical_multiplier'>";
         for ($hr = 1; $hr <= 5; $hr++) {
             if ($hr == $critical_multiplier) {
                 $selected = 'selected="selected"';
             } else {
                 $selected = '';
             }
             $s_critical_multiplier .= '<option value="' . $hr . '"  ' . $selected . '>' . $hr . '</option>';
         }
         $s_critical_multiplier .= "</select>";
         $array_type = array('B', 'P', 'S', 'M');
         $types = json_decode($type, true);
         if ($types != '') {
             sort($types);
             $s_type = '';
             for ($tp = 0; $tp < count($array_type); $tp++) {
                 $selected = '';
                 foreach ($types as $key => $val) {
                     if ($val == $array_type[$tp]) {
                         $selected = 'selected="selected"';
                         break;
                     } else {
                         $selected = '';
                     }
                 }
                 $s_type .= "<option value=\"{$array_type[$tp]}\" {$selected} >{$array_type[$tp]}</option>";
             }
         }
         $s_weapon_name = '';
         $weapon_names = json_decode($weapon_name, true);
         for ($wp = 0; $wp < count($weapon_names); $wp++) {
             $s_weapon_name .= '<option value="' . $weapon_names[$wp] . '"  ' . $selected . '>' . $weapon_names[$wp] . '</option>';
         }
         $bad_condition = json_decode($seleted_bad_condition, true);
         $s_negative_condition_data = '';
         for ($i = 0; $i < $negative_condition_data_count; $i++) {
             if ($bad_condition) {
                 foreach ($bad_condition as $key => $val) {
                     if ($negative_condition_data[$i] == $val) {
                         $selected = 'selected="selected"';
                         break;
                     } else {
                         $selected = '';
                     }
                 }
             }
             $s_negative_condition_data .= "<option value=\"{$negative_condition_data[$i]}\" {$selected} >{$negative_condition_data[$i]}</option>";
         }
         $good_condition = json_decode($seleted_good_condition, true);
         $s_positive_condition_data = '';
         for ($i = 0; $i < $positive_condition_data_count; $i++) {
             if ($good_condition) {
                 foreach ($good_condition as $key => $val) {
                     if ($positive_condition_data[$i] == $val) {
                         $selected = 'selected="selected"';
                         break;
                     } else {
                         $selected = '';
                     }
                 }
             }
             $s_positive_condition_data .= "<option value=\"{$positive_condition_data[$i]}\"{$selected}>{$positive_condition_data[$i]}</option>";
         }
         $levelss = json_decode($levels, true);
         $s_level_data = '';
         for ($i = 0; $i < $level_count; $i++) {
             //if (request_var('mode'] == 'edit') {
             if (count($levelss) == 1) {
                 $variable_level = 'yes';
                 if ($level_data[$i] == $levelss[0]) {
                     $selected = ' selected="selected"';
                 } else {
                     $selected = '';
                 }
             }
             $s_level_data .= "<option value=\"{$level_data[$i]}\"{$selected}>{$level_data[$i]}</option>";
         }
         $user_spell1 = json_decode($user_spell, true);
         $splct = count($user_spell1);
         $levels1 = json_decode($levels, true);
         $spells1 = json_decode($spells, true);
         $spl_count = 0;
         $spell_options = array();
         $arr = @array_unique($levels1);
         $sel = array();
         if ($arr) {
             foreach ($arr as $key => $val) {
                 $spell_options_create = '';
                 if (@key_exists($val, $user_spell1)) {
                     $all_spell = @array_values(array_unique(array_merge($user_spell1[$val]['name'], $spells1)));
                     for ($spl = 0; $spl < count($all_spell); $spl++) {
                         foreach ($user_spell1[$val]['name'] as $k => $v) {
                             if ($all_spell[$spl] == $v) {
                                 $selected = 'selected="selected"';
                                 break;
                             } else {
                                 $selected = '';
                             }
                         }
                         $spell_options_create .= "<option " . $selected . ">" . $all_spell[$spl] . "</option>";
                     }
                     if ($spl_count == 0) {
                         $sel[$val] = "<select name='spell_level[]' multiple>" . $spell_options_create . "</select>";
                     } else {
                         $sel[$val] = "<select name='spell_level" . $spl_count . "[]' multiple>" . $spell_options_create . "</select>";
                     }
                     $spl_count++;
                 } else {
                     for ($spl = 0; $spl < count($spells1); $spl++) {
                         $spell_options_create .= "<option>" . $spells1[$spl] . "</option>";
                     }
                     if ($spl_count == 0) {
                         $sel[$val] = "<select name='spell_level[]' multiple>" . $spell_options_create . "</select>";
                     } else {
                         $sel[$val] = "<select name='spell_level" . $spl_count . "[]' multiple>" . $spell_options_create . "</select>";
                     }
                     $spl_count++;
                 }
             }
         }
         $selectbox_level = '';
         if (count($levelss) > 1) {
             $increment_variable_spell = '<input type="hidden" name="increment_variable_spell" id="increment_variable_spell" value="' . count($levelss) . '">';
             $variable_level = 'no';
             for ($j = 0; $j < count($levelss); $j++) {
                 $selectstart = '';
                 $selectends = '';
                 $select = '';
                 $s_level_data_all_options = '';
                 if ($j == 0) {
                     $lvl = '';
                 } else {
                     $lvl = $j;
                 }
                 $selectstart .= 'Level : <select name="select_level' . $lvl . '" id="select_level' . $lvl . '" style="width:5em;">';
                 for ($i = 0; $i < $level_count; $i++) {
                     if ($level_data[$i] == $levelss[$j]) {
                         $selected = 'selected="selected"';
                     } else {
                         $selected = '';
                     }
                     $s_level_data_all_options .= "<option value=\"{$level_data[$i]}\" {$selected} >{$level_data[$i]}</option>";
                 }
                 $selectends .= '</select>';
                 if ($j != count($levelss) - 1) {
                     $select .= $selectstart . $s_level_data_all_options . $selectends . "<br><br>";
                 } else {
                     $select .= $selectstart . $s_level_data_all_options . $selectends;
                 }
                 //if ($user_spell != null) {
                 foreach ($sel as $kespel => $valspell) {
                     if ($levelss[$j] == $kespel) {
                         $box = $valspell;
                         break;
                     } else {
                         $box = '';
                     }
                 }
                 //}
                 $selectbox_level .= "&nbsp;&nbsp;" . $box . "&nbsp;&nbsp;" . $select;
             }
         }
         $sel_count = count($sel);
         if ($sel_count > 1) {
             $spell_variable = 'no';
         } elseif ($sel_count == 1) {
             $spell_variable = 'yes';
             $spell_one = $sel[0];
         }
         $levelss_min = json_decode($levels_min, true);
         $s_level_min_select_box = '';
         for ($i = 0; $i < $level_min_data_count; $i++) {
             //if (request_var('mode'] == 'edit') {
             if (count($levelss_min) == 1) {
                 if ($level_min_data[$i] == $levelss_min[0]) {
                     $selected = ' selected="selected"';
                 } else {
                     $selected = '';
                 }
             }
             $s_level_min_data .= "<option value=\"{$level_min_data[$i]}\"{$selected}>{$level_min_data[$i]}</option>";
         }
         $selectbox_level_min = '';
         if (count($levelss_min) > 1) {
             for ($j = 0; $j < count($levelss_min); $j++) {
                 $selectstart = '';
                 $selectends = '';
                 $select = '';
                 $s_level_data_all_options = '';
                 if ($j == 0) {
                     $lvl = '';
                 } else {
                     $lvl = $j;
                 }
                 $selectstart .= '&nbsp&nbsp Current/Max  : <select name="select_level_min' . $lvl . '" id="select_level_min' . $lvl . '" style="width:5em;">';
                 for ($i = 0; $i < $level_min_data_count; $i++) {
                     if ($level_min_data[$i] == $levelss_min[$j]) {
                         $selected = 'selected="selected"';
                     } else {
                         $selected = '';
                     }
                     $s_level_data_all_options .= "<option value=\"{$level_min_data[$i]}\" {$selected} >{$level_min_data[$i]}</option>";
                 }
                 $selectends .= '</select>';
                 if ($j != count($levelss_min) - 1) {
                     $select .= $selectstart . $s_level_data_all_options . $selectends . "/" . "<br><br><br><br><br>";
                 } else {
                     $select .= $selectstart . $s_level_data_all_options . $selectends . "/";
                 }
                 $selectbox_level_min .= $select;
             }
         }
         $levelss_max = json_decode($levels_max, true);
         $s_level_max_data = '';
         for ($i = 0; $i < $level_max_data_count; $i++) {
             if (count($levelss_max) == 1) {
                 if ($level_max_data[$i] == $levelss_max[0]) {
                     $selected = ' selected="selected"';
                 } else {
                     $selected = '';
                 }
             }
             $s_level_max_data .= "<option value=\"{$level_max_data[$i]}\"{$selected}>{$level_max_data[$i]}</option>";
         }
         $s_level_max_data .= "<option value=\"{$level_max_data[$i]}\"{$selected}>{$level_max_data[$i]}</option>";
         $delete_last_level_ability = $post_id . '_' . $user->data["user_id"] . '_' . '0';
         $selectbox_level_max = '';
         $button_level = '';
         if (count($levelss_min) > 1) {
             for ($j = 0; $j < count($levelss_max); $j++) {
                 $selectstart = '';
                 $selectends = '';
                 $select = '';
                 $s_level_data_all_options = '';
                 if ($j == 0) {
                     $lvl = '';
                 } else {
                     $lvl = $j;
                 }
                 $selectstart .= '<select name="select_level_max' . $lvl . '" id="select_level_max' . $lvl . '" style="width:5em;;">';
                 for ($i = 0; $i < $level_max_data_count; $i++) {
                     if ($level_max_data[$i] == $levelss_max[$j]) {
                         $value = $level_max_data[$i];
                         $ivalue = $j;
                         $selected = 'selected="selected"';
                     } else {
                         $selected = '';
                     }
                     $s_level_data_all_options .= "<option value=\"{$level_max_data[$i]}\" {$selected} >{$level_max_data[$i]}</option>";
                 }
                 $name = $post_id . '_' . $user->data["user_id"] . '_' . $ivalue;
                 $selectends .= '</select>';
                 if ($j < count($levelss_max) - 1) {
                     //$style = 'style="height: 53px;"';
                     $style = 'style="height: 80px;"';
                 } else {
                     $style = '';
                 }
                 $button_level .= '<div ' . $style . '><input type="button" name=' . $name . ' id=' . $value . ' value="-" class=button1 addaditinal onclick="return remove_level1(this);" style="width: 25px;height: 22px;"></div>';
                 if ($j != count($levelss_max) - 1) {
                     $select .= $selectstart . $s_level_data_all_options . $selectends . "<br><br><br><br><br>";
                 } else {
                     $select .= $selectstart . $s_level_data_all_options . $selectends;
                 }
                 $selectbox_level_max .= $select;
             }
         }
         $ability_names = json_decode($ability_namey, true);
         $edit_ability_namey = '';
         if (count($ability_names) != 0) {
             for ($j = 0; $j < count($ability_names); $j++) {
                 $selectstart = '';
                 $selectends = '';
                 $select = '';
                 if ($j == 0) {
                     $lvl = '';
                     $nl = '<br>';
                 } else {
                     $lvl = $j;
                     $nl = '';
                 }
                 $name = $ability_names[$j];
                 $selectstart .= '' . $nl . 'Name : <input type="text" name=ability' . $lvl . ' value=' . str_replace(" ", "&nbsp;", $name) . ' ><br><br>';
                 $edit_ability_namey .= $selectstart;
             }
         }
         $min_abilityyy = json_decode($min_abilityy, true);
         $s_min_ability = '';
         for ($i = 0; $i < $min_ability_data_count; $i++) {
             if (count($min_abilityyy) == 1) {
                 $variable_ability = 'yes';
                 if ($min_ability_data[$i] == $min_abilityyy[0]) {
                     $selected = ' selected="selected"';
                 } else {
                     $selected = '';
                 }
             }
             $s_min_ability .= "<option value=\"{$min_ability_data[$i]}\"{$selected}>{$min_ability_data[$i]}</option>";
         }
         $selectbox_min_ability = '';
         if (count($min_abilityyy) > 1) {
             $increment_variable_ability = '<input type="hidden" name="increment_variable_ability" id="increment_variable_ability" value="' . count($min_abilityyy) . '">';
             $variable_ability = 'no';
             for ($j = 0; $j < count($min_abilityyy); $j++) {
                 $selectstart = '';
                 $select = '';
                 $s_level_data_all_options = '';
                 if ($j == 0) {
                     $lvl = '';
                 } else {
                     $lvl = $j;
                 }
                 $selectstart .= '&nbsp;Min/Max : <select name="min_ability' . $lvl . '" id="min_ability' . $lvl . '" style="width:4em;height:21px;">';
                 for ($i = 0; $i < $min_ability_data_count; $i++) {
                     if ($min_ability_data[$i] == $min_abilityyy[$j]) {
                         $selected = 'selected="selected"';
                     } else {
                         $selected = '';
                     }
                     $s_level_data_all_options .= "<option value=\"{$min_ability_data[$i]}\" {$selected} >{$min_ability_data[$i]}</option>";
                 }
                 $selectends .= '</select>';
                 if ($j != count($min_abilityyy) - 1) {
                     $select .= $selectstart . $s_level_data_all_options . $selectends . "/" . "<br><br>";
                 } else {
                     $select .= $selectstart . $s_level_data_all_options . $selectends . "/";
                 }
                 $selectbox_min_ability .= $select;
             }
         }
         $max_abilityyy = json_decode($max_abilityy, true);
         $s_max_ability = '';
         for ($i = 0; $i < $max_ability_data_count; $i++) {
             if (count($max_abilityyy) == 1) {
                 if ($max_ability_data[$i] == $max_abilityyy[0]) {
                     $selected = ' selected="selected"';
                 } else {
                     $selected = '';
                 }
             }
             $s_max_ability .= "<option value=\"{$max_ability_data[$i]}\"{$selected}>{$max_ability_data[$i]}</option>";
         }
         $selectbox_max_ability = '';
         $button_ability = '<br>';
         if (count($max_abilityyy) > 1) {
             for ($j = 0; $j < count($max_abilityyy); $j++) {
                 $selectstart = '';
                 $selectends = '';
                 $select = '';
                 $s_level_data_all_options = '';
                 if ($j == 0) {
                     $lvl = '';
                 } else {
                     $lvl = $j;
                 }
                 $selectstart .= '<select name="max_ability' . $lvl . '" id="max_ability' . $lvl . '" style="width:4em;height:21px;">';
                 for ($i = 0; $i < $max_ability_data_count; $i++) {
                     if ($max_ability_data[$i] == $max_abilityyy[$j]) {
                         $value = $max_ability_data[$i];
                         $ivalue = $j;
                         $selected = 'selected="selected"';
                     } else {
                         $selected = '';
                     }
                     $s_level_data_all_options .= "<option value=\"{$max_ability_data[$i]}\" {$selected} >{$max_ability_data[$i]}</option>";
                 }
                 $name = $post_id . '_' . $user->data["user_id"] . '_' . $ivalue;
                 $selectends .= '</select>';
                 $button_ability .= '&nbsp<input type="button" name=' . $name . ' id=' . $value . ' value="-" class=button1 addaditinal onclick="return remove_ability1(this);" style="width: 25px;height: 22px;"><br><br>';
                 if ($j != count($max_abilityyy) - 1) {
                     $select .= $selectstart . $s_level_data_all_options . $selectends . "<br><br>";
                 } else {
                     $select .= $selectstart . $s_level_data_all_options . $selectends;
                 }
                 $selectbox_max_ability .= $select;
             }
         }
         $seleted_gears = json_decode($seleted_gear, true);
         $s_gear_data = '';
         $sel_gear = array();
         $sel_val = array();
         for ($g = 0; $g < count($seleted_gears); $g++) {
             $exp = explode('(', $seleted_gears[$g]);
             $sel_gear[] = $exp[0];
             $sel_val[] = $exp[1];
         }
         $increment = 0;
         $arr_merge = array_merge($gear_data, $sel_gear);
         $unique = array_unique($arr_merge);
         $values = array_values($unique);
         $ar = array();
         $ar = array_diff($values, $sel_gear);
         for ($gg = 0; $gg < count($values); $gg++) {
             if ($ar) {
                 foreach ($ar as $key => $val) {
                     if ($values[$gg] == $val) {
                         $selected = 'deselected="deselected"';
                         break;
                     }
                 }
             }
             foreach ($sel_gear as $key => $val) {
                 if ($val == $values[$gg]) {
                     if ($sel_val[$increment] != '') {
                         $value1 = $val . '(' . $sel_val[$increment];
                     } else {
                         $value1 = $val;
                     }
                     $increment++;
                     $values[$gg] = $value1;
                     $selected = 'selected="selected"';
                     break;
                 }
             }
             $s_gear_data .= "<option value=\"{$values[$gg]}\" {$selected} >{$values[$gg]}</option>";
             unset($value1);
         }
     } else {
         $players_id = null;
         $tableid = null;
     }
     if (request_var('submit_variable', '')) {
         if (request_var('increment_variable_spell', '') and request_var('increment_variable_spell', '') != 1) {
             $level = array();
             $level_min = array();
             $level_max = array();
             $spell = array();
             for ($i = 1; $i < request_var('increment_variable_spell', ''); $i++) {
                 $level[] = request_var('select_level' . $i . '', '');
                 $level_min[] = request_var('select_level_min' . $i . '', '');
                 $level_max[] = request_var('select_level_max' . $i . '', '');
             }
             for ($i = 1; $i < request_var('increment_variable_spell', ''); $i++) {
                 $lvl = request_var('select_level' . $i . '', '');
                 $spell = request_var('spell_level' . $i . '', '');
                 $spell_details[$lvl] = array('name' => $spell);
                 unset($lvl);
             }
             $level1 = array_merge(array(request_var('select_level', '')), $level);
             $level_min1 = array_merge(array(request_var('select_level_min', '')), $level_min);
             $level_max1 = array_merge(array(request_var('select_level_max', '')), $level_max);
             $l = json_encode($level1, JSON_FORCE_OBJECT);
             $lmin = json_encode($level_min1, JSON_FORCE_OBJECT);
             $lmax = json_encode($level_max1, JSON_FORCE_OBJECT);
             $fl = request_var('select_level', '');
             $fs = request_var('spell_level', '');
             $spell_details1 = array("{$fl}" => array('name' => $fs));
             $merge = $spell_details + $spell_details1;
             $spell_variable = json_encode($merge, JSON_FORCE_OBJECT);
         } else {
             $l = json_encode(array(request_var('select_level', '')), JSON_FORCE_OBJECT);
             $lmin = json_encode(array(request_var('select_level_min', '')), JSON_FORCE_OBJECT);
             $lmax = json_encode(array(request_var('select_level_max', '')), JSON_FORCE_OBJECT);
             $fl = request_var('select_level', '');
             $fs = request_var('spell_level', '');
             $spell_details1 = array("{$fl}" => array('name' => $fs));
             $spell_variable = json_decode($spell_details1, JSON_FORCE_OBJECT);
         }
         if (request_var('increment_variable_ability', '') and request_var('increment_variable_ability', '') > 1) {
             $ability = array();
             $ability_min = array();
             $ability_max = array();
             for ($i = 1; $i < request_var('increment_variable_ability', ''); $i++) {
                 $ability[] = request_var('ability' . $i . '', '');
                 $ability_min[] = request_var('min_ability' . $i . '', '');
                 $ability_max[] = request_var('max_ability' . $i . '', '');
             }
             $ability1 = array_merge(array(request_var('ability', '')), $ability);
             $ability_min1 = array_merge(array(request_var('min_ability', '')), $ability_min);
             $ability_max1 = array_merge(array(request_var('max_ability', '')), $ability_max);
             $a = json_encode($ability1, JSON_FORCE_OBJECT);
             $amin = json_encode($ability_min1, JSON_FORCE_OBJECT);
             $amax = json_encode($ability_max1, JSON_FORCE_OBJECT);
         } else {
             $a = json_encode(array(request_var('ability', '')), JSON_FORCE_OBJECT);
             $amin = json_encode(array(request_var('min_ability', '')), JSON_FORCE_OBJECT);
             $amax = json_encode(array(request_var('max_ability', '')), JSON_FORCE_OBJECT);
         }
         $arr_gear_quality1 = array();
         if (request_var('gear', '') != '') {
             $gear_quality = json_encode(request_var('gear', ''), JSON_FORCE_OBJECT);
         } else {
             $gear_quality = '';
         }
         $data_update_post = array('selected_current_hit' => request_var('select_current_count', ''), 'selected_maximum_hit' => request_var('select_maximum_count', ''), 'seleted_non_lethal' => request_var('select_non_lethal', ''), 'seleted_bad_condition' => json_encode(request_var('negative_condition', ''), JSON_FORCE_OBJECT), 'seleted_good_condition' => json_encode(request_var('positive_condition', ''), JSON_FORCE_OBJECT), 'level' => $l, 'level_min' => $lmin, 'level_max' => $lmax, 'ability_name' => $a, 'min_ability' => $amin, 'max_ability' => $amax, 'gear' => $gear_quality, 'spell' => $spell_variable);
         $sql = 'UPDATE ' . USER_VARIABLES_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $data_update_post) . ' WHERE user_id = ' . request_var('players', '');
         $db->sql_query($sql);
         $submitted = 1;
         $sid = request_var('sid', '');
     }
     //archi11 code ends :)
     $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action, 'MODE' => $mode, 'CHANGE_PLAYER_INFO' => 'Change Player Information', 'TABLE' => $tablestart, 'TABLE_START' => $variabls, 'PLAYER_ID' => $players_id, "PLAYER_NAME" => $player_name, 'S_HIT_CURRENT_COUNT' => $s_hit_current_data, 'S_HIT_MAXIMUM_COUNT' => $s_hit_maximum_data, 'S_NEGATIVE_CONDITION' => $s_negative_condition_data, 'S_POSITIVE_CONDITION' => $s_positive_condition_data, 'S_LEVEL' => $s_level_data, 'S_LEVEL_MIN' => $s_level_min_data, 'S_LEVEL_MAX' => $s_level_max_data, 'S_MIN_ABILITY' => $s_min_ability, 'S_MAX_ABILITY' => $s_max_ability, 'S_GEAR' => $s_gear_data, 'S_NON_LETHAL' => $s_non_lethal_data, 'S_VARIABLE_LEVEL' => $variable_level, 'S_VARIABLE_ABILITY' => $variable_ability, 'S_EDIT_LEVEL' => $selectbox_level, 'S_EDIT_MIN_LEVEL' => $selectbox_level_min, 'S_EDIT_MAX_LEVEL' => $selectbox_level_max, 'S_SPELL_COUNT' => $spell_variable, 'S_SPELL_VARIABLE' => $spell_one, 'S_EDIT_ABILITY_NAME' => $edit_ability_namey, 'S_EDIT_MIN_ABILITY' => $selectbox_min_ability, 'S_EDIT_MAX_ABILITY' => $selectbox_max_ability, 'S_INCREMENR_SPELL' => $increment_variable_spell, 'S_INCREMENR_ABILITY' => $increment_variable_ability, 'S_HERO_POINT' => $s_hero_points_data, 'S_QUICK_STATS' => $quick_stats, 'S_QUICK_SKILL' => $s_quick_skill_data, 'BUTTON_LEVEL' => $button_level, 'S_WEAPON_NAME' => $s_weapon_name, 'BUTTON_ABILITY' => $button_ability, 'USER_ID' => $user->data["user_id"], 'POST_ID' => $post_id, 'LAST_LEVEL_NAME' => $delete_last_level_ability, 'SUCCESS' => $submitted, 'INFORMATION' => 'Information', 'MESSAGE' => 'Configuration updated successfully.', 'LINK' => '&lt;&lt; Back to previous page', 'SID' => $sid));
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
     if ($mode == 'auth') {
         $template->assign_var('S_AUTH', true);
         foreach ($auth_plugins as $method) {
             if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) {
                 $method = 'acp_' . $method;
                 if (function_exists($method)) {
                     $fields = $method($this->new_config);
                     if ($fields['tpl']) {
                         $template->assign_block_vars('auth_tpl', array('TPL' => $fields['tpl']));
                     }
                     unset($fields);
                 }
             }
         }
     }
 }
コード例 #26
0
 function main($id, $mode)
 {
     global $config, $request, $template, $user, $phpbb_container;
     global $phpbb_root_path, $phpEx;
     $config_text = $phpbb_container->get('config_text');
     $this->page_title = 'ACP_POSTS_MERGING';
     $this->tpl_name = 'acp_posts_merging';
     $submit = isset($_POST['submit']) ? true : false;
     $preview = isset($_POST['preview']) ? true : false;
     $form_key = 'config_posts_merging';
     add_form_key($form_key);
     $display_vars = array('title' => 'ACP_POSTS_MERGING', 'vars' => array('legend1' => 'GENERAL_OPTIONS', 'merge_interval' => array('lang' => 'MERGE_INTERVAL', 'validate' => 'int:0', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['HOURS']), 'merge_no_forums' => array('lang' => 'MERGE_NO_FORUMS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_merge_no_forums', 'explain' => true), 'merge_no_topics' => array('lang' => 'MERGE_NO_TOPICS', 'validate' => 'string', 'type' => 'text:5:255', 'explain' => true), 'legend2' => 'MERGE_SEPARATOR'));
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $user->add_lang(array('posting'));
     $this->new_config = $config;
     $cfg_array = isset($_REQUEST['config']) ? $request->variable('config', array('' => ''), true) : $this->new_config;
     $cfg_array['merge_no_forums'] = $submit ? implode(',', $request->variable('merge_no_forums', array('' => ''))) : $cfg_array['merge_no_forums'];
     $posts_merging_separator_text = $request->variable('posts_merging_separator_text', '', true);
     $error = array();
     // We validate the complete config if wished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             $config->set($config_name, $config_value);
         }
     }
     if ($submit) {
         $config_text->set('posts_merging_separator_text', $posts_merging_separator_text);
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
     $posts_merging_separator_text = $posts_merging_separator_text ?: $config_text->get('posts_merging_separator_text');
     include_once $phpbb_root_path . 'includes/functions_display.' . $phpEx;
     /*
      * Constant preview
      */
     include_once $phpbb_root_path . 'includes/message_parser.' . $phpEx;
     // Prepare message separator
     $user->add_lang_ext('rxu/PostsMerging', 'posts_merging');
     // Calculate the time interval
     $helper = $phpbb_container->get('rxu.PostsMerging.helper');
     $current_time = time();
     $interval = $helper->get_time_interval(strtotime('3 hours 17 minutes 56 seconds'), $current_time);
     $time = array();
     $time[] = $interval->h ? $user->lang('D_HOURS', $interval->h) : null;
     $time[] = $interval->i ? $user->lang('D_MINUTES', $interval->i) : null;
     $time[] = $interval->s ? $user->lang('D_SECONDS', $interval->s) : null;
     // Allow using language variables like {L_LANG_VAR}
     $posts_merging_separator_text_prewiew = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($matches) {
         global $user;
         return $user->lang($matches[1]);
     }, $posts_merging_separator_text);
     // Eval linefeeds and generate the separator, time interval included
     $posts_merging_separator_text_prewiew = sprintf(str_replace('\\n', "\n", $posts_merging_separator_text_prewiew), implode(' ', $time));
     $message_parser = new \parse_message($posts_merging_separator_text_prewiew);
     // Allowing Quote BBCode
     $message_parser->parse(true, true, true, true, true, true, true, true);
     // Now parse it for displaying
     $separator_preview = $message_parser->format_display(true, true, true, false);
     unset($message_parser);
     $template->assign_vars(array('SEPARATOR_PREVIEW' => $separator_preview));
     /*
      * Constant preview end
      */
     $template->assign_vars(array('POSTS_MERGING_SEPARATOR_TEXT' => $posts_merging_separator_text, 'S_SMILIES_ALLOWED' => true, 'S_BBCODE_IMG' => true, 'S_BBCODE_FLASH' => true, 'S_LINKS_ALLOWED' => true, 'U_ACTION' => $this->u_action));
     // Assigning custom bbcodes
     display_custom_bbcodes();
 }
コード例 #27
0
 /**
  * Build Frontend with supplied options
  * @version 3.0.7
  */
 function abbc3_details()
 {
     global $user, $template, $cache, $config, $phpbb_root_path;
     $this->page_title = 'ABBCODES_SETINGS';
     //	$isfounder = ($user->data['user_type'] == USER_FOUNDER) ? true : false;
     $display_vars = array('title' => 'ABBCODES_SETINGS', 'lang' => array('mods/abbcode', 'mods/info_acp_abbcodes'), 'vars' => array('legend1' => 'GENERAL_OPTIONS', 'ABBC3_MOD' => array('lang' => 'ABBCODES_DISABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'ABBC3_BG' => array('lang' => 'ABBCODES_BG', 'validate' => 'string', 'type' => 'custom', 'function' => 'image_select', 'params' => array($this->dir . '/images/bg', '{CONFIG_VALUE}', 'config[ABBC3_BG]', true, $this->u_action, 'ABBC3_BG'), 'explain' => true), 'ABBC3_TAB' => array('lang' => 'ABBCODES_TAB', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'append' => '&nbsp;&nbsp;<span>[ <img src="' . $this->dir . '/images/dots.gif" alt="" /> ]</span>'), 'ABBC3_BOXRESIZE' => array('lang' => 'ABBCODES_BOXRESIZE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'ABBC3_UCP_MODE' => array('lang' => 'ABBCODES_UCP_MODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend2' => 'ABBCODES_WIZARD', 'ABBC3_WIZARD_width' => false, 'ABBC3_WIZARD_height' => false, 'ABBC3_WIZARD_MODE' => array('lang' => 'ABBCODES_WIZARD_MODE', 'validate' => 'int', 'type' => 'custom', 'function' => 'get_radio', 'params' => array('config[ABBC3_WIZARD_MODE]', $user->lang['ABBCODES_WIZARD_SELECTOR'], $config['ABBC3_WIZARD_MODE'], 'ABBC3_WIZARD_MODE'), 'explain' => false), 'ABBC3_WIZARD' => array('lang' => 'ABBCODES_WIZARD_SIZE', 'validate' => 'int', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'legend3' => 'ABBCODES_RESIZER', 'ABBC3_RESIZE' => array('lang' => 'ABBCODES_RESIZE', 'type' => 'string', 'explain' => true, 'append' => ' <span id="ABBC3_RESIZE">' . $user->lang['ABBCODES_JAVASCRIPT_EXPLAIN'] . '</span>'), 'ABBC3_RESIZE_METHOD' => array('lang' => 'ABBCODES_RESIZE_METHOD', 'validate' => 'string', 'type' => 'custom', 'function' => 'method_select', 'params' => array('{CONFIG_VALUE}', 'config[ABBC3_RESIZE_METHOD]', 'ABBC3_RESIZE_METHOD'), 'explain' => true), 'ABBC3_RESIZE_BAR' => array('lang' => 'ABBCODES_RESIZE_BAR', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'ABBC3_MAX_IMG_WIDTH' => array('lang' => 'ABBCODES_MAX_IMAGE_WIDTH', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'ABBC3_MAX_IMG_HEIGHT' => array('lang' => 'ABBCODES_MAX_IMAGE_HEIGHT', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'ABBC3_MAX_THUM_WIDTH' => array('lang' => 'ABBCODES_MAX_THUMB_WIDTH', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'ABBC3_RESIZE_SIGNATURE' => array('lang' => 'ABBCODES_RESIZE_SIGNATURE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'ABBC3_MAX_SIG_WIDTH' => array('lang' => 'ABBCODES_SIG_IMAGE_WIDTH', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'ABBC3_MAX_SIG_HEIGHT' => array('lang' => 'ABBCODES_SIG_IMAGE_HEIGHT', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'legend4' => 'ABBC3_BBVIDEO_TAG', 'ABBC3_VIDEO' => array('lang' => 'ABBCODES_VIDEO_SIZE', 'validate' => 'int', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 'ABBC3_VIDEO_width' => false, 'ABBC3_VIDEO_height' => false, 'ABBC3_VIDEO_OPTIONS' => array('lang' => 'ABBCODES_VIDEO_ALLOWED', 'validate' => 'string', 'type' => 'custom', 'function' => 'video_select', 'params' => array('{CONFIG_VALUE}', 'allowed_videos[]', $this->u_action, 'ABBC3_VIDEO_OPTIONS'), 'explain' => true), 'ABBC3_VIDEO_WMODE' => array('lang' => 'ABBCODES_VIDEO_WMODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true)));
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     $cfg_array = isset($_REQUEST['config']) ? request_var('config', array('' => '')) : $this->new_config;
     $error = array();
     // We validate the complete config if whished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     // Do not write values if there is an error
     if (sizeof($error)) {
         $this->submit = false;
     }
     // Grab global variables, re-cache if necessary
     if ($this->submit) {
         $config = $cache->obtain_config();
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($this->submit) {
             set_config($config_name, $config_value);
         }
     }
     if ($this->submit) {
         $allowed_videos = request_var('allowed_videos', array(0));
         $allowed_videos_string = implode(';', $allowed_videos);
         // The config table only stores 255 chars, so we need to prevent any instance where this might be exceeded.
         if (strlen($allowed_videos_string) > 255) {
             trigger_error($user->lang['ABBCODES_VIDEO_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING);
         }
         set_config('ABBC3_VIDEO_OPTIONS', $allowed_videos_string);
         add_log('admin', 'LOG_CONFIG_ABBCODES');
         if (!sizeof($error)) {
             trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
         } else {
             trigger_error($user->lang['LOG_CONFIG_ABBCODES_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING);
         }
     }
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars)));
         unset($display_vars['vars'][$config_key]);
     }
     $board_path = generate_board_url() . '/' . str_replace($phpbb_root_path, '', $this->dir) . '/';
     $template->assign_vars(array('S_EDIT' => true, 'L_TITLE_EDIT' => $user->lang['ABBCODES_SETINGS'], 'L_TITLE_EXPLAIN' => $user->lang['ABBCODES_SETINGS_EXPLAIN'], 'ICON_BASEDIR' => $this->dir . '/images/bg/', 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'S_FOUNDER' => $user->data['user_type'] == USER_FOUNDER ? true : false, 'NO_FOUNDER' => $user->lang['NO_AUTH_OPERATION'], 'U_ABBC3' => $user->lang['ABBC3_HELP_ABOUT'], 'U_ACTION' => $this->u_action, 'ABBC3_VERSION' => $config['ABBC3_VERSION'], 'ADVANCEDBOX_EXIST' => @file_exists("{$this->dir}/AdvancedBox.js") ? 1 : 0, 'L_NO_EXIST_EXPLAIN_ADVANCEDBOX' => sprintf($user->lang['NO_EXIST_EXPLAIN_ADVANCEDBOX'], $board_path), 'HIGHSLIDE_EXIST' => @file_exists("{$this->dir}/highslide/highslide-full.js") ? 1 : 0, 'L_NO_EXIST_EXPLAIN_HIGHSLIDE' => sprintf($user->lang['NO_EXIST_EXPLAIN_OTHERS'], "highslide-full.js", "4.1.13", "{$board_path}highslide/", "Highslide JS", "http://highslide.com/download.php"), 'LIGHTVIEW_EXIST' => @file_exists("{$this->dir}/lightview/js/lightview.js") ? 1 : 0, 'L_NO_EXIST_EXPLAIN_LIHTVIEW' => sprintf($user->lang['NO_EXIST_EXPLAIN_OTHERS'], "lightview.js", "2.8.0", "{$board_path}lightview/js/", "Lightview", "http://www.nickstakenburg.com/projects/lightview/"), 'PRETTYPHOTO_EXIST' => @file_exists("{$this->dir}/prettyPhoto/js/jquery.prettyPhoto.js") ? 1 : 0, 'L_NO_EXIST_EXPLAIN_PRETTYPHOTO' => sprintf($user->lang['NO_EXIST_EXPLAIN_OTHERS'], "jquery.prettyPhoto.js", "3.1.5", "{$board_path}prettyPhoto/js/", "prettyPhoto", "http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/"), 'SHADOWBOX_EXIST' => @file_exists("{$this->dir}/shadowbox/shadowbox.js") ? 1 : 0, 'L_NO_EXIST_EXPLAIN_SHADOWBOX' => sprintf($user->lang['NO_EXIST_EXPLAIN_OTHERS'], "shadowbox.js", "3.0.3", "{$board_path}shadowbox/", "Shadowbox", "http://www.shadowbox-js.com/download.html")));
 }
コード例 #28
0
 function main($id, $mode)
 {
     global $db, $user, $auth, $template;
     global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
     $user->add_lang(array('acp/board', 'acp/mods/ajax_shoutbox'));
     require $phpbb_root_path . 'includes/functions_shoutbox.' . $phpEx;
     $action = request_var('action', '');
     $submit = isset($_POST['submit']) ? true : false;
     $form_key = 'acp_shoutbox';
     add_form_key($form_key);
     $this->tpl_name = 'acp_shoutbox';
     /**
      *	Validation types are:
      *		string, int, bool,
      *		script_path (absolute path in url - beginning with / and no trailing slash),
      *		rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
      */
     switch ($mode) {
         case 'settings':
             $this->tpl_name = 'acp_board';
             $display_vars = array('title' => 'ACP_SHOUTBOX_SETTINGS', 'vars' => array('legend1' => 'GENERAL_SETTINGS', 'as_prune' => array('lang' => 'AS_PRUNE_TIME', 'validate' => 'int', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['HOURS']), 'as_max_posts' => array('lang' => 'AS_MAX_POSTS', 'validate' => 'int', 'type' => 'text:3:10', 'explain' => true), 'as_flood_interval' => array('lang' => 'AS_FLOOD_INTERVAL', 'validate' => 'int', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'as_ie_nr' => array('lang' => 'AS_IE_NR', 'validate' => 'int', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['MESSAGES']), 'as_non_ie_nr' => array('lang' => 'AS_NON_IE_NR', 'validate' => 'int', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['MESSAGES'])));
             break;
         case 'overview':
             $this->page_title = 'ACP_SHOUTBOX_OVERVIEW';
             $action = request_var('action', '');
             if ($action) {
                 if (!confirm_box(true)) {
                     switch ($action) {
                         default:
                             $confirm = true;
                             $confirm_lang = 'CONFIRM_OPERATION';
                     }
                     if ($confirm) {
                         confirm_box(false, $user->lang[$confirm_lang], build_hidden_fields(array('i' => $id, 'mode' => $mode, 'action' => $action)));
                     }
                 } else {
                     switch ($action) {
                         case 'purge':
                             $sql = 'DELETE FROM ' . SHOUTBOX_TABLE;
                             $db->sql_query($sql);
                             add_log('admin', 'LOG_PURGE_SHOUTBOX');
                             break;
                     }
                 }
             }
             // Get current and latest version
             $errstr = '';
             $errno = 0;
             $info = get_remote_file('www.paulscripts.nl', '/', 'shoutbox.txt', $errstr, $errno);
             if ($info !== false) {
                 $info = explode("\n", $info);
                 $latest_version = trim($info[0]);
                 $up_to_date = version_compare(str_replace('rc', 'RC', strtolower(VERSION)), str_replace('rc', 'RC', strtolower($latest_version)), '<') ? false : true;
                 if (!$up_to_date) {
                     $template->assign_vars(array('S_ERROR' => true, 'ERROR_MSG' => sprintf($user->lang['NEW_VERSION'], VERSION, $latest_version, trim($info[1]))));
                 }
             } else {
                 $template->assign_vars(array('S_ERROR' => true, 'ERROR_MSG' => sprintf($user->lang['UNABLE_CONNECT'], $errstr)));
             }
             $sql = 'SELECT COUNT(shout_id) as total FROM ' . SHOUTBOX_TABLE;
             $result = $db->sql_query($sql);
             $total_posts = $db->sql_fetchfield('total', $result);
             $template->assign_vars(array('TOTAL_POSTS' => $total_posts, 'AS_VERSION' => VERSION, 'U_ACTION' => append_sid($this->u_action)));
             break;
         default:
             trigger_error('NO_MODE', E_USER_ERROR);
             break;
     }
     if ($mode == 'settings') {
         if (isset($display_vars['lang'])) {
             $user->add_lang($display_vars['lang']);
         }
         $this->new_config = $config;
         $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
         $error = array();
         // We validate the complete config if whished
         validate_config_vars($display_vars['vars'], $cfg_array, $error);
         if ($submit && !check_form_key($form_key)) {
             $error[] = $user->lang['FORM_INVALID'];
         }
         // Do not write values if there is an error
         if (sizeof($error)) {
             $submit = false;
         }
         // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
         foreach ($display_vars['vars'] as $config_name => $null) {
             if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
                 continue;
             }
             $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
             if ($submit) {
                 set_config($config_name, $config_value);
             }
         }
         if ($submit) {
             add_log('admin', 'LOG_AS_CONFIG_' . strtoupper($mode));
             trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
         }
         $this->tpl_name = 'acp_board';
         $this->page_title = $display_vars['title'];
         $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
         // Output relevant page
         foreach ($display_vars['vars'] as $config_key => $vars) {
             if (!is_array($vars) && strpos($config_key, 'legend') === false) {
                 continue;
             }
             if (strpos($config_key, 'legend') !== false) {
                 $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
                 continue;
             }
             $type = explode(':', $vars['type']);
             $l_explain = '';
             if ($vars['explain'] && isset($vars['lang_explain'])) {
                 $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
             } else {
                 if ($vars['explain']) {
                     $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
                 }
             }
             $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars)));
             unset($display_vars['vars'][$config_key]);
         }
     }
 }
コード例 #29
0
ファイル: acp_screen.php プロジェクト: bb3mobi/bb3top
 function main($id, $mode)
 {
     global $config, $user, $template, $request;
     $this->user = $user;
     $this->tpl_name = 'acp_board';
     $this->page_title = 'ACP_SCREEN_SETTINGS';
     $submit = $request->is_set_post('submit');
     $form_key = 'top_screen';
     add_form_key($form_key);
     $display_vars = array('title' => 'ACP_RATING_SCREEN', 'vars' => array('legend1' => 'ACP_SCREEN_SETTINGS', 'top_screen_stats' => array('lang' => 'ACP_SCREEN_STATS', 'validate' => 'int:0:600', 'type' => 'number:0:600', 'explain' => true, 'lang_explain' => 'ACP_SCREEN_EXPLAIN'), 'top_screen_rating' => array('lang' => 'ACP_SCREEN_RATING', 'validate' => 'int:0:90', 'type' => 'number:0:90', 'explain' => true, 'lang_explain' => 'ACP_SCREEN_EXPLAIN'), 'top_screen_update' => array('lang' => 'ACP_SCREEN_UPDATE', 'validate' => 'int:0:90', 'type' => 'number:0:90', 'explain' => true), 'top_screen_link' => array('lang' => 'ACP_SCREEN_LINK', 'validate' => 'string', 'type' => 'text:70:220', 'explain' => true), 'top_screen_default' => array('lang' => 'ACP_SCREEN_DEFAULT', 'validate' => 'string', 'type' => 'text:60:100', 'explain' => true), 'top_screen_extension' => array('lang' => 'ACP_SCREEN_EXTENSION', 'validate' => 'string', 'type' => 'select', 'method' => 'select_extension', 'explain' => true), 'legend2' => 'ACP_SUBMIT_CHANGES'));
     if (isset($display_vars['lang'])) {
         $user->add_lang($display_vars['lang']);
     }
     $this->new_config = $config;
     $cfg_array = $request->is_set('config') ? utf8_normalize_nfc($request->variable('config', array('' => ''), true)) : $this->new_config;
     $error = array();
     // We validate the complete config if wished
     validate_config_vars($display_vars['vars'], $cfg_array, $error);
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
     foreach ($display_vars['vars'] as $config_name => $null) {
         if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
             continue;
         }
         $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
         if ($submit) {
             $config->set($config_name, $config_value);
         }
     }
     if ($submit) {
         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
     }
     $this->page_title = $display_vars['title'];
     $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
     // Output relevant page
     foreach ($display_vars['vars'] as $config_key => $vars) {
         if (!is_array($vars) && strpos($config_key, 'legend') === false) {
             continue;
         }
         if (strpos($config_key, 'legend') !== false) {
             $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
             continue;
         }
         $type = explode(':', $vars['type']);
         $l_explain = '';
         if ($vars['explain'] && isset($vars['lang_explain'])) {
             $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
         } else {
             if ($vars['explain']) {
                 $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
             }
         }
         $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
         if (empty($content)) {
             continue;
         }
         $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
         unset($display_vars['vars'][$config_key]);
     }
 }
コード例 #30
0
    function main($id, $mode)
    {
        global $config, $db, $user, $auth, $template, $cache;
        global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $phpbb_seo;
        // Start the phpbb_seo class
        if (empty($phpbb_seo)) {
            include_once $phpbb_root_path . 'phpbb_seo/phpbb_seo_class.' . $phpEx;
            $phpbb_seo = new phpbb_seo();
        }
        $user->add_lang('mods/acp_phpbb_seo');
        $action = request_var('action', '');
        $submit = isset($_POST['submit']) ? true : false;
        $form_key = 'acp_board';
        add_form_key($form_key);
        $display_vars = array();
        // --> Zero Dupe
        if (@isset($phpbb_seo->seo_opt['zero_dupe'])) {
            $this->multiple_options['zero_dupe']['post_redir_values'] = array('off' => 'off', 'post' => 'post', 'guest' => 'guest', 'all' => 'all');
            // do not change
            $this->multiple_options['zero_dupe']['post_redir_lang'] = array('off' => $user->lang['ACP_ZERO_DUPE_OFF'], 'post' => $user->lang['ACP_ZERO_DUPE_MSG'], 'guest' => $user->lang['ACP_ZERO_DUPE_GUEST'], 'all' => $user->lang['ACP_ZERO_DUPE_ALL']);
            // do not change
        }
        // <-- Mod rewrite selector
        if ($phpbb_seo->modrtype == 1) {
            $this->seo_unset_opts = array('cache_layer', 'rem_ids');
        } elseif (!$phpbb_seo->seo_opt['cache_layer']) {
            $this->seo_unset_opts = array('rem_ids');
        }
        $this->modrtype_lang = $this->set_phpbb_seo_links();
        $this->multiple_options['modrtype_lang'] = $this->modrtype_lang['titles'];
        if (@isset($phpbb_seo->seo_opt['modrtype'])) {
            $this->multiple_options['modrtype_values'] = array(1 => 1, 2 => 2, 3 => 3);
            // do not change;
        }
        // <-- Mod rewrite selector
        foreach ($this->seo_unset_opts as $opt) {
            if ($optkey = array_search($opt, $phpbb_seo->cache_config['dynamic_options'])) {
                unset($phpbb_seo->cache_config['dynamic_options'][$optkey]);
            }
        }
        // We need shorter URLs with Virtual Folder Trick
        if ($phpbb_seo->seo_opt['virtual_folder']) {
            $this->lengh_limit = 20;
            $this->word_limit = 3;
        } else {
            $this->lengh_limit = 30;
            $this->word_limit = 5;
        }
        $related_installed = false;
        switch ($mode) {
            case 'settings':
                $this->write_type = 'forum';
                $display_vars['title'] = 'ACP_PHPBB_SEO_CLASS';
                $user->lang['ACP_PHPBB_SEO_CLASS_EXPLAIN'] = sprintf($user->lang['ACP_PHPBB_SEO_CLASS_EXPLAIN'], $this->modrtype_lang['ulink'], $this->modrtype_lang['uforumlink'], '</p><hr/><p><b>' . $user->lang['ACP_PHPBB_SEO_MODE'] . ' : ' . $this->modrtype_lang['link'] . ' - ' . $phpbb_seo->version . ' ( ' . $this->modrtype_lang['forumlink'] . ' )</b></p><hr/><p>');
                $display_vars['vars'] = array();
                $i = 2;
                $display_vars['vars']['legend1'] = 'ACP_PHPBB_SEO_CLASS';
                foreach ($phpbb_seo->cache_config['dynamic_options'] as $optionname => $optionvalue) {
                    if (@is_bool($phpbb_seo->seo_opt[$optionvalue])) {
                        if ($optionvalue == 'virtual_root' && !$phpbb_seo->seo_path['phpbb_script']) {
                            continue;
                        }
                        $display_vars['vars'][$optionvalue] = array('lang' => $optionvalue, 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'lang_explain' => $optionvalue . '_explain');
                        $this->new_config[$optionvalue] = $phpbb_seo->seo_opt[$optionvalue];
                    } elseif (@isset($this->multiple_options[$optionvalue . '_values'])) {
                        $this->dyn_select[$optionvalue] = $this->multiple_options[$optionvalue . '_values'];
                        $display_vars['vars'][$optionvalue] = array('lang' => $optionvalue, 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'lang_explain' => $optionvalue . '_explain');
                        $this->new_config[$optionvalue] = $phpbb_seo->seo_opt[$optionvalue];
                    } elseif (is_array($optionvalue)) {
                        $display_vars['vars']['legend' . $i] = $optionname;
                        $i++;
                        foreach ($optionvalue as $key => $value) {
                            $this->array_type_cfg[$optionname . '_' . $key] = array('main' => $optionname, 'sub' => $key);
                            if (is_bool($value)) {
                                $display_vars['vars'][$optionname . '_' . $key] = array('lang' => $optionname . '_' . $key, 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'lang_explain' => $optionname . '_' . $key . '_explain');
                                $this->new_config[$optionname . '_' . $key] = $phpbb_seo->seo_opt[$optionname][$key];
                            } elseif (@isset($this->multiple_options[$optionname][$key . '_values'])) {
                                $this->dyn_select[$optionname . '_' . $key] = $this->multiple_options[$optionname][$key . '_values'];
                                $display_vars['vars'][$optionname . '_' . $key] = array('lang' => $optionname . '_' . $key, 'validate' => 'string', 'type' => 'select', 'method' => 'select_string', 'explain' => true, 'lang_explain' => $optionname . '_' . $key . '_explain');
                                $this->new_config[$optionname . '_' . $key] = $phpbb_seo->seo_opt[$optionname][$key];
                            } else {
                                $display_vars['vars'][$optionname . '_' . $key] = array('lang' => $optionname . '_' . $key, 'validate' => 'string:0:50', 'type' => 'text:50:50', 'explain' => true, 'lang_explain' => $optionname . '_' . $key . '_explain');
                                $this->new_config[$optionname . '_' . $key] = $phpbb_seo->seo_opt[$optionname][$key];
                            }
                        }
                    }
                }
                break;
            case 'forum_url':
                // used for cache
                $this->write_type = 'forum';
                $forbidden = array($phpbb_seo->seo_static['forum'], $phpbb_seo->seo_static['global_announce'], $phpbb_seo->seo_static['user'], $phpbb_seo->seo_static['topic'], $phpbb_seo->seo_static['atopic'], $phpbb_seo->seo_static['utopic'], $phpbb_seo->seo_static['leaders'], $phpbb_seo->seo_static['post'], $phpbb_seo->seo_static['group'], $phpbb_seo->seo_static['npost'], $phpbb_seo->seo_static['index']);
                if ($phpbb_seo->modrtype == 1 || !$phpbb_seo->seo_opt['cache_layer']) {
                    trigger_error($user->lang['ACP_NO_FORUM_URL'] . preg_replace('`(&amp;|&|\\?)mode=forum_url`i', '', adm_back_link($this->u_action)));
                    break;
                }
                $display_vars['title'] = 'ACP_FORUM_URL';
                $user->lang['ACP_FORUM_URL_EXPLAIN'] .= '</p><hr/><p><b>' . $user->lang['ACP_PHPBB_SEO_VERSION'] . ' : ' . $this->modrtype_lang['link'] . ' - ' . $phpbb_seo->version . ' ( ' . $this->modrtype_lang['forumlink'] . ' )</b></p><hr/><p>';
                $display_vars['vars'] = array();
                $display_vars['vars']['legend1'] = 'ACP_FORUM_URL';
                $sql = "SELECT forum_id, forum_name\n\t\t\t\t\tFROM " . FORUMS_TABLE . "\n\t\t\t\t\tORDER BY left_id ASC";
                $result = $db->sql_query($sql);
                $forum_url_title = $error_cust = '';
                while ($row = $db->sql_fetchrow($result)) {
                    $this->forum_ids[$row['forum_id']] = $row['forum_name'];
                }
                $db->sql_freeresult($result);
                // take care of deleted forums
                foreach ($phpbb_seo->cache_config['forum'] as $fid => $null) {
                    if (!isset($this->forum_ids[$fid])) {
                        unset($phpbb_seo->cache_config['forum'][$fid]);
                    }
                }
                foreach ($this->forum_ids as $forum_id => $forum_name) {
                    $error_cust = '';
                    // Is the URL cached already ?
                    if (empty($phpbb_seo->cache_config['forum'][$forum_id])) {
                        // Suggest the one from the title
                        $forum_url_title = $phpbb_seo->format_url($forum_name, $phpbb_seo->seo_static['forum']);
                        if (!in_array($forum_url_title, $forbidden)) {
                            if (array_search($forum_url_title, $phpbb_seo->cache_config['forum'])) {
                                $this->new_config['forum_url' . $forum_id] = $forum_url_title . $phpbb_seo->seo_delim['forum'] . $forum_id;
                                $error_cust = '<li>&nbsp;' . sprintf($user->lang['SEO_ADVICE_DUPE'], $forum_url_title) . '</li>';
                            } else {
                                $this->new_config['forum_url' . $forum_id] = $forum_url_title . (@$phpbb_seo->cache_config['settings']['rem_ids'] ? '' : $phpbb_seo->seo_delim['forum'] . $forum_id);
                            }
                        } else {
                            $this->new_config['forum_url' . $forum_id] = $forum_url_title . $phpbb_seo->seo_delim['forum'] . $forum_id;
                            $error_cust = '<li>&nbsp;' . sprintf($user->lang['SEO_ADVICE_RESERVED'], $forum_url_title) . '</li>';
                        }
                        $title = '<b style="color:red">' . $forum_name . ' - ID ' . $forum_id . '</b>';
                        $status_msg = '<b style="color:red">' . $user->lang['SEO_CACHE_URL_NOT_OK'] . '</b>';
                        $status_msg .= '<br/><span style="color:red">' . $user->lang['SEO_CACHE_URL'] . '&nbsp;:</span>&nbsp;' . $this->new_config['forum_url' . $forum_id] . $phpbb_seo->seo_ext['forum'];
                        $display_vars['vars']['forum_url' . $forum_id] = array('lang' => $title, 'validate' => 'string', 'type' => 'custom', 'method' => 'forum_url_input', 'explain' => true, 'lang_explain_custom' => $status_msg, 'append' => $this->seo_advices($this->new_config['forum_url' . $forum_id], $forum_id, false, $error_cust));
                    } else {
                        // Cached
                        $this->new_config['forum_url' . $forum_id] = $phpbb_seo->cache_config['forum'][$forum_id];
                        $title = '<b style="color:green">' . $forum_name . ' - ID ' . $forum_id . '</b>';
                        $status_msg = '<span style="color:green">' . $user->lang['SEO_CACHE_URL_OK'] . '&nbsp;:</span>&nbsp;<b style="color:green">' . $this->new_config['forum_url' . $forum_id] . '</b>';
                        $status_msg .= '<br/><span style="color:green">' . $user->lang['SEO_CACHE_URL'] . '&nbsp;:</span>&nbsp;' . $this->new_config['forum_url' . $forum_id] . $phpbb_seo->seo_ext['forum'];
                        $display_vars['vars']['forum_url' . $forum_id] = array('lang' => $title, 'validate' => 'string:0:100', 'type' => 'custom', 'method' => 'forum_url_input', 'explain' => true, 'lang_explain_custom' => $status_msg, 'append' => $this->seo_advices($this->new_config['forum_url' . $forum_id], $forum_id, true));
                    }
                }
                break;
            case 'htaccess':
                $this->write_type = 'htaccess';
                $display_vars['title'] = 'ACP_HTACCESS';
                $user->lang['ACP_HTACCESS_EXPLAIN'] .= '</p><hr/><p><b>' . $user->lang['ACP_PHPBB_SEO_VERSION'] . ' : ' . $this->modrtype_lang['link'] . ' - ' . $phpbb_seo->version . ' ( ' . $this->modrtype_lang['forumlink'] . ' )</b></p><p>';
                $display_vars['vars'] = array();
                $display_vars['vars']['legend1'] = 'ACP_HTACCESS';
                $display_vars['vars']['save'] = array('lang' => 'SEO_HTACCESS_SAVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
                $display_vars['vars']['more_options'] = array('lang' => 'SEO_MORE_OPTION', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
                $this->new_config['save'] = false;
                $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
                $this->new_config['more_options'] = isset($cfg_array['more_options']) ? $cfg_array['more_options'] : false;
                $this->new_config['slash'] = isset($cfg_array['slash']) ? $cfg_array['slash'] : false;
                $this->new_config['wslash'] = isset($cfg_array['wslash']) ? $cfg_array['wslash'] : false;
                $this->new_config['rbase'] = isset($cfg_array['rbase']) ? $cfg_array['rbase'] : false;
                if ($this->new_config['more_options']) {
                    $display_vars['vars']['slash'] = array('lang' => 'SEO_HTACCESS_SLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
                    $display_vars['vars']['wslash'] = array('lang' => 'SEO_HTACCESS_WSLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
                    if ($phpbb_seo->seo_path['phpbb_script'] && !$phpbb_seo->seo_opt['virtual_root']) {
                        $display_vars['vars']['rbase'] = array('lang' => 'SEO_HTACCESS_RBASE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
                    }
                }
                // Dirty yet simple templating
                $user->lang['ACP_HTACCESS_EXPLAIN'] .= $this->seo_htaccess();
                break;
            case 'extended':
                $display_vars = array('title' => 'ACP_SEO_EXTENDED', 'vars' => array('legend1' => 'SEO_EXTERNAL_LINKS', 'seo_ext_links' => array('lang' => 'SEO_EXTERNAL_LINKS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true, 'default' => 1), 'seo_ext_subdomain' => array('lang' => 'SEO_EXTERNAL_SUBDOMAIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'default' => 0), 'seo_ext_classes' => array('lang' => 'SEO_EXTERNAL_CLASSES', 'validate' => 'string', 'type' => 'text:40:250', 'explain' => true, 'default' => '')));
                // Related topics
                if (file_exists($phpbb_root_path . "phpbb_seo/phpbb_seo_related.{$phpEx}")) {
                    $related_installed = true;
                    $user->add_lang('mods/phpbb_seo_related_install');
                    $display_vars['vars'] += array('legend2' => 'RELATED_TOPICS', 'seo_related' => array('lang' => 'SEO_RELATED', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true, 'append' => !empty($config['seo_related']) ? '<br/>' . (!empty($config['seo_related_fulltext']) ? $user->lang['FULLTEXT_INSTALLED'] : $user->lang['FULLTEXT_NOT_INSTALLED']) : '', 'default' => 0), 'seo_related_check_ignore' => array('lang' => 'SEO_RELATED_CHECK_IGNORE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true, 'default' => 0), 'seo_related_limit' => array('lang' => 'SEO_RELATED_LIMIT', 'validate' => 'int:2:25', 'type' => 'text:3:4', 'explain' => true, 'default' => 5), 'seo_related_allforums' => array('lang' => 'SEO_RELATED_ALLFORUMS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'default' => 0));
                }
                // dynamic meta tag mod
                if (class_exists('seo_meta')) {
                    $display_vars['vars'] += array('legend3' => 'SEO_META', 'seo_meta_title' => array('lang' => 'SEO_META_TITLE', 'validate' => 'string:0:225', 'type' => 'text:40:250', 'explain' => true, 'default' => $config['sitename']), 'seo_meta_desc' => array('lang' => 'SEO_META_DESC', 'validate' => 'string:0:225', 'type' => 'text:40:250', 'explain' => true, 'default' => $config['site_desc']), 'seo_meta_desc_limit' => array('lang' => 'SEO_META_DESC_LIMIT', 'validate' => 'int:5:40', 'type' => 'text:3:4', 'explain' => true, 'default' => 25), 'seo_meta_bbcode_filter' => array('lang' => 'SEO_META_BBCODE_FILTER', 'validate' => 'string:0:225', 'type' => 'text:40:250', 'explain' => true, 'default' => 'img|url|flash|code'), 'seo_meta_keywords' => array('lang' => 'SEO_META_KEYWORDS', 'validate' => 'string:0:225', 'type' => 'text:40:250', 'explain' => true, 'default' => $config['site_desc']), 'seo_meta_keywords_limit' => array('lang' => 'SEO_META_KEYWORDS_LIMIT', 'validate' => 'int:5:40', 'type' => 'text:3:4', 'explain' => true, 'default' => 15), 'seo_meta_min_len' => array('lang' => 'SEO_META_MIN_LEN', 'validate' => 'int:0:10', 'type' => 'text:3:4', 'explain' => true, 'default' => 2), 'seo_meta_check_ignore' => array('lang' => 'SEO_META_CHECK_IGNORE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true, 'default' => 0), 'seo_meta_lang' => array('lang' => 'SEO_META_LANG', 'validate' => 'lang', 'type' => 'select', 'method' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => true, 'default' => $config['default_lang']), 'seo_meta_copy' => array('lang' => 'SEO_META_COPY', 'validate' => 'string:0:225', 'type' => 'text:40:250', 'explain' => true, 'default' => $config['sitename']), 'seo_meta_file_filter' => array('lang' => 'SEO_META_FILE_FILTER', 'validate' => 'string:0:225', 'type' => 'text:40:250', 'explain' => true, 'default' => 'ucp'), 'seo_meta_get_filter' => array('lang' => 'SEO_META_GET_FILTER', 'validate' => 'string:0:225', 'type' => 'text:40:250', 'explain' => true, 'default' => 'style,hilit,sid'), 'seo_meta_robots' => array('lang' => 'SEO_META_ROBOTS', 'validate' => 'string:0:225', 'type' => 'text:25:150', 'explain' => true, 'default' => 'index,follow'), 'seo_meta_noarchive' => array('lang' => 'SEO_META_NOARCHIVE', 'validate' => 'string:0:225', 'multiple_validate' => 'int', 'type' => 'custom', 'method' => 'select_multiple', 'params' => array('{CONFIG_VALUE}', '{KEY}', $this->forum_select()), 'explain' => true, 'default' => ''));
                }
                // Optimal title
                if (isset($user->lang['Page'])) {
                    $display_vars['vars'] += array('legend4' => 'SEO_PAGE_TITLES', 'seo_append_sitename' => array('lang' => 'SEO_APPEND_SITENAME', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true, 'default' => 0));
                }
                // install if necessary
                foreach ($display_vars['vars'] as $config_name => $config_setup) {
                    if (strpos($config_name, 'legend') !== false) {
                        continue;
                    }
                    if (!isset($config[$config_name])) {
                        set_config($config_name, $config_setup['default']);
                        unset($display_vars['vars'][$config_name]['default']);
                    }
                }
                $this->new_config = $config;
                break;
            default:
                trigger_error('NO_MODE', E_USER_ERROR);
                break;
        }
        $error = array();
        $seo_msg = array();
        $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
        if ($submit && !check_form_key($form_key)) {
            $error[] = $user->lang['FORM_INVALID'];
        }
        // We validate the complete config if whished
        validate_config_vars($display_vars['vars'], $cfg_array, $error);
        // Do not write values if there is an error
        if (!empty($error)) {
            $submit = false;
        }
        $additional_notes = '';
        // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
        foreach ($display_vars['vars'] as $config_name => $cfg_setup) {
            if (!isset($cfg_array[$config_name]) && @$cfg_setup['method'] != 'select_multiple' || strpos($config_name, 'legend') !== false) {
                continue;
            }
            // Handle multiple select options
            if (!empty($cfg_setup['method']) && $cfg_setup['method'] == 'select_multiple') {
                if (isset($_POST['multiple_' . $config_name])) {
                    $m_values = utf8_normalize_nfc(request_var('multiple_' . $config_name, array('' => '')));
                    $validate_int = !empty($cfg_setup['multiple_validate']) && $cfg_setup['multiple_validate'] == 'int' ? true : false;
                    foreach ($m_values as $k => $v) {
                        if ($validate_int) {
                            $v = max(0, (int) $v);
                        }
                        if (empty($v)) {
                            unset($m_values[$k]);
                        } else {
                            $m_values[$k] = $v;
                        }
                    }
                    sort($m_values);
                    $this->new_config[$config_name] = $m_values;
                    $config_value = implode(',', $m_values);
                    if (strlen($config_value) > 255) {
                        $error[] = sprintf($user->lang['SETTING_TOO_LONG'], $user->lang[$cfg_setup['lang']], 255);
                    }
                    $submit = empty($error);
                } else {
                    if ($submit) {
                        $this->new_config[$config_name] = array();
                        $config_value = '';
                    } else {
                        $config_value = $this->new_config[$config_name];
                        $this->new_config[$config_name] = !empty($config_value) ? explode(',', $config_value) : array();
                    }
                }
            } else {
                $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
            }
            if ($submit) {
                // In case we deal with forum URLs
                if ($mode == 'forum_url' && preg_match('`^forum_url([0-9]+)$`', $config_name, $matches)) {
                    // Check if this is an actual forum_id
                    if (isset($this->forum_ids[$matches[1]])) {
                        $forum_id = intval($matches[1]);
                        $config_value = $phpbb_seo->format_url($config_value, $phpbb_seo->seo_static['forum']);
                        // Remove delim if required
                        while (preg_match('`^[a-z0-9_-]+' . $phpbb_seo->seo_delim['forum'] . '[0-9]+$`i', $config_value)) {
                            $config_value = preg_replace('`^([a-z0-9_-]+)' . $phpbb_seo->seo_delim['forum'] . '[0-9]+$`i', '\\1', $config_value);
                            if (@$phpbb_seo->cache_config['settings']['rem_ids']) {
                                $seo_msg['SEO_ADVICE_DELIM_REM'] = '<li>&nbsp;' . $user->lang['SEO_ADVICE_DELIM_REM'] . '</li>';
                            }
                        }
                        // Forums cannot end with the pagination param
                        while (preg_match('`^[a-z0-9_-]+' . $phpbb_seo->seo_delim['start'] . '[0-9]+$`i', $config_value)) {
                            $config_value = preg_replace('`^([a-z0-9_-]+)' . $phpbb_seo->seo_delim['start'] . '[0-9]+$`i', "\\1", $config_value);
                            $seo_msg['SEO_ADVICE_START'] = '<li>&nbsp;' . $user->lang['SEO_ADVICE_START'] . '</li>';
                        }
                        // Only update if the value is not a static one for forums
                        if (!in_array($config_value, $forbidden)) {
                            // and updated (sic)
                            if ($config_value != @$phpbb_seo->cache_config['forum'][$forum_id]) {
                                // and if not already set
                                if (!array_search($config_value, $phpbb_seo->cache_config['forum'])) {
                                    $phpbb_seo->cache_config['forum'][$forum_id] = $config_value . (@$phpbb_seo->cache_config['settings']['rem_ids'] ? '' : $phpbb_seo->seo_delim['forum'] . $forum_id);
                                } else {
                                    $seo_msg['SEO_ADVICE_DUPE_' . $forum_id] = '<li>&nbsp;' . sprintf($user->lang['SEO_ADVICE_DUPE'], $config_value) . '</li>';
                                }
                            }
                        } else {
                            $seo_msg['SEO_ADVICE_RESERVED_' . $forum_id] = '<li>&nbsp;' . sprintf($user->lang['SEO_ADVICE_RESERVED'], $config_value) . '</li>';
                        }
                    }
                } elseif ($mode == 'settings') {
                    if (isset($this->array_type_cfg[$config_name]) && isset($phpbb_seo->seo_opt[$this->array_type_cfg[$config_name]['main']][$this->array_type_cfg[$config_name]['sub']])) {
                        if (is_bool($phpbb_seo->seo_opt[$this->array_type_cfg[$config_name]['main']][$this->array_type_cfg[$config_name]['sub']])) {
                            $phpbb_seo->cache_config['settings'][$this->array_type_cfg[$config_name]['main']][$this->array_type_cfg[$config_name]['sub']] = $config_value == 1 ? true : false;
                        } elseif (is_numeric($phpbb_seo->seo_opt[$this->array_type_cfg[$config_name]['main']][$this->array_type_cfg[$config_name]['sub']])) {
                            $phpbb_seo->cache_config['settings'][$this->array_type_cfg[$config_name]['main']][$this->array_type_cfg[$config_name]['sub']] = intval($config_value);
                        } elseif (is_string($phpbb_seo->seo_opt[$this->array_type_cfg[$config_name]['main']][$this->array_type_cfg[$config_name]['sub']])) {
                            $phpbb_seo->cache_config['settings'][$this->array_type_cfg[$config_name]['main']][$this->array_type_cfg[$config_name]['sub']] = $config_value;
                        }
                    } elseif (isset($phpbb_seo->seo_opt[$config_name])) {
                        if (is_bool($phpbb_seo->seo_opt[$config_name])) {
                            $phpbb_seo->cache_config['settings'][$config_name] = $config_value == 1 ? true : false;
                        } elseif (is_numeric($phpbb_seo->seo_opt[$config_name])) {
                            $phpbb_seo->cache_config['settings'][$config_name] = intval($config_value);
                        } elseif (is_string($phpbb_seo->seo_opt[$config_name])) {
                            $phpbb_seo->cache_config['settings'][$config_name] = $config_value;
                        }
                    }
                    // Let's make sure that the proper field was added to the topic table
                    if ($config_name === 'sql_rewrite' && $config_value == 1 && !$phpbb_seo->seo_opt['sql_rewrite']) {
                        if (!class_exists('phpbb_db_tools')) {
                            require $phpbb_root_path . 'includes/db/db_tools.' . $phpEx;
                        }
                        $db_tools = new phpbb_db_tools($db);
                        $db_tools->db->sql_return_on_error(true);
                        if (!$db_tools->sql_column_exists(TOPICS_TABLE, 'topic_url')) {
                            $db_tools->sql_column_add(TOPICS_TABLE, 'topic_url', array('VCHAR', ''));
                        }
                        $additional_notes = sprintf($user->lang['SYNC_TOPIC_URL_NOTE'], '<a href="' . $phpbb_seo->seo_path['phpbb_url'] . 'phpbb_seo/sync_url.' . $phpEx . '" onclick="window.open(this.href); return false;">', '</a>');
                        if ($db_tools->db->sql_error_triggered) {
                            $error[] = '<b>' . $user->lang['sql_rewrite'] . '</b> : ' . $user->lang['SEO_SQL_ERROR'] . ' [ ' . $db_tools->db->sql_layer . ' ] : ' . $db_tools->db->sql_error_returned['message'] . ' [' . $db_tools->db->sql_error_returned['code'] . ']' . '<br/>' . $user->lang['SEO_SQL_TRY_MANUALLY'] . '<br/>' . $db_tools->db->sql_error_sql;
                            $submit = false;
                        }
                        $db_tools->db->sql_return_on_error(false);
                    }
                    // Let's make sure the proper index is added for the no dupe (in case it is installed and activated)
                    if ($config_name === 'no_dupe_on' && $config_value == 1 && !$phpbb_seo->seo_opt['no_dupe']['on']) {
                        if (!class_exists('phpbb_db_tools')) {
                            require $phpbb_root_path . 'includes/db/db_tools.' . $phpEx;
                        }
                        // in case we already started the phpbb_db_tools class above
                        if (empty($db_tools)) {
                            $db_tools = new phpbb_db_tools($db);
                        }
                        $db_tools->db->sql_return_on_error(true);
                        $indexes = $db_tools->sql_list_index(TOPICS_TABLE);
                        $drop_index_name = 'topic_last_post_id';
                        $add_index_name = 'topic_lpid';
                        if (in_array($drop_index_name, $indexes)) {
                            $db_tools->sql_index_drop(TOPICS_TABLE, $drop_index_name);
                        }
                        if (!in_array($add_index_name, $indexes)) {
                            // Try to override some limits - maybe it helps some...
                            @set_time_limit(0);
                            @ini_set('memory_limit', '128M');
                            $db_tools->sql_create_index(TOPICS_TABLE, $add_index_name, array('topic_last_post_id'));
                        }
                        if ($db_tools->db->sql_error_triggered) {
                            $error[] = '<b>' . $user->lang['no_dupe'] . '</b> : ' . $user->lang['SEO_SQL_ERROR'] . ' [ ' . $db_tools->db->sql_layer . ' ] : ' . $db_tools->db->sql_error_returned['message'] . ' [' . $db_tools->db->sql_error_returned['code'] . ']' . '<br/>' . $user->lang['SEO_SQL_TRY_MANUALLY'] . '<br/>' . $db_tools->db->sql_error_sql;
                            $submit = false;
                        }
                        $db_tools->db->sql_return_on_error(false);
                    }
                } elseif ($mode == 'extended') {
                    if ($related_installed && $config_name === 'seo_related') {
                        $fulltext = 0;
                        $nothing_to_do = false;
                        if ($db->sql_layer == 'mysql4' || $db->sql_layer == 'mysqli') {
                            $add = $remove = $alter = false;
                            if ($config_value && !$config['seo_related']) {
                                $alter = $add = true;
                            }
                            if (!$config_value && $config['seo_related']) {
                                $alter = $remove = true;
                            }
                            // let's go
                            if ($alter) {
                                // Try to override some limits - maybe it helps some...
                                @set_time_limit(0);
                                @ini_set('memory_limit', '128M');
                                // use db_tools to check the index
                                if (!class_exists('phpbb_db_tools')) {
                                    require $phpbb_root_path . 'includes/db/db_tools.' . $phpEx;
                                }
                                if (empty($db_tools)) {
                                    $db_tools = new phpbb_db_tools($db);
                                }
                                $indexes = $db_tools->sql_list_index(TOPICS_TABLE);
                                if (in_array('topic_tft', $indexes)) {
                                    $nothing_to_do = $add ? true : false;
                                    $fulltext = 1;
                                } else {
                                    $nothing_to_do = $remove ? true : false;
                                    $fulltext = 0;
                                }
                                // do not use db_tools since it does not support to add FullText indexes
                                if (!$nothing_to_do) {
                                    // Here we use quite a basic approach to make sure that the index is not refused for bad reasons
                                    if ($add) {
                                        $sql = 'ALTER TABLE ' . TOPICS_TABLE . '
											ADD FULLTEXT topic_tft (topic_title)';
                                    } else {
                                        $sql = 'ALTER TABLE ' . TOPICS_TABLE . '
											DROP INDEX topic_tft';
                                    }
                                    $db->sql_return_on_error(true);
                                    $db->sql_query($sql);
                                    if ($db->sql_error_triggered) {
                                        $error[] = '<b>' . $user->lang['RELATED_TOPICS'] . '</b> : ' . $user->lang['SEO_SQL_ERROR'] . ' [ ' . $db->sql_layer . ' ] : ' . $db->sql_error_returned['message'] . ' [' . $db->sql_error_returned['code'] . ']' . '<br/>' . $user->lang['SEO_SQL_TRY_MANUALLY'] . '<br/>' . $db->sql_error_sql;
                                        $submit = false;
                                        $config_value = 0;
                                    }
                                    // make *sure* about the index !
                                    $indexes = $db_tools->sql_list_index(TOPICS_TABLE);
                                    $fulltext = in_array('topic_tft', $indexes) ? 1 : 0;
                                    $db->sql_return_on_error(false);
                                }
                            }
                        }
                        if ($alter) {
                            set_config('seo_related_fulltext', $fulltext);
                        }
                    }
                    set_config($config_name, $config_value);
                }
            }
        }
        if (sizeof($error)) {
            $submit = false;
        }
        if ($submit) {
            if ($mode == 'htaccess') {
                if ($this->new_config['save']) {
                    $this->write_cache($this->write_type);
                    add_log('admin', 'SEO_LOG_CONFIG_' . strtoupper($mode));
                }
            } elseif ($mode == 'extended') {
                add_log('admin', 'SEO_LOG_CONFIG_' . strtoupper($mode));
                trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
            } else {
                if ($this->write_cache($this->write_type)) {
                    ksort($phpbb_seo->cache_config[$this->write_type]);
                    add_log('admin', 'SEO_LOG_CONFIG_' . strtoupper($mode));
                    $msg = !empty($seo_msg) ? '<br /><h1 style="color:red;text-align:left;">' . $user->lang['SEO_VALIDATE_INFO'] . '</h1><ul style="text-align:left;">' . implode(' ', $seo_msg) . '</ul><br />' : '';
                    global $msg_long_text;
                    $msg_long_text = $user->lang['SEO_CACHE_MSG_OK'] . $msg . adm_back_link($this->u_action);
                    if ($additional_notes) {
                        $msg_long_text .= "<br/><br/>{$additional_notes}";
                    }
                    trigger_error(false);
                } else {
                    trigger_error($user->lang['SEO_CACHE_MSG_FAIL'] . adm_back_link($this->u_action));
                }
            }
        }
        $this->tpl_name = 'acp_board';
        $this->page_title = $display_vars['title'];
        $phpbb_seo->seo_end();
        $l_title_explain = $user->lang[$display_vars['title'] . '_EXPLAIN'];
        if ($mode != 'extended') {
            $l_title_explain .= $mode == 'htaccess' ? '' : $this->check_cache_folder($phpbb_root_path . $phpbb_seo->seo_opt['cache_folder']);
        }
        $template->assign_vars(array('L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $l_title_explain, 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
        // Output relevant page
        foreach ($display_vars['vars'] as $config_key => $vars) {
            if (!is_array($vars) && strpos($config_key, 'legend') === false) {
                continue;
            }
            if (strpos($config_key, 'legend') !== false) {
                $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
                continue;
            }
            $type = explode(':', $vars['type']);
            $l_explain = '';
            if ($vars['explain'] && isset($vars['lang_explain'])) {
                $l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
            } elseif ($vars['explain'] && isset($vars['lang_explain_custom'])) {
                $l_explain = $vars['lang_explain_custom'];
            } elseif ($vars['explain']) {
                $l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
            }
            $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars)));
            unset($display_vars['vars'][$config_key]);
        }
    }