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

Размер файла: 2.42Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.ru	  *
**********************************/
session_name('PSID');
session_start();
// error_reporting(0);
define('SYS', realpath(dirname(__FILE__)).'/system');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="uk" lang="uk">
<head>
<title>Updating PerfCMS to 1.6.0</title>
<link href="/template/themes/wap/default/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="main">
<div class="panel">Updating PerfCMS to 1.6.0</div>
<?
if(!file_exists('update.txt')) {
	echo '<div class="post">
			PerfCMS already installed!
		</div>
		<div class="block">
			<a href="/">Home Page</a>
		</div
				  <div class="footer">PerfCMS 1.6.0 Update, 2012</div>
</div>
</body>
</html>';
	} else {
          $mysql = parse_ini_file('../system/ini/db.ini');
			try {
				$db = new PDO('mysql:dbname='.$mysql['base'].';host='. $mysql['host'], $mysql['user'], $mysql['pass']);
			} catch (PDOException $e) {
					echo 'Connection failed: ' . $e->getMessage();
			}
          $db->query("SET NAMES utf8");
          $db->query("CREATE TABLE `share_rating` (
					`file_id` INT( 16 ) NOT NULL ,
					`user_id` INT( 16 ) NOT NULL ,
					`rated` INT( 16 ) NOT NULL,
					`rating` INT( 16 ) NOT NULL 
					) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
          $db->query("CREATE TABLE `ads` (
					`id` INT( 16 ) NOT NULL AUTO_INCREMENT ,
					`name` VARCHAR( 150 ) NOT NULL ,
					`link` VARCHAR( 250 ) NOT NULL ,
					`image` VARCHAR( 250 ) NOT NULL ,
					`type` INT( 1 ) NOT NULL ,
					`redirect` INT( 1 ) NOT NULL ,
					PRIMARY KEY ( `id` ) 
					) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
			$db->query("ALTER TABLE `forum` ADD `desc` VARCHAR( 160 ) NOT NULL AFTER `pos`");
			$db->query("ALTER TABLE `forum_c` ADD `desc` VARCHAR( 160 ) NOT NULL AFTER `pos`");
			$db->query("ALTER TABLE `system` ADD `mainpage` TEXT NOT NULL");
		  // print_r($db->errorInfo());
          unlink('update.txt');
          
          echo '<div class="menu">
          PerfCMS Succefuly Updated. Please delete directory /setup/<br />
          <a href="/">Home Page</a>
          </div>
		  <div class="footer">PerfCMS 1.6.0 Update, 2012</div>
</div>
</body>
</html>';
}
?>