mirror of
https://github.com/avecms/AVE.cms.git
synced 2025-01-22 07:20:07 +00:00
Fixes
This commit is contained in:
parent
b2de3b12ad
commit
09a63d195a
@ -92,7 +92,7 @@
|
||||
else
|
||||
$fn_name = 'EVAL';
|
||||
|
||||
if (! $bg)
|
||||
if (empty($bg))
|
||||
$bg = '43648c';
|
||||
|
||||
$var_dump = '
|
||||
@ -101,7 +101,7 @@
|
||||
margin: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
background-color: #f1efef;
|
||||
border-radius: 5px;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
||||
font-family: "Consolas", Verdana, Arial;
|
||||
font-size: 11px;
|
||||
@ -114,7 +114,6 @@
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
|
||||
background-color: #' . $bg . ';
|
||||
background-repeat: repeat-x;
|
||||
border-bottom: 1px solid #ffffff;
|
||||
}
|
||||
@ -126,7 +125,7 @@
|
||||
}
|
||||
</style>
|
||||
<div class="debug_bg">
|
||||
<div class="debug_top">
|
||||
<div class="debug_top" style="background-color: #' . $bg . ';">
|
||||
var_dump(<strong>' . trim($fn_name) . '</strong>)
|
||||
</div>
|
||||
'.self::_trace().'
|
||||
@ -212,8 +211,8 @@
|
||||
margin: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
background-color: #f1efef;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
||||
font-family: Consolas, Verdana, Arial;
|
||||
font-size: 11px;
|
||||
}
|
||||
@ -225,7 +224,6 @@
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
|
||||
background-color: #'.$bg.';
|
||||
background-repeat: repeat-x;
|
||||
border-bottom: 1px solid #ffffff;
|
||||
}
|
||||
@ -237,7 +235,7 @@
|
||||
}
|
||||
</style>
|
||||
<div class="debug_bg">
|
||||
<div class="debug_top">
|
||||
<div class="debug_top" style="background-color: #' . $bg . ';">
|
||||
print_r(<strong>' . trim($fn_name) . '</strong>)
|
||||
</div>
|
||||
'.self::_trace().'
|
||||
@ -323,8 +321,8 @@
|
||||
margin: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
background-color: #f1efef;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
||||
font-family: Consolas, Verdana, Arial;
|
||||
font-size: 11px;
|
||||
}
|
||||
@ -336,7 +334,6 @@
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
|
||||
background-color: #'.$bg.';
|
||||
background-repeat: repeat-x;
|
||||
border-bottom: 1px solid #ffffff;
|
||||
}
|
||||
@ -348,7 +345,7 @@
|
||||
}
|
||||
</style>
|
||||
<div class="debug_bg">
|
||||
<div class="debug_top">
|
||||
<div class="debug_top" style="background-color: #' . $bg . ';">
|
||||
var_export(<strong>' . trim($fn_name) . '</strong>)
|
||||
</div>
|
||||
'.self::_trace().'
|
||||
@ -432,10 +429,9 @@
|
||||
margin: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
background-color: #f1efef;
|
||||
border-radius: 5px;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.1);
|
||||
font-family: Consolas, Verdana, Arial;
|
||||
border-radius: 3px;
|
||||
font-size: 11px;
|
||||
}
|
||||
.debug_top {
|
||||
@ -446,7 +442,6 @@
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
|
||||
background-color: #'.$bg.';
|
||||
background-repeat: repeat-x;
|
||||
border-bottom: 1px solid #ffffff;
|
||||
}
|
||||
@ -458,7 +453,7 @@
|
||||
}
|
||||
</style>
|
||||
<div class="debug_bg">
|
||||
<div class="debug_top">
|
||||
<div class="debug_top" style="background-color: #' . $bg . ';">
|
||||
var_export(<strong>' . trim($fn_name) . '</strong>)
|
||||
</div>
|
||||
'.self::_trace().'
|
||||
@ -538,14 +533,7 @@
|
||||
$fn_name = 'EVAL';
|
||||
|
||||
if (! $bg)
|
||||
{
|
||||
$br = '2a5885';
|
||||
$bg = '43648c';
|
||||
}
|
||||
else
|
||||
{
|
||||
$br = $bg;
|
||||
}
|
||||
|
||||
$var_dump = '
|
||||
<style>
|
||||
@ -553,7 +541,7 @@
|
||||
margin: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
background-color: #f1efef;
|
||||
border-radius: 5px;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.1);
|
||||
font-family: Consolas, Verdana, Arial;
|
||||
font-size: 11px;
|
||||
@ -566,7 +554,6 @@
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
|
||||
background-color: #'.$bg.';
|
||||
background-repeat: repeat-x;
|
||||
border-bottom: 1px solid #ffffff;
|
||||
}
|
||||
@ -578,7 +565,7 @@
|
||||
}
|
||||
</style>
|
||||
<div class="debug_bg">
|
||||
<div class="debug_top">
|
||||
<div class="debug_top" style="background-color: #' . $bg . ';">
|
||||
var_dump(<strong>' . trim($fn_name) . '</strong>)
|
||||
</div>
|
||||
'.self::_trace().'
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
|
@ -244,8 +244,8 @@ INSERT INTO `%%PRFX%%_document_fields` VALUES
|
||||
(4, 2, 2, 0, 'Извините, запрошенный Вами документ не найден.', '0');#inst#
|
||||
|
||||
INSERT INTO `%%PRFX%%_documents` VALUES
|
||||
(1, 1, 0, 0, '/', '0', '', 'Главная', 'Главная страница', '0', '0', '0', '1', '0', '', '', 'index,follow', '3', '0.5', '1', '0', '0', '0', '0', '', '', 'ru', '1', ''),
|
||||
(2, 1, 0, 0, '404-dokument-ne-najden', '0', '', '404 - Документ не найден', 'Ошибка 404', '0', '0', '0', '1', '0', '', '', 'noindex,nofollow', '6', '0', '1', '0', '0', '0', '0', '', '', 'ru', '2', '');#inst#
|
||||
(1, 1, 0, 0, '/', '0', '', 'Главная', 'Главная страница', '0', '0', '0', '1', '0', '', '', 'index,follow', '3', '0.5', '1', '0', '0', '0', '0', '', '', 'ru', '1', '', '0'),
|
||||
(2, 1, 0, 0, '404-dokument-ne-najden', '0', '', '404 - Документ не найден', 'Ошибка 404', '0', '0', '0', '1', '0', '', '', 'noindex,nofollow', '6', '0', '1', '0', '0', '0', '0', '', '', 'ru', '2', '', '0');#inst#
|
||||
|
||||
INSERT INTO `%%PRFX%%_navigation` VALUES
|
||||
(1,'main','Основное меню','<li class=\"nav-item\">\n <a class=\"nav-link\" href=\"[tag:link]\">[tag:linkname]</a>\n</li>','','','<li class=\"nav-item active\">\n <a class=\"nav-link\" href=\"[tag:link]\">[tag:linkname]</a>\n</li>','','','<ul class=\"navbar-nav mr-auto\">\n[tag:content]\n</ul>','','','','','','','','1,2,3,4,5','1');#inst#
|
||||
@ -335,8 +335,38 @@ INSERT INTO `%%PRFX%%_user_groups` VALUES
|
||||
(3, 'Модераторы', '1', '0', '', ''),
|
||||
(4, 'Зарегистрированные', '1', '0', '', '');#inst#
|
||||
|
||||
INSERT INTO `%%PRFX%%_users` VALUES
|
||||
(1, '%%PASS%%', '%%EMAIL%%', '', '', '', '', '', '', '', '', '', '%%USERNAME%%', 1, '', UNIX_TIMESTAMP(), '1', UNIX_TIMESTAMP(), 'RU', '', '0', '0', '0', '0', '', '', '', '%%SALT%%', '', 0);#inst#
|
||||
INSERT INTO `%%PRFX%%_users`
|
||||
SET
|
||||
`Id` = 1,
|
||||
`password` = '%%PASS%%',
|
||||
`email` = '%%EMAIL%%',
|
||||
`street` = '',
|
||||
`street_nr` = '',
|
||||
`zipcode` = '',
|
||||
`city` = '',
|
||||
`phone` = '',
|
||||
`telefax` = '',
|
||||
`description` = '',
|
||||
`firstname` = '',
|
||||
`lastname` = '',
|
||||
`user_name` = '%%USERNAME%%',
|
||||
`user_group` = 1,
|
||||
`user_group_extra` = '',
|
||||
`reg_time` = UNIX_TIMESTAMP(),
|
||||
`status` = 1,
|
||||
`last_visit` = UNIX_TIMESTAMP(),
|
||||
`country` = 'RU',
|
||||
`birthday` = '',
|
||||
`deleted` = '0',
|
||||
`del_time` = 0,
|
||||
`emc` = '0',
|
||||
`reg_ip` = '0',
|
||||
`new_pass` = '',
|
||||
`company` = '',
|
||||
`taxpay` = '0',
|
||||
`salt` = '%%SALT%%',
|
||||
`new_salt` = '',
|
||||
`user_ip` = 0;#inst#
|
||||
|
||||
INSERT INTO `%%PRFX%%_paginations` (`id`, `pagination_name`, `pagination_box`, `pagination_start_label`, `pagination_end_label`, `pagination_separator_box`, `pagination_separator_label`, `pagination_next_label`, `pagination_prev_label`, `pagination_link_box`, `pagination_active_link_box`, `pagination_link_template`, `pagination_link_active_template`)
|
||||
VALUES
|
||||
|
@ -11,52 +11,85 @@
|
||||
* @license GPL v.2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Функции
|
||||
*/
|
||||
|
||||
function check_mysql_connect($dbhost = '', $dbuser = '', $dbpass = '')
|
||||
/**
|
||||
* Проверка подключения к БД
|
||||
*
|
||||
* @param string $dbhost
|
||||
* @param string $dbuser
|
||||
* @param string $dbpass
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function check_mysql_connect ($dbhost = '', $dbuser = '', $dbpass = '')
|
||||
{
|
||||
if ($dbhost != '' && $dbuser != '')
|
||||
{
|
||||
if (@mysqli_connect($dbhost, $dbuser, $dbpass)) return true;
|
||||
}
|
||||
if (@mysqli_connect($dbhost, $dbuser, $dbpass))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_mysql_query($link = '', $sql = '')
|
||||
|
||||
/**
|
||||
* Проверка запроса к БД
|
||||
*
|
||||
* @param object $mysql_connect
|
||||
* @param string $sql
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function check_mysql_query ($mysql_connect, $sql = '')
|
||||
{
|
||||
if ($sql != '' && $link != '')
|
||||
{
|
||||
if (@mysqli_query($link, $sql)) return true;
|
||||
}
|
||||
if (@mysqli_query($mysql_connect, $sql))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_db_connect($dbhost = '', $dbuser = '', $dbpass = '', $dbname = '')
|
||||
|
||||
/**
|
||||
* @param string $dbhost
|
||||
* @param string $dbuser
|
||||
* @param string $dbpass
|
||||
* @param string $dbname
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function check_db_connect ($dbhost = '', $dbuser = '', $dbpass = '', $dbname = '')
|
||||
{
|
||||
if ($dbhost != '' && $dbuser != '' && $dbname != '')
|
||||
{
|
||||
if (@mysqli_select_db(@mysqli_connect($dbhost, $dbuser, $dbpass), $dbname)) return true;
|
||||
}
|
||||
if (@mysqli_select_db(@mysqli_connect($dbhost, $dbuser, $dbpass), $dbname))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_installed($prefix)
|
||||
|
||||
/**
|
||||
* @param $prefix
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function check_installed ($prefix)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$mysql = @mysqli_connect($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbname']);
|
||||
$query = @mysqli_query($mysql, "SELECT 1 FROM " . $prefix . "_users LIMIT 1");
|
||||
|
||||
if (@mysqli_num_rows($query)) return true;
|
||||
else return false;
|
||||
if (@mysqli_num_rows($query))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_required()
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function check_required ()
|
||||
{
|
||||
global $error_is_required, $lang_i;
|
||||
|
||||
@ -67,23 +100,25 @@
|
||||
foreach ($required as $is_required)
|
||||
{
|
||||
if (@!is_file(BASE_DIR . $is_required))
|
||||
{
|
||||
array_push($error_is_required, $lang_i['error_is_required'] . $is_required . $lang_i['error_is_required_2'] );
|
||||
}
|
||||
}
|
||||
|
||||
$myphp = @PHP_VERSION;
|
||||
|
||||
if ($myphp)
|
||||
{
|
||||
$myphp_v = str_replace('.', '', $myphp);
|
||||
|
||||
if ($myphp_v < $required_php)
|
||||
{
|
||||
array_push($error_is_required, $lang_i['phpversion_toold'] . $required_php);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function check_writable()
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function check_writable ()
|
||||
{
|
||||
global $error_is_required, $lang_i;
|
||||
|
||||
@ -96,26 +131,28 @@
|
||||
foreach ($writeable as $must_writeable)
|
||||
{
|
||||
if (! is_writable(BASE_DIR . $must_writeable))
|
||||
{
|
||||
array_push($error_is_required, $lang_i['error_is_writeable'] . $must_writeable . $lang_i['error_is_writeable_2'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clean_db ($name="", $prefix="", $mysql_connect)
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $prefix
|
||||
* @param $mysql_connect
|
||||
*/
|
||||
function clean_db ($name, $prefix, $mysql_connect)
|
||||
{
|
||||
@mysqli_select_db($mysql_connect, $name);
|
||||
|
||||
$query = @mysqli_query($mysql_connect, "SHOW TABLES FROM " . $name);
|
||||
|
||||
while ($row = @mysqli_fetch_array($query, MYSQL_NUM))
|
||||
{
|
||||
while ($row = @mysqli_fetch_array($query, MYSQLI_NUM))
|
||||
if (preg_match("/^" . $prefix . "/", $row[0]))
|
||||
{
|
||||
@mysqli_query($mysql_connect ,"DROP TABLE " . $row[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert size from 10M to bytes
|
||||
*
|
||||
@ -148,6 +185,7 @@
|
||||
return $size;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get GD version
|
||||
* @return string
|
||||
@ -163,6 +201,7 @@
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get PCRE version
|
||||
* @return string
|
||||
@ -176,6 +215,7 @@
|
||||
return $version;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get MySQL version
|
||||
* @return string
|
||||
@ -186,6 +226,13 @@
|
||||
return $version[0];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $level
|
||||
* @param $text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function check_param($level, $text)
|
||||
{
|
||||
$level = intval($level);
|
||||
@ -209,15 +256,16 @@
|
||||
$img = 'ico_ok_noproblem';
|
||||
break;
|
||||
}
|
||||
|
||||
return $img;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @subpackage install
|
||||
*/
|
||||
error_reporting(E_ERROR);
|
||||
ini_set('display_errors', 7);
|
||||
/* @subpackage install */
|
||||
|
||||
|
||||
error_reporting(E_ERROR);
|
||||
ini_set('display_errors', 7);
|
||||
|
||||
global $config;
|
||||
|
||||
@ -227,14 +275,19 @@
|
||||
|
||||
define('BASE_DIR', str_replace("\\", "/", dirname(dirname(__FILE__))));
|
||||
|
||||
//-- Debug Class
|
||||
require (BASE_DIR . '/class/class.debug.php');
|
||||
$Debug = new Debug;
|
||||
|
||||
if (! is_writable(BASE_DIR . '/tmp/cache/smarty/'))
|
||||
die('Cache folder is not writeable!');
|
||||
|
||||
include(BASE_DIR . '/config/db.config.php');
|
||||
include(BASE_DIR . '/inc/config.php');
|
||||
include(BASE_DIR . '/functions/func.common.php');
|
||||
include(BASE_DIR . '/functions/func.helpers.php');
|
||||
include(BASE_DIR . '/class/class.template.php');
|
||||
include (BASE_DIR . '/config/db.config.php');
|
||||
include (BASE_DIR . '/inc/config.php');
|
||||
include (BASE_DIR . '/functions/func.common.php');
|
||||
include (BASE_DIR . '/functions/func.logs.php');
|
||||
include (BASE_DIR . '/functions/func.helpers.php');
|
||||
include (BASE_DIR . '/class/class.template.php');
|
||||
|
||||
$AVE_Template = new AVE_Template(BASE_DIR . '/install/tpl/');
|
||||
|
||||
@ -371,25 +424,24 @@
|
||||
}
|
||||
|
||||
// Создать новую БД
|
||||
if(isset($_REQUEST['dbcreat'])){
|
||||
|
||||
if (isset($_REQUEST['dbcreat']))
|
||||
{
|
||||
$link = check_mysql_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass']);
|
||||
|
||||
if (false === $link) {
|
||||
if (false === $link)
|
||||
$AVE_Template->assign('warning', 'Ошибка соединения: ' . mysqli_error());
|
||||
} else {
|
||||
else
|
||||
$mysqli_connect = @mysqli_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass']);
|
||||
}
|
||||
|
||||
if(false === $db_connect) {
|
||||
if (false === $db_connect)
|
||||
{
|
||||
@mysqli_query($mysqli_connect, "SET collation_server = 'utf8_general_ci'");
|
||||
@mysqli_query($mysqli_connect, "SET character_set_server = 'utf8'");
|
||||
|
||||
$sql = 'CREATE DATABASE ' . $_POST['dbname'];
|
||||
|
||||
if (false === check_mysql_query($mysqli_connect, $sql)) {
|
||||
if (false === check_mysql_query($mysqli_connect, $sql))
|
||||
$AVE_Template->assign('warning', 'Ошибка при создании базы данных: ' . mysqli_error() . "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,49 +459,87 @@
|
||||
}
|
||||
|
||||
$fp = @fopen(BASE_DIR . '/config/db.config.php', 'w+');
|
||||
|
||||
// Записываем данные для подключения
|
||||
@fwrite($fp, "<?php\n"
|
||||
. "\$config = array();\n"
|
||||
. "\$config['dbhost'] = \"" . stripslashes(trim($_POST['dbhost'])) . "\";\n"
|
||||
. "\$config['dbuser'] = \"" . stripslashes(trim($_POST['dbuser'])) . "\";\n"
|
||||
. "\$config['dbpass'] = \"" . stripslashes(trim($_POST['dbpass'])) . "\";\n"
|
||||
. "\$config['dbname'] = \"" . stripslashes(trim($_POST['dbname'])) . "\";\n"
|
||||
. "\$config['dbpref'] = \"" . stripslashes(trim($_POST['dbprefix'])) . "\";\n"
|
||||
. "\$config['dbport'] = null;\n"
|
||||
. "\$config['dbsock'] = null;\n"
|
||||
. "\t\$config = [\n"
|
||||
. "\t\t'dbhost' => \"" . stripslashes(trim($_POST['dbhost'])) . "\",\n"
|
||||
. "\t\t'dbuser' => \"" . stripslashes(trim($_POST['dbuser'])) . "\",\n"
|
||||
. "\t\t'dbpass' => \"" . stripslashes(trim($_POST['dbpass'])) . "\",\n"
|
||||
. "\t\t'dbname' => \"" . stripslashes(trim($_POST['dbname'])) . "\",\n"
|
||||
. "\t\t'dbpref' => \"" . stripslashes(trim($_POST['dbprefix'])) . "\",\n"
|
||||
. "\t\t'dbport' => null,\n"
|
||||
. "\t\t'dbsock' => null\n"
|
||||
. "\t];\n"
|
||||
. "?>"
|
||||
);
|
||||
|
||||
@fclose($fp);
|
||||
|
||||
// Класс для работы с БД
|
||||
require_once (BASE_DIR . '/class/class.database.php');
|
||||
|
||||
//-- Если не существует объекта по работе с БД
|
||||
if (! isset($AVE_DB))
|
||||
{
|
||||
//-- Подключаем конфигурационный файл с параметрами подключения
|
||||
require_once (BASE_DIR . '/config/db.config.php');
|
||||
|
||||
//-- Если параметры не указаны, прерываем работу
|
||||
if (! isset($config))
|
||||
exit;
|
||||
|
||||
//-- Если константа префикса таблиц не задана, принудительно определяем ее на основании параметров в файле db.config.php
|
||||
if (! defined('PREFIX'))
|
||||
define('PREFIX', $config['dbpref']);
|
||||
|
||||
//-- Создаем объект для работы с БД
|
||||
try {
|
||||
$AVE_DB = AVE_DB::getInstance($config)
|
||||
//-- Назначаем кодировку
|
||||
->setCharset('utf8')
|
||||
//-- Назначаем БД
|
||||
->setDatabaseName($config['dbname']);
|
||||
}
|
||||
catch (AVE_DB_Exception $e)
|
||||
{
|
||||
ob_start();
|
||||
header('HTTP/1.1 503 Service Temporarily Unavailable');
|
||||
header('Status: 503 Service Temporarily Unavailable');
|
||||
header('Retry-After: 3600');
|
||||
header('X-Powered-By:');
|
||||
echo $e->getMessage();
|
||||
die;
|
||||
}
|
||||
|
||||
unset ($config);
|
||||
}
|
||||
|
||||
// Открываем файл структуры БД
|
||||
$filename = BASE_DIR . '/install/structure_base.sql';
|
||||
|
||||
$handle = fopen($filename, 'r');
|
||||
$db_structure = fread($handle, filesize($filename));
|
||||
|
||||
fclose($handle);
|
||||
|
||||
// Подставляем префикс
|
||||
$db_structure = str_replace('%%PRFX%%', $_POST['dbprefix'], $db_structure);
|
||||
|
||||
$mysql_connect = @mysqli_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname']);
|
||||
@mysqli_select_db($mysql_connect, $_POST['dbname']);
|
||||
|
||||
// Массив запросов
|
||||
$ar = explode('#inst#', $db_structure);
|
||||
|
||||
foreach ($ar as $in)
|
||||
{
|
||||
@mysqli_query($mysql_connect, "$in");
|
||||
}
|
||||
foreach ($ar as $sql)
|
||||
if (! empty($sql))
|
||||
$AVE_DB->Query($sql);
|
||||
|
||||
$AVE_Template->display('step5.tpl');
|
||||
exit;
|
||||
}
|
||||
elseif (true === $connect && true === $check_installed)
|
||||
{
|
||||
$AVE_Template->assign('installed', $AVE_Template->get_config_vars('database_installed'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$AVE_Template->assign('warning', $AVE_Template->get_config_vars('database_not_connect'));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -468,6 +558,43 @@
|
||||
$regex_password = '/[^\x20-\xFF]/';
|
||||
$regex_email = '/^[\w.-]+@[a-z0-9.-]+\.(?:[a-z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)$/i';
|
||||
|
||||
// Класс для работы с БД
|
||||
require_once (BASE_DIR . '/class/class.database.php');
|
||||
|
||||
//-- Если не существует объекта по работе с БД
|
||||
if (! isset($AVE_DB))
|
||||
{
|
||||
//-- Подключаем конфигурационный файл с параметрами подключения
|
||||
require_once (BASE_DIR . '/config/db.config.php');
|
||||
|
||||
//-- Если параметры не указаны, прерываем работу
|
||||
if (! isset($config))
|
||||
exit;
|
||||
|
||||
//-- Если константа префикса таблиц не задана, принудительно определяем ее на основании параметров в файле db.config.php
|
||||
if (! defined('PREFIX'))
|
||||
define('PREFIX', $config['dbpref']);
|
||||
|
||||
//-- Создаем объект для работы с БД
|
||||
try {
|
||||
$AVE_DB = AVE_DB::getInstance($config)
|
||||
//-- Назначаем кодировку
|
||||
->setCharset('utf8')
|
||||
//-- Назначаем БД
|
||||
->setDatabaseName($config['dbname']);
|
||||
}
|
||||
catch (AVE_DB_Exception $e)
|
||||
{
|
||||
ob_start();
|
||||
header('HTTP/1.1 503 Service Temporarily Unavailable');
|
||||
header('Status: 503 Service Temporarily Unavailable');
|
||||
header('Retry-After: 3600');
|
||||
header('X-Powered-By:');
|
||||
echo $e->getMessage();
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
$errors = array();
|
||||
if ($_POST['email'] == '') array_push($errors, $AVE_Template->get_config_vars('noemail'));
|
||||
if (! preg_match($regex_email, $_POST['email'])) array_push($errors, $AVE_Template->get_config_vars('email_no_specialchars'));
|
||||
@ -480,16 +607,9 @@
|
||||
if (true === $db_connect && ! sizeof($errors))
|
||||
{
|
||||
if (isset($_POST['demo']) && 1 == $_POST['demo'])
|
||||
{
|
||||
$filename = BASE_DIR . '/install/data_demo.sql';
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename = BASE_DIR . '/install/data_base.sql';
|
||||
}
|
||||
|
||||
$mysql_connect = @mysqli_connect($config['dbhost'], $config['dbuser'], $config['dbpass']);
|
||||
@mysqli_select_db($mysql_connect, $config['dbname']);
|
||||
$filename = BASE_DIR . '/install/data_base.sql';
|
||||
|
||||
$handle = fopen($filename, 'r');
|
||||
$dbin = fread($handle, filesize($filename));
|
||||
@ -510,12 +630,9 @@
|
||||
|
||||
$ar = explode('#inst#', $dbin);
|
||||
|
||||
foreach ($ar as $in)
|
||||
{
|
||||
@mysqli_query($mysql_connect, "SET NAMES 'utf8'");
|
||||
@mysqli_query($mysql_connect, "SET COLLATION_CONNECTION = 'utf8_general_ci'");
|
||||
@mysqli_query($mysql_connect, $in);
|
||||
}
|
||||
foreach ($ar as $sql)
|
||||
if (! empty($sql))
|
||||
$AVE_DB->Query($sql);
|
||||
|
||||
$AVE_Template->display('step6.tpl');
|
||||
|
||||
|
@ -23,18 +23,18 @@ CREATE TABLE `%%PRFX%%_countries` (
|
||||
|
||||
|
||||
CREATE TABLE `%%PRFX%%_document_fields` (
|
||||
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`rubric_field_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`document_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`field_number_value` decimal(18,4) NOT NULL DEFAULT '0.0000',
|
||||
`field_value` varchar(500) NOT NULL,
|
||||
`document_in_search` enum('1','0') NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`Id`),
|
||||
KEY `document_id` (`document_id`),
|
||||
KEY `field_id` (`rubric_field_id`),
|
||||
KEY `value` (`field_value`),
|
||||
KEY `number_value` (`field_number_value`),
|
||||
KEY `queries` (`document_id`, `rubric_field_id`)
|
||||
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`rubric_field_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`document_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`field_number_value` decimal(18,4) NOT NULL DEFAULT '0.0000',
|
||||
`field_value` varchar(500) NOT NULL,
|
||||
`document_in_search` enum('1','0') NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`Id`),
|
||||
KEY `document_id` (`document_id`),
|
||||
KEY `field_value` (`field_value`(333)),
|
||||
KEY `field_number_value` (`field_number_value`),
|
||||
KEY `rubric_field_id` (`rubric_field_id`),
|
||||
KEY `queries` (`document_id`,`rubric_field_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
|
||||
|
||||
|
||||
@ -86,44 +86,46 @@ CREATE TABLE `%%PRFX%%_document_rev` (
|
||||
|
||||
|
||||
CREATE TABLE `%%PRFX%%_documents` (
|
||||
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`rubric_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`rubric_tmpl_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`document_parent` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`document_alias` varchar(255) NOT NULL DEFAULT '',
|
||||
`document_alias_history` enum('0','1','2') NOT NULL DEFAULT '0',
|
||||
`document_short_alias` VARCHAR(10) NOT NULL DEFAULT '', # 3.24
|
||||
`document_title` varchar(255) NOT NULL DEFAULT '',
|
||||
`document_breadcrum_title` varchar(255) NOT NULL DEFAULT '',
|
||||
`document_published` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`document_expire` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`document_changed` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`document_author_id` mediumint(5) unsigned NOT NULL DEFAULT '1',
|
||||
`document_in_search` enum('1','0') NOT NULL DEFAULT '1',
|
||||
`document_meta_keywords` text NOT NULL DEFAULT '',
|
||||
`document_meta_description` text NOT NULL DEFAULT '',
|
||||
`document_meta_robots` enum('index,follow','index,nofollow','noindex,nofollow') NOT NULL DEFAULT 'index,follow',
|
||||
`document_sitemap_freq` tinyint(1) NOT NULL DEFAULT '3',
|
||||
`document_sitemap_pr` float NOT NULL DEFAULT '0.5',
|
||||
`document_status` enum('1','0') NOT NULL DEFAULT '1',
|
||||
`document_deleted` enum('0','1') NOT NULL DEFAULT '0',
|
||||
`document_count_print` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`document_count_view` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`document_linked_navi_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`document_teaser` text NOT NULL DEFAULT '',
|
||||
`document_tags` text NOT NULL DEFAULT '',
|
||||
`document_lang` varchar(5) NOT NULL DEFAULT '',
|
||||
`document_lang_group` int(10) NOT NULL DEFAULT '0',
|
||||
`document_property` text,
|
||||
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`rubric_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`rubric_tmpl_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`document_parent` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`document_alias` varchar(255) NOT NULL,
|
||||
`document_alias_history` enum('0','1','2') NOT NULL DEFAULT '0',
|
||||
`document_short_alias` varchar(10) NOT NULL DEFAULT '',
|
||||
`document_title` varchar(255) NOT NULL,
|
||||
`document_breadcrum_title` varchar(255) NOT NULL,
|
||||
`document_published` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`document_expire` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`document_changed` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`document_author_id` mediumint(5) unsigned NOT NULL DEFAULT '1',
|
||||
`document_in_search` enum('1','0') NOT NULL DEFAULT '1',
|
||||
`document_meta_keywords` text NOT NULL,
|
||||
`document_meta_description` text NOT NULL,
|
||||
`document_meta_robots` enum('index,follow','index,nofollow','noindex,nofollow') NOT NULL DEFAULT 'index,follow',
|
||||
`document_sitemap_freq` tinyint(1) NOT NULL DEFAULT '3',
|
||||
`document_sitemap_pr` float NOT NULL DEFAULT '0.5',
|
||||
`document_status` enum('1','0') NOT NULL DEFAULT '1',
|
||||
`document_deleted` enum('0','1') NOT NULL DEFAULT '0',
|
||||
`document_count_print` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`document_count_view` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`document_linked_navi_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`document_teaser` text NOT NULL,
|
||||
`document_tags` text NOT NULL,
|
||||
`document_lang` varchar(5) NOT NULL,
|
||||
`document_lang_group` int(10) NOT NULL DEFAULT '0',
|
||||
`document_property` text,
|
||||
`document_rating` int(3) unsigned NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`Id`),
|
||||
UNIQUE KEY `alias` (`document_alias`),
|
||||
UNIQUE KEY `document_alias` (`document_alias`),
|
||||
KEY `rubric_id` (`rubric_id`),
|
||||
KEY `parent` (`document_parent`),
|
||||
KEY `published` (`document_published`),
|
||||
KEY `expire` (`document_expire`),
|
||||
KEY `status` (`document_status`),
|
||||
KEY `deleted` (`document_deleted`),
|
||||
KEY `count_view` (`document_count_view`)
|
||||
KEY `document_parent` (`document_parent`),
|
||||
KEY `document_published` (`document_published`),
|
||||
KEY `document_expire` (`document_expire`),
|
||||
KEY `document_status` (`document_status`),
|
||||
KEY `document_deleted` (`document_deleted`),
|
||||
KEY `document_count_view` (`document_count_view`),
|
||||
KEY `document_rating` (`document_rating`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user