• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP parse_cfg_file函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中parse_cfg_file函数的典型用法代码示例。如果您正苦于以下问题:PHP parse_cfg_file函数的具体用法?PHP parse_cfg_file怎么用?PHP parse_cfg_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parse_cfg_file函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: repair

    function repair()
    {
        global $db;
        $stylelist = filelist(PHPBB_ROOT_PATH . 'styles/', '', 'cfg');
        ksort($stylelist);
        // Loop throught the files and try to find a style we can use.
        // To be usable the directory name in the style.cfg is the same as the directory.
        foreach (array_keys($stylelist) as $styledirname) {
            if (!in_array('style.cfg', $stylelist[$styledirname])) {
                continue;
            }
            // Read the cfg, should always be index 0
            $items = parse_cfg_file(PHPBB_ROOT_PATH . 'styles/' . $styledirname . 'style.cfg');
            // Unify the name in the cfg to something used as a directory
            // Spaces -> '_'
            // All lowercase
            $stylename = utf8_clean_string(str_replace(' ', '_', $items['name']));
            // Clean up the dirname
            $dirname = substr($styledirname, -1) == '/' ? substr($styledirname, 0, -1) : $styledirname;
            // If not the same switch to the next one
            if ($dirname != $stylename) {
                continue;
            }
            // If this style isn't installed we will install the style at this point.
            $sql = 'SELECT style_id
				FROM ' . STYLES_TABLE . "\n\t\t\t\tWHERE style_name = '" . $db->sql_escape($items['name']) . "'";
            $result = $db->sql_query($sql);
            $this->sid = $db->sql_fetchfield('style_id', false, $result);
            $db->sql_freeresult($result);
            if (empty($this->sid)) {
                // Nasty, but the style installer fetches these in the method o_0
                $GLOBALS['_REQUEST']['path'] = $stylename;
                $GLOBALS['_POST']['update'] = true;
                // Call the style installer
                $this->ac->install('style');
                // Fetch the id
                $sql = 'SELECT style_id
					FROM ' . STYLES_TABLE . "\n\t\t\t\t\tWHERE style_name = '" . $db->sql_escape($items['name']) . "'";
                $result = $db->sql_query($sql);
                $this->sid = $db->sql_fetchfield('style_id', false, $result);
                $db->sql_freeresult($result);
            }
            // Set this style as the active style
            set_config('default_style', $this->sid);
            set_config('override_user_style', 1);
            // Overriding the style should enable the board for everyone
            return;
        }
        echo 'The support toolkit couldn\'t find an available style. Please seek further assistance in the support forums on <a href="http://www.phpbb.com/community/viewforum.php?f=46" title="phpBB.com Support forum">phpbb.com</a>';
        garbage_collection();
        exit_handler();
    }
开发者ID:napus,项目名称:support-toolkit,代码行数:52,代码来源:style_dir_repair.php


示例2: update_installed_styles

    public function update_installed_styles()
    {
        // Get all currently available styles
        $styles = $this->find_style_dirs();
        $style_paths = $style_ids = array();
        $sql = 'SELECT style_path, style_id
				FROM ' . $this->table_prefix . 'styles';
        $result = $this->db->sql_query($sql);
        while ($styles_row = $this->db->sql_fetchrow()) {
            if (in_array($styles_row['style_path'], $styles)) {
                $style_paths[] = $styles_row['style_path'];
                $style_ids[] = $styles_row['style_id'];
            }
        }
        $this->db->sql_freeresult($result);
        // Install prosilver if no style is available and prosilver can be installed
        if (empty($style_paths) && in_array('prosilver', $styles)) {
            // Try to parse config file
            $cfg = parse_cfg_file($this->phpbb_root_path . 'styles/prosilver/style.cfg');
            // Stop running this if prosilver cfg file can't be read
            if (empty($cfg)) {
                throw new \RuntimeException('No styles available and could not fall back to prosilver.');
            }
            $style = array('style_name' => 'prosilver', 'style_copyright' => '&copy; phpBB Limited', 'style_active' => 1, 'style_path' => 'prosilver', 'bbcode_bitfield' => 'kNg=', 'style_parent_id' => 0, 'style_parent_tree' => '');
            // Add to database
            $this->db->sql_transaction('begin');
            $sql = 'INSERT INTO ' . $this->table_prefix . 'styles
					' . $this->db->sql_build_array('INSERT', $style);
            $this->db->sql_query($sql);
            $style_id = $this->db->sql_nextid();
            $style_ids[] = $style_id;
            $this->db->sql_transaction('commit');
            // Set prosilver to default style
            $this->config->set('default_style', $style_id);
        } else {
            if (empty($styles) && empty($available_styles)) {
                throw new \RuntimeException('No valid styles available');
            }
        }
        // Make sure default style is available
        if (!in_array($this->config['default_style'], $style_ids)) {
            $this->config->set('default_style', array_pop($style_ids));
        }
        // Reset users to default style if their user_style is nonexistent
        $sql = 'UPDATE ' . $this->table_prefix . "users\n\t\t\tSET user_style = {$this->config['default_style']}\n\t\t\tWHERE " . $this->db->sql_in_set('user_style', $style_ids, true, true);
        $this->db->sql_query($sql);
    }
开发者ID:Tarendai,项目名称:spring-website,代码行数:47,代码来源:style_update.php


示例3: version_info

 public function version_info($event)
 {
     $sitesplat_themes = array('bboots', 'flatboots');
     foreach ($sitesplat_themes as $sitesplat_theme) {
         if (file_exists($this->root_path . 'styles/' . strtoupper($sitesplat_theme) . '/style.cfg')) {
             $cfg_ary = parse_cfg_file($this->root_path . 'styles/' . strtoupper($sitesplat_theme) . '/style.cfg');
             if ($cfg_ary) {
                 $version = !empty($cfg_ary[$sitesplat_theme]) ? $cfg_ary[$sitesplat_theme] : '0.0.0';
                 $ch = curl_init();
                 curl_setopt($ch, CURLOPT_URL, 'http://www.sitesplat.com/updatecheck/phpbb31/' . $sitesplat_theme . '.txt');
                 curl_setopt($ch, CURLOPT_HEADER, false);
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                 $contents = curl_exec($ch);
                 $http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                 curl_close($ch);
                 if ($http >= 400) {
                     $contents = '';
                 }
                 $this->template->assign_block_vars('sitesplat_themes', array('NAME' => strtoupper($sitesplat_theme), 'VERSION' => $version, 'MSG' => $contents));
             }
         }
     }
 }
开发者ID:rinodung,项目名称:phpbb-forum,代码行数:23,代码来源:admin_listener.php


示例4: installStyle

		function installStyle($styleName)
		{
			global $config, $db, $user, $auth, $template, $cache;
			global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
			if (preg_match('/([^a-z0-9_]+)/iS',$styleName))
				throw new Exception('Style name is not valid',1001);
				
			$res = $db->sql_query(
				"SELECT * FROM 
					{$table_prefix}styles WHERE style_name = '{$styleName}'"
			);
			
			$styles = new acp_styles();
			
			if ($db->sql_affectedrows()) {
				$row = $db->sql_fetchrow();
	
				$db->sql_query(
					"UPDATE {$table_prefix}styles SET style_active = 0"
				);
				$db->sql_query(
					"UPDATE 
						{$table_prefix}styles 
					SET 
						style_name = '{$styleName}',
						style_active = 1 
					WHERE 
						style_id = {$row['style_id']}"
				);
				$db->sql_query(
					"UPDATE {$table_prefix}users SET user_style = " . $row['style_id']
				);
				set_config('default_style', $row['style_id']);
			} else {
				// getting instalation config
				$installcfg = 
					parse_cfg_file(
						$phpbb_root_path 
						. 'styles' 
						. DIRECTORY_SEPARATOR . $styleName 
						. DIRECTORY_SEPARATOR . 'style.cfg'
					);
				
					
				// prepare data to install
				$error 		= array(); 
				$action		= 'install'; 
				$root_path	= $phpbb_root_path . 'styles/' . $styleName . '/'; 
				$id			= 0; 
				$name		= $styleName;
				$path		= $styleName; 
				$copyright	= $installcfg['copyright']; 
				$active		= 1; 
				$default	= 1; 
				$style_row	= array(); 
				
				if (!is_dir($root_path))
					throw new Exception('Directory not found',1002);
	
				$element_ary = array(
					'template' => STYLES_TEMPLATE_TABLE, 
					'theme' => STYLES_THEME_TABLE, 
					'imageset' => STYLES_IMAGESET_TABLE
				);
				
				
				$style_row = array(
					'style_id'			=> 0,
					'style_name'		=> $installcfg['name'],
					'style_copyright'	=> $installcfg['copyright']
				);
				
				
				$reqd_template = 
					(isset($installcfg['required_template'])) 
					? $installcfg['required_template'] 
					: false;
					
				$reqd_theme = 
					(isset($installcfg['required_theme'])) 
					? $installcfg['required_theme'] 
					: false;
					
				$reqd_imageset = 
					(isset($installcfg['required_imageset'])) 
					? $installcfg['required_imageset'] 
					: false;
				
				// Getting related info				
				foreach ($element_ary as $element => $table)
				{
					$style_row = 
						array_merge(
							$style_row, 
							array(
								$element . '_id'			=> 0,
								$element . '_name'			=> '',
								$element . '_copyright'		=> ''
							)
						);
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:101,代码来源:acp_mods.php


示例5: get_name_from_cfg

 /**
  * Get style|component name from configuration file.
  *
  * @param string $file		Full path to .cfg file
  * @return bool|string Returns style|component name, or false
  *	on failure
  */
 protected function get_name_from_cfg($file)
 {
     $result = parse_cfg_file($file);
     return empty($result['name']) ? false : $result['name'];
 }
开发者ID:Sajaki,项目名称:customisation-db,代码行数:12,代码来源:colorizeit_helper.php


示例6: main

 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);
             }
//.........这里部分代码省略.........
开发者ID:TurinTurambar,项目名称:PBWoW3ext,代码行数:101,代码来源:pbwow_module.php


示例7: repair

    function repair()
    {
        global $db, $table_prefix;
        $sql = 'SELECT s.style_id
			FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c, ' . STYLES_IMAGESET_TABLE . " i\n\t\t\tWHERE t.template_id = s.template_id\n\t\t\t\tAND c.theme_id = s.theme_id\n\t\t\t\tAND i.imageset_id = s.imageset_id";
        $result2 = $db->sql_query_limit($sql, 1);
        $row = $db->sql_fetchrow($result2);
        if ($row) {
            // There is a style in the database, so we are lucky
            set_config('default_style', $row['style_id']);
        } else {
            // Not so lucky...need to add a style into the database to access the Support Toolkit (can not guarentee this style will work for the board however).
            $template_id = $theme_id = $imageset_id = $style_id = $style_name = false;
            foreach (array('template', 'theme', 'imageset') as $mode) {
                $var = $mode . '_id';
                $subpath = $mode != 'style' ? "{$mode}/" : '';
                $result = $db->sql_query('SELECT * FROM ' . $table_prefix . 'styles_' . $mode);
                $row = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                if ($row && file_exists(PHPBB_ROOT_PATH . "styles/{$mode}_path/{$subpath}{$mode}.cfg")) {
                    // There already is one of this item in the database, so no need to add it.
                    ${$var} = $row[$var];
                    if ($mode == 'template') {
                        $style_name = $row['template_name'];
                    }
                    continue;
                }
                $dp = @opendir(PHPBB_ROOT_PATH . 'styles');
                if ($dp) {
                    while (($file = readdir($dp)) !== false) {
                        if ($file[0] != '.' && file_exists(PHPBB_ROOT_PATH . "styles/{$file}/{$subpath}{$mode}.cfg")) {
                            if ($cfg = file(PHPBB_ROOT_PATH . "styles/{$file}/{$subpath}{$mode}.cfg")) {
                                $items = parse_cfg_file('', $cfg);
                                $name = isset($items['name']) ? trim($items['name']) : false;
                                $sql_ary = array($mode . '_name' => $name, $mode . '_copyright' => $items['copyright'], $mode . '_path' => $file);
                                if ($mode == 'theme') {
                                    $sql_ary['theme_data'] = '';
                                }
                                $db->sql_query('INSERT INTO ' . $table_prefix . 'styles_' . $mode . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                                ${$var} = $db->sql_nextid();
                                if ($mode == 'template') {
                                    $style_name = $name;
                                }
                                break;
                            }
                        }
                    }
                    closedir($dp);
                }
            }
            if ($template_id && $theme_id && $imageset_id) {
                // We've got one of each, so we can add a new style and repair this.
                $sql_ary = array('style_name' => $style_name, 'style_copyright' => '', 'style_active' => 1, 'template_id' => $template_id, 'theme_id' => $theme_id, 'imageset_id' => $imageset_id);
                $db->sql_query('INSERT INTO ' . STYLES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                $style_id = $db->sql_nextid();
                // That should be everything, only reset the board style and purge the cache yet
                set_config('default_style', $style_id);
            } else {
                // Can't use trigger_error
                echo 'We could not automatically add a new style.  Please install at least one style on your phpBB3 forum and try again.';
                garbage_collection();
                exit_handler();
            }
        }
        $db->sql_freeresult($result2);
    }
开发者ID:napus,项目名称:support-toolkit,代码行数:66,代码来源:style_repair.php


示例8: __construct


//.........这里部分代码省略.........
                trigger_error($error['message']);
            }
        }
        // main sql is done, let's get a fresh $config array
        $sql = 'SELECT *
			FROM ' . CONFIG_TABLE;
        $result = $db->sql_query($sql);
        $config = array();
        while ($row = $db->sql_fetchrow($result)) {
            $config[$row['config_name']] = $row['config_value'];
        }
        $db->sql_freeresult($result);
        // no templates though :P
        $config['load_tplcompile'] = '1';
        // build search index
        include_once $phpbb_root_path . 'includes/search/fulltext_native.' . $phpEx;
        $search = new fulltext_native($error = false);
        $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
			FROM ' . POSTS_TABLE;
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']);
        }
        $db->sql_freeresult($result);
        // extended phpbb install script
        include $phpbb_root_path . 'install/install_install.' . $phpEx;
        include $quickinstall_path . 'includes/install_install_qi.' . $phpEx;
        $install = new install_install_qi($p_master = new p_master_dummy());
        $install->set_data(array('dbms' => $dbms, 'dbhost' => $qi_config['dbhost'], 'dbport' => $qi_config['dbport'], 'dbuser' => $qi_config['dbuser'], 'dbpasswd' => $qi_config['dbpasswd'], 'dbname' => $dbname, 'table_prefix' => $table_prefix, 'default_lang' => $qi_config['default_lang'], 'admin_name' => $qi_config['admin_name'], 'admin_pass1' => $qi_config['admin_pass'], 'admin_pass2' => $qi_config['admin_pass'], 'board_email1' => $qi_config['board_email'], 'board_email2' => $qi_config['board_email'], 'email_enable' => $qi_config['email_enable'], 'smtp_delivery' => $qi_config['smtp_delivery'], 'smtp_host' => $qi_config['smtp_host'], 'smtp_auth' => $qi_config['smtp_auth'], 'smtp_user' => $qi_config['smtp_user'], 'smtp_pass' => $qi_config['smtp_pass'], 'cookie_secure' => $qi_config['cookie_secure'], 'server_protocol' => !empty($qi_config['server_protocol']) ? $qi_config['server_protocol'] : 'http://', 'server_name' => $qi_config['server_name'], 'server_port' => $qi_config['server_port'], 'script_path' => $script_path));
        $install->add_modules(false, false);
        $install->add_language(false, false);
        $install->add_bots(false, false);
        // login
        $user->session_begin();
        $auth->login($qi_config['admin_name'], $qi_config['admin_pass'], false, true, true);
        // now automod (easymod)
        if ($automod) {
            include $quickinstall_path . 'includes/functions_install_automod.' . $phpEx;
            automod_installer::install_automod($board_dir, $make_writable);
        }
        if ($dbms == 'sqlite' || $dbms == 'firebird') {
            // copy the temp db over
            file_functions::copy_file($quickinstall_path . 'cache/' . $qi_config['db_prefix'] . $dbname, $board_dir . $qi_config['db_prefix'] . $dbname);
            $db->sql_select_db($board_dir . $qi_config['db_prefix'] . $dbname);
        }
        // clean up
        file_functions::delete_files($board_dir, array('Thumbs.db', 'DS_Store', 'CVS', '.svn', '.git'));
        // remove install dir, develop and umil
        file_functions::delete_dir($board_dir . 'install/');
        file_functions::delete_dir($board_dir . 'develop/');
        file_functions::delete_dir($board_dir . 'umil/');
        // copy extra user added files
        file_functions::copy_dir($quickinstall_path . 'sources/extra/', $board_dir);
        // Install Subsilver2
        if ($subsilver) {
            if (!class_exists('bitfield')) {
                include $phpbb_root_path . 'includes/functions_content.' . $phpEx;
            }
            include $phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx;
            $acp_styles = new acp_styles();
            $acp_styles->main(0, '');
            // Mostly copied from includes/acp/acp_styles.php
            $reqd_template = $reqd_theme = $reqd_imageset = false;
            $error = $installcfg = $style_row = array();
            $element_ary = array('template' => STYLES_TEMPLATE_TABLE, 'theme' => STYLES_THEME_TABLE, 'imageset' => STYLES_IMAGESET_TABLE);
            $install_path = 'subsilver2';
            $root_path = $phpbb_root_path . 'styles/subsilver2/';
            $cfg_file = $root_path . 'style.cfg';
            $installcfg = parse_cfg_file($cfg_file);
            if (!sizeof($installcfg)) {
                continue;
            }
            $name = $installcfg['name'];
            $copyright = $installcfg['copyright'];
            $version = $installcfg['version'];
            $style_row = array('style_id' => 0, 'template_id' => 0, 'theme_id' => 0, 'imageset_id' => 0, 'style_name' => $installcfg['name'], 'template_name' => $installcfg['name'], 'theme_name' => $installcfg['name'], 'imageset_name' => $installcfg['name'], 'template_copyright' => $installcfg['copyright'], 'theme_copyright' => $installcfg['copyright'], 'imageset_copyright' => $installcfg['copyright'], 'style_copyright' => $installcfg['copyright'], 'store_db' => 0, 'style_active' => 1, 'style_default' => $subsilver == 2 ? 1 : 0);
            $acp_styles->install_style($error, 'install', $root_path, $style_row['style_id'], $style_row['style_name'], $install_path, $style_row['style_copyright'], $style_row['style_active'], $style_row['style_default'], $style_row);
            unset($error);
        }
        // Add some random users and posts.
        if ($populate) {
            include $quickinstall_path . 'includes/functions_populate.' . $phpEx;
            new populate($pop_data);
        }
        // add log entry :D
        $user->ip =& $user_ip;
        add_log('admin', 'LOG_INSTALL_INSTALLED_QI', $qi_config['qi_version']);
        // purge cache
        $cache->purge();
        // Make all files world writable.
        if ($make_writable) {
            file_functions::make_writable($board_dir);
        }
        // if he wants to be redirected, redirect him
        if ($redirect) {
            qi::redirect($board_dir);
        }
        // On succces just return to main page.
        qi::redirect('index.' . $phpEx);
    }
开发者ID:Gfksx,项目名称:quickinstall,代码行数:101,代码来源:qi_create.php


示例9: setup


//.........这里部分代码省略.........
            $sql = 'UPDATE ' . STYLES_THEME_TABLE . '
				SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
				WHERE theme_id = ' . $this->theme['theme_id'];
            $db->sql_query($sql);
            unset($sql_ary);
        }
        $template->set_template();
        $this->img_lang = file_exists($phpbb_root_path . 'styles/' . $this->theme['imageset_path'] . '/imageset/' . $this->lang_name) ? $this->lang_name : $config['default_lang'];
        // Same query in style.php
        $sql = 'SELECT *
			FROM ' . STYLES_IMAGESET_DATA_TABLE . '
			WHERE imageset_id = ' . $this->theme['imageset_id'] . "\n\t\t\tAND image_filename <> ''\n\t\t\tAND image_lang IN ('" . $db->sql_escape($this->img_lang) . "', '')";
        $result = $db->sql_query($sql, 3600);
        $localised_images = false;
        while ($row = $db->sql_fetchrow($result)) {
            if ($row['image_lang']) {
                $localised_images = true;
            }
            $row['image_filename'] = rawurlencode($row['image_filename']);
            $this->img_array[$row['image_name']] = $row;
        }
        $db->sql_freeresult($result);
        // there were no localised images, try to refresh the localised imageset for the user's language
        if (!$localised_images) {
            // Attention: this code ignores the image definition list from acp_styles and just takes everything
            // that the config file contains
            $sql_ary = array();
            $db->sql_transaction('begin');
            $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . '
				WHERE imageset_id = ' . $this->theme['imageset_id'] . '
					AND image_lang = \'' . $db->sql_escape($this->img_lang) . '\'';
            $result = $db->sql_query($sql);
            if (@file_exists("{$phpbb_root_path}styles/{$this->theme['imageset_path']}/imageset/{$this->img_lang}/imageset.cfg")) {
                $cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$this->theme['imageset_path']}/imageset/{$this->img_lang}/imageset.cfg");
                foreach ($cfg_data_imageset_data as $image_name => $value) {
                    if (strpos($value, '*') !== false) {
                        if (substr($value, -1, 1) === '*') {
                            list($image_filename, $image_height) = explode('*', $value);
                            $image_width = 0;
                        } else {
                            list($image_filename, $image_height, $image_width) = explode('*', $value);
                        }
                    } else {
                        $image_filename = $value;
                        $image_height = $image_width = 0;
                    }
                    if (strpos($image_name, 'img_') === 0 && $image_filename) {
                        $image_name = substr($image_name, 4);
                        $sql_ary[] = array('image_name' => (string) $image_name, 'image_filename' => (string) $image_filename, 'image_height' => (int) $image_height, 'image_width' => (int) $image_width, 'imageset_id' => (int) $this->theme['imageset_id'], 'image_lang' => (string) $this->img_lang);
                    }
                }
            }
            if (sizeof($sql_ary)) {
                $db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary);
                $db->sql_transaction('commit');
                $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
                add_log('admin', 'LOG_IMAGESET_LANG_REFRESHED', $this->theme['imageset_name'], $this->img_lang);
            } else {
                $db->sql_transaction('commit');
                add_log('admin', 'LOG_IMAGESET_LANG_MISSING', $this->theme['imageset_name'], $this->img_lang);
            }
        }
        // Call phpbb_user_session_handler() in case external application want to "bend" some variables or replace classes...
        // After calling it we continue script execution...
        phpbb_user_session_handler();
        // If this function got called from the error handler we are finished here.
开发者ID:esacinc,项目名称:forum-sitplatform-org-website,代码行数:67,代码来源:session.php


示例10: install_demo_style

    /**
     * Install a style on the demo board.
     *
     * @param string $phpbb_root_path
     * @param mixed contrib object
     */
    public function install_demo_style($phpbb_root_path, $contrib)
    {
        phpbb::$user->add_lang('acp/styles');
        if ($phpbb_root_path[strlen($phpbb_root_path) - 1] != '/') {
            $phpbb_root_path .= '/';
        }
        if (!is_dir($phpbb_root_path) || !file_exists($phpbb_root_path . 'config.' . PHP_EXT)) {
            $this->error[] = 'PATH_INVALID';
            return false;
        }
        include $phpbb_root_path . 'config.' . PHP_EXT;
        $sql_db = !empty($dbms) ? 'dbal_' . basename($dbms) : 'dbal';
        // Is this DBAL loaded?
        phpbb::_include('db/' . $dbms, false, $sql_db);
        // Instantiate DBAL class
        $db = new $sql_db();
        // Connect to demo board DB
        $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport);
        // We do not need this any longer, unset for safety purposes
        unset($dbpasswd);
        if (empty($this->unzip_dir)) {
            // Extract zip.
            $this->unzip_dir = titania::$config->contrib_temp_path . basename($this->original_zip, 'zip') . '/';
            // Clear out old stuff if there is anything here...
            $this->rmdir_recursive($this->unzip_dir);
            // Unzip to our temp directory
            $this->extract($this->original_zip, $this->unzip_dir);
        }
        $package_root = $this->find_root(false, 'style.cfg');
        $stylecfg = parse_cfg_file($this->unzip_dir . $package_root . '/style.cfg');
        $style_root = $phpbb_root_path . 'styles/' . $contrib->contrib_id . '/';
        $this->mvdir_recursive($this->unzip_dir . $package_root, $style_root, false);
        $this->rmdir_recursive($this->unzip_dir);
        $variables = array('db', 'phpbb_root_path');
        // Let's get lazy.
        foreach ($variables as $variable) {
            ${'_' . $variable} = $GLOBALS[$variable];
            $GLOBALS[$variable] = ${$variable};
        }
        // Get the acp_styles class.
        phpbb::_include('acp/acp_styles', false, 'acp_styles');
        if (!defined('TEMPLATE_BITFIELD')) {
            // Hardcoded template bitfield to add for new templates
            $bitfield = new bitfield();
            $bitfield->set(0);
            $bitfield->set(1);
            $bitfield->set(2);
            $bitfield->set(3);
            $bitfield->set(4);
            $bitfield->set(8);
            $bitfield->set(9);
            $bitfield->set(11);
            $bitfield->set(12);
            define('TEMPLATE_BITFIELD', $bitfield->get_base64());
            unset($bitfield);
        }
        $styles = new acp_styles();
        // Fill the configuration variables
        $styles->style_cfg = $styles->template_cfg = $styles->theme_cfg = $styles->imageset_cfg = '
#
# phpBB {MODE} configuration file
#
# @package phpBB3
# @copyright (c) 2005 phpBB Group
# @license http://opensource.org/licenses/gpl-license.php GNU Public License
#
#
# At the left is the name, please do not change this
# At the right the value is entered
# For on/off options the valid values are on, off, 1, 0, true and false
#
# Values get trimmed, if you want to add a space in front or at the end of
# the value, then enclose the value with single or double quotes.
# Single and double quotes do not need to be escaped.
#
#

# General Information about this {MODE}
name = {NAME}
copyright = {COPYRIGHT}
version = {VERSION}
';
        $styles->theme_cfg .= '
# Some configuration options

#
# You have to turn this option on if you want to use the
# path template variables ({T_IMAGESET_PATH} for example) within
# your css file.
# This is mostly the case if you want to use language specific
# images within your css file.
#
parse_css_file = {PARSE_CSS_FILE}
';
//.........这里部分代码省略.........
开发者ID:Gfksx,项目名称:customisation-db,代码行数:101,代码来源:contrib_tools.php


示例11: cache_purge

    /**
     * Cache Purge
     *
     * This function is for purging either phpBB3’s data cache, authorization cache, or the styles cache.
     *
     * @param string $type The type of cache you want purged.  Available types: auth, imageset, template, theme.  Anything else sent will purge the forum's cache.
     * @param int $style_id The id of the item you want purged (if the type selected is imageset/template/theme, 0 for all items in that section)
     */
    function cache_purge($type = '', $style_id = 0)
    {
        global $auth, $cache, $user, $phpbb_root_path, $phpEx;
        // Multicall
        if (is_array($type)) {
            if (!empty($type)) {
                foreach ($type as $params) {
                    call_user_func_array(array($this, 'cache_purge'), $params);
                }
                return;
            }
        }
        $style_id = (int) $style_id;
        $type = (string) $type;
        // Prevent PHP bug.
        switch ($type) {
            case 'auth':
                $this->umil_start('AUTH_CACHE_PURGE');
                $cache->destroy('_acl_options');
                $auth->acl_clear_prefetch();
                return $this->umil_end();
                break;
            case 'imageset':
                if ($style_id == 0) {
                    $return = array();
                    $sql = 'SELECT imageset_id
						FROM ' . STYLES_IMAGESET_TABLE;
                    $result = $this->db->sql_query($sql);
                    while ($row = $this->db->sql_fetchrow($result)) {
                        $return[] = $this->cache_purge('imageset', $row['imageset_id']);
                    }
                    $this->db->sql_freeresult($result);
                    return implode('<br /><br />', $return);
                } else {
                    $sql = 'SELECT *
						FROM ' . STYLES_IMAGESET_TABLE . "\n\t\t\t\t\t\tWHERE imageset_id = {$style_id}";
                    $result = $this->db->sql_query($sql);
                    $imageset_row = $this->db->sql_fetchrow($result);
                    $this->db->sql_freeresult($result);
                    if (!$imageset_row) {
                        $this->umil_start('IMAGESET_CACHE_PURGE', 'UNKNOWN');
                        return $this->umil_end('FAIL');
                    }
                    $this->umil_start('IMAGESET_CACHE_PURGE', $imageset_row['imageset_name']);
                    // The following is from includes/acp/acp_styles.php (edited)
                    $sql_ary = array();
                    $cfg_data_imageset = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/imageset.cfg");
                    $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . '
						WHERE imageset_id = ' . $style_id;
                    $result = $this->db->sql_query($sql);
                    foreach ($cfg_data_imageset as $image_name => $value) {
                        if (strpos($value, '*') !== false) {
                            if (substr($value, -1, 1) === '*') {
                                list($image_filename, $image_height) = explode('*', $value);
                                $image_width = 0;
                            } else {
                                list($image_filename, $image_height, $image_width) = explode('*', $value);
                            }
                        } else {
                            $image_filename = $value;
                            $image_height = $image_width = 0;
                        }
                        if (strpos($image_name, 'img_') === 0 && $image_filename) {
                            $image_name = substr($image_name, 4);
                            $sql_ary[] = array('image_name' => (string) $image_name, 'image_filename' => (string) $image_filename, 'image_height' => (int) $image_height, 'image_width' => (int) $image_width, 'imageset_id' => (int) $style_id, 'image_lang' => '');
                        }
                    }
                    $sql = 'SELECT lang_dir
						FROM ' . LANG_TABLE;
                    $result = $this->db->sql_query($sql);
                    while ($row = $this->db->sql_fetchrow($result)) {
                        if (@file_exists("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$row['lang_dir']}/imageset.cfg")) {
                            $cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$row['lang_dir']}/imageset.cfg");
                            foreach ($cfg_data_imageset_data as $image_name => $value) {
                                if (strpos($value, '*') !== false) {
                                    if (substr($value, -1, 1) === '*') {
                                        list($image_filename, $image_height) = explode('*', $value);
                                        $image_width = 0;
                                    } else {
                                        list($image_filename, $image_height, $image_width) = explode('*', $value);
                                    }
                                } else {
                                    $image_filename = $value;
                                    $image_height = $image_width = 0;
                                }
                                if (strpos($image_name, 'img_') === 0 && $image_filename) {
                                    $image_name = substr($image_name, 4);
                                    $sql_ary[] = array('image_name' => (string) $image_name, 'image_filename' => (string) $image_filename, 'image_height' => (int) $image_height, 'image_width' => (int) $image_width, 'imageset_id' => (int) $style_id, 'image_lang' => (string) $row['lang_dir']);
                                }
                            }
                        }
                    }
//.........这里部分代码省略.........
开发者ID:poyntesm,项目名称:phpbbgarage,代码行数:101,代码来源:umil.php


示例12: read_style_cfg

 /**
  * Read style configuration file
  *
  * @param string $dir style directory
  * @return array|bool Style data, false on error
  */
 function read_style_cfg($dir)
 {
     static $required = array('name', 'phpbb_version', 'copyright');
     $cfg = @parse_cfg_file($dir);
     // Check if it is a valid file
     foreach ($required as $key) {
         if (!isset($cfg[$key])) {
             return false;
         }
     }
     // Check data
     if (!isset($cfg['parent']) || !is_string($cfg['parent']) || $cfg['parent'] == $cfg['name']) {
         $cfg['parent'] = '';
     }
     if (!isset($cfg['template_bitfield'])) {
         //			$cfg['template_bitfield'] = $this->default_bitfield();
     }
     return $cfg;
 }
开发者ID:Galixte,项目名称:uploadstyle,代码行数:25,代码来源:uploadstyle_module.php


示例13: test_parse_cfg_file

 /**
  * @dataProvider parse_cfg_file_data
  */
 public function test_parse_cfg_file($file_contents, $expected)
 {
     $this->assertEquals($expected, parse_cfg_file(false, $file_contents));
 }
开发者ID:MrAdder,项目名称:phpbb,代码行数:7,代码来源:parse_cfg_file_test.php


示例14: obtain_cfg_items

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP parse_color_declaration函数代码示例发布时间:2022-05-15
下一篇:
PHP parse_calendardate函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap