set() public method

public set ( $n )
Exemplo n.º 1
0
 /**
  * Parse BBCode
  */
 function parse_bbcode()
 {
     if (!$this->bbcodes) {
         $this->bbcode_init();
     }
     global $user;
     $this->bbcode_bitfield = '';
     $bitfield = new bitfield();
     foreach ($this->bbcodes as $bbcode_name => $bbcode_data) {
         if (isset($bbcode_data['disabled']) && $bbcode_data['disabled']) {
             foreach ($bbcode_data['regexp'] as $regexp => $replacement) {
                 if (preg_match($regexp, $this->message)) {
                     $this->warn_msg[] = sprintf($user->lang['UNAUTHORISED_BBCODE'], '[' . $bbcode_name . ']');
                     continue;
                 }
             }
         } else {
             foreach ($bbcode_data['regexp'] as $regexp => $replacement) {
                 // The pattern gets compiled and cached by the PCRE extension,
                 // it should not demand recompilation
                 if (preg_match($regexp, $this->message)) {
                     $this->message = preg_replace($regexp, $replacement, $this->message);
                     $bitfield->set($bbcode_data['bbcode_id']);
                 }
             }
         }
     }
     $this->bbcode_bitfield = $bitfield->get_base64();
 }
Exemplo n.º 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;
    }
Exemplo n.º 3
0
 /**
  * Generates default bitfield
  *
  * This bitfield decides which bbcodes are defined in a template.
  *
  * @return string Bitfield
  */
 function default_bitfield()
 {
     static $value;
     if (isset($value)) {
         return $value;
     }
     // 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);
     $value = $bitfield->get_base64();
     return $value;
 }
Exemplo n.º 4
0
    function main($id, $mode)
    {
        global $db, $user, $auth, $template, $cache;
        global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
        // 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);
        $user->add_lang('acp/styles');
        $this->tpl_name = 'acp_styles';
        $this->page_title = 'ACP_CAT_STYLES';
        $action = request_var('action', '');
        $action = isset($_POST['add']) ? 'add' : $action;
        $style_id = request_var('id', 0);
        // Fill the configuration variables
        $this->style_cfg = $this->template_cfg = $this->theme_cfg = $this->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}
';
        $this->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}
';
        $this->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.
#';
        $this->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_quickedit', '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', 'icon_topic_solved_set', 'icon_topic_solved_unset', 'icon_topic_solved_head', 'icon_topic_solved_list', 'icon_topic_solved_post'), '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'));
        // [+] Karma MOD
        global $karmamod;
        $karmamod->acp_styles_imageset($this->imageset_keys);
        // [-] Karma MOD
        // Execute overall actions
        switch ($action) {
            case 'delete':
                if ($style_id) {
                    $this->remove($mode, $style_id);
                    return;
                }
                break;
            case 'export':
                if ($style_id) {
                    $this->export($mode, $style_id);
                    return;
                }
                break;
            case 'install':
                $this->install($mode);
                return;
                break;
            case 'add':
                $this->add($mode);
                return;
                break;
            case 'details':
                if ($style_id) {
                    $this->details($mode, $style_id);
                    return;
                }
                break;
            case 'edit':
                if ($style_id) {
                    switch ($mode) {
                        case 'imageset':
                            return $this->edit_imageset($style_id);
                        case 'template':
                            return $this->edit_template($style_id);
                        case 'theme':
                            return $this->edit_theme($style_id);
                    }
                }
                break;
            case 'cache':
                if ($style_id) {
                    switch ($mode) {
                        case 'template':
                            return $this->template_cache($style_id);
                    }
                }
                break;
        }
        switch ($mode) {
            case 'style':
                switch ($action) {
                    case 'activate':
                    case 'deactivate':
                        if ($style_id == $config['default_style']) {
                            trigger_error($user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING);
                        }
                        if ($action == 'deactivate' && confirm_box(true) || $action == 'activate') {
                            $sql = 'UPDATE ' . STYLES_TABLE . '
								SET style_active = ' . ($action == 'activate' ? 1 : 0) . '
								WHERE style_id = ' . $style_id;
                            $db->sql_query($sql);
                            // Set style to default for any member using deactivated style
                            if ($action == 'deactivate') {
                                $sql = 'UPDATE ' . USERS_TABLE . '
									SET user_style = ' . $config['default_style'] . "\n\t\t\t\t\t\t\t\t\tWHERE user_style = {$style_id}";
                                $db->sql_query($sql);
                                $sql = 'UPDATE ' . FORUMS_TABLE . '
									SET forum_style = 0
									WHERE forum_style = ' . $style_id;
                                $db->sql_query($sql);
                            }
                        } else {
                            if ($action == 'deactivate') {
                                $s_hidden_fields = array('i' => $id, 'mode' => $mode, 'action' => $action, 'style_id' => $style_id);
                                confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields));
                            }
                        }
                        break;
                }
                $this->frontend('style', array('details'), array('export', 'delete'));
                break;
            case 'template':
                switch ($action) {
                    // Refresh template data stored in db and clear cache
                    case 'refresh':
                        $sql = 'SELECT *
							FROM ' . STYLES_TEMPLATE_TABLE . "\n\t\t\t\t\t\t\tWHERE template_id = {$style_id}";
                        $result = $db->sql_query($sql);
                        $template_row = $db->sql_fetchrow($result);
                        $db->sql_freeresult($result);
                        if (!$template_row) {
                            trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING);
                        }
                        if (confirm_box(true)) {
                            $template_refreshed = '';
                            // Only refresh database if the template is stored in the database
                            if ($template_row['template_storedb'] && file_exists("{$phpbb_root_path}styles/{$template_row['template_path']}/template/")) {
                                $filelist = array('' => array());
                                $sql = 'SELECT template_filename, template_mtime
									FROM ' . STYLES_TEMPLATE_DATA_TABLE . "\n\t\t\t\t\t\t\t\t\tWHERE template_id = {$style_id}";
                                $result = $db->sql_query($sql);
                                while ($row = $db->sql_fetchrow($result)) {
                                    //									if (@filemtime("{$phpbb_root_path}styles/{$template_row['template_path']}/template/" . $row['template_filename']) > $row['template_mtime'])
                                    //									{
                                    // get folder info from the filename
                                    if (($slash_pos = strrpos($row['template_filename'], '/')) === false) {
                                        $filelist[''][] = $row['template_filename'];
                                    } else {
                                        $filelist[substr($row['template_filename'], 0, $slash_pos + 1)][] = substr($row['template_filename'], $slash_pos + 1, strlen($row['template_filename']) - $slash_pos - 1);
                                    }
                                    //									}
                                }
                                $db->sql_freeresult($result);
                                $this->store_templates('update', $style_id, $template_row['template_path'], $filelist);
                                unset($filelist);
                                $template_refreshed = $user->lang['TEMPLATE_REFRESHED'] . '<br />';
                                add_log('admin', 'LOG_TEMPLATE_REFRESHED', $template_row['template_name']);
                            }
                            $this->clear_template_cache($template_row);
                            trigger_error($template_refreshed . $user->lang['TEMPLATE_CACHE_CLEARED'] . adm_back_link($this->u_action));
                        } else {
                            confirm_box(false, $template_row['template_storedb'] ? $user->lang['CONFIRM_TEMPLATE_REFRESH'] : $user->lang['CONFIRM_TEMPLATE_CLEAR_CACHE'], build_hidden_fields(array('i' => $id, 'mode' => $mode, 'action' => $action, 'id' => $style_id)));
                        }
                        break;
                }
                $this->frontend('template', array('edit', 'cache', 'details'), array('refresh', 'export', 'delete'));
                break;
            case 'theme':
                switch ($action) {
                    // Refresh theme data stored in the database
                    case 'refresh':
                        $sql = 'SELECT *
							FROM ' . STYLES_THEME_TABLE . "\n\t\t\t\t\t\t\tWHERE theme_id = {$style_id}";
                        $result = $db->sql_query($sql);
                        $theme_row = $db->sql_fetchrow($result);
                        $db->sql_freeresult($result);
                        if (!$theme_row) {
                            trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING);
                        }
                        if (!$theme_row['theme_storedb']) {
                            trigger_error($user->lang['THEME_ERR_REFRESH_FS'] . adm_back_link($this->u_action), E_USER_WARNING);
                        }
                        if (confirm_box(true)) {
                            if ($theme_row['theme_storedb'] && file_exists("{$phpbb_root_path}styles/{$theme_row['theme_path']}/theme/stylesheet.css")) {
                                // Save CSS contents
                                $sql_ary = array('theme_mtime' => (int) filemtime("{$phpbb_root_path}styles/{$theme_row['theme_path']}/theme/stylesheet.css"), 'theme_data' => $this->db_theme_data($theme_row));
                                $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\t\t\t\t\t\t\tWHERE theme_id = {$style_id}";
                                $db->sql_query($sql);
                                $cache->destroy('sql', STYLES_THEME_TABLE);
                                add_log('admin', 'LOG_THEME_REFRESHED', $theme_row['theme_name']);
                                trigger_error($user->lang['THEME_REFRESHED'] . adm_back_link($this->u_action));
                            }
                        } else {
                            confirm_box(false, $user->lang['CONFIRM_THEME_REFRESH'], build_hidden_fields(array('i' => $id, 'mode' => $mode, 'action' => $action, 'id' => $style_id)));
                        }
                        break;
                }
                $this->frontend('theme', array('edit', 'details'), array('refresh', 'export', 'delete'));
                break;
            case 'imageset':
                switch ($action) {
                    case 'refresh':
                        $sql = 'SELECT *
							FROM ' . STYLES_IMAGESET_TABLE . "\n\t\t\t\t\t\t\tWHERE imageset_id = {$style_id}";
                        $result = $db->sql_query($sql);
                        $imageset_row = $db->sql_fetchrow($result);
                        $db->sql_freeresult($result);
                        if (!$imageset_row) {
                            trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
                        }
                        if (confirm_box(true)) {
                            $sql_ary = array();
                            $imageset_definitions = array();
                            foreach ($this->imageset_keys as $topic => $key_array) {
                                $imageset_definitions = array_merge($imageset_definitions, $key_array);
                            }
                            $cfg_data_imageset = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/imageset.cfg");
                            $db->sql_transaction('begin');
                            $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . '
								WHERE imageset_id = ' . $style_id;
                            $result = $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);
                                    if (in_array($image_name, $imageset_definitions)) {
                                        $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 = $db->sql_query($sql);
                            while ($row = $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);
                                            if (in_array($image_name, $imageset_definitions)) {
                                                $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']);
                                            }
                                        }
                                    }
                                }
                            }
                            $db->sql_freeresult($result);
                            $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_REFRESHED', $imageset_row['imageset_name']);
                            trigger_error($user->lang['IMAGESET_REFRESHED'] . adm_back_link($this->u_action));
                        } else {
                            confirm_box(false, $user->lang['CONFIRM_IMAGESET_REFRESH'], build_hidden_fields(array('i' => $id, 'mode' => $mode, 'action' => $action, 'id' => $style_id)));
                        }
                        break;
                }
                $this->frontend('imageset', array('edit', 'details'), array('refresh', 'export', 'delete'));
                break;
        }
    }
    /**
     * Set manager from acp_styles class.
     *
     * @return null
     */
    protected function set_manager()
    {
        $this->user->add_lang('acp/styles');
        if (!class_exists('acp_styles')) {
            include $this->root_path . 'includes/acp/acp_styles.' . $this->php_ext;
        }
        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);
        }
        $this->manager = new acp_styles();
        // Fill the configuration variables
        $this->manager->style_cfg = $this->manager->template_cfg = $this->manager->theme_cfg = $this->manager->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}
';
        $this->manager->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}
';
        $this->manager->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.
#';
        $this->manager->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'));
    }