예제 #1
0
function get_pbwow_config()
{
	global $db, $cache, $phpbb_root_path, $phpEx;

	$pbwow_config = $cache->get('pbwow_config');

	if ($pbwow_config == false)
	{
		$pbwow_config = $cached_pbwow_config = array();

		if (!class_exists('phpbb_db_tools'))
		{
			include("$phpbb_root_path/includes/db/db_tools.$phpEx");
		}
		$db_tool = new phpbb_db_tools($db);
	
		if($db_tool->sql_table_exists(PBWOW2_CONFIG_TABLE)){

			$sql = 'SELECT config_name, config_value
				FROM ' . PBWOW2_CONFIG_TABLE;
			$result = $db->sql_query($sql);
	
			while ($row = $db->sql_fetchrow($result))
			{
				$cached_pbwow_config[$row['config_name']] = $row['config_value'];
				$pbwow_config[$row['config_name']] = $row['config_value'];
			}
			$db->sql_freeresult($result);
	
			$cache->put('pbwow_config', $cached_pbwow_config);
		}
	}
	return $pbwow_config;
}
예제 #2
0
 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]);
     }
 }
 /**
  *  API function - set up shop
  */
 function install()
 {
     global $db;
     if (!class_exists('phpbb_db_tools')) {
         include IP_ROOT_PATH . '/includes/db/db_tools.' . PHP_EXT;
     }
     $db_tool = new phpbb_db_tools($db);
     $tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE);
     $schemas = array(CAPTCHA_QUESTIONS_TABLE => array('COLUMNS' => array('question_id' => array('UINT', Null, 'auto_increment'), 'strict' => array('BOOL', 0), 'lang_id' => array('UINT', 0), 'lang_iso' => array('VCHAR:30', ''), 'question_text' => array('TEXT_UNI', '')), 'PRIMARY_KEY' => 'question_id', 'KEYS' => array('lang_iso' => array('INDEX', 'lang_iso'))), CAPTCHA_ANSWERS_TABLE => array('COLUMNS' => array('question_id' => array('UINT', 0), 'answer_text' => array('STEXT_UNI', '')), 'KEYS' => array('question_id' => array('INDEX', 'question_id'))), CAPTCHA_QA_CONFIRM_TABLE => array('COLUMNS' => array('session_id' => array('CHAR:32', ''), 'confirm_id' => array('CHAR:32', ''), 'lang_iso' => array('VCHAR:30', ''), 'question_id' => array('UINT', 0), 'attempts' => array('UINT', 0), 'confirm_type' => array('USINT', 0)), 'KEYS' => array('session_id' => array('INDEX', 'session_id'), 'lookup' => array('INDEX', array('confirm_id', 'session_id', 'lang_iso'))), 'PRIMARY_KEY' => 'confirm_id'));
     foreach ($schemas as $table => $schema) {
         if (!$db_tool->sql_table_exists($table)) {
             $db_tool->sql_create_table($table, $schema);
         }
     }
 }
예제 #4
0
$user->lang['CONTINUE_TO_CONFIRM'] = 'Are you sure you want to continue to step ' . ($step + 1) . '?';
if (!$submit) {
    if (confirm_box(true)) {
        redirect("convertor.{$phpEx}?step=1&amp;submit=1");
    } else {
        //display mode
        confirm_box(false, 'CONVERT', '', 'confirm_body.html', "convertor.{$phpEx}");
    }
} else {
    if (confirm_box(true)) {
        redirect("convertor.{$phpEx}?step={$step}&amp;submit=1");
    }
    switch ($step) {
        case 1:
            // First check tas2580 mod
            $tas_installed = $db_tools->sql_table_exists($table_prefix . 'kb_article');
            // Second check ours
            $kb_installed = $db_tools->sql_table_exists($table_prefix . 'articles');
            if (!$tas_installed) {
                $error[] = "tas2580's Knowledge Base Mod isn't installed";
            }
            if (!$kb_installed && file_exists($phpbb_root_path . 'kb.' . $phpEx)) {
                $error[] = "Our Knowledge Base Mod isn't installed, please navigate to kb." . $phpEx . " to install then come back here";
            } else {
                if (!file_exists($phpbb_root_path . 'kb.' . $phpEx)) {
                    $error[] = "Please download our Knowledge Base Mod and upload the files to your server and install.";
                }
            }
            if (sizeof($error)) {
                trigger_error(implode('<br />', $error));
            }