Ejemplo n.º 1
0
/**
* Fix site_url in content
*
* If the site's URL changed due to the migration, this function will replace
* the old URL with the new one in text content of the given tables.
*
* @param    string  $old_url    the site's previous URL
* @param    string  $new_url    the site's new URL after the migration
* @param    array   $tablespec  (optional) list of tables to patch
*
* The $tablespec is an array of tablename => fieldlist pairs, where the field
* list contains the text fields to be searched and the table's index field
* as the first(!) entry.
*
* NOTE: This function may be used by plugins during PLG_migrate. Changes should
*       ensure backward compatibility.
*
*/
function INST_updateSiteUrl($old_url, $new_url, $tablespec = '')
{
    global $_TABLES;
    // standard tables to update if no $tablespec given
    $tables = array('stories' => 'sid, introtext, bodytext, related', 'storysubmission' => 'sid, introtext, bodytext', 'comments' => 'cid, comment', 'trackback' => 'cid, excerpt, url', 'blocks' => 'bid, content');
    if (empty($tablespec) || !is_array($tablespec)) {
        $tablespec = $tables;
    }
    if (empty($old_url) || empty($new_url)) {
        return;
    }
    if ($old_url == $new_url) {
        return;
    }
    foreach ($tablespec as $table => $fieldlist) {
        $fields = explode(',', str_replace(' ', '', $fieldlist));
        $index = array_shift($fields);
        if (empty($_TABLES[$table]) || !DB_checkTableExists($table)) {
            COM_errorLog("Table {$table} does not exist - skipping migration");
            continue;
        }
        $result = DB_query("SELECT {$fieldlist} FROM {$_TABLES[$table]}");
        $numRows = DB_numRows($result);
        for ($i = 0; $i < $numRows; $i++) {
            $A = DB_fetchArray($result);
            $changed = false;
            foreach ($fields as $field) {
                $newtxt = str_replace($old_url, $new_url, $A[$field]);
                if ($newtxt != $A[$field]) {
                    $A[$field] = $newtxt;
                    $changed = true;
                }
            }
            if ($changed) {
                $sql = "UPDATE {$_TABLES[$table]} SET ";
                foreach ($fields as $field) {
                    $sql .= "{$field} = '" . DB_escapeString($A[$field]) . "', ";
                }
                $sql = substr($sql, 0, -2);
                DB_query($sql . " WHERE {$index} = '" . DB_escapeString($A[$index]) . "'");
            }
        }
    }
}
Ejemplo n.º 2
0
 /**
  * Check if a table exists
  *
  * @param   string $table Table name
  * @return  bool         True if table exists, false if it does not
  * @see     DB_checkTableExists
  */
 private function tableExists($table)
 {
     return DB_checkTableExists($table);
 }
Ejemplo n.º 3
0
/**
 * Check if a table exists
 * @see DB_checkTableExists
 *
 *
 * @param   string $table   Table name
 * @return  boolean         True if table exists, false if it does not
 *
 */
function INST_checkTableExists($table)
{
    return DB_checkTableExists($table);
}
Ejemplo n.º 4
0
function INST_doPrePluginUpgrade()
{
    global $_TABLES, $_CONF, $_SYSTEM, $_SP_CONF, $_DB, $_DB_dbms, $_DB_table_prefix, $LANG_AM, $dbconfig_path, $siteconfig_path, $html_path, $LANG_INSTALL, $_GLFUSION;
    $retval = '';
    require_once $_CONF['path_system'] . 'classes/config.class.php';
    $c = config::get_instance();
    switch ($_GLFUSION['original_version']) {
        case '1.0.0':
        case '1.0.1':
        case '1.0.2':
        case '1.1.0':
        case '1.1.1':
        case '1.1.2':
        case '1.1.3':
        case '1.1.4':
        case '1.1.5':
        case '1.1.6':
        case '1.1.7':
        case '1.1.8':
        case '1.2.0':
        case '1.2.1':
        case '1.2.2':
            require_once $_CONF['path_system'] . 'lib-install.php';
            // move sitetailor data over
            $complete = DB_getItem($_TABLES['vars'], 'value', 'name="stcvt"');
            if ($complete != 1) {
                $_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';
                if (DB_checkTableExists('st_config')) {
                    DB_query("INSERT INTO {$_TABLES['logo']} SELECT * FROM {$_TABLES['st_config']}");
                    DB_query("INSERT INTO {$_TABLES['menu']} SELECT * FROM {$_TABLES['st_menus']}");
                    DB_query("INSERT INTO {$_TABLES['menu_elements']} SELECT * FROM {$_TABLES['st_menu_elements']}");
                    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);
                    $remvars = array('tables' => array('st_config', 'st_menus', 'st_menu_config', 'st_menu_elements'), 'groups' => array('sitetailor Admin'), 'features' => array('sitetailor.admin'), 'php_blocks' => array(''), 'vars' => array());
                    // removing tables
                    for ($i = 0; $i < count($remvars['tables']); $i++) {
                        DB_query("DROP TABLE {$_TABLES[$remvars['tables'][$i]]}", 1);
                    }
                    // removing variables
                    for ($i = 0; $i < count($remvars['vars']); $i++) {
                        DB_delete($_TABLES['vars'], 'name', $remvars['vars'][$i]);
                    }
                    // 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)) {
                            DB_delete($_TABLES['groups'], 'grp_id', $grp_id);
                            DB_delete($_TABLES['group_assignments'], 'ug_main_grp_id', $grp_id);
                        }
                    }
                    // 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)) {
                            DB_delete($_TABLES['access'], 'acc_ft_id', $access_id);
                            DB_delete($_TABLES['features'], 'ft_name', $remvars['features'][$i]);
                        }
                    }
                    if ($c->group_exists('sitetailor')) {
                        $c->delGroup('sitetailor');
                    }
                    DB_delete($_TABLES['plugins'], 'pi_name', 'sitetailor');
                }
            }
            $_TABLES['am_autotags'] = $_DB_table_prefix . 'am_autotags';
            $_TABLES['autotags'] = $_DB_table_prefix . 'autotags';
            if (DB_checkTableExists('am_autotags') && isset($_TABLES['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
                $remvars = array('tables' => array('am_autotags'), 'groups' => array('AutoTag Users'), 'features' => array(), 'php_blocks' => array(), 'vars' => array());
                // removing tables
                for ($i = 0; $i < count($remvars['tables']); $i++) {
                    DB_query("DROP TABLE {$_TABLES[$remvars['tables'][$i]]}", 1);
                }
                // removing variables
                for ($i = 0; $i < count($remvars['vars']); $i++) {
                    DB_delete($_TABLES['vars'], 'name', $remvars['vars'][$i]);
                }
                // 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)) {
                        DB_delete($_TABLES['groups'], 'grp_id', $grp_id);
                        DB_delete($_TABLES['group_assignments'], 'ug_main_grp_id', $grp_id);
                    }
                }
                // 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)) {
                        DB_delete($_TABLES['access'], 'acc_ft_id', $access_id);
                        DB_delete($_TABLES['features'], 'ft_name', $remvars['features'][$i]);
                    }
                }
                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);
                }
            }
            break;
        default:
            break;
    }
    return $retval;
}
$htmlfilter = array();
$htmlfilter['ja'] = array('user' => array('a' => array('href' => 1, 'title' => 1, 'rel' => 1), 'b' => array(), 'blockquote' => array(), 'br' => array('clear' => 1), 'code' => array(), 'div' => array('class' => 1), 'em' => array(), 'font' => array('color' => 1), 'h' => array(), 'hr' => array(), 'i' => array(), 'li' => array(), 'ol' => array(), 'p' => array('lang' => 1), 'pre' => array(), 'strong' => array(), 'tt' => array(), 'ul' => array()), 'admin' => array('a' => array('href' => 1, 'title' => 1, 'id' => 1, 'lang' => 1, 'name' => 1, 'type' => 1, 'rel' => 1), 'br' => array('clear' => 1, 'style' => 1), 'caption' => array('style' => 1), 'div' => array('class' => 1, 'id' => 1, 'style' => 1), 'embed' => array('src' => 1, 'loop' => 1, 'quality' => 1, 'width' => 1, 'height' => 1, 'type' => 1, 'pluginspage' => 1, 'align' => 1), 'h1' => array('class' => 1, 'id' => 1, 'style' => 1), 'h2' => array('class' => 1, 'id' => 1, 'style' => 1), 'h3' => array('class' => 1, 'id' => 1, 'style' => 1), 'h4' => array('class' => 1, 'id' => 1, 'style' => 1), 'h5' => array('class' => 1, 'id' => 1, 'style' => 1), 'h6' => array('class' => 1, 'id' => 1, 'style' => 1), 'hr' => array('class' => 1, 'id' => 1, 'align' => 1), 'img' => array('src' => 1, 'width' => 1, 'height' => 1, 'vspace' => 1, 'hspace' => 1, 'dir' => 1, 'align' => 1, 'valign' => 1, 'border' => 1, 'lang' => 1, 'longdesc' => 1, 'title' => 1, 'id' => 1, 'alt' => 1, 'style' => 1), 'noscript' => array(), 'object' => array('type' => 1, 'data' => 1, 'classid' => 1, 'codebase' => 1, 'width' => 1, 'height' => 1, 'align' => 1), 'ol' => array('class' => 1, 'style' => 1), 'p' => array('class' => 1, 'id' => 1, 'align' => 1, 'lang' => 1), 'param' => array('name' => 1, 'value' => 1), 'script' => array('src' => 1, 'language' => 1, 'type' => 1), 'span' => array('class' => 1, 'id' => 1, 'lang' => 1), 'table' => array('class' => 1, 'id' => 1, 'width' => 1, 'border' => 1, 'cellspacing' => 1, 'cellpadding' => 1), 'tbody' => array(), 'td' => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1, 'colspan' => 1, 'rowspan' => 1), 'th' => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1, 'colspan' => 1, 'rowspan' => 1), 'tr' => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1), 'ul' => array('class' => 1, 'style' => 1)));
$htmlfilter['en'] = array('user' => array('p' => array(), 'b' => array(), 'strong' => array(), 'i' => array(), 'a' => array('href' => 1, 'title' => 1, 'rel' => 1), 'em' => array(), 'br' => array(), 'tt' => array(), 'hr' => array(), 'li' => array(), 'ol' => array(), 'ul' => array(), 'code' => array(), 'pre' => array()), 'admin' => array('p' => array('class' => 1, 'id' => 1, 'align' => 1), 'div' => array('class' => 1, 'id' => 1), 'span' => array('class' => 1, 'id' => 1), 'table' => array('class' => 1, 'id' => 1, 'width' => 1, 'border' => 1, 'cellspacing' => 1, 'cellpadding' => 1), 'tr' => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1), 'th' => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1, 'colspan' => 1, 'rowspan' => 1), 'td' => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1, 'colspan' => 1, 'rowspan' => 1)));
$_JAPANIZE_DATA = array();
// 1. テーブル構造とデータを変更する
$_JAPANIZE_DATA[1] = array(array('ja' => "ALTER TABLE {$_TABLES['syndication']} " . "MODIFY language VARCHAR(20) NOT NULL DEFAULT 'ja' ", 'en' => "ALTER TABLE {$_TABLES['syndication']} " . "MODIFY language VARCHAR(20) NOT NULL DEFAULT 'en-gb' "), array('ja' => "UPDATE {$_TABLES['syndication']} " . "SET language = 'ja' ", 'en' => "UPDATE {$_TABLES['syndication']} " . "SET language = 'en-gb' "), array('ja' => "UPDATE {$_TABLES['syndication']} " . "SET charset = 'utf-8' ", 'en' => "UPDATE {$_TABLES['syndication']} " . "SET charset = '" . COM_getCharset() . "' "), array('ja' => "ALTER TABLE {$_TABLES['users']} " . "MODIFY username VARCHAR(108) NOT NULL DEFAULT '' ", 'en' => "ALTER TABLE {$_TABLES['users']} " . "MODIFY username VARCHAR(16) NOT NULL DEFAULT '' "), array('ja' => "UPDATE {$_TABLES['users']} " . "SET username = '******'ゲストユーザー') . "', " . "    fullname = '" . DB_escapeString('ゲストユーザー') . "' " . "WHERE (uid = 1) ", 'en' => "UPDATE {$_TABLES['users']} " . "SET username = '******', fullname = 'Anonymous' " . "WHERE (uid = 1) "), array('ja' => "UPDATE {$_TABLES['users']} " . "SET fullname= '" . DB_escapeString('サイト管理者') . "', homepage='" . DB_escapeString($_CONF['site_url']) . "' " . "WHERE (uid = 2) ", 'en' => "UPDATE {$_TABLES['users']} " . "SET fullname= 'Geeklog SuperUser', homepage='http://www.geeklog.net/' " . "WHERE (uid = 2) "), array('ja' => "UPDATE {$_TABLES['stories']} " . "SET title = '" . DB_escapeString('Geeklogへようこそ!') . "', " . "introtext = '" . DB_escapeString("<p>無事インストールが完了したようですね。おめでとうございます。できれば、<a href=\"docs/japanese/index.html\">docs ディレクトリ</a>のすべての文書に一通り目を通しておいてください。Geeklogはユーザーを中心としたセキュリティモデルを実装しています。Geeklogを管理・運用するにはこの仕組みを理解する必要があります。</p>\n<p>サイトにログインするには、次のアカウントを使用してください:</p>\n<p>ユーザー名: <strong>Admin</strong><br />\nパスワード: <strong>password</strong></p><p><strong>ログインしたら、忘れずに<a href=\"{$_CONF['site_url']}/usersettings.php?mode=edit\">パスワードを変更</a>してください。</strong></p><p>Geeklogのサポートは、<a href=\"http://www.geeklog.jp\">Geeklog Japanese</a>へ。追加ドキュメントは <a href=\"http://wiki.geeklog.jp\">Geeklog Wiki ドキュメント</a>をどうぞ。</p>") . "' " . "WHERE (sid = 'welcome') ", 'en' => "UPDATE {$_TABLES['stories']} " . "SET title = 'Welcome to Geeklog!', " . "introtext = '" . DB_escapeString("<p>Welcome and let me be the first to congratulate you on installing Geeklog. Please take the time to read everything in the <a href=\"docs/english/index.html\">docs directory</a>. Geeklog now has enhanced, user-based security.  You should thoroughly understand how these work before you run a production Geeklog Site.</p>\n<p>To log into your new Geeklog site, please use this account:</p>\n<p>Username: <b>Admin</b><br />\nPassword: <b>password</b></p><p><b>And don't forget to <a href=\"{$_CONF['site_url']}/usersettings.php?mode=edit\">change your password</a> after logging in!</b></p>") . "' " . "WHERE (sid = 'welcome') "), array('ja' => "UPDATE {$_TABLES['storysubmission']} " . "SET title = '" . DB_escapeString('セキュリティを確認してください。') . "', " . "introtext = '" . DB_escapeString("<p>インストールが終了したら、次のことを実行してセキュリティを高めてください。</p><ol>\n<li>Adminアカウントのパスワードを変更する。</li>\n<li>installディレクトリを削除する(もう必要ありません)。</li>\n</ol>") . "' " . "WHERE (sid = 'security-reminder') ", 'en' => "UPDATE {$_TABLES['storysubmission']} " . "SET title = 'Are you secure?', " . "introtext = '" . DB_escapeString("<p>This is a reminder to secure your site once you have Geeklog up and running. What you should do:</p>\n\n<ol>\n<li>Change the default password for the Admin account.</li>\n<li>Remove the install directory (you won't need it any more).</li>\n</ol>") . "' " . "WHERE (sid = 'security-reminder') "), array('ja' => "UPDATE {$_TABLES['topics']} " . "SET topic = '" . DB_escapeString('おしらせ') . "' " . "WHERE (tid = 'General') ", 'en' => "UPDATE {$_TABLES['topics']} " . "SET topic = '" . DB_escapeString('General News') . "' " . "WHERE (tid = 'General') "));
if (DB_checkTableExists('events')) {
    // イベントの郵便番号を16桁に
    $_JAPANIZE_DATA[1][] = array('ja' => "ALTER TABLE {$_TABLES['events']} MODIFY zipcode VARCHAR(16)", 'en' => "SELECT 1");
    $_JAPANIZE_DATA[1][] = array('ja' => "ALTER TABLE {$_TABLES['eventsubmission']} MODIFY zipcode VARCHAR(16)", 'en' => "SELECT 1");
    $_JAPANIZE_DATA[1][] = array('ja' => "ALTER TABLE {$_TABLES['personal_events']} MODIFY zipcode VARCHAR(16)", 'en' => "SELECT 1");
}
if (DB_checkTableExists('linkcategories')) {
    $_JAPANIZE_DATA[1][] = array('ja' => "UPDATE {$_TABLES['linkcategories']} " . "SET description = '" . DB_escapeString('Geeklog関係のサイト') . "' " . "WHERE (cid = '" . DB_escapeString('geeklog-sites') . "') ", 'en' => "UPDATE {$_TABLES['linkcategories']} " . "SET description = '" . DB_escapeString('Sites using or related to the Geeklog CMS') . "' " . "WHERE (cid = '" . DB_escapeString('geeklog-sites') . "') ");
}
if (DB_checkTableExists('links')) {
    if (DB_count($_TABLES['links'], 'lid', 'geeklog.jp') == 0) {
        $group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Links Admin'");
        $_JAPANIZE_DATA[1][] = array('ja' => "INSERT INTO {$_TABLES['links']} " . "(lid, cid, url, description, title, hits, date, " . "owner_id, group_id, perm_owner, perm_group, " . "perm_members, perm_anon) " . "VALUES ('geeklog.jp', 'geeklog-sites', 'http://www.geeklog.jp/', " . "'" . DB_escapeString('Geeklog日本公式サイト') . "', '" . DB_escapeString('Geeklog Japanese') . "', 0, NOW(), 1, {$group_id}, " . "3, 3, 2, 2) ", 'en' => "DELETE FROM {$_TABLES['links']} " . "WHERE (lid = 'geeklog.jp')");
    } else {
        $_JAPANIZE_DATA[1][] = array('ja' => "SELECT 1", 'en' => "DELETE FROM {$_TABLES['links']} " . "WHERE (lid = 'geeklog.jp')");
    }
}
// 2. グループ詳細を変更する
//
// UPDATE {$_TABLES['groups']}
//   SET grp_descr = '{en/ja}'
//   WHERE (grp_name = '{group}')
$_JAPANIZE_DATA[2] = array(array('en' => 'Has full access to the site', 'ja' => 'サイト管理者', 'group' => 'Root'), array('en' => 'Group that a typical user is added to', 'ja' => 'すべてのユーザー', 'group' => 'All Users'), array('en' => 'Has full access to story features', 'ja' => '記事管理者', 'group' => 'Story Admin'), array('en' => 'Has full access to block features', 'ja' => 'ブロック管理者', 'group' => 'Block Admin'), array('en' => 'Has full access to topic features', 'ja' => '話題管理者', 'group' => 'Topic Admin'), array('en' => 'Has full access to topic features', 'ja' => 'ユーザー管理者', 'group' => 'User Admin'), array('en' => 'Has full access to plugin features', 'ja' => 'プラグイン管理者', 'group' => 'Plugin Admin'), array('en' => 'Has full access to plugin features', 'ja' => 'グループ管理者兼ユーザー管理者', 'group' => 'Group Admin'), array('en' => 'Can use Mail Utility', 'ja' => 'メール管理者', 'group' => 'Mail Admin'), array('en' => 'All registered members', 'ja' => 'すべての登録ユーザー', 'group' => 'Logged-in Users'), array('en' => 'Users in this group can have authenticated against a remote server.', 'ja' => 'リモートユーザー', 'group' => 'Remote Users'), array('en' => 'Can create and modify web feeds for the site', 'ja' => 'フィード管理者', 'group' => 'Syndication Admin'), array('en' => 'Has full access to configuration', 'ja' => 'コンフィギュレーション管理者', 'group' => 'Configuration Admin'), array('en' => 'Has full access to calendar features', 'ja' => 'カレンダー管理者', 'group' => 'Calendar Admin'), array('en' => 'Has full access to links features', 'ja' => 'リンク管理者', 'group' => 'Links Admin'), array('en' => 'Has full access to polls features', 'ja' => 'アンケート管理者', 'group' => 'Polls Admin'), array('en' => 'Users in this group can administer the Spam-x plugin', 'ja' => 'スパム管理者', 'group' => 'spamx Admin'), array('en' => 'Can administer static pages', 'ja' => '静的ページ管理者', 'group' => 'Static Page Admin'), array('en' => 'Has full access to japanize features', 'ja' => '日本語化管理者', 'group' => 'japanize Admin'), array('en' => 'Users in this group can administer the filemgmt plugin', 'ja' => 'ファイル管理者', 'group' => 'filemgmt Admin'), array('en' => 'Users in this group can administer the forum plugin', 'ja' => '掲示板管理者', 'group' => 'forum Admin'), array('en' => 'Can use the Webservices API (if restricted)', 'ja' => 'WebサービスAPIユーザー', 'group' => 'Webservices Users'), array('en' => 'Can moderate comments', 'ja' => 'コメント管理者', 'group' => 'Comment Admin'), array('en' => 'Can submit comments', 'ja' => 'コメント承認者', 'group' => 'Comment Submitters'), array('en' => 'Has full access to File Manager', 'ja' => 'ファイルマネージャー管理者', 'group' => 'Filemanager Admin'), array('en' => 'Users in this group can administer the Autotags plugin', 'ja' => 'Autotagsプラグイン管理者', 'group' => 'Autotags Admin'), array('en' => 'Has full access to custommenu features', 'ja' => 'カスタムメニュー管理者', 'group' => 'CustomMenu Admin'), array('en' => 'Has full access to DataProxy features', 'ja' => 'DataProxyプラグイン管理者', 'group' => 'DataProxy Admin'), array('en' => 'Users in this group can administer the sitemap plugin', 'ja' => 'Sitemapプラグイン管理者', 'group' => 'Sitemap Admin'), array('en' => 'Users in this group can administer the dbman plugin', 'ja' => 'Dbmanプラグイン管理者', 'group' => 'dbman Admin'), array('en' => 'Has full access to Mycaljp features', 'ja' => 'Mycaljpプラグイン管理者', 'group' => 'Mycaljp Admin'), array('en' => 'Users in this group can administer the nmoxtopicown plugin', 'ja' => '話題譲渡プラグイン管理者', 'group' => 'nmoxtopicown Admin'), array('en' => 'Users in this group can administer the themedit plugin', 'ja' => 'テーマエディタプラグイン管理者', 'group' => 'themedit Admin'));
// 3. 初期ブロックタイトル等を変更する
//
Ejemplo n.º 6
0
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);
}