Ejemplo n.º 1
0
/**
* Load plugin configuration from database
*
* @param    string  $pi_name    Plugin name
* @return   boolean             true on success, otherwise false
* @see      plugin_initconfig_filemgmt
*
*/
function plugin_load_configuration_filemgmt($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_filemgmt();
}
Ejemplo n.º 2
0
/**
* Called by the plugin Editor to run the SQL Update for a plugin update
*/
function filemgmt_upgrade()
{
    global $_TABLES, $_CONF, $_TABLES, $CONF_FM, $_DB_table_prefix;
    include $_CONF['path'] . '/plugins/filemgmt/config.php';
    include $_CONF['path'] . '/plugins/filemgmt/filemgmt.php';
    require_once $_CONF['path_system'] . 'classes/config.class.php';
    $cur_version = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name='filemgmt'");
    switch ($cur_version) {
        case '1.3':
            DB_query("ALTER TABLE {$_TABLES['filemgmt_cat']} ADD `grp_access` mediumint(8) DEFAULT '2' NOT NULL AFTER imgurl");
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.5' WHERE pi_name = 'filemgmt'");
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_gl_version = '1.0.0' WHERE pi_name = 'filemgmt'");
            // Update all the comment records
            $result = DB_query("SELECT cid,sid FROM {$_TABLES['comments']} WHERE type='filemgmt'");
            while (list($cid, $sid) = DB_fetchArray($result)) {
                if (strpos($sid, 'fileid_') === FALSE) {
                    $sid = "fileid_{$sid}";
                    DB_query("UPDATE {$_TABLES['comments']} SET sid='{$sid}' WHERE cid='{$cid}'");
                }
            }
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.5' WHERE pi_name = 'filemgmt'");
        case '1.5':
        case '1.5.1':
        case '1.5.2':
        case '1.5.3':
            DB_query("ALTER TABLE {$_TABLES['filemgmt_cat']} ADD `grp_writeaccess` MEDIUMINT( 8 ) NOT NULL DEFAULT '1'");
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.6' WHERE pi_name = 'filemgmt'");
        case '1.6':
        case '1.6.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/filemgmt/install_defaults.php';
            plugin_initconfig_filemgmt();
        case '1.7.0.fusion':
            $c = config::get_instance();
            $c->add('outside_webroot', 0, 'select', 0, 2, 0, 100, true, 'filemgmt');
        case '1.7.0':
        case '1.7.1':
        case '1.7.2':
        case '1.7.3':
        case '1.7.4':
            DB_query("UPDATE {$_TABLES['filemgmt_filedetail']} set rating = rating / 2", 1);
            $result = DB_query("SELECT * FROM {$_TABLES['filemgmt_filedetail']} WHERE votes > 0");
            while ($F = DB_fetchArray($result)) {
                $item_id = $F['lid'];
                $votes = $F['votes'];
                $rating = $F['rating'];
                DB_query("INSERT INTO {$_TABLES['rating']} (type,item_id,votes,rating) VALUES ('filemgmt','" . $item_id . "',{$votes},{$rating});", 1);
            }
            $result = DB_query("SELECT * FROM {$_TABLES['filemgmt_votedata']}");
            while ($H = DB_fetchArray($result)) {
                $item_id = $H['lid'];
                $user_id = $H['ratinguser'];
                $ip = $H['ratinghostname'];
                $time = $H['ratingtimestamp'];
                $rating = $H['rating'] / 2;
                DB_query("INSERT INTO {$_TABLES['rating_votes']} (type,item_id,rating,uid,ip_address,ratingdate) VALUES ('filemgmt','" . $item_id . "',{$rating},{$user_id},'" . $ip . "',{$time});", 1);
            }
        case '1.7.5':
        case '1.7.6':
            $c = config::get_instance();
            $c->add('enable_rating', 1, 'select', 0, 2, 0, 35, true, 'filemgmt');
            $c->add('silent_edit_default', 1, 'select', 0, 2, 0, 37, true, 'filemgmt');
            $c->add('displayblocks', 0, 'select', 0, 0, 3, 115, true, 'filemgmt');
        default:
            DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '" . $CONF_FM['pi_version'] . "',pi_gl_version = '" . $CONF_FM['gl_version'] . "' WHERE pi_name = 'filemgmt'");
            return true;
    }
}
Ejemplo n.º 3
0
/**
* Loads the configuration records for the Online Config Manager
*
* @return   boolean     true = proceed with install, false = an error occured
*
*/
function plugin_load_configuration_filemgmt()
{
    global $_CONF;
    require_once $_CONF['path'] . 'plugins/filemgmt/install_defaults.php';
    return plugin_initconfig_filemgmt();
}
Ejemplo n.º 4
0
/**
* Loads the configuration records for the GL Online Config Manager
*
* @return   boolean     true = proceed with install, false = an error occured
*
*/
function plugin_load_configuration()
{
    global $_CONF, $base_path;
    require_once $_CONF['path_system'] . 'classes/config.class.php';
    require_once $base_path . 'install_defaults.php';
    $retval = plugin_initconfig_filemgmt();
    return $retval;
}