AVE.CMS v3.28
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

186 lines
4.8 KiB

8 years ago
<?php
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2016 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
7 years ago
define ('START_MICROTIME', microtime());
define ('START_MEMORY', memory_get_usage());
define ('BASE_DIR', str_replace("\\", "/", dirname(__FILE__)));
8 years ago
7 years ago
//-- Проверяем уставлена ли CMS
if (! @filesize(BASE_DIR . '/config/db.config.php'))
8 years ago
{
7 years ago
header ('Location:install/index.php');
8 years ago
exit;
}
7 years ago
//-- Если в запросе пришел вызов thumbnail
//-- подключаем файл обработки thumbnail
8 years ago
if (! empty($_REQUEST['thumb']))
{
7 years ago
require (BASE_DIR . '/inc/thumb.php');
8 years ago
exit;
}
ob_start();
7 years ago
//-- Подключаем файл определения мобильных устройств
//-- далее пользуемся $MDetect
7 years ago
require_once (BASE_DIR . '/lib/mobile_detect/Mobile_Detect.php');
8 years ago
$MDetect = new Mobile_Detect;
7 years ago
//-- Подключаем файл инициализации
7 years ago
require (BASE_DIR . '/inc/init.php');
8 years ago
7 years ago
unset ($GLOBALS['CMS_CONFIG']);
8 years ago
7 years ago
//-- Проверяем нет ли в запросе папки UPLOADS_DIR
//-- подключаем файл для работы thumbsnail
7 years ago
if (strpos ($_SERVER['REQUEST_URI'], ABS_PATH . UPLOAD_DIR . '/') === 0)
8 years ago
{
7 years ago
require (BASE_DIR . '/inc/thumb.php');
8 years ago
exit;
}
7 years ago
//-- Папка с шаблонами для Smarty
8 years ago
$AVE_Template = new AVE_Template(BASE_DIR . '/templates/');
7 years ago
//-- Подключаем ядро системы
7 years ago
require (BASE_DIR . '/class/class.core.php');
8 years ago
$AVE_Core = new AVE_Core;
7 years ago
//-- Проверям на вызов внешних модулей и системных блоков
if (
empty ($_REQUEST['module'])
||
empty ($_REQUEST['sysblock'])
||
empty ($_REQUEST['request'])
)
8 years ago
$AVE_Core->coreUrlParse($_SERVER['REQUEST_URI']);
$GLOBALS['page_id'] = array((isset($_REQUEST['id'])
? $_REQUEST['id']
: '')
7 years ago
=> array('page' => floatval(0)));
8 years ago
7 years ago
//-- Если пришел вызов на показ ревизии документа
8 years ago
if (! empty($_REQUEST['revission']))
{
$res = $AVE_DB->Query("
SELECT
doc_data
FROM
" . PREFIX . "_document_rev
WHERE
doc_id = '" . (int)$_REQUEST['id'] . "'
AND
doc_revision = '" . (int)$_REQUEST['revission'] . "'
LIMIT 1
")->GetCell();
$res = @unserialize($res);
$flds = get_document_fields((int)$_REQUEST['id'], $res);
}
7 years ago
//-- Собираем страницу
8 years ago
$AVE_Core->coreSiteFetch(get_current_document_id());
$content = ob_get_clean();
7 years ago
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && GZIP_COMPRESSION)
{
ob_start('ob_gzhandler');
}
else
ob_start();
8 years ago
7 years ago
eval (' '.'?>' . $content . '<?'.'php ');
8 years ago
$render = ob_get_clean();
7 years ago
unset ($content);
8 years ago
7 years ago
//-- Ловим 404 ошибку
8 years ago
if (isset($_REQUEST['id']) AND ($_REQUEST['id']) == PAGE_NOT_FOUND_ID)
{
report404();
7 years ago
header ($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true);
8 years ago
}
7 years ago
//-- Постраничка
8 years ago
if (
empty($_REQUEST['module']) &&
(
(
isset($_REQUEST['page'])
&& is_numeric($_REQUEST['page'])
&& ($_REQUEST['page'] < 2 OR ($_REQUEST['page'] > @$GLOBALS['page_id'][$_REQUEST['id']]['page']))
)
OR
(
isset($_REQUEST['apage'])
&& is_numeric($_REQUEST['apage'])
&& ($_REQUEST['apage'] < 2 OR ($_REQUEST['apage'] > @$GLOBALS['page_id'][$_REQUEST['id']]['apage']))
)
OR
(
isset($_REQUEST['artpage'])
&& is_numeric($_REQUEST['artpage'])
&& ($_REQUEST['artpage'] < 2 OR ($_REQUEST['artpage'] > @$GLOBALS['page_id'][$_REQUEST['id']]['artpage']))
)
)
)
{
if ($_REQUEST['id'] == 1)
7 years ago
header ('Location:' . ABS_PATH);
8 years ago
else
7 years ago
header ('Location:' . ABS_PATH . $AVE_Core->curentdoc->document_alias . URL_SUFF);
8 years ago
exit;
}
7 years ago
//-- Тут заменяем [tag:rubheader]
//-- на собранный $GLOBALS["user_header"]
7 years ago
$rubheader = (empty($GLOBALS['user_header'])
? ''
: implode(chr(10), $GLOBALS['user_header']));
8 years ago
$render = str_replace('[tag:rubheader]', $rubheader, $render);
7 years ago
//-- Тут заменяем [tag:rubfooter]
//-- на собранный $GLOBALS["user_footer"]
7 years ago
$rubfooter = (empty($GLOBALS['user_footer'])
? ''
: implode(chr(10), $GLOBALS['user_footer']));
$render = str_replace('[tag:rubfooter]', $rubfooter, $render);
unset ($rubheader, $rubfooter);
7 years ago
//-- Header Engine
header('X-Engine: AVE.cms');
header('X-Engine-Copyright: 2007-' . date('Y') . ' (c) AVE.cms');
header('X-Engine-Site: https://ave-cms.ru');
8 years ago
7 years ago
//-- Вывод конечного результата
7 years ago
output_compress($render);
7 years ago
7 years ago
//-- Вывод статистики загрузки и запросов SQL (только для администраторов)
if (
! defined('ONLYCONTENT')
&&
UGROUP == 1
&&
defined('PROFILING') && PROFILING
)
Debug::displayInfo();
8 years ago
?>