<?php
if( !defined( 'DATALIFEENGINE' ) ) {
header( "HTTP/1.1 403 Forbidden" );
header ( 'Location: ../../../' );
die( "Hacking attempt!" );
}
$config['version_id'] = "9.6";
$config['allow_comments_cache'] = "1";
$tableSchema = array();
$tableSchema[] = "CREATE TABLE IF NOT EXISTS " . PREFIX . "_post_extras (
`eid` int(11) NOT NULL AUTO_INCREMENT,
`news_id` int(11) NOT NULL DEFAULT '0',
`news_read` mediumint(8) NOT NULL DEFAULT '0',
`allow_rate` tinyint(1) NOT NULL DEFAULT '1',
`rating` mediumint(8) NOT NULL DEFAULT '0',
`vote_num` mediumint(8) NOT NULL DEFAULT '0',
`votes` tinyint(1) NOT NULL DEFAULT '0',
`view_edit` tinyint(1) NOT NULL DEFAULT '0',
`disable_index` tinyint(1) NOT NULL DEFAULT '0',
`related_ids` varchar(255) NOT NULL DEFAULT '',
`access` varchar(150) NOT NULL DEFAULT '',
`editdate` int(11) NOT NULL DEFAULT '0',
`editor` varchar(40) NOT NULL DEFAULT '',
`reason` varchar(255) NOT NULL DEFAULT '',
`user_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`eid`),
KEY `news_id` (`news_id`),
KEY `user_id` (`user_id`)
) ENGINE=" . $storage_engine . " DEFAULT CHARACTER SET " . COLLATE . " COLLATE " . COLLATE . "_general_ci";
$tableSchema[] = "ALTER TABLE `" . PREFIX . "_static` ADD `disable_index` TINYINT(1) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE `" . PREFIX . "_usergroups` ADD `disable_news_captcha` SMALLINT(6) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE `" . PREFIX . "_usergroups` ADD `disable_comments_captcha` SMALLINT(6) NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE `" . PREFIX . "_banners` ADD `fpage` TINYINT(1) NOT NULL DEFAULT '0'";
$tableSchema[] = "UPDATE " . PREFIX . "_pm SET pm_read='1' WHERE pm_read='yes'";
$tableSchema[] = "ALTER TABLE `" . PREFIX . "_pm` CHANGE `pm_read` `pm_read` TINYINT(1) NOT NULL DEFAULT '0', ADD `sendid` INT(10) UNSIGNED NOT NULL DEFAULT '0'";
$tableSchema[] = "ALTER TABLE `" . PREFIX . "_pm` ADD INDEX `pm_read` (`pm_read`)";
foreach($tableSchema as $table) {
$db->query ($table, false);
}
$handler = fopen(ENGINE_DIR.'/data/config.php', "w");
fwrite($handler, "<?PHP \n\n//System Configurations\n\n\$config = array (\n\n");
foreach($config as $name => $value)
{
fwrite($handler, "'{$name}' => \"{$value}\",\n\n");
}
fwrite($handler, ");\n\n?>");
fclose($handler);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_post_extras", false );
if ( !$row['count'] ) {
$db->query ("INSERT INTO `" . PREFIX . "_post_extras` (`news_id`, `news_read`, `allow_rate`, `rating`, `vote_num`, `votes`, `view_edit`, `access`, `editdate`, `editor`, `reason`, `user_id`) SELECT `id`, `news_read`, `allow_rate`, `rating`, `vote_num`, `votes`, `view_edit`, `access`, `editdate`, `editor`, `reason`, `user_id` FROM `" . PREFIX . "_post` LEFT JOIN " . PREFIX . "_users ON (" . PREFIX . "_post.autor=" . PREFIX . "_users.name)", false);
}
$db->query ("ALTER TABLE `" . PREFIX . "_post` DROP `allow_rate`, DROP `rating`, DROP `vote_num`, DROP `news_read`, DROP `votes`, DROP `access`, DROP `editdate`, DROP `editor`, DROP `reason`, DROP `view_edit`, DROP `flag`", false);
$db->query ("ALTER TABLE `" . PREFIX . "_post` ADD INDEX `fixed` (`fixed`)", false);
?>