|
From: OryNider <ory...@us...> - 2008-05-14 20:46:07
|
Update of /cvsroot/mxbb/mx_online_adv In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13645 Added Files: db_upgrade.php Log Message: --- NEW FILE: db_upgrade.php --- <?php /** * * @package Mx-Publisher Module - mx_online_adv * @version $Id: db_upgrade.php,v 1.1 2008/05/14 20:46:01 orynider Exp $ * @copyright (c) 2006 [Horace, OryNider] MxP Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ define( 'IN_PORTAL', true ); if ( !defined( 'IN_ADMIN' ) ) { $mx_root_path = './../../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include( $mx_root_path . 'common.' . $phpEx ); // Start session management $mx_user->init($user_ip, PAGE_INDEX); if ( !$userdata['session_logged_in'] ) { die( "Hacking attempt(1)" ); } if ( $userdata['user_level'] != ADMIN ) { die( "Hacking attempt(2)" ); } // End session management } $mx_module_version = '1.0.1'; $mx_module_copy = 'MxP <i> - mx_online_adv</i> module by Goofy Horace & <a href="http://www.mxbb.net" target="_blank">MxP-Development Team</a>'; $message = "<b>Upgrading!</b><br /><br />"; $sql = array(); // // Precheck // if ($result = $db->sql_query("SELECT username from " . $mx_table_prefix . "online_adv_session")) { // // Upgrade checks // $upgrade_101 = 0; // // validate before 1.01 // if (!$result = $db->sql_query("SELECT id from " . $mx_table_prefix . "online_adv_session")) { $upgrade_101 = 1; } $message = "<b>Upgrading!</b><br/><br/>"; if ($upgrade_101 == 1) { $message .= "<b>Upgrading to v. 1.01...</b><br/><br/>"; $sql[] = "DROP TABLE IF EXISTS " . $mx_table_prefix . "online_adv_session"; $sql[] = "CREATE TABLE ".$mx_table_prefix."online_adv_session ( id int(11) unsigned NOT NULL auto_increment, username varchar(99) NOT NULL, time int(11) DEFAULT '0' NOT NULL, bot_id mediumint(8) DEFAULT '0' NOT NULL, PRIMARY KEY (id) ) TYPE=MyISAM"; } else { $message .= "<b>Nothing to upgrade...</b><br/><br/>"; } $sql[] = "UPDATE " . $mx_table_prefix . "module" . " SET module_version = '" . $mx_module_version . "', module_copy = '" . $mx_module_copy . "' WHERE module_id = '" . $mx_module_id . "'"; $message .= mx_do_install_upgrade($sql); } else { // // If not installed // $message = "<b>Module is not installed...and thus cannot be upgraded ;)</b><br/><br/>"; } echo "<br /><br />"; echo "<table width=\"90%\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"forumline\">"; echo "<tr><th class=\"thHead\" align=\"center\">Module Installation/Upgrading/Uninstalling Information - module specific db tables</th></tr>"; echo "<tr><td class=\"row1\" align=\"left\"><span class=\"gen\">" . $message . "</span></td></tr>"; echo "</table><br />"; ?> |