function glfusion_130() { global $_TABLES, $_CONF, $_PLUGINS, $LANG_AM, $_DB_table_prefix; $_SQL = array(); $_TABLES['autotags'] = $_DB_table_prefix . 'autotags'; $_SQL[] = "CREATE TABLE IF NOT EXISTS {$_TABLES['autotags']} (\n tag varchar( 24 ) NOT NULL DEFAULT '',\n description varchar( 128 ) DEFAULT '',\n is_enabled tinyint( 1 ) NOT NULL DEFAULT '0',\n is_function tinyint( 1 ) NOT NULL DEFAULT '0',\n replacement text,\n PRIMARY KEY ( tag )\n ) ENGINE=MYISAM;"; $_SQL[] = "CREATE TABLE IF NOT EXISTS {$_TABLES['autotag_perm']} (\n autotag_id varchar(128) NOT NULL,\n autotag_namespace varchar(128) NOT NULL,\n autotag_name varchar(128) NOT NULL,\n PRIMARY KEY (autotag_id)\n ) ENGINE=MyISAM"; $_SQL[] = "CREATE TABLE IF NOT EXISTS {$_TABLES['autotag_usage']} (\n autotag_id varchar(128) NOT NULL,\n autotag_allowed tinyint(1) NOT NULL DEFAULT '1',\n usage_namespace varchar(128) NOT NULL,\n usage_operation varchar(128) NOT NULL,\n KEY autotag_id (autotag_id)\n ) ENGINE=MyISAM"; $_SQL[] = "CREATE TABLE IF NOT EXISTS {$_TABLES['subscriptions']} (\n sub_id int(11) NOT NULL AUTO_INCREMENT,\n type varchar(128) NOT NULL,\n category varchar(128) NOT NULL DEFAULT '',\n category_desc varchar(255) NOT NULL DEFAULT '',\n id varchar(40) NOT NULL,\n id_desc varchar(255) NOT NULL DEFAULT '',\n uid int(11) NOT NULL,\n date_added datetime NOT NULL,\n PRIMARY KEY (`sub_id`),\n UNIQUE KEY type (type,category,id,uid),\n KEY uid (uid)\n ) ENGINE=MyISAM"; $_SQL[] = "CREATE TABLE {$_TABLES['logo']} (\n id int(11) NOT NULL auto_increment,\n config_name varchar(255) default NULL,\n config_value varchar(255) NOT NULL,\n PRIMARY KEY (id),\n UNIQUE KEY config_name (config_name)\n ) ENGINE=MyISAM;\n "; $_SQL[] = "CREATE TABLE {$_TABLES['menu']} (\n id int(11) NOT NULL auto_increment,\n menu_name varchar(64) NOT NULL,\n menu_type tinyint(4) NOT NULL,\n menu_active tinyint(3) NOT NULL,\n group_id mediumint(9) NOT NULL,\n PRIMARY KEY (id),\n KEY menu_name (menu_name)\n ) ENGINE=MyISAM;"; $_SQL[] = "CREATE TABLE {$_TABLES['menu_config']} (\n id int(11) NOT NULL auto_increment,\n menu_id int(11) NOT NULL,\n conf_name varchar(64) NOT NULL,\n conf_value varchar(64) NOT NULL,\n PRIMARY KEY (id),\n UNIQUE KEY Config (menu_id,conf_name),\n KEY menu_id (menu_id)\n ) ENGINE=MyISAM;"; $_SQL[] = "CREATE TABLE {$_TABLES['menu_elements']} (\n id int(11) NOT NULL auto_increment,\n pid int(11) NOT NULL,\n menu_id int(11) NOT NULL default '0',\n element_label varchar(255) NOT NULL,\n element_type int(11) NOT NULL,\n element_subtype varchar(255) NOT NULL,\n element_order int(11) NOT NULL,\n element_active tinyint(4) NOT NULL,\n element_url varchar(255) NOT NULL,\n element_target varchar(255) NOT NULL,\n group_id mediumint(9) NOT NULL,\n PRIMARY KEY( id ),\n INDEX ( pid )\n ) ENGINE=MyISAM;"; $_SQL[] = "ALTER TABLE {$_TABLES['sessions']} ADD browser varchar(255) default '' AFTER sess_id"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='l F d, Y @h:iA' WHERE dfid=1"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='l F d, Y @H:i' WHERE dfid=2"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='l F d @H:i' WHERE dfid=4"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='H:i d F Y' WHERE dfid=5"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='H:i l d F Y' WHERE dfid=6"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='h:iA -- l F d Y' WHERE dfid=7"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='D F d, h:iA' WHERE dfid=8"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='D F d, H:i' WHERE dfid=9"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='m-d-y H:i' WHERE dfid=10"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='d-m-y H:i' WHERE dfid=11"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='m-d-y h:iA' WHERE dfid=12"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='h:iA F d, Y' WHERE dfid=13"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='D M d, \\'y h:iA' WHERE dfid=14"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='Day z, h ish' WHERE dfid=15"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='y-m-d h:i' WHERE dfid=16"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='d/m/y H:i' WHERE dfid=17"; $_SQL[] = "UPDATE {$_TABLES['dateformats']} SET format='D d M h:iA' WHERE dfid=18"; foreach ($_SQL as $sql) { DB_query($sql, 1); } $complete = DB_getItem($_TABLES['vars'], 'value', 'name="stcvt"'); if ($complete != 1) { if (!in_array('sitetailor', $_PLUGINS)) { $_TABLES['st_config'] = $_DB_table_prefix . 'st_config'; $_TABLES['st_menus'] = $_DB_table_prefix . 'st_menus'; $_TABLES['st_menus_config'] = $_DB_table_prefix . 'st_menus_config'; $_TABLES['st_menu_elements'] = $_DB_table_prefix . 'st_menu_elements'; } $_SQL = array(); $_SQL[] = "INSERT INTO {$_TABLES['logo']} SELECT * FROM {$_TABLES['st_config']}"; $_SQL[] = "INSERT INTO {$_TABLES['menu']} SELECT * FROM {$_TABLES['st_menus']}"; $_SQL[] = "INSERT INTO {$_TABLES['menu_config']} SELECT * FROM {$_TABLES['st_menus_config']}"; $_SQL[] = "INSERT INTO {$_TABLES['menu_elements']} SELECT * FROM {$_TABLES['st_menu_elements']}"; foreach ($_SQL as $sql) { DB_query($sql, 1); } DB_query("UPDATE {$_TABLES['plugins']} SET pi_enabled=0 WHERE pi_name='sitetailor'", 1); DB_query("INSERT INTO {$_TABLES['vars']} (name,value) VALUES ('stcvt','1')", 1); } $_SQL = array(); $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='tl_menu_background_color' WHERE conf_name='main_menu_bg_color'"; $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='tl_menu_background_color_hover' WHERE conf_name='main_menu_hover_bg_color'"; $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='tl_menu_text_color' WHERE conf_name='main_menu_text_color'"; $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='tl_menu_text_color_hover' WHERE conf_name='main_menu_hover_text_color'"; $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='ch_menu_text_color' WHERE conf_name='submenu_text_color'"; $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='ch_menu_text_color_hover' WHERE conf_name='submenu_hover_text_color'"; $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='ch_menu_background_color' WHERE conf_name='submenu_background_color'"; $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='ch_menu_background_color_hover' WHERE conf_name='submenu_hover_bg_color'"; $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='ch_menu_element_border_top_color' WHERE conf_name='submenu_highlight_color'"; $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='ch_menu_element_border_bottom_color' WHERE conf_name='submenu_shadow_color'"; $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='tl_menu_background_image' WHERE conf_name='menu_bg_filename'"; $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='tl_menu_text_hover_image' WHERE conf_name='menu_hover_filename'"; $_SQL[] = "UPDATE {$_TABLES['menu_config']} SET conf_name='ch_menu_parent_image' WHERE conf_name='menu_parent_filename'"; foreach ($_SQL as $sql) { DB_query($sql, 1); } // new config options require_once $_CONF['path_system'] . 'classes/config.class.php'; $c = config::get_instance(); // logo $c->add('fs_logo', NULL, 'fieldset', 5, 28, NULL, 0, TRUE); $c->add('max_logo_height', 150, 'text', 5, 28, NULL, 1630, TRUE); $c->add('max_logo_width', 500, 'text', 5, 28, NULL, 1640, TRUE); // whats new cache time $c->add('whatsnew_cache_time', 3600, 'text', 3, 15, NULL, 1060, TRUE); // add user photo option to whosonline block $c->add('whosonline_photo', FALSE, 'select', 3, 14, 0, 930, TRUE); $c->del('wikitext_editor', 'Core'); $c->del('microsummary_short', 'Core'); // add oauth user_login_method $standard = $_CONF['user_login_method']['standard'] ? true : false; $openid = $_CONF['user_login_method']['openid'] ? true : false; $thirdparty = $_CONF['user_login_method']['3rdparty'] ? true : false; if (isset($_CONF['user_login_method']['oauth'])) { $oauth = $_CONF['user_login_method']['oauth']; } else { $oauth = false; } $c->del('user_login_method', 'Core'); $c->add('user_login_method', array('standard' => $standard, 'openid' => $openid, '3rdparty' => $thirdparty, 'oauth' => $oauth), '@select', 4, 16, 1, 320, TRUE); // OAuth configuration settings if (!isset($_CONF['facebook_login'])) { $c->add('facebook_login', 0, 'select', 4, 16, 1, 350, TRUE); $c->add('facebook_consumer_key', 'not configured yet', 'text', 4, 16, NULL, 351, TRUE); $c->add('facebook_consumer_secret', 'not configured yet', 'text', 4, 16, NULL, 352, TRUE); } if (!isset($_CONF['google_login'])) { $c->add('google_login', 0, 'select', 4, 16, 1, 353, TRUE); $c->add('google_consumer_key', 'not configured yet', 'text', 4, 16, NULL, 354, TRUE); $c->add('google_consumer_secret', 'not configured yet', 'text', 4, 16, NULL, 355, TRUE); } /* if ( !isset($_CONF['yahoo_login']) ) { $c->add('yahoo_login',0,'select',4,16,1,356,TRUE); $c->add('yahoo_consumer_key','not configured yet','text',4,16,NULL,357,TRUE); $c->add('yahoo_consumer_secret','not configured yet','text',4,16,NULL,358,TRUE); } */ if (!isset($_CONF['microsoft_login'])) { $c->add('microsoft_login', 0, 'select', 4, 16, 1, 357, TRUE); $c->add('microsoft_consumer_key', 'not configured yet', 'text', 4, 16, NULL, 358, TRUE); $c->add('microsoft_consumer_secret', 'not configured yet', 'text', 4, 16, NULL, 359, TRUE); } if (!isset($_CONF['linkedin_login'])) { $c->add('linkedin_login', 0, 'select', 4, 16, 1, 358, TRUE); $c->add('linkedin_consumer_key', 'not configured yet', 'text', 4, 16, NULL, 359, TRUE); $c->add('linkedin_consumer_secret', 'not configured yet', 'text', 4, 16, NULL, 360, TRUE); } if (!isset($_CONF['twitter_login'])) { $c->add('twitter_login', 0, 'select', 4, 16, 1, 361, TRUE); $c->add('twitter_consumer_key', 'not configured yet', 'text', 4, 16, NULL, 362, TRUE); $c->add('twitter_consumer_secret', 'not configured yet', 'text', 4, 16, NULL, 363, TRUE); } $c->del('yahoo_login', 'Core'); $c->del('yahoo_consumer_key', 'Core'); $c->del('yahoo_consumer_secret', 'Core'); /* $c->del('microsoft_login','Core'); $c->del('microsoft_consumer_key','Core'); $c->del('microsoft_consumer_secret','Core'); */ // date / time format changes $c->add('date', 'l, F d Y @ h:i A T', 'text', 6, 29, NULL, 370, TRUE); $c->add('daytime', 'm/d h:iA', 'text', 6, 29, NULL, 380, TRUE); $c->add('shortdate', 'm/d/y', 'text', 6, 29, NULL, 390, TRUE); $c->add('dateonly', 'd-M', 'text', 6, 29, NULL, 400, TRUE); $c->add('timeonly', 'H:iA', 'text', 6, 29, NULL, 410, TRUE); // hide what's new if empty $c->add('hideemptyblock', 0, 'select', 3, 15, 0, 1045, TRUE); // update check $c->add('fs_update', NULL, 'fieldset', 0, 7, NULL, 0, TRUE); $c->add('update_check_interval', '86400', 'select', 0, 7, 29, 765, TRUE); $c->add('send_site_data', TRUE, 'select', 0, 7, 1, 770, TRUE); // rating information $c->add('fs_rating', NULL, 'fieldset', 4, 7, NULL, 0, TRUE); $c->add('rating_speedlimit', 15, 'text', 4, 7, NULL, 10, TRUE); // add new logo.admin permission $result = DB_query("SELECT * FROM {$_TABLES['features']} WHERE ft_name='logo.admin'"); if (DB_numRows($result) > 0) { COM_errorLog("glFusion 1.3.0 Development update: logo.admin permission already exists"); } else { DB_query("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('logo.admin','Ability to modify site logo',1)", 1); $ft_id = DB_insertId(); $grp_id = (int) DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Root'"); DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$ft_id}, {$grp_id})", 1); } // add new menu.admin permission $result = DB_query("SELECT * FROM {$_TABLES['features']} WHERE ft_name='menu.admin'"); if (DB_numRows($result) > 0) { COM_errorLog("glFusion 1.3.0 Development update: menu.admin permission already exists"); } else { DB_query("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('menu.admin','Ability to create/edit site menus',1)", 1); $ft_id = DB_insertId(); $grp_id = (int) DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Root'"); DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$ft_id}, {$grp_id})", 1); } // add new autotag_perm permission /* ------------------ $result = DB_query("SELECT * FROM {$_TABLES['features']} WHERE ft_name='autotag_perm.admin'"); if ( DB_numRows($result) > 0 ) { COM_errorLog("glFusion 1.3.0 Development update: autotag_perm.admin permission already exists"); } else { DB_query("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('autotag_perm.admin','AutoTag Permissions Admin',1)",1); $ft_id = DB_insertId(); $grp_id = (int) DB_getItem($_TABLES['groups'],'grp_id',"grp_name = 'Root'"); DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ($ft_id, $grp_id)", 1); } ------------------- */ // forum update $c->del('pre2.5_mode', 'forum'); $c->del('mysql4+', 'forum'); $c->add('use_sfs', true, 'select', 0, 2, 0, 135, true, 'forum'); _forum_cvt_watch(); _forum_fix_watch(); // attachment handling... DB_query("ALTER TABLE {$_TABLES['ff_topic']} ADD attachments INT NOT NULL DEFAULT '0' AFTER views", 1); $sql = "SELECT id FROM {$_TABLES['ff_topic']} WHERE pid=0"; $result = DB_query($sql, 1); 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, 1); if (DB_numRows($attResult) > 0) { list($attCount) = DB_fetchArray($attResult); DB_query("UPDATE {$_TABLES['ff_topic']} SET attachments=" . $attCount . " WHERE id=" . (int) $F['id'], 1); } } DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '3.3.0',pi_gl_version='1.3.0' WHERE pi_name = 'forum'"); // autotag $_TABLES['am_autotags'] = $_DB_table_prefix . 'am_autotags'; if (DB_checkTableExists('am_autotags')) { // we have an installed version of autotags plugin.... DB_query("INSERT INTO {$_TABLES['autotags']} SELECT * FROM " . $_TABLES['am_autotags'], 1); // delete the old autotag plugin require_once $_CONF['path_system'] . 'lib-install.php'; $remvars = array('tables' => array('am_autotags'), 'groups' => array('AutoTag Admin', 'AutoTag Users'), 'features' => array('autotag.admin', 'autotag.user', 'autotag.PHP'), 'php_blocks' => array(), 'vars' => array()); // removing tables for ($i = 0; $i < count($remvars['tables']); $i++) { COM_errorLog("Dropping table {$_TABLES[$remvars['tables'][$i]]}", 1); DB_query("DROP TABLE {$_TABLES[$remvars['tables'][$i]]}", 1); COM_errorLog('...success', 1); } // removing variables for ($i = 0; $i < count($remvars['vars']); $i++) { COM_errorLog("Removing variable {$remvars['vars'][$i]}", 1); DB_delete($_TABLES['vars'], 'name', $remvars['vars'][$i]); COM_errorLog('...success', 1); } // removing groups for ($i = 0; $i < count($remvars['groups']); $i++) { $grp_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = '{$remvars['groups'][$i]}'"); if (!empty($grp_id)) { COM_errorLog("Attempting to remove the {$remvars['groups'][$i]} group", 1); DB_delete($_TABLES['groups'], 'grp_id', $grp_id); COM_errorLog('...success', 1); COM_errorLog("Attempting to remove the {$remvars['groups'][$i]} group from all groups.", 1); DB_delete($_TABLES['group_assignments'], 'ug_main_grp_id', $grp_id); COM_errorLog('...success', 1); } } // removing features for ($i = 0; $i < count($remvars['features']); $i++) { $access_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = '{$remvars['features'][$i]}'"); if (!empty($access_id)) { COM_errorLog("Attempting to remove {$remvars['features'][$i]} rights from all groups", 1); DB_delete($_TABLES['access'], 'acc_ft_id', $access_id); COM_errorLog('...success', 1); COM_errorLog("Attempting to remove the {$remvars['features'][$i]} feature", 1); DB_delete($_TABLES['features'], 'ft_name', $remvars['features'][$i]); COM_errorLog('...success', 1); } } if ($c->group_exists('autotag')) { $c->delGroup('autotag'); } DB_delete($_TABLES['plugins'], 'pi_name', 'autotag'); } else { $_DATA = array(); $_DATA[] = "INSERT INTO " . $_TABLES['autotags'] . " (tag, description, is_enabled, is_function, replacement) VALUES ('cipher', '{$LANG_AM['desc_cipher']}', 1, 1, NULL)"; $_DATA[] = "INSERT INTO " . $_TABLES['autotags'] . " (tag, description, is_enabled, is_function, replacement) VALUES ('topic', '{$LANG_AM['desc_topic']}', 1, 1, NULL)"; $_DATA[] = "INSERT INTO " . $_TABLES['autotags'] . " (tag, description, is_enabled, is_function, replacement) VALUES ('glfwiki', '{$LANG_AM['desc_glfwiki']}', 1, 1, NULL)"; $_DATA[] = "INSERT INTO " . $_TABLES['autotags'] . " (tag, description, is_enabled, is_function, replacement) VALUES ('lang', '{$LANG_AM['desc_lang']}', 0, 1, NULL)"; $_DATA[] = "INSERT INTO " . $_TABLES['autotags'] . " (tag, description, is_enabled, is_function, replacement) VALUES ('conf', '{$LANG_AM['desc_conf']}', 0, 1, NULL)"; $_DATA[] = "INSERT INTO " . $_TABLES['autotags'] . " (tag, description, is_enabled, is_function, replacement) VALUES ('user', '{$LANG_AM['desc_user']}', 0, 1, NULL)"; $_DATA[] = "INSERT INTO " . $_TABLES['autotags'] . " (tag, description, is_enabled, is_function, replacement) VALUES ('wikipedia', '{$LANG_AM['desc_wikipedia']}', 1, 1, NULL)"; $_DATA[] = "INSERT INTO " . $_TABLES['autotags'] . " (tag, description, is_enabled, is_function, replacement) VALUES ('youtube', '{$LANG_AM['desc_youtube']}', 1, 0, '<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/%1%\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/%1%\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed></object>')"; foreach ($_DATA as $sql) { DB_query($sql, 1); } } // add new autotag features $autotag_admin_ft_id = 0; $autotag_php_ft_id = 0; $autotag_group_id = 0; $result = DB_query("SELECT * FROM {$_TABLES['features']} WHERE ft_name='autotag.admin'"); if (DB_numRows($result) > 0) { COM_errorLog("glFusion 1.3.0 Development update: autotag.admin permission already exists"); } else { DB_query("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('autotag.admin','Ability to create / edit autotags',1)", 1); $autotag_admin_ft_id = DB_insertId(); } $result = DB_query("SELECT * FROM {$_TABLES['features']} WHERE ft_name='autotag.PHP'"); if (DB_numRows($result) > 0) { COM_errorLog("glFusion 1.3.0 Development update: autotag.PHP permission already exists"); } else { DB_query("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('autotag.PHP','Ability to create / edit autotags utilizing PHP functions',1)", 1); $autotag_php_ft_id = DB_insertId(); } // now check for the group $result = DB_query("SELECT * FROM {$_TABLES['groups']} WHERE grp_name='Autotag Admin'"); if (DB_numRows($result) > 0) { COM_errorLog("glFusion 1.3.0 Development update: Autotag Admin group already exists"); } else { DB_query("INSERT INTO {$_TABLES['groups']} (grp_name, grp_descr, grp_gl_core, grp_default) VALUES ('Autotag Admin','Has full access to create and modify autotags',1,0)", 1); $autotag_group_id = DB_insertId(); } if ($autotag_admin_ft_id != 0 && $autotag_group_id != 0) { DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES (" . $autotag_admin_ft_id . "," . $autotag_group_id . ")", 1); } if ($autotag_php_ft_id != 0 && $autotag_group_id != 0) { DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES (" . $autotag_php_ft_id . "," . $autotag_group_id . ")", 1); } if ($autotag_group_id != 0) { DB_query("INSERT INTO {$_TABLES['group_assignments']} (ug_main_grp_id,ug_grp_id) VALUES (" . $autotag_group_id . ",1)"); } // update syndication feeds DB_query("UPDATE {$_TABLES['syndication']} set format='RSS-0.91' WHERE format='RSS-09x'", 1); DB_query("UPDATE {$_TABLES['syndication']} set format='RDF-1.0' WHERE format='RSS-1.0'", 1); DB_query("UPDATE {$_TABLES['mg_config']} set rss_feed_type='RSS-2.0' WHERE rss_feed_type='RSS2.0'", 1); DB_query("UPDATE {$_TABLES['mg_config']} set rss_feed_type='RSS-1.0' WHERE rss_feed_type='RSS1.0'", 1); DB_query("UPDATE {$_TABLES['mg_config']} set rss_feed_type='RSS-0.91' WHERE rss_feed_type='RSS0.91'", 1); // remove microsummary feature $c->del('microsummary_short', 'Core'); // alter the users table DB_query("ALTER TABLE {$_TABLES['users']} ADD account_type smallint(5) NOT NULL default '1' AFTER status", 1); _updateConfig(); // update version number DB_query("INSERT INTO {$_TABLES['vars']} SET value='1.3.0',name='glfusion'", 1); DB_query("UPDATE {$_TABLES['vars']} SET value='1.3.0' WHERE name='glfusion'", 1); }
/** * 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; } }