Просмотр файла update.php

Размер файла: 3.63Kb
<?php 
// by mides, wmclub.mobi

require('config.php');
require('includes/sys.php');
$v = 'v1.9';

echo '<?xml version="1.0" encoding="utf-8"?>
	<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
	<head>
	<meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=UTF-8"/>
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
	<link rel="stylesheet" href="styles/default/style.css" type="text/css"/>
	<title>Обновление CoolCMS до '.$v.'</title>
	</head>
	<body>';

$sql = array();

$sql[] = "RENAME TABLE `adv` TO `ad` ;";
$sql[] = "ALTER TABLE `ad` CHANGE `site_name` `name` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL";
$sql[] = "ALTER TABLE `ad` CHANGE `site_link` `link` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL";
$sql[] = "ALTER TABLE `ad` ADD `type` INT( 1 ) NOT NULL AFTER `link`";
$sql[] = "ALTER TABLE `ad` CHANGE `time` `time` INT( 10 ) NOT NULL";
$sql[] = "CREATE TABLE `smiles` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`code` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`path` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
PRIMARY KEY ( `id` ) 
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;";
$sql[] = "INSERT INTO `smiles` (`id`, `code`, `path`) VALUES
(1, ':)', '../images/smiles/1.gif'),
(2, ':-)', '../images/smiles/2.gif'),
(3, ';))', '../images/smiles/4.gif'),
(4, ':sad', '../images/smiles/4.gif'),
(5, ';)', '../images/smiles/5.gif'),
(6, '%0', '../images/smiles/6.gif'),
(7, ':(', '../images/smiles/7.gif'),
(8, ':-(', '../images/smiles/8.gif'),
(9, ':yy', '../images/smiles/9.gif'),
(10, ':sho', '../images/smiles/10.gif'),
(11, ':o_o', '../images/smiles/11.gif'),
(12, ':crazy', '../images/smiles/12.gif'),
(13, ':d', '../images/smiles/13.gif'),
(14, ':-d', '../images/smiles/14.gif'),
(15, ':peace', '../images/smiles/15.gif'),
(16, ':flud', '../images/smiles/16.gif'),
(17, ':closed', '../images/smiles/17.gif'),
(18, ':angry', '../images/smiles/18.gif'),
(19, ':bravo', '../images/smiles/19.gif'),
(20, ':ban', '../images/smiles/20.gif'),
(21, ':f', '../images/smiles/21.gif'),
(22, ':welcome', '../images/smiles/22.gif'),
(23, ':good', '../images/smiles/23.gif'),
(24, ':ubanned', '../images/smiles/24.gif'),
(25, ':spam', '../images/smiles/25.gif'),
(26, ':shut', '../images/smiles/26.gif'),
(27, ':shock', '../images/smiles/27.gif'),
(28, ':read', '../images/smiles/28.gif'),
(29, ':overlook', '../images/smiles/29.gif'),
(30, ':oops', '../images/smiles/30.gif'),
(31, ':?', '../images/smiles/31.gif'),
(32, ':@', '../images/smiles/32.gif'),
(33, ';/', '../images/smiles/33.gif'),
(34, ':off', '../images/smiles/34.gif'),
(35, ':lol', '../images/smiles/35.gif'),
(36, ':hack', '../images/smiles/36.gif'),
(37, ':sorry', '../images/smiles/37.gif')";
$sql[] = "";
$sql[] = "";
$sql[] = "";
$sql[] = "";

$errormsg = '';

for( $i = 0; $i < count($sql); $i++ )
{
	if( !$result = mysql_query($sql[$i]) )
	{
		$error = mysql_error();
		$errorsql = true;
		$errormsg .= $error['message'].'<br/>';
	}
	else
	{
		$errorsql = false;
	}
}

tp('Обновление CoolCMS до '.$v);

if(!$errorsql){
	echo 'Движок успешно обновлен! Удалите update.php, readme.txt и пользуйтесь! :)';
}else{
	echo 'Ошибка! Возможно проблемы с бд или вы уже обновили движок!';
}

nav_main();

echo  '&copy; by <a href="http://wmclub.mobi">mides</a>';
?>