Location: PHPKode > projects > PHP-Fusion: Guestbook > inf_guestbook_v4.12/files/infusions/guest_book/updates/update_from_v4.07.php
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Guestbook Infusion 4.08
| Author: Sebastian Schüssler (slaughter)
| Download:
| http://basti2web.de
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../../../maincore.php";

// Check: iAUTH and $aid
if (!defined("iAUTH") || $_GET['aid'] != iAUTH) redirect("index.php");

// Includes
require_once INFUSIONS."guest_book/infusion_db.php";
require_once INFUSIONS."guest_book/includes/functions.php";

// Check: Admin Rights
if (!GB_ADMIN) redirect("index.php");

// Header
switch(UCC_PHPF_VER) {
case 6:
	require_once BASEDIR."subheader.php";
	require_once ADMIN."navigation.php";
	break;
case 7:
	require_once THEMES."templates/header.php";
	break;
default:
	redirect(INFUSIONS."guest_book/admin/error.php?id=3");
}

// Language Files
if (file_exists(INFUSIONS."guest_book/locale/".$settings['locale'].".php")) {
	include INFUSIONS."guest_book/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."guest_book/locale/English.php";
}

// MySQL database functions || edited by slaughter
function dbquery_gb_update($query) {
	$result = @mysql_query($query);
	if (!$result) {
		//echo mysql_error();
		return false;
	} else {
		return $result;
	}
}

opentable($locale['gb_300'].": v4.07 => v4.08");

//-----------


$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_level='103'");
while ($data = dbarray($result)) {
if(!in_array("GB", explode(".", $data['user_rights']))){
	$mysql[] = "UPDATE ".DB_USERS." SET user_rights='".$data['user_rights'].".GB' WHERE user_id='".$data['user_id']."'";
}
}

$mysql[] = "UPDATE ".DB_GB_SETTINGS." SET gb_version = '4.08'";

$mysql[] = "UPDATE ".DB_INFUSIONS." SET inf_version='4.08' WHERE inf_folder='guest_book'";


//-----------

$errors = 0;
foreach($mysql as $query) {

		if(dbquery_gb_update($query)) {
			$res = "<b>".$locale['gb_301']."</b>";
		} else {
			$errors++;
			$res = "<b>".$locale['gb_302'].":</b>&nbsp;";
			$res .= mysql_error();
		}

	echo "<br /><code>".htmlentities($query)."</code>";

	echo "<br />".$res."<br />";

}

if($errors) {
	echo "<p><b>".$locale['gb_303'].": ".$errors."</b></p>";
} else {
	echo "<p><b>".$locale['gb_304']."</b></p>";
}

echo "<br /><a href='".INFUSIONS."guest_book/admin/gb_admin.php".$aidlink."'>".$locale['gb_305']."</a><br /><br />";

closetable();

// Footer
switch(UCC_PHPF_VER) {
case 6:
	require_once BASEDIR."side_right.php";
	require_once BASEDIR."footer.php";
	break;
case 7:
	require_once THEMES."templates/footer.php";
	break;
default:
	redirect(INFUSIONS."guest_book/admin/error.php?id=3");
}
?>
Return current item: PHP-Fusion: Guestbook