Просмотр файла upgrade/index.php

Размер файла: 4.47Kb
<?php
#-----------------------------------------------------#
#          ********* ROTORCMS *********               #
#              Made by  :  VANTUZ                     #
#               E-mail  :  [email protected]         #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#        для его дальнейшего распространения          #
#-----------------------------------------------------#	
require_once ('../includes/start.php');
require_once ('../includes/functions.php');
require_once ('../includes/header.php');
include_once ('../themes/' . $config['themes'] . '/index.php');

if ($config['rotorversion'] < '1.2') {

$version = '1.2';

DB::$dbh->exec("
CREATE TABLE IF NOT EXISTS `cats` (
`cats_id` smallint(4) unsigned NOT NULL auto_increment,
`cats_order` smallint(4) unsigned NOT NULL default '0',
`cats_parent` smallint(4) unsigned NOT NULL default '0',
`cats_name` varchar(100) NOT NULL,
`cats_count` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`cats_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
");

DB::$dbh->exec("
CREATE TABLE IF NOT EXISTS `downs` (
`downs_id` mediumint(8) unsigned NOT NULL auto_increment,
`downs_cats_id` smallint(4) unsigned NOT NULL default '0',
`downs_title` varchar(100) NOT NULL,
`downs_text` text NOT NULL,
`downs_link` varchar(50) NOT NULL,
`downs_user` varchar(20) NOT NULL,
`downs_author` varchar(50) NOT NULL,
`downs_site` varchar(50) NOT NULL default'',
`downs_screen` varchar(50) NOT NULL default'',
`downs_time` int(11) unsigned NOT NULL default '0',
`downs_comments` mediumint(8) unsigned NOT NULL default '0',
`downs_raiting` mediumint(8) unsigned NOT NULL default '0',
`downs_rated` mediumint(8) unsigned NOT NULL default '0',
`downs_load` mediumint(8) unsigned NOT NULL default '0',
`downs_last_load` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`downs_id`),
KEY `downs_cats_id` (`downs_cats_id`),
KEY `downs_time` (`downs_time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
");

DB::$dbh->exec("
CREATE TABLE IF NOT EXISTS `commload` (
`commload_id` int(11) unsigned NOT NULL auto_increment,
`commload_cats` smallint(4) unsigned NOT NULL,
`commload_down` mediumint(8) unsigned NOT NULL,
`commload_text` text NOT NULL,
`commload_author` varchar(20) NOT NULL,
`commload_time` int(11) unsigned NOT NULL default '0',
`commload_ip` varchar(20) NOT NULL,
`commload_brow` varchar(25) NOT NULL,
PRIMARY KEY (`commload_id`),
KEY `commload_down` (`commload_down`),
KEY `commload_time` (`commload_time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
");

DB::$dbh->exec("
CREATE TABLE IF NOT EXISTS `loads` (
`loads_id` int(11) unsigned NOT NULL auto_increment,
`loads_down` mediumint(8) unsigned NOT NULL,
`loads_ip` varchar(20) NOT NULL,
`loads_time` int(11) unsigned NOT NULL,
PRIMARY KEY (`loads_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
");

DB::$dbh->exec("
CREATE TABLE IF NOT EXISTS `rateddown` (
`rated_id` int(11) unsigned NOT NULL auto_increment,
`rated_down` mediumint(8) unsigned NOT NULL,
`rated_user` varchar(20) NOT NULL,
`rated_time` int(11) unsigned NOT NULL,
PRIMARY KEY (`rated_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
");

$queryindex = DB :: $dbh -> queryFetch("SHOW INDEX FROM `online` WHERE `Key_name`='online_ip';");

if (empty($queryindex)){
DB :: $dbh -> query("ALTER TABLE `online` ADD INDEX `online_ip` (`online_ip`);");
}

  $check = DB :: $dbh -> querySingle("SELECT `setting_name` FROM `setting` WHERE `setting_name`=?;", array('anonymity'));
  if (empty($check)) {
    DB :: $dbh -> query("INSERT INTO `setting` (`setting_name`, `setting_value`) VALUES (?, ?);", array('anonymity', '0'));
  } 

DB :: $dbh -> query("REPLACE INTO `setting` (`setting_name`, `setting_value`) VALUES (?, ?);", array('rotorversion', $version));
save_setting();

  echo '<img src="../images/img/open.gif" alt="image" /> <b>RotorCMS успешно обновлен до версии '.$version.'</b><br /><br />';
} else {
  echo '<img src="../images/img/error.gif" alt="image" /> <b>Ваш сайт не нуждается в обновлении</b><br /><br />';
} 

echo '<b>Удалите файл upgrade/index.php после завершения апгрейда!</b><br /><br />';

echo '<img src="../images/img/homepage.gif" alt="image" /> <a href="../index.php?' . SID . '">На главную</a>';

include_once ('../themes/' . $config['themes'] . '/foot.php');
?>