Browse Source

Fixes

pull/3/head
MadD3n 4 years ago
parent
commit
0ee7891d41
  1. 9
      admin/templates/main.tpl
  2. 9
      admin/templates/pop.tpl
  3. 163
      class/class.errors.php
  4. 4
      fields/code/field.php
  5. 49
      inc/init.php
  6. 7
      index.php

9
admin/templates/main.tpl

@ -30,11 +30,10 @@
<!-- JS Scripts -->
<script>
var ave_path = "{$ABS_PATH}";
var ave_theme = "{$smarty.const.DEFAULT_THEME_FOLDER}";
var ave_admintpl = "{$tpl_dir}";
var sess = '{$sess}';
var ave_path = "{$ABS_PATH}",
ave_theme = "{$smarty.const.DEFAULT_THEME_FOLDER}",
ave_admintpl = "{$tpl_dir}",
sess = '{$sess}';
</script>
<script type="text/javascript" language="JavaScript">

9
admin/templates/pop.tpl

@ -1,6 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
@ -32,10 +31,10 @@
<!-- JS Scripts -->
<script>
var ave_path = "{$ABS_PATH}";
var ave_theme = "{$smarty.const.DEFAULT_THEME_FOLDER}";
var ave_admintpl = "{$tpl_dir}";
var sess = "{$sess}";
var ave_path = "{$ABS_PATH}",
ave_theme = "{$smarty.const.DEFAULT_THEME_FOLDER}",
ave_admintpl = "{$tpl_dir}",
sess = "{$sess}";
</script>
</head>

163
class/class.errors.php

@ -0,0 +1,163 @@
<?php
// Проверка
if (! defined('BASE_DIR'))
exit('Access denied');
/**
* This source file is part of the AVE.cms. More information,
* documentation and tutorials can be found at http://www.ave-cms.ru
*
* @package AVE.cms
* @file system/helpers/errors.php
* @author @
* @copyright 2007-2016 (c) AVE.cms
* @link http://www.ave-cms.ru
* @version 4.0
* @since $date$
* @license license GPL v.2 http://www.ave-cms.ru/license.txt
*/
class Errors
{
/**
* Errors constructor.
*/
public function __construct ()
{
set_error_handler([$this, 'scriptError']);
register_shutdown_function([$this, 'shutDown']);
}
/**
* @param $errno
* @param $errstr
* @param $errfile
* @param $errline
*/
public function scriptError ($errno, $errstr, $errfile, $errline)
{
switch($errno)
{
case E_ERROR:
$errseverity = 'Error';
$color = '#f05050';
break;
case E_WARNING:
$errseverity = 'Warning';
$color = '#fad733';
break;
case E_NOTICE:
$errseverity = 'Notice';
$color = '#23b7e5';
break;
case E_CORE_ERROR:
$errseverity = 'Core Error';
$color = '#f05050';
break;
case E_CORE_WARNING:
$errseverity = 'Core Warning';
$color = '#fad733';
break;
case E_COMPILE_ERROR:
$errseverity = 'Compile Error';
$color = '#f05050';
break;
case E_COMPILE_WARNING:
$errseverity = 'Compile Warning';
$color = '#fad733';
break;
case E_USER_ERROR:
$errseverity = 'User Error';
$color = '#f05050';
break;
case E_USER_WARNING:
$errseverity = 'User Warning';
$color = '#fad733';
break;
case E_USER_NOTICE:
$errseverity = 'User Notice';
$color = '#23b7e5';
break;
case E_STRICT:
$errseverity = 'Strict Standards';
$color = '#edf1f2';
break;
case E_PARSE:
$errseverity = 'Parse Error';
$color = '#f05050';
break;
case E_RECOVERABLE_ERROR:
$errseverity = 'Recoverable Error';
$color = '#f05050';
break;
case E_DEPRECATED:
$errseverity = 'Deprecated';
$color = '#fad733';
break;
case E_USER_DEPRECATED:
$errseverity = 'User Deprecated';
$color = '#fad733';
break;
default:
$errseverity = 'Error';
$color = '#fad733';
break;
}
$out = '<div style="border: 1px solid ' . $color . '; margin: 10px; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 5px; box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2);">';
$out .= '<div style="background: ' . $color . '; color: #000; margin: 0; padding: 6px;">';
$out .= '<strong>' . $errseverity . '</strong> Line <strong>' . $errline . '</strong>: ' . $errfile;
$out .= '</div>';
$out .= '<div style="background: #f0f0f0; color: #000; margin: 0; padding: 6px; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);">';
$out .= '['.$errno.'] '. $errstr;
$out .= '</div>';
$out .= '</div>';
echo $out;
}
/**
*
*/
public function shutDown ()
{
if ($error = error_get_last())
{
if (! headers_sent())
header('HTTP/1.1 500 Internal Server Error');
switch($error['type'])
{
case E_ERROR:
case E_PARSE:
case E_STRICT:
case E_CORE_ERROR:
case E_CORE_WARNING:
case E_COMPILE_ERROR:
case E_COMPILE_WARNING:
case E_USER_ERROR:
case E_RECOVERABLE_ERROR:
$this->scriptError($error['type'], $error['message'], $error['file'], $error['line']);
break;
}
}
}
}

4
fields/code/field.php

@ -21,6 +21,8 @@
$lang_file = $fld_dir . 'lang/' . (defined('ACP') ? $_SESSION['admin_language'] : $_SESSION['user_language']) . '.txt';
$doc_id = isset($_REQUEST['Id']) ? (int)$_REQUEST['Id'] : '0';
$AVE_Template->config_load($lang_file, 'lang');
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars());
$AVE_Template->config_load($lang_file, 'admin');
@ -32,7 +34,7 @@
$AVE_Template->assign('field_value', $field_value);
$AVE_Template->assign('doc_id', (int)$_REQUEST['Id']);
$AVE_Template->assign('rubric_id', $rubric_id);
$AVE_Template->assign('f_id', $field_id.'_'.(int)$_REQUEST['Id']);
$AVE_Template->assign('f_id', $field_id . '_' . $doc_id);
$tpl_file = get_field_tpl($tpl_dir, $field_id, 'admin', $_tpl);

49
inc/init.php

@ -21,8 +21,24 @@
//-- Подключаем файл настроек
require_once (BASE_DIR . '/inc/config.php');
//-- Вкл/Выкл отображения ошибок php
if (! PHP_DEBUGGING)
{
error_reporting(E_ERROR);
ini_set('display_errors', 7);
}
else
{
error_reporting(E_ALL);
ini_set('display_errors', false);
}
if (PHP_DEBUGGING_FILE && !defined('ACP'))
include_once BASE_DIR . '/inc/errors.php';
{
require(BASE_DIR . '/class/class.errors.php');
new Errors();
}
//-- Registry
require(BASE_DIR . '/class/class.registry.php');
@ -42,7 +58,7 @@
if (! ini_get('register_globals'))
return;
$allowed = array(
$allowed =[
'_ENV' => 1,
'_GET' => 1,
'_POST' => 1,
@ -51,9 +67,9 @@
'_SERVER' => 1,
'_REQUEST' => 1,
'GLOBALS' => 1
);
];
foreach ($GLOBALS as $key => $value)
foreach ($GLOBALS AS $key => $value)
{
if (! isset($allowed[$key]))
unset($GLOBALS[$key]);
@ -92,16 +108,6 @@
return $array;
}
if (! get_magic_quotes_gpc())
{
$_GET = add_slashes($_GET);
$_POST = add_slashes($_POST);
$_REQUEST = array_merge($_POST, $_GET);
$_COOKIE = add_slashes($_COOKIE);
}
function isSSL()
{
if (isset($_SERVER['HTTPS']))
@ -184,21 +190,6 @@
//-- Переключение для нормальной работы с русскими буквами в некоторых функциях
mb_internal_encoding("UTF-8");
//-- Вкл/Выкл отображения ошибок php
if (! PHP_DEBUGGING_FILE)
{
if (! PHP_DEBUGGING)
{
error_reporting(E_ERROR);
ini_set('display_errors', 7);
}
else
{
error_reporting(E_ALL);
ini_set('display_errors', 1);
}
}
//-- Подкючаем необходимые файлы функций
require_once (BASE_DIR . '/functions/func.breadcrumbs.php'); // Хлебные крошки
require_once (BASE_DIR . '/functions/func.common.php'); // Основные функции

7
index.php

@ -37,7 +37,7 @@
require_once (BASE_DIR . '/lib/mobile_detect/Mobile_Detect.php');
$MobileDetect = new Mobile_Detect;
$init_start = microtime(true);
$init_start = microtime();
//-- Подключаем файл инициализации
require (BASE_DIR . '/inc/init.php');
@ -57,6 +57,7 @@
//-- Подключаем ядро системы
require (BASE_DIR . '/class/class.core.php');
$AVE_Core = new AVE_Core;
//-- Проверям на вызов внешних модулей и системных блоков
@ -69,10 +70,10 @@
)
$AVE_Core->coreUrlParse($_SERVER['REQUEST_URI']);
$GLOBALS['page_id'] = array((isset($_REQUEST['id'])
$GLOBALS['page_id'] = [(isset($_REQUEST['id'])
? $_REQUEST['id']
: '')
=> ['page' => floatval(0)]);
=> ['page' => floatval(0)]];
//-- Если пришел вызов на показ ревизии документа
if (! empty($_REQUEST['revission']))

Loading…
Cancel
Save