Browse Source

Fixes

master
M@d D3n 6 years ago
parent
commit
e510c55b7c
  1. 1
      .htaccess
  2. 8
      README.md
  3. 2
      admin/admin.php
  4. 2
      admin/dbsettings.php
  5. 25
      admin/functions/func.admin.common.php
  6. 4
      admin/index.php
  7. 1161
      admin/rubs.php
  8. 57
      admin/start.php
  9. 2
      admin/templates/browser/browser_upload.tpl
  10. 6
      admin/templates/modules/modules.tpl
  11. 2
      admin/templates/rubs/_field_code.tpl
  12. 35
      admin/templates/rubs/fields_list.tpl
  13. 34
      class/class.blocks.php
  14. 141
      class/class.core.php
  15. 116
      class/class.database.php
  16. 18
      class/class.dbdump.php
  17. 167
      class/class.debug.php
  18. 34
      class/class.docs.php
  19. 259
      class/class.hooks.php
  20. 525
      class/class.logs.php
  21. 108
      class/class.modules.php
  22. 46
      class/class.navigation.php
  23. 68
      class/class.rubs.php
  24. 214
      class/class.session.files.php
  25. 2
      class/class.session.php
  26. 16
      class/class.settings.php
  27. 28
      class/class.sysblocks.php
  28. 19
      class/class.template.php
  29. 41
      class/class.templates.php
  30. 1
      config/.htaccess
  31. 0
      config/config.inc.php
  32. 0
      config/db.config.php
  33. 2
      fields/checkbox/field.php
  34. 2
      fields/date/field.php
  35. 2
      fields/doc_from_rub/field.php
  36. 2
      fields/doc_from_rub_check/field.php
  37. 2
      fields/drop_down/field.php
  38. 2
      fields/drop_down_key/field.php
  39. 25
      fields/image_mega/field.php
  40. 4
      fields/image_single/field.php
  41. 4
      fields/image_single/js/field.js
  42. 2
      fields/single_line/field.php
  43. 2
      functions/func.block.php
  44. 19
      functions/func.common.php
  45. 2
      functions/func.custom.php
  46. 81
      functions/func.hidden.php
  47. 2
      functions/func.locale.php
  48. 211
      functions/func.logs.php
  49. 2
      functions/func.mail.php
  50. 6
      functions/func.navigation.php
  51. 15
      functions/func.parserequest.php
  52. 2
      functions/func.sysblock.php
  53. 120
      inc/antispam.php
  54. 6
      inc/config.php
  55. 158
      inc/init.php
  56. 2
      inc/thumb.php
  57. 70
      index.php
  58. 26
      install/data_base.sql
  59. 887
      install/index.php
  60. 19
      install/structure_base.sql
  61. 48
      lib/debug/debug.css
  62. 30
      lib/debug/debug.js
  63. 1077
      lib/debug/sql.php
  64. 4
      lib/redactor/codemirror/addon/comment/comment.js
  65. 1
      lib/redactor/codemirror/addon/display/placeholder.js
  66. 26
      lib/redactor/codemirror/addon/edit/closebrackets.js
  67. 16
      lib/redactor/codemirror/addon/edit/closetag.js
  68. 45
      lib/redactor/codemirror/addon/edit/continuelist.js
  69. 13
      lib/redactor/codemirror/addon/edit/matchbrackets.js
  70. 2
      lib/redactor/codemirror/addon/fold/xml-fold.js
  71. 8
      lib/redactor/codemirror/addon/hint/javascript-hint.js
  72. 17
      lib/redactor/codemirror/addon/hint/show-hint.js
  73. 28
      lib/redactor/codemirror/addon/hint/sql-hint.js
  74. 108
      lib/redactor/codemirror/addon/lint/javascript-lint.js
  75. 6
      lib/redactor/codemirror/addon/lint/lint.js
  76. 6
      lib/redactor/codemirror/addon/merge/merge.css
  77. 5
      lib/redactor/codemirror/addon/merge/merge.js
  78. 10
      lib/redactor/codemirror/addon/mode/multiplex.js
  79. 2
      lib/redactor/codemirror/addon/search/match-highlighter.js
  80. 20
      lib/redactor/codemirror/addon/search/searchcursor.js
  81. 3
      lib/redactor/codemirror/addon/tern/tern.js
  82. 1
      lib/redactor/codemirror/codemirror_connect.tpl
  83. 3
      lib/redactor/codemirror/codemirror_editor.tpl
  84. 6
      lib/redactor/codemirror/lib/codemirror.css
  85. 92
      lib/redactor/codemirror/lib/codemirror.js
  86. 45
      lib/redactor/codemirror/mode/clike/clike.js
  87. 360
      lib/redactor/codemirror/mode/clike/index.html
  88. 767
      lib/redactor/codemirror/mode/clike/scala.html
  89. 59
      lib/redactor/codemirror/mode/clike/test.js
  90. 18
      lib/redactor/codemirror/mode/css/css.js
  91. 103
      lib/redactor/codemirror/mode/css/gss.html
  92. 17
      lib/redactor/codemirror/mode/css/gss_test.js
  93. 75
      lib/redactor/codemirror/mode/css/index.html
  94. 152
      lib/redactor/codemirror/mode/css/less.html
  95. 54
      lib/redactor/codemirror/mode/css/less_test.js
  96. 157
      lib/redactor/codemirror/mode/css/scss.html
  97. 110
      lib/redactor/codemirror/mode/css/scss_test.js
  98. 206
      lib/redactor/codemirror/mode/css/test.js
  99. 9
      lib/redactor/codemirror/mode/htmlembedded/htmlembedded.js
  100. 60
      lib/redactor/codemirror/mode/htmlembedded/index.html
  101. Some files were not shown because too many files have changed in this diff Show More

1
.htaccess

@ -319,6 +319,7 @@ AddDefaultCharset utf-8
# Файл sitemap.xml
RewriteRule ^sitemap.xml$ inc/sitemap.php [QSA,L]
RewriteRule ^sitemap-([0-9]+).xml$ inc/sitemap.php?id=$1 [QSA,L]
#--start-ave-editor--#

8
README.md

@ -21,10 +21,8 @@
* ПО WEB сервера:
* Apache >= 1.3
* Nginx >= 1.6.2
* IIS >= 5
* PHP >= 5.5
* PHP >= 5.5.x ... <= 5.6.x разрешить использовать короткие теги short_open_tag = On (zlib, cURL, mbString, JSON)
* PHP >= 7.x ... <= 7.1.x
* PHP >= 5.6.x разрешить использовать короткие теги short_open_tag = On (zlib, cURL, mbString, JSON)
* PHP >= 7.x ... <= 7.2.x
## Модули
@ -55,7 +53,7 @@
1. Распакуйте содержимое архива в новую папку на вашем локальном компьютере.
2. Загрузить эту папку целиком через FTP-клиент на ваш хост.
3. Вам также может потребоваться установить права доступа (CHMOD 777) рекурсивно, на папки /cache/, /session/ и /uploads/, если ваш хостинг не установливает это по умолчанию.
3. Вам также может потребоваться установить права доступа (CHMOD 777) рекурсивно, на папки /tmp/cache/, /tmp/session/ и /uploads/, если ваш хостинг не установливает это по умолчанию.
4. Также вам может потребоваться установить права доступа (CHMOD 777) рекурсивно, на файлы inc/db.config.php и inc/config.inc.php, если ваш хостинг не установливает это по умолчанию.
5. Наберите http://адрес вашего сайта/ в браузере.
6. Следуйте инструкциям.

2
admin/admin.php

@ -15,7 +15,7 @@
define('ACPL', 1);
define('BASE_DIR', str_replace("\\", "/", dirname(dirname(__FILE__))));
if (! @filesize(BASE_DIR . '/inc/db.config.php'))
if (! @filesize(BASE_DIR . '/config/db.config.php'))
{
header('Location:/install/index.php');
exit;

2
admin/dbsettings.php

@ -46,7 +46,7 @@
exit;
case 'restore':
$AVE_DB_Service->databaseDumpImport(BASE_DIR . "/" . ATTACH_DIR . "/");
$AVE_DB_Service->databaseDumpImport(BASE_DIR . "/tmp/" . ATTACH_DIR . "/");
break;
case 'download':

25
admin/functions/func.admin.common.php

@ -48,22 +48,22 @@
$log404 = array();
$logsql = array();
$_404dir = BASE_DIR . '/cache/404.php';
$_logdir = BASE_DIR . '/cache/log.php';
$_sqldir = BASE_DIR . '/cache/sql.php';
$_404dir = BASE_DIR . '/tmp/logs/404.php';
$_logdir = BASE_DIR . '/tmp/logs/log.php';
$_sqldir = BASE_DIR . '/tmp/logs/sql.php';
if(file_exists($_logdir))
@eval('?>' . file_get_contents($_logdir) . '<?');
if (file_exists($_logdir))
@eval(' ?>' . file_get_contents($_logdir) . '<?php ');
$logs['logs'] = count($logdata);
if(file_exists($_404dir))
@eval('?>' . file_get_contents($_404dir) . '<?');
if (file_exists($_404dir))
@eval(' ?>' . file_get_contents($_404dir) . '<?php ');
$logs['404'] = count($log404);
if(file_exists($_sqldir))
@eval('?>' . file_get_contents($_sqldir) . '<?');
if (file_exists($_sqldir))
@eval(' ?>' . file_get_contents($_sqldir) . '<?php ');
$logs['sql'] = count($logsql);
@ -81,7 +81,8 @@
* @param int $onlinetime количество секунд
* @return Array массив из пользователей отсортированный по последней активности
*/
function get_online_users($onlinetime=USERS_TIME_SHOW){
function get_online_users($onlinetime=USERS_TIME_SHOW)
{
global $AVE_DB, $AVE_Template;
$time=(time()-intval($onlinetime));
$sql=@$AVE_DB->Query("SELECT * FROM ".PREFIX."_users WHERE last_visit>".$time." ORDER BY last_visit DESC");
@ -283,7 +284,7 @@
foreach ($modules AS $module)
{
if ($module['ModuleAdminEdit'] == 1 && $module['status'])
if ($module['ModuleAdminEdit'] == 1 && $module['ModuleStatus'])
$modules_instaled[] = array(
'ModuleName' => $module['ModuleName'],
'ModuleSysName' => $module['ModuleSysName']
@ -503,7 +504,7 @@
$row->canDelete = 0;
$row->canEndDel = 0;
$row->canOpenClose = 0;
$row->rubric_admin_teaser_template=@eval2var('?>'.($row->rubric_admin_teaser_template>'' ? @showrequestelement($row,$row->rubric_admin_teaser_template) : '').'<?');
$row->rubric_admin_teaser_template=@eval2var(' ?>'.($row->rubric_admin_teaser_template>'' ? @showrequestelement($row,$row->rubric_admin_teaser_template) : '').'<?php ');
// разрешаем редактирование и удаление
// если автор имеет право изменять свои документы в рубрике

4
admin/index.php

@ -19,7 +19,7 @@
define('BASE_DIR', str_replace("\\", "/", dirname(dirname(__FILE__))));
if (! @filesize(BASE_DIR . '/inc/db.config.php'))
if (! @filesize(BASE_DIR . '/config/db.config.php'))
{
header('Location: ../install/index.php');
exit;
@ -116,7 +116,7 @@
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Expires: " . date("r"));
include (BASE_DIR . '/admin/' . $do . '.php');
include_once (BASE_DIR . '/admin/' . $do . '.php');
if (defined('NOPERM'))
$AVE_Template->assign('content', $config_vars['MAIN_NO_PERMISSION']);

1161
admin/rubs.php

File diff suppressed because it is too large Load Diff

57
admin/start.php

@ -1,35 +1,34 @@
<?php
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
if (!defined('ACP'))
{
header('Location:index.php');
exit;
}
if (! defined('ACP'))
{
header('Location:index.php');
exit;
}
get_ave_info();
getInstaledModules();
DisplayMainDocuments();
get_online_users();
getLogRecords();
//$AVE_Template->config_load(BASE_DIR . '/admin/lang/' . $_SESSION['admin_language'] . '/main.txt', 'index');
$AVE_Template->assign('php_version', (@PHP_VERSION != '') ? @PHP_VERSION : 'unknow');
$AVE_Template->assign('domain', $_SERVER["HTTP_HOST"]);
$AVE_Template->assign('mysql_version', $GLOBALS['AVE_DB']->mysql_version());
$AVE_Template->assign('mysql_size', get_mysql_size());
$AVE_Template->assign('navi', $AVE_Template->fetch('navi/navi.tpl'));
$AVE_Template->assign('navi_top', $AVE_Template->fetch('navi/navi_top.tpl'));
$AVE_Template->assign('content', $AVE_Template->fetch('start.tpl'));
get_ave_info();
getInstaledModules();
DisplayMainDocuments();
get_online_users();
getLogRecords();
//$AVE_Template->config_load(BASE_DIR . '/admin/lang/' . $_SESSION['admin_language'] . '/main.txt', 'index');
$AVE_Template->assign('php_version', (@PHP_VERSION != '') ? @PHP_VERSION : 'unknow');
$AVE_Template->assign('domain', $_SERVER["HTTP_HOST"]);
$AVE_Template->assign('mysql_version', $GLOBALS['AVE_DB']->mysql_version());
$AVE_Template->assign('mysql_size', get_mysql_size());
$AVE_Template->assign('navi', $AVE_Template->fetch('navi/navi.tpl'));
$AVE_Template->assign('navi_top', $AVE_Template->fetch('navi/navi_top.tpl'));
$AVE_Template->assign('content', $AVE_Template->fetch('start.tpl'));
?>

2
admin/templates/browser/browser_upload.tpl

@ -39,7 +39,7 @@ $(function() {
{title : "Image files", extensions : "jpg,jpeg,jpe,gif,png"},
{title : "Video files", extensions : "mp4,avi,mov,wmv,wmf"},
{title : "Music files", extensions : "mp3"},
{title : "Documents", extensions : "doc,xls,pdf"},
{title : "Documents", extensions : "doc,docx,xls,xlsx,pdf"},
{title : "Zip files", extensions : "zip,rar"}
],
// Flash settings

6
admin/templates/modules/modules.tpl

@ -88,7 +88,7 @@ $(document).ready(function(){ldelim}
<td nowrap="nowrap">
{if check_permission('modules_admin')}
{if $module.ModuleAdminEdit && $module.status && $module.permission}
{if $module.ModuleAdminEdit && $module.ModuleStatus && $module.permission}
<strong><a href="index.php?do=modules&action=modedit&mod={$module.ModuleSysName}&moduleaction=1&cp={$sess}" title="{#MODULES_SETUP#}" class="toprightDir link">{$module.ModuleName}</a></strong>
{if (isset($module.ModuleTagLink) && $module.ModuleTagLink != "")}
<br /><span class="dgrey doclink">{$module.ModuleTagLink}</span>
@ -104,7 +104,7 @@ $(document).ready(function(){ldelim}
<td>
{if $module.template}
{assign var=module_id value=$module.id}
{if $module.status && $module.permission}
{if $module.ModuleStatus && $module.permission}
{html_options name=Template[$module_id] options=$all_templates selected=$module.template style="width: 200px"}
{else}
{html_options name=Template[$module_id] options=$all_templates selected=$module.template style="width: 200px" disabled="disabled"}
@ -120,7 +120,7 @@ $(document).ready(function(){ldelim}
{if check_permission('modules_system')}
<td align="center" width="20">
{if $module.status}
{if $module.ModuleStatus}
<a title="{#MODULES_STOP#}" href="index.php?do=modules&action=onoff&module={$module.ModuleSysName}&cp={$sess}" class="topDir icon_sprite ico_stop"></a>
{else}
<a title="{#MODULES_START#}" href="index.php?do=modules&action=onoff&module={$module.ModuleSysName}&cp={$sess}" class="topDir icon_sprite ico_start"></a>

2
admin/templates/rubs/_field_code.tpl

@ -59,7 +59,7 @@
</form>
{include file="$codemirror_editor" conn_id="ftpl" textarea_id='code_text' ctrls='$("#code_templ").ajaxSubmit(sett_options);' height=400}
{include file="$codemirror_editor" conn_id="ftpl" textarea_id='code_text' ctrls='$("#code_templ").ajaxSubmit(sett_options);' height=400 mode='smartymixed'}
<script language="javascript">
$(document).ready(function(){ldelim}

35
admin/templates/rubs/fields_list.tpl

@ -221,51 +221,20 @@ function openAliasWindow(fieldId, rubId, width, height, target) {ldelim}
</div>
</div>
</form>
{else}
<form action="index.php?do=rubs&action=edit&Id={$smarty.request.Id|escape}&cp={$sess}" method="post" class="mainForm" id="Rubric">
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#RUBRIK_FIELDS_TITLE#}</h5>
<div class="num">
<a class="basicNum" href="index.php?do=rubs&action=template&Id={$smarty.request.Id|escape}&cp={$sess}">{#RUBRIK_EDIT_TEMPLATE#}</a>
<a class="basicNum greenNum" href="index.php?do=rubs&action=template&Id={$smarty.request.Id|escape}&cp={$sess}">{#RUBRIK_EDIT_TEMPLATE#}</a>
</div>
</div>
<div id="fields_list">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic" id="FieldsList">
<col width="10">
<col width="10">
<col width="10">
<col width="10">
<col width="10">
<col width="100">
<col>
<col width="280">
<col width="280">
<col width="10">
<thead>
<tr>
<td align="center" title="{#RUBRIK_MARK_DEL_ALL#}" class="topDir">
<div align="center">
<input type="checkbox" id="selall" value="1" />
</div>
</td>
<td align="center"><a href="javascript:void(0);" class="topDir link" style="cursor: help;" title="{#RUBRIK_F_SORT_TIP#}">[?]</a></td>
<td align="center"><a href="javascript:void(0);" class="topDir link" style="cursor: help;" title="{#RUBRIK_NUMERIC_TIP#}">[?]</a></td>
<td align="center"><a href="javascript:void(0);" class="topDir link" style="cursor: help;" title="{#RUBRIK_SEARCH_TIP#}">[?]</a></td>
<td>{#RUBRIK_ID#}</td>
<td>{#RUBRIK_FIELD_ALIAS#}</td>
<td>{#RUBRIK_FIELD_NAME#}</td>
<td>{#RUBRIK_FIELD_TYPE#}</td>
<td>{#RUBRIK_FIELD_GROUP#}</td>
<td align="center"></td>
</tr>
</thead>
<tbody class="field_tbody">
<tr>
<td align="center" colspan="10">
<td align="center">
<ul class="messages">
<li class="highlight red">{#RUBRIK_NO_FIELDS#}</li>
</ul>

34
class/class.blocks.php

@ -78,7 +78,9 @@
{
$_REQUEST['block_visual'] = (isset($_REQUEST['block_visual'])) ? $_REQUEST['block_visual'] : 0;
$block_alias = isset($_REQUEST['block_alias']) ? $_REQUEST['block_alias'] : '';
$block_alias = isset($_REQUEST['block_alias'])
? $_REQUEST['block_alias']
: '';
$sql = $AVE_DB->Query("
UPDATE
@ -105,11 +107,7 @@
$theme = 'accept';
//-- Стираем кеш блока
if (file_exists(BASE_DIR . '/cache/sql/block/' . $block_id . '.cache'))
unlink(BASE_DIR . '/cache/sql/block/' . $block_id . '.cache');
if ($block_alias != '' && file_exists(BASE_DIR . '/cache/sql/block/' . $block_alias . '.cache'))
unlink(BASE_DIR . '/cache/sql/block/' . $block_alias . '.cache');
$this->clearCache($block_id, $block_alias);
//-- Сохраняем системное сообщение в журнал
reportLog($AVE_Template->get_config_vars('BLOCK_SQLUPDATE') . " (" . stripslashes($_REQUEST['block_name']) . ") (id: $block_id)");
@ -249,12 +247,8 @@
id = '" . $block_id . "'
");
//-- Стираем кеш сисблока
if (file_exists(BASE_DIR . '/cache/sql/block-' . $block_id . '.cache'))
unlink(BASE_DIR . '/cache/sql/block/' . $block_id . '.cache');
if ($row->block_alias != '')
unlink(BASE_DIR . '/cache/sql/block/' . $row->block_alias . '.cache');
//-- Стираем кеш блока
$this->clearCache($block_id, $row->block_alias);
//-- Сохраняем системное сообщение в журнал
reportLog($AVE_Template->get_config_vars('BLOCK_SQLDEL') . " (" . stripslashes($row->block_name) . ") (id: $block_id)");
@ -262,5 +256,21 @@
header('Location:index.php?do=blocks&cp=' . SESSION);
}
function clearCache ($id, $alias = null)
{
$cache_id = md5('block' . $id);
$cache_alias = md5('block' . $alias);
$cache_id_file = BASE_DIR . '/tmp/cache/sql/block/' . $cache_id . '.cache';
$cache_alias_file = BASE_DIR . '/tmp/cache/sql/block/' . $cache_alias . '.cache';
if (file_exists($cache_id_file))
unlink($cache_id_file);
if (file_exists($cache_alias_file))
unlink($cache_alias_file);
}
}
?>

141
class/class.core.php

@ -100,13 +100,58 @@
}
function _getMainTemplate($rubric_id, $template_id)
{
global $AVE_DB;
$return = null;
if (is_numeric($template_id))
{
$cache = 'template_' . $template_id;
$cache_file = BASE_DIR . '/tmp/cache/templates/' . $cache . '.inc';
// Если включен DEV MODE, то отключаем кеширование
if (defined('DEV_MODE') AND DEV_MODE)
$cache_file = null;
if (! file_exists(dirname($cache_file)))
mkdir(dirname($cache_file), 0766, true);
if (file_exists($cache_file))
{
$return = file_get_contents($cache_file);
}
else
{
$return = $AVE_DB->Query("
SELECT
template_text
FROM
" . PREFIX . "_templates
WHERE
Id = '" . $template_id . "'
LIMIT 1
")->GetCell();
$return = stripslashes($return);
if ($cache_file)
file_put_contents($cache_file, $return);
}
}
return $return;
}
/**
* Получение основных настроек сисблока
*
* @param string $param параметр настройки, если не указан - все параметры
* @return mixed
*/
function _requestGet($id, $param = '')
{
global $AVE_DB;
@ -141,7 +186,7 @@
* @param string $fetched шаблон модуля
* @return string
*/
function _coreDocumentTemplateGet($rubric_id = '', $template = '', $fetched = '')
function _coreDocumentTemplateGet($rubric_id = null, $template = null, $fetched = null, $template_id = null)
{
global $AVE_DB;
@ -200,18 +245,7 @@
}
// Выполняем запрос к БД на получение основного шаблона, а также шаблона рубрики
$tpl = $AVE_DB->Query("
SELECT
template_text
FROM
" . PREFIX . "_templates AS tpl
LEFT JOIN
" . PREFIX . "_rubrics AS rub
ON tpl.Id = rubric_template_id
WHERE
rub.Id = '" . $rubric_id . "'
LIMIT 1
")->GetCell();
$tpl = $this->_getMainTemplate($rubric_id, $template_id);
// Если запрос выполнился с нулевым результатом, возвращаем пустую строку
$out = $tpl
@ -742,7 +776,7 @@
$cache_file = $this->_get_cache_hash();
$cache_dir = BASE_DIR . '/cache/sql/' . (trim($cache_id) > ''
$cache_dir = BASE_DIR . '/tmp/cache/sql/' . (trim($cache_id) > ''
? trim($cache_id) . '/'
: substr($cache_file, 0, 2) . '/' . substr($cache_file, 2, 2) . '/' . substr($cache_file, 4, 2) . '/');
@ -800,41 +834,53 @@
// Циклически обрабатываем каждый модуль
foreach ($this->install_modules as $row)
{
if ($row['ModuleStatus'] != 1)
continue;
// Если в запросе пришел вызов модуля или у модуля есть функция вызываемая тегом,
// который присутствует в шаблоне
if ((isset($_REQUEST['module']) && $_REQUEST['module'] == $row->ModuleSysName) ||
(1 == $row->ModuleIsFunction && !empty($row->ModuleAveTag) && 1 == preg_match($row->ModuleAveTag, $template)))
if (
(isset($_REQUEST['module']) && $_REQUEST['module'] == $row['ModuleSysName'])
||
(
1 == $row['ModuleIsFunction']
&&
(isset($row['ModuleAveTag']) && !empty($row['ModuleAveTag']))
&&
1 == @preg_match($row['ModuleAveTag'], $template)
)
)
{
// Проверяем, существует ли для данного модуля функция. Если да,
// получаем php код функции.
if (function_exists($row->ModuleStatus))
if (function_exists($row['ModuleFunction']))
{
$pattern[] = $row->ModuleAveTag;
$replace[] = $row->ModulePHPTag;
$pattern[] = $row['ModuleAveTag'];
$replace[] = $row['ModulePHPTag'];
}
else // В противном случае
{
// Проверяем, существует ли для данного модуля файл module.php в его персональной директории
$mod_file = BASE_DIR . '/modules/' . $row->ModuleSysName . '/module.php';
$mod_file = BASE_DIR . '/modules/' . $row['ModuleSysName'] . '/module.php';
if (is_file($mod_file) && include_once($mod_file))
{
// Если файл модуля найден, тогда
if ($row->ModuleAveTag)
if ($row['ModuleAveTag'])
{
$pattern[] = $row->ModuleAveTag; // Получаем его системный тег
$pattern[] = $row['ModuleAveTag']; // Получаем его системный тег
// Проверяем, существует ли для данного модуля функция. Если да,
// получаем php код функции, в противном случае формируем сообщение с ошибкой
$replace[] = function_exists($row->ModuleFunction)
? $row->ModulePHPTag
: ($this->_module_error . ' &quot;' . $row->ModuleName . '&quot;');
$replace[] = function_exists($row['ModuleFunction'])
? $row['ModulePHPTag']
: ($this->_module_error . ' &quot;' . $row['ModuleName'] . '&quot;');
}
}
// Если файла module.php не существует, формируем сообщение с ошибкой
elseif ($row->ModuleAveTag)
{ $pattern[] = $row->ModuleAveTag;
$replace[] = $this->_module_error . ' &quot;' . $row->ModuleName . '&quot;';
elseif ($row['ModuleAveTag'])
{ $pattern[] = $row['ModuleAveTag'];
$replace[] = $this->_module_error . ' &quot;' . $row['ModuleName'] . '&quot;';
}
}
}
@ -998,11 +1044,11 @@
// Выполняем Код рубрики До загрузки документа
ob_start();
eval('?>' . $this->curentdoc->rubric_start_code . '<?');
eval(' ?>' . $this->curentdoc->rubric_start_code . '<?php ');
ob_end_clean();
// Получаем шаблон
$out = $this->_coreDocumentTemplateGet(RUB_ID);
$out = $this->_coreDocumentTemplateGet(RUB_ID, null, null, $this->curentdoc->rubric_template_id);
if (! ((isset ($_SESSION[RUB_ID . '_docread']) && $_SESSION[RUB_ID . '_docread'] == 1)
|| (isset ($_SESSION[RUB_ID . '_alles']) && $_SESSION[RUB_ID . '_alles'] == 1)) )
@ -1084,7 +1130,7 @@
$cache_file = $this->_get_cache_hash();
$cache_dir = BASE_DIR . '/cache/sql/' . (trim($cache_id) > ''
$cache_dir = BASE_DIR . '/tmp/cache/sql/' . (trim($cache_id) > ''
? trim($cache_id) . '/'
: substr($cache_file, 0, 2) . '/' . substr($cache_file, 2, 2) . '/' . substr($cache_file, 4, 2) . '/');
@ -1245,7 +1291,7 @@
// проверяем установлен и активен ли модуль
if (isset($_REQUEST['module'])
&& ! (isset($this->install_modules[$_REQUEST['module']])
&& '1' == $this->install_modules[$_REQUEST['module']]->ModuleStatus) )
&& '1' == $this->install_modules[$_REQUEST['module']]['ModuleStatus']) )
{
// Выводим сообщение о том что такого модуля нет
display_notice($this->_module_error);
@ -1596,26 +1642,27 @@
// Выполняем запрос к БД на получение всей необходимой
// информации о документе
$document_id = (! empty($_REQUEST['id'])
? intval($_REQUEST['id'])
: 1);
// Забираем нужные данные
$sql = $AVE_DB->Query("
$sql = "
SELECT
doc.*,
rubric_permission,
rubric_template,
rubric_meta_gen,
rubric_template_id,
rub.rubric_header_template,
rub.rubric_footer_template,
rub.rubric_start_code,
template_text,
other.template
FROM
" . PREFIX . "_documents AS doc
JOIN
" . PREFIX . "_rubrics AS rub
ON rub.Id = doc.rubric_id
JOIN
" . PREFIX . "_templates AS tpl
ON tpl.Id = rubric_template_id
JOIN
" . PREFIX . "_rubric_permissions AS prm
ON doc.rubric_id = prm.rubric_id
@ -1625,15 +1672,19 @@
WHERE
user_group_id = '" . UGROUP . "'
AND
" . (! empty ($get_url)
" . (! empty ($get_url) && ! isset($_REQUEST['module'])
? "document_alias = '" . str_ireplace("'", "\'", $get_url) . "'"
: (! empty($_REQUEST['id'])
? "doc.Id =" . intval($_REQUEST['id'])
: "doc.Id = 1")) . "
LIMIT 1
");
";
if ($this->curentdoc = $sql->FetchRow())
$hash_url = md5($get_url);
$query = $AVE_DB->Query($sql, CACHE_DOC_SQL, 'url_' . $hash_url);
if ($this->curentdoc = $query->FetchRow())
{
if ($this->curentdoc->rubric_tmpl_id != 0)
{
@ -1692,16 +1743,22 @@
$redirect_alias = $AVE_DB->Query($sql)->GetCell();
$redirect_alias = ABS_PATH . $redirect_alias . URL_SUFF;
$redirect_alias = str_replace('//', '/', $redirect_alias);
if (! empty($redirect_alias))
{
header('HTTP/1.1 301 Moved Permanently');
header('Location:' . ABS_PATH . $redirect_alias . URL_SUFF);
header('Location:' . $redirect_alias);
exit();
}
if (! (! empty($_REQUEST['sysblock']) || ! empty($_REQUEST['module']) || ! empty($_REQUEST['request'])))
$_GET['id'] = $_REQUEST['id'] = PAGE_NOT_FOUND_ID;
}
unset ($sql, $query);
}
}
?>

116
class/class.database.php

@ -616,6 +616,12 @@
if (! is_array($this->_query_list))
return false;
$div = '';
include_once BASE_DIR . '/lib/debug/sql.php';
$SqlFormatter = new SqlFormatter();
foreach ($this->_query_list AS $k => $v)
{
$_caller = '';
@ -633,15 +639,15 @@
$_ttl = $v['ttl'] > 0 ? $v['ttl'] : 'None';
if ($v['cache'])
if (isset($v['cache']))
$_ttl .= PHP_EOL . $v['cache'];
$_query = $this->prepareQuery($v['query']);
$_query = SqlFormatter::format($v['query']);
$div = '
<div style="border: 1px solid #aaa; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;">' .
$div .= '
<div style="border: 1px solid #f0f0f0; margin: 5px 0; font-size: 11px; font-family: Consolas, Verdana, Arial; border-radius: 3px;">' .
'<div style="background:#aaa; color: #fff; margin: 0; padding: 5px;">' .
'<strong>' . $k . '</strong>' .
'<strong>' . ($k+1) . '</strong>' .
'</div>' .
'<pre style="background:#f5f5f5; color: #000; margin: 0; padding: 5px; border: 0; font-size: 11px; font-family: Consolas, Verdana, Arial;">' .
'<strong>Trace:</strong>' . PHP_EOL .
@ -656,9 +662,9 @@
'</pre>' .
'</div>
';
echo($div);
}
return $div;
}
/**
@ -702,7 +708,7 @@
foreach ((array)$stack as $call)
{
if (@$call['class'] == __CLASS__)
if (isset($call['class']) && $call['class'] == __CLASS__)
continue;
$function = $call['function'];
@ -711,6 +717,7 @@
{
$function = $call['class'] . "->$function";
}
$caller[] =
(array (
'call_file' => (isset($call['file']) ? $call['file'] : 'Unknown'),
@ -760,6 +767,33 @@
}
public function cacheFile($cache_id)
{
// Если это документ, то меняем расположение
if (substr($cache_id, 0, 3) == 'doc')
{
$cache_id = (int)str_replace('doc_', '', $cache_id);
$cache_id = 'doc/' . (floor($cache_id / 1000)) . '/' . $cache_id;
}
// Если это
if (substr($cache_id, 0, 3) == 'url')
{
$cache_id = str_replace('url_', '', $cache_id);
$cache_id = 'url/' . substr($cache_id, 0, 3);
}
// Если это
if (substr($cache_id, 0, 3) == 'nav')
{
$cache_id = str_replace('nav_', '', $cache_id);
$cache_id = 'nav/' . substr($cache_id, 0, 3);
}
return $cache_id;
}
/**
* Метод, предназначенный для выполнения запроса к MySQL и возвращение результата в виде асоциативного массива с поддержкой кеша
*
@ -771,12 +805,7 @@
*/
public function Query($query, $TTL = null, $cache_id = '', $log = true)
{
// Если это документ, то меняем расположение
if (substr($cache_id, 0, 3) == 'doc')
{
$cache_id = (int)str_replace('doc_', '', $cache_id);
$cache_id = 'doc/' . (floor($cache_id / 1000)) . '/' . $cache_id;
}
$cache_id = $this->cacheFile($cache_id);
// Принудительная фильтрация запроса
if (defined(SQL_QUERY_SANITIZE) && SQL_QUERY_SANITIZE)
@ -793,17 +822,16 @@
if (defined('DEV_MODE') AND DEV_MODE)
$TTL = null;
if ($TTL && ($TTL != 'nocache' AND $TTL != null))
{
$cache_file = md5($query);
$cache_dir = BASE_DIR . '/cache/sql/' . (trim($cache_id) > ''
$cache_dir = BASE_DIR . '/tmp/cache/sql/' . (trim($cache_id) > ''
? trim($cache_id) . '/'
: substr($cache_file, 0, 2) . '/' . substr($cache_file, 2, 2) . '/' . substr($cache_file, 4, 2) . '/');
if (! file_exists($cache_dir))
mkdir($cache_dir, 0777, true);
mkdir($cache_dir, 0766, true);
// Если стоит в настройках, запоминать все запросы
if (defined('SQL_PROFILING') && SQL_PROFILING)
@ -1005,7 +1033,7 @@
// Кол-во
$cache_file = md5($query) . '.count';
$cache_dir = BASE_DIR . '/cache/sql/' . (trim($cache_id) > ''
$cache_dir = BASE_DIR . '/tmp/cache/sql/' . (trim($cache_id) > ''
? trim($cache_id) . '/'
: substr($cache_file, 0, 2) . '/'. substr($cache_file, 2, 2) . '/' . substr($cache_file, 4, 2) . '/');
@ -1020,7 +1048,7 @@
}
else
{
$res = (int)$this->Query("SELECT FOUND_ROWS();")->GetCell();
$res = (int)$this->Query('SELECT FOUND_ROWS();')->GetCell();
file_put_contents($cache_dir . $cache_file, $res);
}
@ -1033,7 +1061,7 @@
}
}
return (int)$this->Query("SELECT FOUND_ROWS();")->GetCell();
return (int)$this->Query('SELECT FOUND_ROWS();')->GetCell();
}
@ -1294,7 +1322,45 @@
? 'doc/' . intval(floor((int)substr($cache_id, 4)) / 1000) . '/' . (int)substr($cache_id, 4)
: $cache_id);
$cache_dir = BASE_DIR . '/cache/sql/' . (trim($cache_id) > ''
$cache_dir = BASE_DIR . '/tmp/cache/sql/' . (trim($cache_id) > ''
? trim($cache_id) . '/'
: '');
return rrmdir($cache_dir);
}
/**
* Метод, предназначенный для очищения кеша документов
*
* @param $cache_id
* @return bool
*/
public function clearCacheUrl($cache_id)
{
$cache_id = str_replace('url_', '', $cache_id);
$cache_id = 'url/' . substr($cache_id, 0, 3);
$cache_dir = BASE_DIR . '/tmp/cache/sql/' . (trim($cache_id) > ''
? trim($cache_id) . '/'
: '');
return rrmdir($cache_dir);
}
/**
* Метод, предназначенный для очищения кеша документов
*
* @param $cache_id
* @return bool
*/
public function clearCacheNav($cache_id)
{
$cache_id = str_replace('nav_', '', $cache_id);
$cache_id = 'nav/' . substr($cache_id, 0, 3);
$cache_dir = BASE_DIR . '/tmp/cache/sql/' . (trim($cache_id) > ''
? trim($cache_id) . '/'
: '');
@ -1314,7 +1380,7 @@
? 'request/' . (int)substr($cache_id, 4)
: $cache_id);
$cache_dir = BASE_DIR . '/cache/sql/' . (trim($cache_id) > ''
$cache_dir = BASE_DIR . '/tmp/cache/sql/' . (trim($cache_id) > ''
? trim($cache_id) . '/'
: '');
@ -1334,7 +1400,7 @@
? 'compiled/' . intval(floor((int)substr($cache_id, 4)) / 1000) . '/' . (int)substr($cache_id, 4)
: $cache_id);
$cache_dir = BASE_DIR . '/cache/sql/' . (trim($cache_id) > ''
$cache_dir = BASE_DIR . '/tmp/cache/sql/' . (trim($cache_id) > ''
? trim($cache_id) . '/'
: '');
@ -1352,11 +1418,11 @@
{
$request = request_get_settings($cache_id);
$cache_from_id = BASE_DIR . '/cache/sql/request/settings/' . (trim($request->Id) > ''
$cache_from_id = BASE_DIR . '/tmp/cache/sql/request/settings/' . (trim($request->Id) > ''
? trim($request->Id) . '/'
: '');
$cache_from_alias = BASE_DIR . '/cache/sql/request/settings/' . (trim($request->request_alias) > ''
$cache_from_alias = BASE_DIR . '/tmp/cache/sql/request/settings/' . (trim($request->request_alias) > ''
? trim($request->request_alias) . '/'
: '');

18
class/class.dbdump.php

@ -243,20 +243,20 @@
if (isset($_REQUEST['server']) && $_REQUEST['server'] == 1)
{
if(! is_dir(BASE_DIR . '/backup/'))
if (! is_dir(BASE_DIR . '/tmp/backup/'))
{
@mkdir(BASE_DIR . '/backup/', 0777);
write_htaccess_deny(BASE_DIR . '/backup/');
@mkdir(BASE_DIR . '/tmp/backup/', 0777, true);
write_htaccess_deny(BASE_DIR . '/tmp/backup/');
}
@file_put_contents(BASE_DIR . '/backup/'. $file_name . '.sql'. (defined('DB_EXPORT_GZ') && DB_EXPORT_GZ ? '.gz' : ''), $dump);
@file_put_contents(BASE_DIR . '/tmp/backup/'. $file_name . '.sql'. (defined('DB_EXPORT_GZ') && DB_EXPORT_GZ ? '.gz' : ''), $dump);
@chmod(BASE_DIR . '/backup/'. $file_name . '.sql', 0777);
@chmod(BASE_DIR . '/tmp/backup/'. $file_name . '.sql', 0777);
if (! $exit)
header('Location:index.php?do=dbsettings&cp=' . SESSION);
else
return BASE_DIR . '/backup/'. $file_name . '.sql'. (defined('DB_EXPORT_GZ') && DB_EXPORT_GZ ? '.gz' : '');
return BASE_DIR . '/tmp/backup/'. $file_name . '.sql'. (defined('DB_EXPORT_GZ') && DB_EXPORT_GZ ? '.gz' : '');
}
else
{
@ -288,7 +288,7 @@
{
global $AVE_Template;
$file = BASE_DIR . '/backup/'. $file;
$file = BASE_DIR . '/tmp/backup/'. $file;
// Если дамп не удалось создать, тогда завершаем работу
if (! is_file($file))
@ -454,7 +454,7 @@
$insert = false;
$file = BASE_DIR . '/backup/'. $file;
$file = BASE_DIR . '/tmp/backup/'. $file;
// Если дамп не удалось создать, тогда завершаем работу
if (! is_file($file)) $insert = false;
@ -611,7 +611,7 @@
*/
function databaseFilesGet()
{
$dir = BASE_DIR . '/backup/';
$dir = BASE_DIR . '/tmp/backup/';
if($handle = opendir($dir))
{

167
class/class.debug.php

@ -539,5 +539,172 @@
return '';
}
/**
* Вывод статистики
*/
public static function getStatistic ($type = null)
{
global $AVE_DB;
$stat = null;
switch ($type)
{
case 'time':
$stat = number_format(microtime_diff(START_MICROTIME, microtime()), 3, ',', ' ');
break;
case 'memory':
$stat = Debug::formatSize(memory_get_usage() - START_MEMORY);
break;
case 'peak':
$stat = Debug::formatSize(memory_get_peak_usage());
break;
case 'sqlcount':
$stat = $AVE_DB->DBProfilesGet('count');
break;
case 'sqltrace':
$stat = count($AVE_DB->_query_list);
break;
case 'sqltime':
$stat = $AVE_DB->DBProfilesGet('time');
break;
case 'get':
$stat = self::_stat_get('get');
break;
case 'post':
$stat = self::_stat_get('post');
break;
case 'request':
$stat = self::_stat_get('request');
break;
case 'session':
$stat = self::_stat_get('session');
break;
case 'server':
$stat = self::_stat_get('server');
break;
case 'globals':
$stat = self::_stat_get('globals');
break;
}
return $stat;
}
public static function _stat_get($type = 'get')
{
$var = '123123';
ob_start();
if ($type == 'get')
var_dump($_GET);
else if ($type == 'post')
var_dump($_POST);
else if ($type == 'request')
var_dump($_REQUEST);
else if ($type == 'session')
var_dump($_SESSION);
else if ($type == 'server')
var_dump($_SERVER);
else if ($type == 'globals')
var_dump($GLOBALS);
$stat = ob_get_contents();
$stat = preg_replace('/=>(\s+|\s$)/', ' => ', $stat);
$stat = htmlspecialchars($stat);
$stat = preg_replace('/(=&gt;)/', '<span style="color: #FF8C00;">$1</span>', $stat);
$stat = '<pre style="background:#f5f5f5; color: #000; margin: 0; padding: 5px; border: 0; font-size: 11px; font-family: Consolas, Verdana, Arial;">'. $stat .'</pre>';
ob_end_clean();
return $stat;
}
//
public static function displayInfo ()
{
global $AVE_DB;
$out = PHP_EOL;
$out .= '<link rel="stylesheet" href="/lib/debug/debug.css" />';
$out .= PHP_EOL;
$out .= '<script src="/lib/debug/debug.js"></script>';
$out .= PHP_EOL;
$out .= '
<div id="debug-panel">
<div class="debug-wrapper">
<div id="debug-panel-legend" class="legend">
<span>Debug console</span>
<a id="debugArrowMinimize" class="debugArrow" href="javascript:void(0)" title="Minimize" onclick="javascript:appTabsHide()">&times;</a>
<span>
<a id="tabGeneral" href="javascript:void(\'General\')" onclick="javascript:appExpandTabs(\'auto\', \'General\')">General</a>
<a id="tabParams" href="javascript:void(\'Params\')" onclick="javascript:appExpandTabs(\'auto\', \'Params\')">Params</a>
<a id="tabGlobals" href="javascript:void(\'Globals\')" onclick="javascript:appExpandTabs(\'auto\', \'Globals\')">Globals</a>
<a id="tabQueries" href="javascript:void(\'Queries\')" onclick="javascript:appExpandTabs(\'auto\', \'Queries\')">SQL Queries (' . self::getStatistic('sqlcount') . ')</a>
<a id="tabSqlTrace" href="javascript:void(\'SqlTrace\')" onclick="javascript:appExpandTabs(\'auto\', \'SqlTrace\')">SQL Trace (' . self::getStatistic('sqltrace') . ')</a>
</span>
</div>
';
$out .= PHP_EOL;
$out .= '<div id="contentGeneral" class="items" style="display: none">' . PHP_EOL;
$out .= 'Time generation: ' . self::getStatistic('time') . ' sec';
$out .= '<br>';
$out .= 'Memory usage: ' . self::getStatistic('memory');
$out .= '<br>';
$out .= 'Memory peak usage: ' . self::getStatistic('peak');
$out .= '<br>';
$out .= 'SQL Queries: ' . $AVE_DB->DBProfilesGet('count') . ' for ' . $AVE_DB->DBProfilesGet('time') . ' sec';
$out .= '</div>';
$out .= PHP_EOL;
$out .= '<div id="contentParams" class="items" style="display: none">' . PHP_EOL;
$out .= 'GET:';
$out .= self::getStatistic('get');
$out .= '<br>';
$out .= 'POST:';
$out .= self::getStatistic('post');
$out .= '<br>';
$out .= 'REQUEST:';
$out .= self::getStatistic('request');
$out .= '<br>';
$out .= 'SESSION:';
$out .= self::getStatistic('session');
$out .= '<br>';
$out .= 'SERVER:';
$out .= self::getStatistic('server');
$out .= '</div>';
$out .= PHP_EOL;
$out .= '<div id="contentGlobals" class="items" style="display: none">' . PHP_EOL;
$out .= self::getStatistic('globals');
$out .= '</div>';
$out .= PHP_EOL;
$out .= '<div id="contentQueries" class="items" style="display: none">' . PHP_EOL;
$out .= $AVE_DB->DBProfilesGet('list');
$out .= '</div>';
$out .= PHP_EOL;
$out .= '<div id="contentSqlTrace" class="items" style="display: none">' . PHP_EOL;
$out .= $AVE_DB->showAllQueries();
$out .= '</div>';
$out .= PHP_EOL;
$out .= '</div>';
echo $out;
}
}
?>

34
class/class.docs.php

@ -322,7 +322,7 @@ class AVE_Document
$sql_where_field = '';
$field_link = '';
if ($_REQUEST['field_id'] && (int)$_REQUEST['field_id'] > 0)
if (isset($_REQUEST['field_id']) && (int)$_REQUEST['field_id'] > 0)
{
$sql_join_field = "
LEFT JOIN
@ -415,6 +415,8 @@ class AVE_Document
$nav_lang = '&lang_id=' . $_REQUEST['lang_id'];
}
else
$nav_lang = '';
// Поиск с выводом всех результатов из всех рубрик
if (@$_REQUEST['rubric_id'] == 'all')
@ -699,9 +701,9 @@ class AVE_Document
$row->canDelete = 0;
$row->canEndDel = 0;
$row->canOpenClose = 0;
$row->rubric_admin_teaser_template = @eval2var('?>'.($row->rubric_admin_teaser_template>''
$row->rubric_admin_teaser_template = @eval2var(' ?>'.($row->rubric_admin_teaser_template>''
? @showrequestelement($row, $row->rubric_admin_teaser_template)
: '').'<?');
: '').'<?php ');
$row->document_title = stripslashes(htmlspecialchars_decode($row->document_title));
$row->document_breadcrum_title = stripslashes(htmlspecialchars_decode($row->document_breadcrum_title));
@ -915,7 +917,7 @@ class AVE_Document
{
$key = trim(mb_substr($v, 0, 254));
$res= $AVE_DB->Query("INSERT INTO ".PREFIX."_document_keywords
$res = $AVE_DB->Query("INSERT INTO ".PREFIX."_document_keywords
(
document_id,
keyword
@ -1511,7 +1513,7 @@ class AVE_Document
}
}
unset($sql, $query);
unset ($sql, $query);
$where = ($oper == 'UPDATE' ? 'WHERE Id = ' . $document_id : '');
$author = ($oper != 'UPDATE' ? 'document_author_id = ' . $_SESSION['user_id'] . ',' : '');
@ -1521,6 +1523,10 @@ class AVE_Document
? $data['document_breadcrum_title']
: '';
$document_tags = isset($data['document_tags'])
? $data['document_tags']
: '';
// Сохраняем все параметры документа
$sql = "
$operator
@ -1531,7 +1537,7 @@ class AVE_Document
document_title = '" . htmlspecialchars(clean_no_print_char($data['document_title']), ENT_QUOTES) . "',
document_breadcrum_title = '" . htmlspecialchars(clean_no_print_char($breadcrumb_title), ENT_QUOTES) . "',
document_alias = '" . $data['document_alias'] . "',
document_alias_history = '" . $data['document_alias_log'] . "',
document_alias_history = '" . $data['document_alias_history'] . "',
document_published = '" . $data["document_published"] . "',
document_expire = '" . $data["document_expire"] . "',
document_changed = '" . $data["document_changed"] . "',
@ -1544,7 +1550,7 @@ class AVE_Document
document_sitemap_pr = '" . $data['document_sitemap_pr'] . "',
document_status = '" . $data['document_status'] . "',
document_linked_navi_id = '" . (int)$data['document_linked_navi_id'] . "',
document_tags = '" . addslashes(htmlspecialchars(clean_no_print_char($data['document_tags']))). "',
document_tags = '" . addslashes(htmlspecialchars(clean_no_print_char($document_tags))). "',
document_lang = '" . (empty($data['document_lang']) ? DEFAULT_LANGUAGE : $data['document_lang']). "',
document_lang_group = '" . (empty($data['document_lang_group']) ? '0' : (int)$data['document_lang_group']). "',
document_property = '" . (empty($data['document_property']) ? '' : $data['document_property']). "'
@ -1757,17 +1763,27 @@ class AVE_Document
doc_id = '" . $document_id . "'
");
$field_module = isset($data['field_module'])
? $data['field_module']
: '';
// Запускаем триггер после сохранения
Hooks::trigger('DocumentAfterSave', array('rubric_id' => $rubric_id, 'document_id' => $document_id, 'data' => $data, 'field_module' => $data['field_module']));
Hooks::trigger('DocumentAfterSave', array('rubric_id' => $rubric_id, 'document_id' => $document_id, 'data' => $data, 'field_module' => $field_module));
// Выполняем код рубрики, после сохранения
if ($rubric_code)
eval ('?>' . $_rubric->rubric_code_end . '<?');
eval (' ?>' . $_rubric->rubric_code_end . '<?php ');
if ($document_id == 1)
$hash_url = md5('');
else
$hash_url = md5($data['document_alias']);
// Чистим кеш
$AVE_DB->clearcache('rub_' . $rubric_id);
$AVE_DB->clearcache('doc_' . $document_id);
$AVE_DB->clearcompile('doc_' . $document_id);
$AVE_DB->clearCacheUrl('url_' . $hash_url);
$AVE_DB->clearcacherequest('doc_' . $document_id);
unset ($_rubric, $fields);

259
class/class.hooks.php

@ -1,174 +1,175 @@
<?php
// Проверка
if (! defined('BASE_DIR'))
exit('Access denied');
// Проверка
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/hooks.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 Hooks
{
public static $instance;
/**
* 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/hooks.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 Hooks
{
public static $instance;
public static $hooks;
public static $hooks;
public static $current_hook;
public static $current_hook;
public static $run_hooks;
public static $run_hooks;
public static function init()
{
if (!self::$instance) {
self::$instance = new Hooks();
}
return self::$instance;
}
/**
* Add Hook
*/
public static function register($name, $function, $priority = 10)
{
// If we have already registered this action return true
if (isset(self::$hooks[$name][$priority][$function]))
public static function init()
{
return true;
if (!self::$instance) {
self::$instance = new Hooks();
}
return self::$instance;
}
/**
* Allows us to iterate through multiple action hooks.
* Add Hook
*/
if (is_array($name))
public static function register($name, $function, $priority = 10)
{
foreach ($name AS $item)
// If we have already registered this action return true
if (isset(self::$hooks[$name][$priority][$function]))
{
return true;
}
/**
* Allows us to iterate through multiple action hooks.
*/
if (is_array($name))
{
foreach ($name AS $item)
{
// Store the action hook in the $hooks array
self::$hooks[$item][$priority][$function] = array(
"function" => $function
);
}
}
else
{
// Store the action hook in the $hooks array
self::$hooks[$item][$priority][$function] = array(
self::$hooks[$name][$priority][$function] = array(
"function" => $function
);
}
}
else
{
// Store the action hook in the $hooks array
self::$hooks[$name][$priority][$function] = array(
"function" => $function
);
}
return true;
}
return true;
}
/**
* Do Hook
*/