<?php

/*
=================================================================
Bullet Energy - by White-Master 
-----------------------------------------------------------------
http://white-master.ru/
-----------------------------------------------------------------
Copyright (c) 2011 White-Master
=================================================================
Данный код защищен авторскими правами
=================================================================
Файл: sql.php
-----------------------------------------------------------------
Назначение: Формирование массива sql запросов для обновления.
=================================================================
*/
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_groups ADD be_fix tinyint(1) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_groups ADD be_replic_is_cloze tinyint(1) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_groups ADD be_create_vote tinyint(1) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_groups ADD be_replic_vote tinyint(1) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_groups ADD be_preview_topic tinyint(1) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_groups ADD be_load_ajax_topic tinyint(1) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_groups ADD be_sort tinyint(1) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_groups ADD be_warning  tinyint(1) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_groups ADD be_warning_delete  tinyint(1) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_groups ADD be_view_warning_log  tinyint(1) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_message ADD is_warning_id int(11) unsigned DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_topic DROP topic_vote";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_topic DROP topic_viewer_full";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_topic ADD vote_id mediumint(8) unsigned NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_topic ADD is_fixed_count smallint(5) unsigned NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_topic ADD post_id int(11) unsigned NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_user_warning ADD id_user int(11) unsigned DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_user_warning ADD ball mediumint(8) unsigned DEFAULT '0'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_user_warning ADD action enum('up','down') NOT NULL DEFAULT 'down'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_be_user_warning ADD type enum('comment','message') NOT NULL DEFAULT 'message'";
$tableSchema[] = "ALTER TABLE " . PREFIX . "_post ADD topic_id int(11) unsigned DEFAULT '0'";
$tableSchema[] = "DROP TABLE IF EXISTS " . PREFIX . "_be_topic_vote";
$tableSchema[] = "CREATE TABLE " . PREFIX . "_be_poll  (
  `vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `vote_topic_id` int(11) unsigned NOT NULL,
  `vote_question` varchar(255) NOT NULL,
  `answers` mediumblob NOT NULL,
  `vote_count` int(10) unsigned NOT NULL DEFAULT '0',
  `multi` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `visible_vote_user` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `close_date` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`vote_id`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=" . COLLATE . " AUTO_INCREMENT = 1";
$tableSchema[] = "CREATE TABLE " . PREFIX . "_be_poll_answers  (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `vote_id` int(10) unsigned NOT NULL,
  `answers` varchar(100) NOT NULL,
  `answers_count` int(10) unsigned NOT NULL DEFAULT '0',
  `user_vote` mediumblob NOT NULL,
  PRIMARY KEY (`id`),
  KEY `vote_id` (`vote_id`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=" . COLLATE . " AUTO_INCREMENT = 1";
$tableSchema[] = "CREATE TABLE " . PREFIX . "_be_poll_log  (
  `user_id` int(10) unsigned NOT NULL,
  `answers_id` int(10) unsigned NOT NULL,
  `vote_id` int(10) unsigned NOT NULL,
  `vote_date` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`answers_id`,`user_id`),
  KEY `pid` (`vote_id`,`user_id`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=" . COLLATE . " AUTO_INCREMENT = 1";
$roocke[] = array('paste' => '<br>Откройте файл .htaccess лежащий в корне сайта, после <strong>RewriteEngine On</strong> добавьте: <br> <textarea style="height: 115px;">RewriteRule ^forum/discussion-([0-9]+)(/?)+$ index.php?do=forum&action=discussion&id=$1 [L]
RewriteRule ^forum/categories/([0-9]+)-([^/]*)(/?)+$ index.php?do=forum&action=categories&id=$1&name=$2 [L]
RewriteRule ^forum/categories/([0-9]+)-([^/]*)/page-([0-9]+)(/?)+$ index.php?do=forum&action=categories&id=$1&name=$2&page=$3 [L]
RewriteRule ^forum/showtopic/([0-9]+)-([^/]*)(/?)+$ index.php?do=forum&action=showtopic&id=$1&name=$2 [L]
RewriteRule ^forum/showtopic/([0-9]+)-([^/]*)/page-([0-9]+)(/?)+$ index.php?do=forum&action=showtopic&id=$1&name=$2&page=$3 [L]
RewriteRule ^forum/showtopic/([0-9]+)-([^/]*)/findpost-([0-9]+)(/?)+$ index.php?do=forum&action=findpost&id=$1&name=$2&findpost=$3 [L]
RewriteRule ^forum/unread/([0-9]+)(/?)+$ index.php?do=forum&action=unread&id=$1 [L]</textarea>');
$roocke[] = array('paste' => '<br>
          <br>
          Откройте <strong>файл engine/modules/banned.php</strong> и найдите в нем строку:<br> 
          <textarea style="height:14px">if( $row[\'users_id\'] ) $db-&gt;query( "UPDATE " . USERPREFIX . "_users SET banned=\'\' WHERE user_id = \'{$row[\'users_id\']}\'" );</textarea>Замените её на:<br><textarea style="height:145px">if($row[\'users_id\']) {
      $db-&gt;query("UPDATE " . USERPREFIX . "_users SET banned=\'\' WHERE user_id = \'{$row[\'users_id\']}\'");
      $forumInfoUser = $db-&gt;super_query("SELECT forum_warning FROM " . PREFIX . "_users WHERE user_id = \'{$row[\'users_id\']}\'");
      if($forumInfoUser == 100) {
         $db-&gt;query("INSERT INTO " . PREFIX . "_be_user_warning (id, moderator_id, post_id, date, description, id_user, date_out, action, type, ball) VALUES (NULL, \'1\', \'0\', \'{$this_time}\', \'Понижения уровня предупреждений после блокировки.\', \'{$row[\'users_id\']}\', \'0\', \'down\', \'message\', \'10\')");
         $db-&gt;query("UPDATE " . PREFIX . "_users SET forum_warning = forum_warning - 10 WHERE user_id = {$row[\'users_id\']} LIMIT 1");
      }
}</textarea>');

?>