コード例 #1
0
ファイル: install_custom.php プロジェクト: ZerGabriel/bbDKP
 /**
  * installs default game roles for custom game
  */
 protected function InstallRoles()
 {
     global $db;
     $umil = new \umil();
     $db->sql_query('DELETE FROM ' . BB_GAMEROLE_TABLE . " WHERE role_id < 3 and game_id = '" . $this->game_id . "'");
     $umil->table_row_insert(BB_GAMEROLE_TABLE, array(array('game_id' => $this->game_id, 'role_id' => 0, 'role_color' => '#FF4455', 'role_icon' => 'dps_icon'), array('game_id' => $this->game_id, 'role_id' => 1, 'role_color' => '#11FF77', 'role_icon' => 'healer_icon'), array('game_id' => $this->game_id, 'role_id' => 2, 'role_color' => '#c3834c', 'role_icon' => 'tank_icon')));
     $db->sql_query('DELETE FROM ' . BB_LANGUAGE . " WHERE attribute_id < 3  and attribute = 'role' and game_id = '" . $this->game_id . "'");
     //english
     $umil->table_row_insert(BB_LANGUAGE, array(array('game_id' => $this->game_id, 'attribute_id' => 0, 'language' => 'en', 'attribute' => 'role', 'name' => 'Damage', 'name_short' => 'DPS'), array('game_id' => $this->game_id, 'attribute_id' => 1, 'language' => 'en', 'attribute' => 'role', 'name' => 'Healer', 'name_short' => 'HPS'), array('game_id' => $this->game_id, 'attribute_id' => 2, 'language' => 'en', 'attribute' => 'role', 'name' => 'Defense', 'name_short' => 'DEF')));
     //french
     $umil->table_row_insert(BB_LANGUAGE, array(array('game_id' => $this->game_id, 'attribute_id' => 0, 'language' => 'fr', 'attribute' => 'role', 'name' => 'Dégats', 'name_short' => 'DPS'), array('game_id' => $this->game_id, 'attribute_id' => 1, 'language' => 'fr', 'attribute' => 'role', 'name' => 'Soigneur', 'name_short' => 'HPS'), array('game_id' => $this->game_id, 'attribute_id' => 2, 'language' => 'fr', 'attribute' => 'role', 'name' => 'Défense', 'name_short' => 'DEF')));
     //german
     $umil->table_row_insert(BB_LANGUAGE, array(array('game_id' => $this->game_id, 'attribute_id' => 0, 'language' => 'de', 'attribute' => 'role', 'name' => 'Kämpfer', 'name_short' => 'Schaden'), array('game_id' => $this->game_id, 'attribute_id' => 1, 'language' => 'de', 'attribute' => 'role', 'name' => 'Heiler', 'name_short' => 'Heil'), array('game_id' => $this->game_id, 'attribute_id' => 2, 'language' => 'de', 'attribute' => 'role', 'name' => 'Verteidigung', 'name_short' => 'Schutz')));
     //Italian
     $umil->table_row_insert(BB_LANGUAGE, array(array('game_id' => $this->game_id, 'attribute_id' => 0, 'language' => 'it', 'attribute' => 'role', 'name' => 'Danni', 'name_short' => 'Danni'), array('game_id' => $this->game_id, 'attribute_id' => 1, 'language' => 'it', 'attribute' => 'role', 'name' => 'Cura', 'name_short' => 'Cura'), array('game_id' => $this->game_id, 'attribute_id' => 2, 'language' => 'it', 'attribute' => 'role', 'name' => 'Difeza', 'name_short' => 'Tank')));
 }
コード例 #2
0
/**
* Setup Advertisements
*
* Grabs an advertisement for each available position and outputs it to the template.
*/
function setup_ads()
{
    global $cache, $config, $db, $phpbb_root_path, $phpEx, $template, $user, $forum_id;
    if (!isset($config['ads_version'])) {
        return;
    }
    $user->add_lang('mods/ads');
    // Automatically update if required
    if (version_compare($config['ads_version'], '1.0.12', '<')) {
        if (!class_exists('umil')) {
            if (!file_exists($phpbb_root_path . 'umil/umil.' . $phpEx)) {
                trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
            }
            include $phpbb_root_path . 'umil/umil.' . $phpEx;
        }
        $umil = new umil(true);
        include $phpbb_root_path . 'ads/versions.' . $phpEx;
        $umil->run_actions('update', $versions, 'ads_version');
        unset($versions);
    }
    if (!$config['ads_enable']) {
        return;
    }
    $forum_id = $forum_id ? $forum_id : request_var('f', 0);
    $ads = get_ads($user->data['user_id'], $forum_id);
    if (sizeof($ads)) {
        foreach ($ads as $position_id => $code) {
            $template->assign_vars(array('ADS_' . $position_id => $code));
        }
    }
    if (sizeof($ads) || isset($user->data['ad_owner']) && $user->data['ad_owner']) {
        if (isset($user->data['ad_owner']) && $user->data['ad_owner']) {
            $template->_tpldata['.'][0]['ADS_8'] = isset($template->_tpldata['.'][0]['ADS_8']) ? $template->_tpldata['.'][0]['ADS_8'] : '';
            $template->_tpldata['.'][0]['ADS_8'] .= '<div class="copyright" style="text-align: center; margin-top: 5px;"><a href="' . append_sid("{$phpbb_root_path}ads/my_ads.{$phpEx}") . '">' . $user->lang['MY_ADS'] . '</a></div>';
        }
        $template->assign_var('ADS_CLICK_FILE', $phpbb_root_path . 'ads/click.' . $phpEx);
        $template->assign_var('ADS_VIEW_FILE', $phpbb_root_path . 'ads/view.' . $phpEx);
    }
}
コード例 #3
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;
    }
コード例 #4
0
ファイル: style.php プロジェクト: kairion/customisation-db
 /**
  * Uninstall the type
  */
 public function uninstall()
 {
     if (isset(phpbb::$config['titania_num_mods'])) {
         if (!class_exists('umil')) {
             include PHPBB_ROOT_PATH . 'umil/umil.' . PHP_EXT;
         }
         $umil = new umil(true, phpbb::$db);
         // Permissions
         $umil->permission_remove(array('u_titania_mod_style_queue_discussion', 'u_titania_mod_style_queue', 'u_titania_mod_style_validate', 'u_titania_mod_style_moderate'));
         // Mod count holder
         $umil->config_remove('titania_num_styles');
     }
 }
コード例 #5
0
* @copyright (c) 2008 phpBB Customisation Database Team
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_TITANIA')) {
    exit;
}
//define('TEST_INSTALLATION', true);
titania::$hook->register_ary('phpbb_com_', array('titania_page_header', 'titania_page_footer', array('titania_queue', 'update_first_queue_post'), array('titania_topic', '__construct'), array('titania_post', '__construct'), array('titania_post', 'post'), array('titania_post', 'edit'), array('titania_queue', 'approve'), array('titania_queue', 'deny'), array('titania_queue', 'close'), array('titania_queue', 'delete'), array('titania_contribution', 'assign_details')));
// Do we need to install the DB stuff?
if (!isset(phpbb::$config['titania_hook_phpbb_com']) || version_compare(phpbb::$config['titania_hook_phpbb_com'], '1.0.1', '<')) {
    phpbb::_include('../umil/umil', false, 'umil');
    $umil = new umil(true, phpbb::$db);
    $umil->run_actions('update', array('1.0.0' => array('table_column_add' => array(array(TITANIA_TOPICS_TABLE, 'phpbb_topic_id', array('UINT', 0)))), '1.0.1' => array('table_column_add' => array(array(TITANIA_POSTS_TABLE, 'phpbb_post_id', array('UINT', 0))))), 'titania_hook_phpbb_com');
    unset($umil);
}
/**
* .com custom header and footer
*/
function phpbb_com_titania_page_header($hook, $page_title)
{
    if (defined('TEST_INSTALLATION')) {
        return;
    }
    phpbb::$template->assign_vars(array('S_BODY_CLASS' => 'customise customisation-database', 'S_IS_WEBSITE' => true));
    global $auth, $phpEx, $template, $user;
    $root_path = TITANIA_ROOT . '../../';
    $base_path = generate_board_url(true) . '/';
コード例 #6
0
ファイル: umil_manual_example.php プロジェクト: phpbb/umil
$user->setup('mods/umil_auto_example');
if (!file_exists($phpbb_root_path . 'umil/umil.' . $phpEx)) {
    trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
}
// We only allow a founder install this MOD
if ($user->data['user_type'] != USER_FOUNDER) {
    if ($user->data['user_id'] == ANONYMOUS) {
        login_box('', 'LOGIN');
    }
    trigger_error('NOT_AUTHORISED');
}
if (!class_exists('umil')) {
    include $phpbb_root_path . 'umil/umil.' . $phpEx;
}
// If you want a completely stand alone version (able to use UMIL without messing with any of the language stuff) send true, otherwise send false
$umil = new umil(true);
if (confirm_box(true)) {
    // Install the base 0.3.0 version
    if (!$umil->config_exists('test_version')) {
        // Lets add a config setting named test_enable and set it to true
        $umil->config_add('test_enable', true);
        // We must handle the version number ourselves.
        $umil->config_add('test_version', '0.3.0');
    }
    switch ($config['test_version']) {
        // Update to 0.3.1
        case '0.3.0':
            // Now to add some permission settings.  Showing both the one at a time and "multicall" options
            $umil->permission_add('a_test_mod', true);
            $umil->permission_add(array(array('f_test_mod', false), array('u_test_mod', true)));
            // How about we give some default permissions then as well?
コード例 #7
0
 /**
  * Uninstall the type
  */
 public function uninstall()
 {
     if (isset(phpbb::$config['titania_num_official_tools'])) {
         if (!class_exists('umil')) {
             include PHPBB_ROOT_PATH . 'umil/umil.' . PHP_EXT;
         }
         $umil = new umil(true, phpbb::$db);
         // Permissions
         $umil->permission_remove(array('u_titania_mod_official_tool_moderate'));
         // Offical Tool count holder
         $umil->config_remove('titania_num_official_tools');
     }
 }
コード例 #8
0
$auth->acl($user->data);
$user->setup('mods/umil_legend_repositioning_mod');
if (!file_exists($phpbb_root_path . 'umil/umil.' . $phpEx)) {
    trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
}
// We only allow a founder to install this MOD
if ($user->data['user_type'] != USER_FOUNDER) {
    if ($user->data['user_id'] == ANONYMOUS) {
        login_box('', 'LOGIN');
    }
    trigger_error('NOT_AUTHORISED');
}
if (!class_exists('umil')) {
    include $phpbb_root_path . 'umil/umil.' . $phpEx;
}
$umil = new umil(true);
$mod = array('name' => 'Legend Repositioning', 'version' => '1.0.3', 'config' => 'legend_repositioning_version', 'enable' => 'legend_repositioning_enable');
if (confirm_box(true)) {
    // Install the base 1.0.3 version
    if (!$umil->config_exists($mod['config'])) {
        // Lets add a config setting for enabling/disabling the MOD and set it to true
        $umil->config_add($mod['enable'], true);
        // We must handle the version number ourselves.
        $umil->config_add($mod['config'], $mod['version']);
        $umil->table_column_add('phpbb_groups', 'group_position', array('UINT', '0'));
        // Select all groups that have no set position
        $sql = 'SELECT group_id
			FROM ' . GROUPS_TABLE . '
			WHERE group_position = 0';
        $result = $db->sql_query($sql);
        // Set default positions for groups (so that all positions are not set to 0)
コード例 #9
0
ファイル: index.php プロジェクト: ZerGabriel/bbDKP
/**
 * checks if there is an older install then quit
 * only updates from 1.2.8 are allowed...
 *   @package bbdkp
 */
function check_oldbbdkp()
{
    global $user, $umil, $config, $phpbb_root_path, $phpEx;
    include $phpbb_root_path . 'umil/umil.' . $phpEx;
    $umil = new umil();
    // check config
    if ($umil->config_exists('bbdkp_version')) {
        if (version_compare($config['bbdkp_version'], '1.2.8') == -1) {
            //stop here, the version is less than 1.2.8
            trigger_error($user->lang['UMIL_128MINIMUM'], E_USER_WARNING);
        }
    }
}
コード例 #10
0
<?php

/**
*
* @package Anti-Spam ACP
* @copyright (c) 2008 EXreaction
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB')) {
    exit;
}
if (!file_exists($phpbb_root_path . 'umil/umil.' . $phpEx)) {
    if (!file_exists($phpbb_root_path . 'antispam/umil.' . $phpEx)) {
        trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
    } else {
        include $phpbb_root_path . 'antispam/umil.' . $phpEx;
    }
} else {
    include $phpbb_root_path . 'umil/umil.' . $phpEx;
}
$umil = new umil(true);
include $phpbb_root_path . 'antispam/asacp_versions.' . $phpEx;
$umil->run_actions('update', $versions, 'asacp_version');
コード例 #11
0
$auth->acl($user->data);
$user->setup('mods/umil_scheduled_posts_mod');
if (!file_exists($phpbb_root_path . 'umil/umil.' . $phpEx)) {
    trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
}
// We only allow a founder to install this MOD
if ($user->data['user_type'] != USER_FOUNDER) {
    if ($user->data['user_id'] == ANONYMOUS) {
        login_box('', 'LOGIN');
    }
    trigger_error('NOT_AUTHORISED');
}
if (!class_exists('umil')) {
    include $phpbb_root_path . 'umil/umil.' . $phpEx;
}
$umil = new umil(true);
$mod = array('name' => $user->lang['TEST_MOD'], 'version' => '1.0.0', 'config' => 'scheduled_posts_version', 'enable' => 'scheduled_posts_enable');
if (confirm_box(true)) {
    // Install the base 1.0.0 version
    if (!$umil->config_exists($mod['config'])) {
        // Lets add a config setting for enabling/disabling the MOD and set it to true
        $umil->config_add($mod['enable'], true);
        // We must handle the version number ourselves.
        $umil->config_add($mod['config'], $mod['version']);
        $umil->permission_add(array(array('f_future_post', 0), array('m_viewfp', 0)));
        // Our final action, we purge the board cache
        $umil->cache_purge();
    }
    // We are done
    trigger_error('Done!');
} else {
コード例 #12
0
ファイル: erk.php プロジェクト: melvingb/phpbb3.1-STK
        } else {
            if (is_numeric($unit)) {
                $mem_limit = floor((int) ($mem_limit . $unit) / 1048576);
            }
        }
    }
    $mem_limit = max(128, $mem_limit) . 'M';
} else {
    $mem_limit = '128M';
}
@ini_set('memory_limit', $mem_limit);
// Init critical repair and run the tools that *must* be ran before initing anything else
include STK_ROOT_PATH . 'includes/critical_repair.' . PHP_EXT;
$critical_repair = new critical_repair();
$critical_repair->initialise();
$critical_repair->run_tool('bom_sniffer');
$critical_repair->run_tool('config_repair');
require STK_ROOT_PATH . 'common.' . PHP_EXT;
// We'll run the rest of the critical repair tools automatically now
$critical_repair->autorun_tools();
// At this point things should be runnable
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('acp/common', $config['default_style']);
stk_add_lang('common');
// Purge teh caches
$umil = new umil(true);
$umil->cache_purge(array('data'));
// Let's tell the user all is okay :)
$critical_repair->trigger_error($user->lang['ERK_OK'], true);
コード例 #13
0
function insert_data_060($action, $version)
{
    global $db, $table_prefix, $umil, $config, $version_config_name, $transfer_invitation_data;
    switch ($action) {
        case 'install':
        case 'update':
            // Run this when installing the first time
            if ($umil->table_exists($table_prefix . 'invite_config')) {
                // Before we fill anything in this table, we truncate it. Maybe someone missed an old installation.
                $db->sql_query('TRUNCATE TABLE ' . $table_prefix . 'invite_config');
                // Now that's a lot of config...
                $sql_ary = array();
                $sql_ary[] = array('config_name' => 'tracking_time', 'config_value' => time());
                $sql_ary[] = array('config_name' => 'num_invitations', 'config_value' => 0);
                $sql_ary[] = array('config_name' => 'num_registrations', 'config_value' => 0);
                $sql_ary[] = array('config_name' => 'enable', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'enable_key', 'config_value' => 2);
                $sql_ary[] = array('config_name' => 'key_group', 'config_value' => 2);
                $sql_ary[] = array('config_name' => 'key_group_default', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'remove_newly_registered', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'invite_require_activation', 'config_value' => 0);
                $sql_ary[] = array('config_name' => 'invite_multiple', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'prevent_abuse', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'invite_confirm_code', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'set_cookie', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'enable_email_identification', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'invite_search_allowed', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'queue_time', 'config_value' => 300);
                $sql_ary[] = array('config_name' => 'message_min_chars', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'message_max_chars', 'config_value' => 1000);
                $sql_ary[] = array('config_name' => 'subject_min_chars', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'subject_max_chars', 'config_value' => 50);
                $sql_ary[] = array('config_name' => 'confirm', 'config_value' => 2);
                $sql_ary[] = array('config_name' => 'confirm_method', 'config_value' => 2);
                $sql_ary[] = array('config_name' => 'zebra', 'config_value' => 2);
                $sql_ary[] = array('config_name' => 'invite_language_select', 'config_value' => 'opt');
                $sql_ary[] = array('config_name' => 'invite_priority_flag', 'config_value' => MAIL_NORMAL_PRIORITY);
                $sql_ary[] = array('config_name' => 'display_navigation', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'display_registration', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'autohide_valid_key', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'advanced_statistics', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'display_t_inviter', 'config_value' => 0);
                $sql_ary[] = array('config_name' => 'display_t_invite', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'display_t_register', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'display_p_inviter', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'display_p_invite', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'display_p_register', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'display_m_inviter', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'display_m_invite', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'display_m_register', 'config_value' => 0);
                $sql_ary[] = array('config_name' => 'enable_limit_daily', 'config_value' => 0);
                $sql_ary[] = array('config_name' => 'limit_daily_basic', 'config_value' => 10);
                $sql_ary[] = array('config_name' => 'limit_daily_registrations', 'config_value' => 10);
                $sql_ary[] = array('config_name' => 'limit_daily_registrations_invitations', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'limit_daily_posts', 'config_value' => 200);
                $sql_ary[] = array('config_name' => 'limit_daily_posts_invitations', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'limit_daily_topics', 'config_value' => 10);
                $sql_ary[] = array('config_name' => 'limit_daily_topics_invitations', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'limit_daily_memberdays', 'config_value' => 100);
                $sql_ary[] = array('config_name' => 'limit_daily_memberdays_invitations', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'enable_limit_total', 'config_value' => 0);
                $sql_ary[] = array('config_name' => 'limit_total_basic', 'config_value' => 100);
                $sql_ary[] = array('config_name' => 'limit_total_registrations', 'config_value' => 10);
                $sql_ary[] = array('config_name' => 'limit_total_registrations_invitations', 'config_value' => 2);
                $sql_ary[] = array('config_name' => 'limit_total_posts', 'config_value' => 200);
                $sql_ary[] = array('config_name' => 'limit_total_posts_invitations', 'config_value' => 5);
                $sql_ary[] = array('config_name' => 'limit_total_topics', 'config_value' => 10);
                $sql_ary[] = array('config_name' => 'limit_total_topics_invitations', 'config_value' => 2);
                $sql_ary[] = array('config_name' => 'limit_total_memberdays', 'config_value' => 100);
                $sql_ary[] = array('config_name' => 'limit_total_memberdays_invitations', 'config_value' => 10);
                $sql_ary[] = array('config_name' => 'enable_cash', 'config_value' => 0);
                $sql_ary[] = array('config_name' => 'cash_invite', 'config_value' => 10);
                $sql_ary[] = array('config_name' => 'cash_id_invite', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'cash_register', 'config_value' => 20);
                $sql_ary[] = array('config_name' => 'cash_id_register', 'config_value' => 1);
                $sql_ary[] = array('config_name' => 'enable_ultimate_points', 'config_value' => 0);
                $sql_ary[] = array('config_name' => 'ultimate_points_invite', 'config_value' => 5);
                $sql_ary[] = array('config_name' => 'ultimate_points_register', 'config_value' => 20);
                $db->sql_multi_insert($table_prefix . 'invite_config ', $sql_ary);
            }
            // As version 0.5.4 doesn't support UMIL we have to make updating work correctly...
            if (isset($config[$version_config_name])) {
                if (version_compare($config[$version_config_name], '0.5.4', '==')) {
                    if (!class_exists('umil')) {
                        include $phpbb_root_path . 'umil/umil.' . $phpEx;
                        if (!isset($umil) || !is_object($umil)) {
                            $umil = new umil();
                        }
                    }
                    // Remove old modules with categories first to not cause any error
                    $umil->module_remove(array(array('acp', 'ACP_INVITE', 'ACP_INVITE'), array('acp', false, 'ACP_INVITE_LOG'), array('acp', false, 'ACP_INVITE'), array('ucp', false, 'UCP_INVITE_INVITE'), array('ucp', false, 'UCP_INVITE')));
                    // Add the new modules
                    $umil->module_add(array(array('acp', 'ACP_CAT_DOT_MODS', 'ACP_INVITE'), array('acp', 'ACP_INVITE', array('module_basename' => 'invite', 'module_langname' => 'ACP_INVITE_SETTINGS', 'module_mode' => 'settings', 'module_auth' => 'acl_a_invite_settings')), array('acp', 'ACP_INVITE', array('module_basename' => 'invite', 'module_langname' => 'ACP_INVITE_TEMPLATES', 'module_mode' => 'templates', 'module_auth' => 'acl_a_invite_settings')), array('acp', 'ACP_INVITE', array('module_basename' => 'invite', 'module_langname' => 'ACP_INVITE_LOG', 'module_mode' => 'log', 'module_auth' => 'acl_a_invite_log')), array('ucp', '', 'UCP_INVITE'), array('ucp', 'UCP_INVITE', array('module_basename' => 'invite', 'module_langname' => 'UCP_INVITE_INVITE', 'module_mode' => 'invite', 'module_auth' => 'acl_u_send_invite'))));
                }
            }
            // Transfer existing invitation data if wished
            if ($transfer_invitation_data) {
                transfer_invitation_data();
                // Send a message that the command was successful
                return 'Transferring invitation data';
            }
            // Send a message that the command was successful
            return 'Populating database tables';
            break;
        case 'uninstall':
            break;
    }
}
コード例 #14
0
ファイル: erk.php プロジェクト: napus/support-toolkit
        if ($unit == 'g') {
            $mem_limit *= 1024;
        } else {
            if (is_numeric($unit)) {
                $mem_limit = floor((int) ($mem_limit . $unit) / 1048576);
            }
        }
    }
    $mem_limit = max(128, $mem_limit) . 'M';
} else {
    $mem_limit = '128M';
}
@ini_set('memory_limit', $mem_limit);
// Init critical repair and run the tools that *must* be ran before initing anything else
include STK_ROOT_PATH . 'includes/critical_repair.' . PHP_EXT;
$critical_repair = new critical_repair();
$critical_repair->run_tool('bom_sniffer');
$critical_repair->run_tool('config_repair');
require STK_ROOT_PATH . 'common.' . PHP_EXT;
// We'll run the rest of the critical repair tools automatically now
$critical_repair->autorun_tools();
// At this point things should be runnable
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('acp/common', $config['default_style']);
// Purge teh caches
$umil = new umil(true);
$umil->cache_purge(array('data', 'template', 'theme', 'imageset'));
// Let's tell the user all is okay :)
$critical_repair->trigger_error("The Emergency Repair Kit hasn't found any critical issues within your phpBB installation.", true);