diff --git a/admin/templates/main.tpl b/admin/templates/main.tpl index b2afd00..a25c013 100644 --- a/admin/templates/main.tpl +++ b/admin/templates/main.tpl @@ -30,11 +30,10 @@ + - - + + - - - - +
diff --git a/class/class.errors.php b/class/class.errors.php new file mode 100644 index 0000000..f31e1ea --- /dev/null +++ b/class/class.errors.php @@ -0,0 +1,163 @@ +'; + $out .= '
'; + $out .= '' . $errseverity . ' Line ' . $errline . ': ' . $errfile; + $out .= '
'; + $out .= '
'; + $out .= '['.$errno.'] '. $errstr; + $out .= '
'; + $out .= '
'; + + 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; + } + } + } + } \ No newline at end of file diff --git a/class/class.hooks.php b/class/class.hooks.php index 82bf230..c962ee7 100755 --- a/class/class.hooks.php +++ b/class/class.hooks.php @@ -29,7 +29,7 @@ public static $run_hooks; - public static function init() + public static function init () { if (!self::$instance) { self::$instance = new Hooks(); @@ -40,7 +40,7 @@ /** * Add Hook */ - public static function register($name, $function, $priority = 10) + public static function register ($name, $function, $priority = 10) { // If we have already registered this action return true if (isset(self::$hooks[$name][$priority][$function])) @@ -74,7 +74,7 @@ /** * Do Hook */ - public static function trigger($name, $arguments = "") + public static function trigger ($name, $arguments = "") { // Oh, no you didn't. Are you trying to run an action hook that doesn't exist? if (! isset(self::$hooks[$name])) @@ -115,7 +115,7 @@ /** * Remove Hook */ - public static function unregister($name, $function, $priority = 10) + public static function unregister ($name, $function, $priority = 10) { // If the action hook doesn't, just return true if (!isset(self::$hooks[$name][$priority][$function])) @@ -135,7 +135,7 @@ * Get the currently running action hook * */ - public static function current() + public static function current () { return self::$current_hook; } @@ -144,7 +144,7 @@ /** * Has Run */ - public static function has($hook, $priority = 10) + public static function has ($hook, $priority = 10) { if (isset(self::$hooks[$hook][$priority])) { @@ -160,7 +160,7 @@ /** * Hook Exists */ - public static function exists($name) + public static function exists ($name) { if (isset(self::$hooks[$name])) { diff --git a/fields/code/field.php b/fields/code/field.php index 6ab4c71..7b8cc13 100644 --- a/fields/code/field.php +++ b/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); diff --git a/inc/init.php b/inc/init.php index 7d232a1..8e03976 100644 --- a/inc/init.php +++ b/inc/init.php @@ -21,8 +21,24 @@ //-- Подключаем файл настроек require_once (BASE_DIR . '/inc/config.php'); - if (PHP_DEBUGGING_FILE && ! defined('ACP')) - include_once BASE_DIR . '/inc/errors.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')) + { + 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'); // Основные функции diff --git a/index.php b/index.php index 9f7d719..692abbf 100755 --- a/index.php +++ b/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'])) @@ -173,4 +174,4 @@ $GLOBALS['block_generate']['DOCUMENT']['CONTENT'] = Debug::endTime('CONTENT'); //-- Вывод конечного результата - output_compress($render); + output_compress($render); \ No newline at end of file