Esempio n. 1
0
/**
* Load plugin configuration from database
*
* @param    string  $pi_name    Plugin name
* @return   boolean             true on success, otherwise false
* @see      plugin_initconfig_forum
*
*/
function plugin_load_configuration_forum($pi_name)
{
    global $_CONF;
    $base_path = $_CONF['path'] . 'plugins/' . $pi_name . '/';
    require_once $_CONF['path_system'] . 'classes/config.class.php';
    require_once $base_path . 'install_defaults.php';
    return plugin_initconfig_forum();
}
Esempio n. 2
0
/**
* Loads the configuration records for the Online Config Manager
*
* @return   boolean     true = proceed with install, false = an error occured
*
*/
function plugin_load_configuration_forum()
{
    global $_CONF;
    require_once $_CONF['path'] . 'plugins/forum/install_defaults.php';
    return plugin_initconfig_forum();
}
Esempio n. 3
0
/**
* Called by the plugin Editor to run the SQL Update for a plugin update
*/
function forum_upgrade()
{
    global $_CONF, $_TABLES, $_FF_CONF, $_FF_CONF;
    require_once $_CONF['path_system'] . 'classes/config.class.php';
    $curversion = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name = 'forum'");
    switch ($curversion) {
        case "2.3":
        case "2.3.2":
            if (upgrade_232() == 0) {
                DB_query("UPDATE {$_TABLES['plugins']} SET `pi_version` = '2.5RC1' WHERE `pi_name` = 'forum' LIMIT 1");
            } else {
                return false;
            }
        case "2.5RC1":
            if (upgrade_25() == 0) {
                DB_query("UPDATE {$_TABLES['plugins']} SET `pi_version` = '2.7', `pi_gl_version` = '1.4.1' WHERE `pi_name` = 'forum' LIMIT 1");
            } else {
                return false;
            }
        case "2.6":
        case "2.7":
        case "2.7.1":
        case "2.7.2":
            if (upgrade_30() == 0) {
                DB_query("UPDATE {$_TABLES['plugins']} SET `pi_version` = '3.0', `pi_gl_version` = '1.0.0' WHERE `pi_name` = 'forum' LIMIT 1");
            } else {
                return false;
            }
        case "3.0.0":
        case "3.0":
            // need to migrate the configuration to our new online configuration.
            require_once $_CONF['path_system'] . 'classes/config.class.php';
            require_once $_CONF['path'] . 'plugins/forum/install_defaults.php';
            plugin_initconfig_forum();
            include $_CONF['path'] . 'plugins/forum/forum.php';
        case "3.1.0.fusion":
            $c = config::get_instance();
            $c->add('enable_fm_integration', 0, 'select', 0, 1, 0, 120, true, 'forum');
            $c->add('allow_memberlist', 0, 'select', 0, 0, 0, 25, true, 'forum');
            $c->del('show_popular_perpage', 'forum');
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '3.1.1',pi_gl_version='1.1.2' WHERE pi_name = 'forum'");
        case '3.1.1':
        case '3.1.2':
        case '3.1.3':
            $c = config::get_instance();
            $c->add('enable_user_rating_system', FALSE, 'select', 0, 0, 0, 22, TRUE, 'forum');
            $c->add('bbcode_signature', TRUE, 'select', 0, 0, 0, 37, true, 'forum');
            $c->add('use_wysiwyg_editor', false, 'select', 0, 2, 0, 85, true, 'forum');
            DB_query("ALTER TABLE {$_TABLES['ff_forums']} ADD `rating_view` INT( 8 ) NOT NULL ,ADD `rating_post` INT( 8 ) NOT NULL", 1);
            DB_query("ALTER TABLE {$_TABLES['ff_userinfo']} ADD `rating` INT( 8 ) NOT NULL ");
            DB_query("ALTER TABLE {$_TABLES['ff_userinfo']} ADD signature MEDIUMTEXT");
            DB_query("ALTER TABLE {$_TABLES['ff_userprefs']} ADD notify_full tinyint(1) NOT NULL DEFAULT '0' AFTER alwaysnotify");
            $sql = "CREATE TABLE IF NOT EXISTS {$_TABLES['ff_rating_assoc']} ( " . "`user_id` mediumint( 9 ) NOT NULL , " . "`voter_id` mediumint( 9 ) NOT NULL , " . "`grade` smallint( 6 ) NOT NULL  , " . "`topic_id` int( 11 ) NOT NULL , " . " KEY `user_id` (`user_id`), " . " KEY `voter_id` (`voter_id`) );";
            DB_query($sql);
            // add forum.html feature
            DB_query("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('forum.html','Can post using HTML',0)", 1);
            $ft_id = DB_insertId();
            $grp_id = intval(DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'forum Admin'"));
            DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$ft_id}, {$grp_id})", 1);
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '3.1.4',pi_gl_version='1.1.5' WHERE pi_name = 'forum'");
        case '3.1.4':
            DB_query("ALTER TABLE {$_TABLES['ff_rating_assoc']} DROP PRIMARY KEY", 1);
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '3.1.5',pi_gl_version='1.1.6' WHERE pi_name = 'forum'");
        case '3.1.5':
        case '3.1.6':
        case '3.1.7':
            DB_query("ALTER TABLE {$_TABLES['ff_userprefs']} ADD topic_order varchar(10) NOT NULL DEFAULT 'ASC' AFTER notify_once");
            DB_query("ALTER TABLE {$_TABLES['ff_userprefs']} ADD use_wysiwyg_editor tinyint(3) NOT NULL DEFAULT '1' AFTER topic_order");
            DB_query("ALTER TABLE {$_TABLES['ff_topic']} ADD `status` int(10) unsigned NOT NULL DEFAULT '0' AFTER locked");
            $c = config::get_instance();
            $c->add('bbcode_disabled', 0, 'select', 0, 2, 6, 165, true, 'forum');
            $c->add('smilies_disabled', 0, 'select', 0, 2, 6, 170, true, 'forum');
            $c->add('urlparse_disabled', 0, 'select', 0, 2, 6, 175, true, 'forum');
        case '3.2.0':
            // convert watch records
            $c = config::get_instance();
            $c->del('pre2.5_mode', 'forum');
            $c->del('mysql4+', 'forum');
            $c->add('use_sfs', true, 'select', 0, 2, 0, 135, true, 'forum');
            DB_query("UPDATE {$_TABLES['conf_values']} SET value='s:11:\"m/d/y h:i a\";' WHERE name='default_Datetime_format' AND group_name='forum'");
            DB_query("UPDATE {$_TABLES['conf_values']} SET value='s:11:\"M d Y H:i a\";' WHERE name='default_Topic_Datetime_format' AND group_name='forum'");
            _forum_cvt_watch();
            // drop watch table
            // attachment handling...
            DB_query("ALTER TABLE {$_TABLES['ff_topic']} ADD attachments INT NOT NULL DEFAULT '0' AFTER views");
            $sql = "SELECT id FROM {$_TABLES['ff_topic']} WHERE pid=0";
            $result = DB_query($sql);
            while ($F = DB_fetchArray($result)) {
                $sql = "SELECT count(*) AS count FROM {$_TABLES['ff_topic']} topic left join {$_TABLES['ff_attachments']} att ON topic.id=att.topic_id WHERE (topic.id=" . (int) $F['id'] . " OR topic.pid=" . $F['id'] . ") and att.filename <> ''";
                $attResult = DB_query($sql);
                if (DB_numRows($attResult) > 0) {
                    list($attCount) = DB_fetchArray($attResult);
                    DB_query("UPDATE {$_TABLES['ff_topic']} SET attachments=" . $attCount . " WHERE id=" . (int) $F['id']);
                }
            }
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '3.3.0',pi_gl_version='1.3.0' WHERE pi_name = 'forum'");
        case '3.3.0':
            $c = config::get_instance();
            $c->add('allowed_html', 'p,b,i,strong,em,br,pre,img,ol,ul,li,u', 'text', 0, 2, 0, 82, true, 'forum');
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '3.3.1',pi_gl_version='1.4.0' WHERE pi_name = 'forum'");
        default:
            DB_query("ALTER TABLE {$_TABLES['ff_forums']} DROP INDEX forum_id", 1);
            DB_query("ALTER TABLE {$_TABLES['ff_rating_assoc']} DROP PRIMARY KEY", 1);
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '" . $_FF_CONF['pi_version'] . "',pi_gl_version='" . $_FF_CONF['gl_version'] . "' WHERE pi_name = 'forum'");
            return true;
    }
}