コード例 #1
0
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file: Upgrade from PostNuke .72 to PostNuke .722 [Neo]
// ----------------------------------------------------------------------
//
// Temp fixes for validation and correct update of 0.7.2.2
// Note that this is upgrade script uses ADODB instead
// of raw mysql
global $dbconn, $pntable, $prefix;
include_once 'install/pntables72.php';
include_once 'install/update_functions.php';
// Table structure changes first
// Change most pn_url to 254 instead of 255 to later support vfp
// add-statements right at the end
// Fixes for 0.7.2.2 installation prevents duplication and errors [Neo]
if (!CheckForField('pn_type', 'banner')) {
    $dbconn->Execute("ALTER TABLE {$pntable['banner']} ADD `pn_type` VARCHAR( 2 ) DEFAULT '0' NOT NULL AFTER `pn_cid`");
}
// || die  ("<b>"._NOTUPDATED."$pntable[banner]</b>");
// Verfy existance prior to alter Neo
$pnValConfigVar = $dbconn->Execute("SELECT pn_format_type FROM " . $prefix . "_stories\n                              WHERE pn_sid >0 LIMIT 1");
if (!$pnValConfigVar) {
    $dbconn->Execute("ALTER TABLE {$pntable['stories']} ADD pn_format_type tinyint(1) unsigned NOT NULL DEFAULT '0'") || die("<b>" . _NOTUPDATED . "{$pntable['stories']}</b>");
}
// Now lets get the module_vars up to date.
$pnValConfigVar = $dbconn->Execute("SELECT pn_value FROM " . $prefix . "_module_vars\n                              WHERE pn_name='pnAntiCracker' AND pn_modname='/PNConfig'");
if (!$pnValConfigVar) {
    $dbconn->Execute("INSERT INTO " . $prefix . "_module_vars\n                    (pn_modname,\n                     pn_name,\n                     pn_value)\n                   VALUES\n                     ('/PNConfig',\n                      'pnAntiCracker',\n                      '" . serialize(0) . "')") || die("<b>" . _NOTUPDATED . $prefix . "_modules</b>");
}
$pnValConfigVar = $dbconn->Execute("SELECT pn_value FROM " . $prefix . "_module_vars\n                              WHERE pn_name='WYSIWYGEditor' AND pn_modname='/PNConfig'");
if (!$pnValConfigVar) {
コード例 #2
0
                    }
                    $image .= $v2;
                    $flag = true;
                }
            } else {
                $image = $v[img];
            }
            $v[title] = addslashes($v[title]);
            mysql_query("INSERT INTO {$GLOBALS['prefix']}_blocks_buttons (id, bid, title, url, images) VALUES (NULL, {$row['bid']}, '{$v['title']}', '{$v['url']}', '{$image}')");
        }
        print "Done</li>\n";
    }
    print '</ul>Done converting old-style button blocks!';
}
// Add a column to the queue of news for the bodytext
if (CheckForField('bodytext', 'queue')) {
    echo "<font class=\"pn-normal\">It appears your {$GLOBALS['prefix']}_queue table already contains a bodytext field ... skipping</font><br>\r\n";
} else {
    echo "<font class=\"pn-normal\">Attempting to add 'bodytext' field to {$GLOBALS['prefix']}_queue... ";
    if (!@mysql_query("ALTER TABLE {$GLOBALS['prefix']}_queue add bodytext text")) {
        echo "failed</font><br>\r\n";
    } else {
        echo "done!</font><br>\r\n";
    }
}
// Alter length of url field in links_links table
if (CheckTableExists('links_links')) {
    // alter table
    print '<br><br>';
    print "<font class=\"pn-normal\">Updating Links Table ({$GLOBALS['prefix']}_links_links).</font><br>";
    if (!@mysql_query("ALTER TABLE {$GLOBALS['prefix']}_links_links CHANGE pn_url VARCHAR(255) NOT NULL DEFAULT ''")) {