install_style() protected method

Install style
protected install_style ( array $style ) : integer
$style array style data
return integer Style id
Example #1
0
		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'		=> ''
							)
						);
	
		 			$styles->test_installed(
		 				$element, 
		 				$error, 
		 				
		 				(${'reqd_' . $element}) 
		 					? $phpbb_root_path . 'styles/' . $reqd_template .'/' 
		 					: $root_path, ${'reqd_' . $element}, 
		 					
		 				$style_row[$element . '_id'], 
		 				$style_row[$element . '_name'], 
		 				$style_row[$element . '_copyright']
		 			);
	
					if (!$style_row[$element . '_name'])
						$style_row[$element . '_name'] = $reqd_template;
				}
				
				// Install
				$styles->install_style(
					$error, 
					$action, 
					$root_path,
					$id,
					$name,
					$path,
					$copyright,
					$active,
					$default,
					$style_row
				);
			}
		}
Example #2
0
    /**
     * 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}
';
        $styles->template_cfg .= '
# Some configuration options

#
# You can use this function to inherit templates from another template.
# The template of the given name has to be installed.
# Templates cannot inherit from inheriting templates.
#';
        $styles->imageset_keys = array('logos' => array('site_logo'), 'buttons' => array('icon_back_top', 'icon_contact_aim', 'icon_contact_email', 'icon_contact_icq', 'icon_contact_jabber', 'icon_contact_msnm', 'icon_contact_pm', 'icon_contact_yahoo', 'icon_contact_www', 'icon_post_delete', 'icon_post_edit', 'icon_post_info', 'icon_post_quote', 'icon_post_report', 'icon_user_online', 'icon_user_offline', 'icon_user_profile', 'icon_user_search', 'icon_user_warn', 'button_pm_forward', 'button_pm_new', 'button_pm_reply', 'button_topic_locked', 'button_topic_new', 'button_topic_reply'), 'icons' => array('icon_post_target', 'icon_post_target_unread', 'icon_topic_attach', 'icon_topic_latest', 'icon_topic_newest', 'icon_topic_reported', 'icon_topic_unapproved', 'icon_friend', 'icon_foe'), 'forums' => array('forum_link', 'forum_read', 'forum_read_locked', 'forum_read_subforum', 'forum_unread', 'forum_unread_locked', 'forum_unread_subforum', 'subforum_read', 'subforum_unread'), 'folders' => array('topic_moved', 'topic_read', 'topic_read_mine', 'topic_read_hot', 'topic_read_hot_mine', 'topic_read_locked', 'topic_read_locked_mine', 'topic_unread', 'topic_unread_mine', 'topic_unread_hot', 'topic_unread_hot_mine', 'topic_unread_locked', 'topic_unread_locked_mine', 'sticky_read', 'sticky_read_mine', 'sticky_read_locked', 'sticky_read_locked_mine', 'sticky_unread', 'sticky_unread_mine', 'sticky_unread_locked', 'sticky_unread_locked_mine', 'announce_read', 'announce_read_mine', 'announce_read_locked', 'announce_read_locked_mine', 'announce_unread', 'announce_unread_mine', 'announce_unread_locked', 'announce_unread_locked_mine', 'global_read', 'global_read_mine', 'global_read_locked', 'global_read_locked_mine', 'global_unread', 'global_unread_mine', 'global_unread_locked', 'global_unread_locked_mine', 'pm_read', 'pm_unread'), 'polls' => array('poll_left', 'poll_center', 'poll_right'), 'ui' => array('upload_bar'), 'user' => array('user_icon1', 'user_icon2', 'user_icon3', 'user_icon4', 'user_icon5', 'user_icon6', 'user_icon7', 'user_icon8', 'user_icon9', 'user_icon10'));
        // Define references.
        $error = array();
        $style_id = 0;
        $style_row = array('install_name' => $stylecfg['name'], 'install_copyright' => $stylecfg['copyright'], 'template_id' => 0, 'template_name' => $stylecfg['name'], 'template_copyright' => $stylecfg['copyright'], 'theme_id' => 0, 'theme_name' => $stylecfg['name'], 'theme_copyright' => $stylecfg['copyright'], 'imageset_id' => 0, 'imageset_name' => $stylecfg['name'], 'imageset_copyright' => $stylecfg['copyright'], 'store_db' => 0, 'style_active' => 1, 'style_default' => 0);
        // Install the style.
        // (&$error, $action, $root_path, &$id, $name, $path, $copyright, $active, $default, &$style_row, $template_root_path = false, $template_path = false, $theme_root_path = false, $theme_path = false, $imageset_root_path = false, $imageset_path = false)
        if (!$styles->install_style($error, 'install', $style_root, $style_id, $stylecfg['name'], $contrib->contrib_id, $stylecfg['copyright'], true, false, $style_row)) {
            if ($error != array(phpbb::$user->lang['STYLE_ERR_NAME_EXIST'])) {
                $this->error = array_merge($this->error, $error);
            } else {
                $sql = 'SELECT style_id
					FROM ' . STYLES_TABLE . "\n\t\t\t\t\tWHERE style_name = '" . $db->sql_escape(basename($stylecfg['name'])) . "'";
                $db->sql_query($sql);
                $style_id = $db->sql_fetchfield('style_id');
                $db->sql_freeresult();
            }
        }
        // Have UMIL refresh the template, theme, imageset
        phpbb::_include('../umil/umil', false, 'umil');
        $umil = new umil(true, $db);
        $umil->cache_purge('template', $style_id);
        $umil->cache_purge('theme', $style_id);
        $umil->cache_purge('imageset', $style_id);
        foreach ($variables as $variable) {
            $GLOBALS[$variable] = ${'_' . $variable};
        }
        return $style_id;
    }
Example #3
0
    public function __construct()
    {
        global $db, $user, $auth, $cache;
        global $quickinstall_path, $phpbb_root_path, $phpEx, $config, $qi_config, $msg_title;
        // include installation functions
        include $quickinstall_path . 'includes/functions_install.' . $phpEx;
        //		include($quickinstall_path . 'includes/qi_functions.' . $phpEx);
        $config = array_merge($config, array('rand_seed' => md5(mt_rand()), 'rand_seed_last_update' => time()));
        // load installer lang
        qi::add_lang('phpbb');
        // phpbb's install uses $lang instead of $user->lang
        // need to use $GLOBALS here
        $GLOBALS['lang'] =& $user->lang;
        global $lang;
        // request variables
        $dbname = htmlspecialchars_decode(request_var('dbname', '', true));
        $redirect = request_var('redirect', false);
        $drop_db = request_var('drop_db', false);
        $delete_files = request_var('delete_files', false);
        $automod = request_var('automod', false);
        $make_writable = request_var('make_writable', false);
        $populate = request_var('populate', false);
        $subsilver = request_var('subsilver', 0);
        $alt_env = request_var('alt_env', '');
        $pop_data = request_var('pop_data', array('' => ''));
        // Some populate checking
        if ($populate) {
            if (empty($pop_data['num_users']) && empty($pop_data['num_cats']) && empty($pop_data['num_forums']) && empty($pop_data['num_topics']) && empty($pop_data['num_replies'])) {
                // populate with nothing?
                $populate = false;
            } else {
                $pop_data['email_domain'] = trim($pop_data['email_domain']);
                if (!empty($pop_data['num_users']) && empty($pop_data['email_domain'])) {
                    trigger_error($user->lang['NEED_EMAIL_DOMAIN'], E_USER_ERROR);
                }
            }
        }
        foreach (array('site_name', 'site_desc', 'table_prefix', 'admin_name', 'admin_pass') as $r) {
            if ($_r = request_var($r, '', true)) {
                $qi_config[$r] = $_r;
            }
        }
        if ($alt_env !== '' && !file_exists($quickinstall_path . 'sources/phpBB3_alt/' . $alt_env)) {
            trigger_error('NO_ALT_ENV');
        }
        // Set up our basic founder.
        $user->data['user_id'] = 2;
        //
        $user->data['username'] = $qi_config['admin_name'];
        $user->data['user_colour'] = 'AA0000';
        // overwrite some of them ;)
        $user->lang = array_merge($user->lang, array('CONFIG_SITE_DESC' => $qi_config['site_desc'], 'CONFIG_SITENAME' => $qi_config['site_name']));
        // smaller ^^
        list($dbms, $table_prefix) = array(&$qi_config['dbms'], &$qi_config['table_prefix']);
        // check if we have a board db (and folder) name
        if (!$dbname) {
            trigger_error('NO_DB');
        }
        // Set the new board as root path.
        $board_dir = $quickinstall_path . 'boards/' . $dbname . '/';
        $phpbb_root_path = $board_dir;
        if (!defined('PHPBB_ROOT_PATH')) {
            define('PHPBB_ROOT_PATH', $board_dir);
        }
        if (file_exists($board_dir)) {
            if ($delete_files) {
                file_functions::delete_dir($board_dir);
            } else {
                trigger_error(sprintf($user->lang['DIR_EXISTS'], $board_dir));
            }
        }
        // copy all of our files
        file_functions::copy_dir($quickinstall_path . 'sources/' . ($alt_env === '' ? 'phpBB3/' : "phpBB3_alt/{$alt_env}/"), $board_dir);
        if ($make_writable) {
            chmod($board_dir, 0777);
        }
        // Now make sure we have a valid db-name and prefix
        $qi_config['db_prefix'] = validate_dbname($qi_config['db_prefix'], true);
        $dbname = validate_dbname($dbname);
        // copy qi's lang file for the log
        if (file_exists("{$quickinstall_path}language/{$qi_config['qi_lang']}/info_acp_qi.{$phpEx}") && file_exists($board_dir . 'language/' . $qi_config['qi_lang'])) {
            copy("{$quickinstall_path}language/{$qi_config['qi_lang']}/info_acp_qi.{$phpEx}", "{$board_dir}language/{$qi_config['qi_lang']}/mods/info_acp_qi.{$phpEx}");
        } else {
            copy("{$quickinstall_path}language/en/info_acp_qi.{$phpEx}", "{$board_dir}language/en/mods/info_acp_qi.{$phpEx}");
        }
        if ($dbms == 'sqlite' || $dbms == 'firebird') {
            $qi_config['dbhost'] = $qi_config['db_prefix'] . $dbname;
            // temp remove some
            list($qi_config['db_prefix'], $dbname, $temp1, $temp2) = array('', '', &$qi_config['db_prefix'], &$dbname);
        }
        // Set the new board as language path to get language files from outside phpBB
        $user->set_custom_lang_path($phpbb_root_path . 'language/');
        // Write to config.php ;)
        $config_data = "<?php\n";
        $config_data .= "// phpBB 3.0.x auto-generated configuration file\n// Do not change anything in this file!\n";
        $config_data_array = array('dbms' => $dbms, 'dbhost' => $qi_config['dbhost'], 'dbport' => $qi_config['dbport'], 'dbname' => $qi_config['db_prefix'] . $dbname, 'dbuser' => $qi_config['dbuser'], 'dbpasswd' => htmlspecialchars_decode($qi_config['dbpasswd']), 'table_prefix' => $table_prefix, 'acm_type' => 'file', 'load_extensions' => '');
        foreach ($config_data_array as $key => $value) {
            $config_data .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n";
        }
        unset($config_data_array);
        $config_data .= "\n@define('PHPBB_INSTALLED', true);\n";
        $config_data .= "@define('DEBUG', true);\n";
        $config_data .= "@define('DEBUG_EXTRA', true);\n";
        $config_data .= '?' . '>';
        // Done this to prevent highlighting editors getting confused!
        file_put_contents($board_dir . 'config.' . $phpEx, $config_data);
        if ($dbms == 'sqlite' || $dbms == 'firebird') {
            // and now restore
            list($qi_config['db_prefix'], $dbname) = array(&$temp1, &$temp2);
        }
        // update phpbb_root_path
        $phpbb_root_path = $board_dir;
        if ($drop_db) {
            $db->sql_query('DROP DATABASE IF EXISTS ' . $qi_config['db_prefix'] . $dbname);
        } else {
            // Check if the database exists.
            if ($dbms == 'sqlite' || $dbms == 'firebird') {
                $db_check = $db->sql_select_db($quickinstall_path . 'cache/' . $qi_config['db_prefix'] . $dbname);
            } else {
                $db_check = $db->sql_select_db($qi_config['db_prefix'] . $dbname);
            }
            if ($db_check) {
                trigger_error(sprintf($user->lang['DB_EXISTS'], $qi_config['db_prefix'] . $dbname));
            }
        }
        if ($dbms == 'sqlite' || $dbms == 'firebird') {
            $db->sql_query('CREATE DATABASE ' . $quickinstall_path . 'cache/' . $qi_config['db_prefix'] . $dbname);
            $db->sql_select_db($quickinstall_path . 'cache/' . $qi_config['db_prefix'] . $dbname);
        } else {
            $db->sql_query('CREATE DATABASE ' . $qi_config['db_prefix'] . $dbname);
            $db->sql_select_db($qi_config['db_prefix'] . $dbname);
        }
        // include install lang fom phpbb
        qi::add_lang('install', $phpbb_root_path . 'language/' . $qi_config['default_lang'] . '/');
        // perform sql
        load_schema($phpbb_root_path . 'install/schemas/', $dbms);
        $current_time = time();
        $user_ip = !empty($_SERVER['REMOTE_ADDR']) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : '';
        $script_path = !empty($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
        if (!$script_path) {
            $script_path = !empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
        }
        // Replace backslashes and doubled slashes (could happen on some proxy setups)
        $script_path = str_replace(array('\\', '//'), '/', $script_path);
        $script_path = trim(dirname($script_path));
        // add the dbname to script path
        $script_path .= '/boards/' . $dbname;
        $config_ary = array('board_startdate' => $current_time, 'default_lang' => $qi_config['default_lang'], 'server_name' => $qi_config['server_name'], 'server_port' => $qi_config['server_port'], 'board_email' => $qi_config['board_email'], 'board_contact' => $qi_config['board_email'], 'cookie_domain' => $qi_config['cookie_domain'], 'default_dateformat' => $user->lang['default_dateformat'], 'email_enable' => $qi_config['email_enable'], 'smtp_delivery' => $qi_config['smtp_delivery'], 'smtp_host' => $qi_config['smtp_host'], 'smtp_auth_method' => $qi_config['smtp_auth'], 'smtp_username' => $qi_config['smtp_user'], 'smtp_password' => $qi_config['smtp_pass'], 'cookie_secure' => $qi_config['cookie_secure'], 'script_path' => $script_path, 'server_protocol' => !empty($qi_config['server_protocol']) ? $qi_config['server_protocol'] : 'http://', 'newest_username' => $qi_config['admin_name'], 'avatar_salt' => md5(mt_rand()), 'cookie_name' => 'phpbb3_' . strtolower(gen_rand_string(5)));
        if (@extension_loaded('gd') || can_load_dll('gd')) {
            $config_ary['captcha_gd'] = 1;
        }
        foreach ($config_ary as $config_name => $config_value) {
            set_config($config_name, $config_value);
        }
        // Set default config and post data, this applies to all DB's
        $sql_ary = array("UPDATE {$table_prefix}users\n\t\t\t\tSET username = '******'admin_name']) . "', user_password='******'admin_pass'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($qi_config['default_lang']) . "', user_email='" . $db->sql_escape($qi_config['board_email']) . "', user_dateformat='" . $db->sql_escape($user->lang['default_dateformat']) . "', user_email_hash = " . (crc32($qi_config['board_email']) . strlen($qi_config['board_email'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($qi_config['admin_name'])) . "'\n\t\t\t\tWHERE username = '******'", "UPDATE {$table_prefix}moderator_cache\n\t\t\t\tSET username = '******'admin_name']) . "'\n\t\t\t\tWHERE username = '******'", "UPDATE {$table_prefix}forums\n\t\t\t\tSET forum_last_poster_name = '" . $db->sql_escape($qi_config['admin_name']) . "'\n\t\t\t\tWHERE forum_last_poster_name = 'Admin'", "UPDATE {$table_prefix}topics\n\t\t\t\tSET topic_first_poster_name = '" . $db->sql_escape($qi_config['admin_name']) . "', topic_last_poster_name = '" . $db->sql_escape($qi_config['admin_name']) . "'\n\t\t\t\tWHERE topic_first_poster_name = 'Admin'\n\t\t\t\t\tOR topic_last_poster_name = 'Admin'", "UPDATE {$table_prefix}users\n\t\t\t\tSET user_regdate = {$current_time}", "UPDATE {$table_prefix}posts\n\t\t\t\tSET post_time = {$current_time}, poster_ip = '" . $db->sql_escape($user_ip) . "'", "UPDATE {$table_prefix}topics\n\t\t\t\tSET topic_time = {$current_time}, topic_last_post_time = {$current_time}", "UPDATE {$table_prefix}forums\n\t\t\t\tSET forum_last_post_time = {$current_time}", "UPDATE {$table_prefix}config\n\t\t\t\tSET config_value = '" . $db->sql_escape($qi_config['site_name']) . "'\n\t\t\t\tWHERE config_name = 'sitename'", "UPDATE {$table_prefix}config\n\t\t\t\tSET config_value = '" . $db->sql_escape($qi_config['site_desc']) . "'\n\t\t\t\tWHERE config_name = 'site_desc'", "UPDATE {$table_prefix}config\n\t\t\t\tSET config_value = '1'\n\t\t\t\tWHERE config_name = 'load_tplcompile'");
        foreach ($sql_ary as $sql) {
            if (!$db->sql_query($sql)) {
                $error = $db->sql_error();
                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);
    }