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
09a63d195a
commit
97290b236d
5
admin/lang/ru/sysblocks.txt
Normal file → Executable file
5
admin/lang/ru/sysblocks.txt
Normal file → Executable file
@ -73,4 +73,7 @@ SYSBLOCK_ALIAS = "Алиас"
|
||||
SYSBLOCK_I = "Опционально. Алиас позволяет использовать легко запоминающийся тег [tag:sysblock:alias] вместо [tag:sysblock:id]. Алиас не должен являться числом, может содержать только цифры, латинские буквы, дефис, подчёркивание, иметь длину не более 20 символов и быть уникальным в пределах модуля"
|
||||
SYSBLOCK_ACCEPT = "Этот алиас можно использовать"
|
||||
SYSBLOCK_ER_SYN = "Неверный алиас!<br> Алиас не должен являться числом, может содержать только цифры, латинские буквы, дефис, подчёркивание и иметь длину не более 20 символов"
|
||||
SYSBLOCK_ER_EXISTS = "Неверный алиас!<br> Данный алиас уже привязан к другоому системному блоку"
|
||||
SYSBLOCK_ER_EXISTS = "Неверный алиас!<br> Данный алиас уже привязан к другоому системному блоку"
|
||||
|
||||
// v 3.25
|
||||
SYSBLOCK_EVAL = "Выполнять PHP перед выозвращением результата"
|
8
admin/templates/sysblocks/form.tpl
Normal file → Executable file
8
admin/templates/sysblocks/form.tpl
Normal file → Executable file
@ -42,7 +42,7 @@
|
||||
<td>
|
||||
<strong>{#SYSBLOCK_NAME#}</strong>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<td colspan="4">
|
||||
<div class="pr12">
|
||||
<input name="sysblock_name" class="mousetrap" type="text" value="{if $smarty.request.id != ''}{$sysblock_name|escape}{else}{$smarty.request.sysblock_name}{/if}" />
|
||||
</div>
|
||||
@ -50,7 +50,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{#SYSBLOCK_DESCRIPTION#}</td>
|
||||
<td colspan="3">
|
||||
<td colspan="4">
|
||||
<input name="sysblock_description" type="text" id="sysblock_description" value="{if $smarty.request.id != ''}{$sysblock_description|escape}{else}{$smarty.request.sysblock_description}{/if}" placeholder="{#SYSBLOCK_DESCRIPTION#}">
|
||||
</td>
|
||||
</tr>
|
||||
@ -60,7 +60,7 @@
|
||||
<strong><a class="toprightDir" title="{#SYSBLOCK_I#}">[?]</a></strong> {#SYSBLOCK_ALIAS#}:
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<td colspan="4">
|
||||
<div class="pr12">
|
||||
<input type="text" name="sysblock_alias" id="sysblock_alias" value="{if $smarty.request.id != ''}{$sysblock_alias}{else}{$smarty.request.sysblock_alias}{/if}" class="mousetrap" data-accept="{#SYSBLOCK_ACCEPT#}" data-error-syn="{#SYSBLOCK_ER_SYN#}" data-error-exists="{#SYSBLOCK_ER_EXISTS#}" placeholder="{#SYSBLOCK_ALIAS#}" maxlength="20" style="width: 200px;" autocomplete="off" />
|
||||
<input type="text" id="sysblock_alias_tag" value="[tag:sysblock:{if $smarty.request.id != ''}{if $sysblock_alias != ''}{$sysblock_alias}{else}{$smarty.request.id}{/if}{else}{$smarty.request.sysblock_alias}{/if}]" readonly size="40" class="mousetrap" style="width: 200px;" />
|
||||
@ -81,7 +81,7 @@
|
||||
<input type="checkbox" value="1" name="sysblock_visual" class="float" {if $sysblock_visual}checked="checked"{/if} /><label>{#SYSBLOCK_VISUAL#}</label>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<input type="checkbox" value="1" name="sysblock_eval" class="float" {if $sysblock_eval}checked="checked"{/if} /><label>{#SYSBLOCK_EVAL#}</label>
|
||||
</td>
|
||||
</tr>
|
||||
{if $sysblock_external}
|
||||
|
0
admin/templates/sysblocks/form_visual.tpl
Normal file → Executable file
0
admin/templates/sysblocks/form_visual.tpl
Normal file → Executable file
2
admin/templates/sysblocks/list.tpl
Normal file → Executable file
2
admin/templates/sysblocks/list.tpl
Normal file → Executable file
@ -120,7 +120,7 @@
|
||||
<td align="center">{$sysblock->sysblock_author_id|escape}</td>
|
||||
|
||||
<td align="center">
|
||||
<span class="date_text dgrey">{$sysblock->sysblock_created|date_format:$TIME_FORMAT|pretty_date}</span>
|
||||
<span class="date_text dgrey">{$sysblock->sysblock_created|date_format:$TIME_FORMAT|translate_date}</span>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
0
admin/templates/sysblocks/multi.tpl
Normal file → Executable file
0
admin/templates/sysblocks/multi.tpl
Normal file → Executable file
0
admin/templates/sysblocks/nav.tpl
Normal file → Executable file
0
admin/templates/sysblocks/nav.tpl
Normal file → Executable file
0
class/class.blocks.php
Normal file → Executable file
0
class/class.blocks.php
Normal file → Executable file
@ -66,47 +66,6 @@
|
||||
public $_module_not_found = 'Запрашиваемый модуль не найден.';
|
||||
|
||||
|
||||
/**
|
||||
* Получение основных настроек сисблока
|
||||
*
|
||||
* @param string $param параметр настройки, если не указан - все параметры
|
||||
* @return mixed
|
||||
*/
|
||||
function _sysBlock($id, $param = '')
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
static $sys_block = null;
|
||||
|
||||
if ($sys_block === null)
|
||||
{
|
||||
$sys_block = $AVE_DB->Query("
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
" . PREFIX . "_sysblocks
|
||||
WHERE
|
||||
" . (is_numeric($id) ? 'id' : 'sysblock_alias') . " = '" . $id . "'
|
||||
")->FetchAssocArray();
|
||||
}
|
||||
|
||||
if ($param == '')
|
||||
return $sys_block;
|
||||
|
||||
return isset($sys_block[$param])
|
||||
? $sys_block[$param]
|
||||
: null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Получаем шаблон документа
|
||||
*
|
||||
* @param $rubric_id
|
||||
* @param $template_id
|
||||
*
|
||||
* @return bool|null|string
|
||||
*/
|
||||
function _getMainTemplate($rubric_id, $template_id)
|
||||
{
|
||||
global $AVE_DB;
|
||||
@ -186,7 +145,6 @@
|
||||
: null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для получения шаблонов
|
||||
*
|
||||
@ -294,7 +252,6 @@
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для получения шаблона модуля
|
||||
*
|
||||
@ -351,7 +308,6 @@
|
||||
return stripslashes($out);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для получения прав доступа к документам рубрики
|
||||
*
|
||||
@ -412,7 +368,7 @@
|
||||
/**
|
||||
* Метод, предназначенный для обработки события 404 Not Found, т.е. когда страница не найдена.
|
||||
*
|
||||
* @return void
|
||||
* @return unknown
|
||||
*/
|
||||
function _coreErrorPage404()
|
||||
{
|
||||
@ -501,7 +457,6 @@
|
||||
return (isset($this->curentdoc->Id) && $this->curentdoc->Id == $document_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для получения содержимого страницы с 404 ошибкой
|
||||
*
|
||||
@ -546,7 +501,6 @@
|
||||
return (isset($this->curentdoc->Id) && $this->curentdoc->Id == $page_not_found_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для получения МЕТА-тегов для различных модулей.
|
||||
* ToDo
|
||||
@ -577,7 +531,6 @@
|
||||
return (isset($this->curentdoc->Id) && $this->curentdoc->Id == 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для определения статуса документа (доступен ли он к публикации).
|
||||
*
|
||||
@ -627,7 +580,6 @@
|
||||
return (! empty($this->curentdoc));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод парсинга тега [tag:(css|js):files]
|
||||
* для вывода css/js-файлов в шаблоне через combine.php
|
||||
@ -681,13 +633,6 @@
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $main_content
|
||||
* @param $id
|
||||
* @param $rubTmpl
|
||||
*
|
||||
* @return mixed|null|string|string[]
|
||||
*/
|
||||
function _main_content ($main_content, $id, $rubTmpl)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
@ -695,13 +640,13 @@
|
||||
// Проверяем теги полей в шаблоне рубрики на условие != ''
|
||||
if (defined('USE_GET_FIELDS') && USE_GET_FIELDS)
|
||||
{
|
||||
$main_content = preg_replace("/\[tag:if_notempty:fld:([a-zA-Z0-9-_]+)\]/u", '<'.'?php if((htmlspecialchars(get_field(\'$1\'), ENT_QUOTES)) != \'\') { '.' ?'.'>', $rubTmpl);
|
||||
$main_content = preg_replace("/\[tag:if_empty:fld:([a-zA-Z0-9-_]+)\]/u", '<'.'?php if((htmlspecialchars(get_field(\'$1\'), ENT_QUOTES)) == \'\') { '.' ?'.'>', $main_content);
|
||||
$main_content = preg_replace("/\[tag:if_notempty:fld:([a-zA-Z0-9-_]+)\]/u", '<'.'?php if((htmlspecialchars(get_field(\'$1\'), ENT_QUOTES)) != \'\') { '.'?'.'>', $rubTmpl);
|
||||
$main_content = preg_replace("/\[tag:if_empty:fld:([a-zA-Z0-9-_]+)\]/u", '<'.'?php if((htmlspecialchars(get_field(\'$1\'), ENT_QUOTES)) == \'\') { '.'?'.'>', $main_content);
|
||||
}
|
||||
else
|
||||
{
|
||||
$main_content = preg_replace("/\[tag:if_notempty:fld:([a-zA-Z0-9-_]+)\]/u", '<'.'?php if((htmlspecialchars(document_get_field(\'$1\'), ENT_QUOTES)) != \'\') { '.' ?'.'>', $rubTmpl);
|
||||
$main_content = preg_replace("/\[tag:if_empty:fld:([a-zA-Z0-9-_]+)\]/u", '<'.'?php if((htmlspecialchars(document_get_field(\'$1\'), ENT_QUOTES)) == \'\') { '.' ?'.'>', $main_content);
|
||||
$main_content = preg_replace("/\[tag:if_notempty:fld:([a-zA-Z0-9-_]+)\]/u", '<'.'?php if((htmlspecialchars(document_get_field(\'$1\'), ENT_QUOTES)) != \'\') { '.'?'.'>', $rubTmpl);
|
||||
$main_content = preg_replace("/\[tag:if_empty:fld:([a-zA-Z0-9-_]+)\]/u", '<'.'?php if((htmlspecialchars(document_get_field(\'$1\'), ENT_QUOTES)) == \'\') { '.'?'.'>', $main_content);
|
||||
}
|
||||
|
||||
$main_content = str_replace('[tag:if:else]', '<?php }else{ ?>', $main_content);
|
||||
@ -710,10 +655,10 @@
|
||||
// Парсим элементы полей
|
||||
$main_content = preg_replace_callback(
|
||||
'/\[tag:fld:([a-zA-Z0-9-_]+)\]\[([0-9]+)]\[([0-9]+)]/',
|
||||
function ($m)
|
||||
{
|
||||
return get_field_element($m[1], $m[2], $m[3], $this->curentdoc->Id);
|
||||
},
|
||||
create_function(
|
||||
'$m',
|
||||
'return get_field_element($m[1], $m[2], $m[3], ' . $this->curentdoc->Id . ');'
|
||||
),
|
||||
$main_content
|
||||
);
|
||||
|
||||
@ -723,10 +668,10 @@
|
||||
// Повторно парсим элементы полей
|
||||
$main_content = preg_replace_callback(
|
||||
'/\[tag:fld:([a-zA-Z0-9-_]+)\]\[([0-9]+)]\[([0-9]+)]/',
|
||||
function ($m)
|
||||
{
|
||||
return get_field_element($m[1], $m[2], $m[3], $this->curentdoc->Id);
|
||||
},
|
||||
create_function(
|
||||
'$m',
|
||||
'return get_field_element($m[1], $m[2], $m[3], ' . $this->curentdoc->Id . ');'
|
||||
),
|
||||
$main_content
|
||||
);
|
||||
|
||||
@ -765,10 +710,8 @@
|
||||
// парсим теги в шаблоне рубрики
|
||||
$main_content = preg_replace_callback(
|
||||
'/\[tag:date:([a-zA-Z0-9-. \/]+)\]/',
|
||||
function ($m)
|
||||
{
|
||||
return translate_date(date($m[1], $this->curentdoc->document_published));
|
||||
},
|
||||
create_function('$m','return translate_date(date($m[1], '.$this->curentdoc->document_published.'));
|
||||
'),
|
||||
$main_content
|
||||
);
|
||||
|
||||
@ -809,11 +752,6 @@
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Получаем ID для кеша документа
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
function _get_cache_id()
|
||||
{
|
||||
$cache = array();
|
||||
@ -839,13 +777,6 @@
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Создаем компилированный документ
|
||||
*
|
||||
* @param $main_content
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function setCompileDocument ($main_content)
|
||||
{
|
||||
$cache = $this->_get_cache_id();
|
||||
@ -876,11 +807,6 @@
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Получаем скомпилированный документ
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
function getCompileDocument ()
|
||||
{
|
||||
$cache = $this->_get_cache_id();
|
||||
@ -1059,7 +985,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназанченный для сборки всей страницы в единое целое.
|
||||
*
|
||||
@ -1088,14 +1013,14 @@
|
||||
}
|
||||
|
||||
// проверяем разрешение на внешнее обращение
|
||||
if (! $this->_sysBlock($_REQUEST['sysblock'], 'sysblock_external'))
|
||||
if (! _getSysBlock($_REQUEST['sysblock'], 'sysblock_external'))
|
||||
{
|
||||
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true);
|
||||
exit;
|
||||
}
|
||||
|
||||
// проверяем разрешение на обращение только по Ajax
|
||||
if ($this->_sysBlock($_REQUEST['sysblock'], 'sysblock_ajax'))
|
||||
if (_getSysBlock($_REQUEST['sysblock'], 'sysblock_ajax'))
|
||||
{
|
||||
if (isAjax())
|
||||
$out = parse_sysblock($_REQUEST['sysblock']);
|
||||
@ -1158,9 +1083,7 @@
|
||||
|
||||
// Выполняем Код рубрики До загрузки документа
|
||||
ob_start();
|
||||
|
||||
eval(' ?>' . $this->curentdoc->rubric_start_code . '<?php ');
|
||||
|
||||
ob_end_clean();
|
||||
|
||||
// Получаем шаблон
|
||||
@ -1341,6 +1264,7 @@
|
||||
$out
|
||||
);
|
||||
|
||||
|
||||
// Удаляем ошибочные теги полей документа в шаблоне рубрики
|
||||
$out = preg_replace('/\[tag:rfld:\w*\]/', '', $out);
|
||||
|
||||
@ -1362,7 +1286,22 @@
|
||||
$out = preg_replace_callback('/\[tag:block:([A-Za-z0-9-_]{1,20}+)\]/', 'parse_block', $out);
|
||||
|
||||
// Парсим теги системных блоков
|
||||
$out = preg_replace_callback('/\[tag:sysblock:([A-Za-z0-9-_]{1,20}+)\]/', 'parse_sysblock', $out);
|
||||
$out = preg_replace_callback('/\[tag:sysblock:([A-Za-z0-9-_]{1,20}+)(|:\{(.*?)\})\]/',
|
||||
function ($m)
|
||||
{
|
||||
return parse_sysblock($m[1], $m[2]);
|
||||
},
|
||||
$out);
|
||||
|
||||
// Парсим тизер документа
|
||||
$out = preg_replace_callback(
|
||||
'/\[tag:teaser:(\d+)(|:\[(.*?)\])\]/',
|
||||
create_function(
|
||||
'$m',
|
||||
'return showteaser($m[1], $m[2]);'
|
||||
),
|
||||
$out
|
||||
);
|
||||
|
||||
// Парсим теги модулей
|
||||
$out = $this->coreModuleTagParse($out);
|
||||
@ -1560,10 +1499,10 @@
|
||||
// Парсим тизер документа
|
||||
$out = preg_replace_callback(
|
||||
'/\[tag:teaser:(\d+)(|:\[(.*?)\])\]/',
|
||||
function ($m)
|
||||
{
|
||||
return showteaser($m[1], $m[2]);
|
||||
},
|
||||
create_function(
|
||||
'$m',
|
||||
'return showteaser($m[1], $m[2]);'
|
||||
),
|
||||
$out
|
||||
);
|
||||
|
||||
@ -1571,10 +1510,10 @@
|
||||
if (defined('RUB_ID'))
|
||||
$out = preg_replace_callback(
|
||||
'/\[tag:docauthoravatar:(\d+)\]/',
|
||||
function ($m)
|
||||
{
|
||||
return getAvatar(intval($this->curentdoc->document_author_id), $m[1]);
|
||||
},
|
||||
create_function(
|
||||
'$m',
|
||||
'return getAvatar('.intval($this->curentdoc->document_author_id).', $m[1]);'
|
||||
),
|
||||
$out
|
||||
);
|
||||
|
||||
@ -1613,7 +1552,6 @@
|
||||
echo $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод, предназначенный для формирования ЧПУ, а также для поиска документа и разбора
|
||||
* дополнительных параметров в URL
|
||||
|
0
class/class.dbdump.php
Normal file → Executable file
0
class/class.dbdump.php
Normal file → Executable file
@ -41,7 +41,7 @@
|
||||
*
|
||||
* @return false|null|string|string[]
|
||||
*/
|
||||
public static function _echo($var, $exit = false, $bg = null, $echo = true)
|
||||
public static function _echo($var, $exit = false, $_bg = null, $echo = true)
|
||||
{
|
||||
$code = '';
|
||||
|
||||
@ -92,8 +92,10 @@
|
||||
else
|
||||
$fn_name = 'EVAL';
|
||||
|
||||
if (empty($bg))
|
||||
$bg = '43648c';
|
||||
if ($_bg)
|
||||
$bg = 'style="background: #' . $_bg . ';"';
|
||||
else
|
||||
$bg = '';
|
||||
|
||||
$var_dump = '
|
||||
<style>
|
||||
@ -101,7 +103,7 @@
|
||||
margin: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
background-color: #f1efef;
|
||||
border-radius: 3px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
||||
font-family: "Consolas", Verdana, Arial;
|
||||
font-size: 11px;
|
||||
@ -114,6 +116,7 @@
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
|
||||
background-color: #43648c;
|
||||
background-repeat: repeat-x;
|
||||
border-bottom: 1px solid #ffffff;
|
||||
}
|
||||
@ -125,7 +128,7 @@
|
||||
}
|
||||
</style>
|
||||
<div class="debug_bg">
|
||||
<div class="debug_top" style="background-color: #' . $bg . ';">
|
||||
<div class="debug_top" ' . $bg . '>
|
||||
var_dump(<strong>' . trim($fn_name) . '</strong>)
|
||||
</div>
|
||||
'.self::_trace().'
|
||||
@ -157,7 +160,7 @@
|
||||
*
|
||||
* @return null|string|string[]
|
||||
*/
|
||||
public static function _print($var, $exit = false, $bg = null, $echo = true)
|
||||
public static function _print($var, $exit = false, $_bg = null, $echo = true)
|
||||
{
|
||||
$code = '';
|
||||
|
||||
@ -202,8 +205,10 @@
|
||||
else
|
||||
$fn_name = 'EVAL';
|
||||
|
||||
if (! $bg)
|
||||
$bg = '4e5665';
|
||||
if ($_bg)
|
||||
$bg = 'style="background: #' . $_bg . ';"';
|
||||
else
|
||||
$bg = '';
|
||||
|
||||
$var_dump = '
|
||||
<style>
|
||||
@ -211,9 +216,9 @@
|
||||
margin: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
background-color: #f1efef;
|
||||
border-radius: 3px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
||||
font-family: Consolas, Verdana, Arial;
|
||||
font-family: "Consolas", Verdana, Arial;
|
||||
font-size: 11px;
|
||||
}
|
||||
.debug_top {
|
||||
@ -224,6 +229,7 @@
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
|
||||
background-color: #4e5665;
|
||||
background-repeat: repeat-x;
|
||||
border-bottom: 1px solid #ffffff;
|
||||
}
|
||||
@ -235,7 +241,7 @@
|
||||
}
|
||||
</style>
|
||||
<div class="debug_bg">
|
||||
<div class="debug_top" style="background-color: #' . $bg . ';">
|
||||
<div class="debug_top" ' . $bg . '>
|
||||
print_r(<strong>' . trim($fn_name) . '</strong>)
|
||||
</div>
|
||||
'.self::_trace().'
|
||||
@ -267,7 +273,7 @@
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function _exp($var, $exit = false, $bg = null, $echo = true)
|
||||
public static function _exp($var, $exit = false, $_bg = null, $echo = true)
|
||||
{
|
||||
$code = '';
|
||||
|
||||
@ -306,8 +312,10 @@
|
||||
else
|
||||
$fn_name = 'EVAL';
|
||||
|
||||
if (! $bg)
|
||||
$bg = 'ccc';
|
||||
if ($_bg)
|
||||
$bg = 'style="background: #' . $_bg . ';"';
|
||||
else
|
||||
$bg = '';
|
||||
|
||||
$var_export = htmlspecialchars(ob_get_contents());
|
||||
|
||||
@ -321,9 +329,9 @@
|
||||
margin: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
background-color: #f1efef;
|
||||
border-radius: 3px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
||||
font-family: Consolas, Verdana, Arial;
|
||||
font-family: "Consolas", Verdana, Arial;
|
||||
font-size: 11px;
|
||||
}
|
||||
.debug_top {
|
||||
@ -334,6 +342,7 @@
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
|
||||
background-color: #ccc;
|
||||
background-repeat: repeat-x;
|
||||
border-bottom: 1px solid #ffffff;
|
||||
}
|
||||
@ -345,7 +354,7 @@
|
||||
}
|
||||
</style>
|
||||
<div class="debug_bg">
|
||||
<div class="debug_top" style="background-color: #' . $bg . ';">
|
||||
<div class="debug_top" ' . $bg . '>
|
||||
var_export(<strong>' . trim($fn_name) . '</strong>)
|
||||
</div>
|
||||
'.self::_trace().'
|
||||
@ -377,7 +386,7 @@
|
||||
*
|
||||
* @return false|string
|
||||
*/
|
||||
public static function _html($var, $exit = false, $bg = null, $echo = true)
|
||||
public static function _html($var, $exit = false, $_bg = null, $echo = true)
|
||||
{
|
||||
$code = '';
|
||||
|
||||
@ -416,8 +425,10 @@
|
||||
else
|
||||
$fn_name = 'EVAL';
|
||||
|
||||
if (! $bg)
|
||||
$bg = '43648c';
|
||||
if ($_bg)
|
||||
$bg = 'style="background: #' . $_bg . ';"';
|
||||
else
|
||||
$bg = '';
|
||||
|
||||
$var_dump = ob_get_contents();
|
||||
|
||||
@ -429,9 +440,9 @@
|
||||
margin: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
background-color: #f1efef;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.1);
|
||||
font-family: Consolas, Verdana, Arial;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
|
||||
font-family: "Consolas", Verdana, Arial;
|
||||
font-size: 11px;
|
||||
}
|
||||
.debug_top {
|
||||
@ -442,6 +453,7 @@
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
|
||||
background-color: #43648c;
|
||||
background-repeat: repeat-x;
|
||||
border-bottom: 1px solid #ffffff;
|
||||
}
|
||||
@ -453,7 +465,7 @@
|
||||
}
|
||||
</style>
|
||||
<div class="debug_bg">
|
||||
<div class="debug_top" style="background-color: #' . $bg . ';">
|
||||
<div class="debug_top" ' . $bg . '>
|
||||
var_export(<strong>' . trim($fn_name) . '</strong>)
|
||||
</div>
|
||||
'.self::_trace().'
|
||||
@ -533,7 +545,14 @@
|
||||
$fn_name = 'EVAL';
|
||||
|
||||
if (! $bg)
|
||||
{
|
||||
$br = '2a5885';
|
||||
$bg = '43648c';
|
||||
}
|
||||
else
|
||||
{
|
||||
$br = $bg;
|
||||
}
|
||||
|
||||
$var_dump = '
|
||||
<style>
|
||||
@ -541,7 +560,7 @@
|
||||
margin: 20px;
|
||||
border: 1px solid #d9d9d9;
|
||||
background-color: #f1efef;
|
||||
border-radius: 3px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.1);
|
||||
font-family: Consolas, Verdana, Arial;
|
||||
font-size: 11px;
|
||||
@ -554,6 +573,7 @@
|
||||
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;
|
||||
}
|
||||
@ -565,7 +585,7 @@
|
||||
}
|
||||
</style>
|
||||
<div class="debug_bg">
|
||||
<div class="debug_top" style="background-color: #' . $bg . ';">
|
||||
<div class="debug_top">
|
||||
var_dump(<strong>' . trim($fn_name) . '</strong>)
|
||||
</div>
|
||||
'.self::_trace().'
|
||||
|
@ -1478,7 +1478,7 @@
|
||||
// Если пришел вызов поля, который связан с модулем
|
||||
if (isset($data['field_module']))
|
||||
{
|
||||
while(list($mod_key, $mod_val) = each($_REQUEST['field_module']))
|
||||
while(list($mod_key, $mod_val) = each($data['field_module']))
|
||||
{
|
||||
require_once(BASE_DIR . '/modules/' . $mod_val . '/document.php');
|
||||
|
||||
|
0
class/class.hooks.php
Normal file → Executable file
0
class/class.hooks.php
Normal file → Executable file
0
class/class.logs.php
Normal file → Executable file
0
class/class.logs.php
Normal file → Executable file
30
class/class.meta.php
Normal file → Executable file
30
class/class.meta.php
Normal file → Executable file
@ -14,19 +14,17 @@ class Meta
|
||||
{
|
||||
private $_keyword_count = 10;
|
||||
|
||||
public function __construct($keyword_count = false)
|
||||
public function __construct( $keyword_count = false )
|
||||
{
|
||||
if ((int)$keyword_count)
|
||||
$this->_keyword_count = $keyword_count;
|
||||
if( (int) $keyword_count ) $this->_keyword_count = $keyword_count;
|
||||
}
|
||||
|
||||
public function setKeywordCount($keyword_count)
|
||||
public function setKeywordCount( $keyword_count )
|
||||
{
|
||||
if ((int)$keyword_count)
|
||||
$this->_keyword_count = $keyword_count;
|
||||
if( (int) $keyword_count ) $this->_keyword_count = $keyword_count;
|
||||
}
|
||||
|
||||
public function generateMeta($text)
|
||||
public function generateMeta( $text )
|
||||
{
|
||||
$newarr = array ();
|
||||
|
||||
@ -51,24 +49,20 @@ class Meta
|
||||
|
||||
$arr = explode( " ", $text );
|
||||
|
||||
foreach ($arr as $word)
|
||||
{
|
||||
if (mb_strlen(($word)) > 4 OR (mb_strtoupper($word) == $word) and mb_strlen(($word)) > 1)
|
||||
$newarr[] = $word;
|
||||
foreach ( $arr as $word ) {
|
||||
if( mb_strlen( ($word) ) > 4 OR (mb_strtoupper($word)==$word) and mb_strlen( ($word) ) > 1) $newarr[] = $word;
|
||||
}
|
||||
|
||||
$arr = array_count_values($newarr);
|
||||
$arr = array_count_values( $newarr );
|
||||
arsort( $arr );
|
||||
|
||||
arsort($arr);
|
||||
$arr = array_keys( $arr );
|
||||
|
||||
$arr = array_keys($arr);
|
||||
|
||||
// Не используется
|
||||
// $total = count($arr);
|
||||
$total = count( $arr );
|
||||
|
||||
$offset = 0;
|
||||
|
||||
$arr = array_slice($arr, $offset, $this->_keyword_count);
|
||||
$arr = array_slice( $arr, $offset, $this->_keyword_count );
|
||||
|
||||
$return['keywords'] = implode( ", ", $arr );
|
||||
$return['description'] = trim(mb_substr( trim($text), 0, 220 ),'.').'.';
|
||||
|
5
class/class.modules.php
Normal file → Executable file
5
class/class.modules.php
Normal file → Executable file
@ -404,7 +404,6 @@
|
||||
ModuleSysName = '" . MODULE_PATH . "'
|
||||
");
|
||||
}
|
||||
|
||||
// Сохраняем системное сообщение в журнал
|
||||
reportLog ($AVE_Template->get_config_vars('MODULES_ACTION_UPDATE') . ' (' . MODULE_PATH . ')');
|
||||
|
||||
@ -514,8 +513,8 @@
|
||||
|
||||
foreach ($files as $file)
|
||||
{
|
||||
if (substr($file, -1) == '/')
|
||||
$this->moduleRemove($file);
|
||||
if(substr($file, -1) == '/')
|
||||
moduleRemove($file);
|
||||
else
|
||||
unlink($file);
|
||||
}
|
||||
|
0
class/class.navigation.php
Normal file → Executable file
0
class/class.navigation.php
Normal file → Executable file
6
class/class.paginations.php
Normal file → Executable file
6
class/class.paginations.php
Normal file → Executable file
@ -132,7 +132,10 @@
|
||||
$search = array('[link]', '[page]', '[name]');
|
||||
$replace = array($template_label, $page, $page);
|
||||
|
||||
$link = str_replace($search, $replace, $pagination_link_template);
|
||||
if ($curent_page != 1)
|
||||
$link = str_replace($search, $replace, $pagination_link_template);
|
||||
else
|
||||
$link = str_replace($search, $replace, $pagination_link_active_template);
|
||||
|
||||
$pagination .= sprintf($pagination_link_box, str_replace(array('{s}', '{t}'), $page, str_replace(array('&' . $type . '={s}', '&' . $type . '={s}', '/' . $type . '-{s}'), '', $link)));
|
||||
}
|
||||
@ -150,6 +153,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Следующая
|
||||
if ($curent_page < $total_pages)
|
||||
{
|
||||
|
0
class/class.porter.php
Normal file → Executable file
0
class/class.porter.php
Normal file → Executable file
0
class/class.request.php
Normal file → Executable file
0
class/class.request.php
Normal file → Executable file
0
class/class.session.files.php
Normal file → Executable file
0
class/class.session.files.php
Normal file → Executable file
0
class/class.session.memcached.php
Normal file → Executable file
0
class/class.session.memcached.php
Normal file → Executable file
278
class/class.session.php
Normal file → Executable file
278
class/class.session.php
Normal file → Executable file
@ -1,155 +1,161 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
*/
|
||||
|
||||
class AVE_Session_DB
|
||||
{
|
||||
|
||||
public $sess_lifetime;
|
||||
|
||||
/**
|
||||
* AVE.cms
|
||||
* Хост
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @version 3.x
|
||||
* @filesource
|
||||
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
|
||||
*
|
||||
* @license GPL v.2
|
||||
* @var string
|
||||
*/
|
||||
protected $db_host;
|
||||
|
||||
class AVE_Session_DB
|
||||
/**
|
||||
* Имя пользователя
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $db_user;
|
||||
|
||||
/**
|
||||
* Пароль
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $db_pass;
|
||||
|
||||
/**
|
||||
* Имя текущей БД.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $db_dbase;
|
||||
|
||||
/**
|
||||
* Префикс БД.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $db_prefix;
|
||||
|
||||
private $mysql_connect = null;
|
||||
private $mysql_db = null;
|
||||
|
||||
/* Create a connection to a database */
|
||||
function __construct()
|
||||
{
|
||||
// Подключаем конфигурационный файл с параметрами подключения
|
||||
require (BASE_DIR . '/config/db.config.php');
|
||||
|
||||
public $sess_lifetime;
|
||||
$this->db_host = $config['dbhost'];
|
||||
$this->db_user = $config['dbuser'];
|
||||
$this->db_pass = $config['dbpass'];
|
||||
$this->db_dbase = $config['dbname'];
|
||||
$this->db_prefix = $config['dbpref'];
|
||||
|
||||
/**
|
||||
* Хост
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $db_host;
|
||||
$this->sess_lifetime = (defined('SESSION_LIFETIME') && is_numeric(SESSION_LIFETIME))
|
||||
? SESSION_LIFETIME
|
||||
: (get_cfg_var("session.gc_maxlifetime") < 1440
|
||||
? 1440
|
||||
: get_cfg_var("session.gc_maxlifetime"));
|
||||
|
||||
/**
|
||||
* Имя пользователя
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $db_user;
|
||||
|
||||
/**
|
||||
* Пароль
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $db_pass;
|
||||
|
||||
/**
|
||||
* Имя текущей БД.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $db_dbase;
|
||||
|
||||
/**
|
||||
* Префикс БД.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $db_prefix;
|
||||
|
||||
private $mysql_connect = null;
|
||||
private $mysql_db = null;
|
||||
|
||||
|
||||
/* Create a connection to a database */
|
||||
function __construct()
|
||||
if (! $this->mysql_connect = mysqli_connect ($this->db_host, $this->db_user, $this->db_pass))
|
||||
{
|
||||
// Подключаем конфигурационный файл с параметрами подключения
|
||||
require (BASE_DIR . '/config/db.config.php');
|
||||
|
||||
$this->db_host = $config['dbhost'];
|
||||
$this->db_user = $config['dbuser'];
|
||||
$this->db_pass = $config['dbpass'];
|
||||
$this->db_dbase = $config['dbname'];
|
||||
$this->db_prefix = $config['dbpref'];
|
||||
|
||||
$this->sess_lifetime = (defined('SESSION_LIFETIME') && is_numeric(SESSION_LIFETIME))
|
||||
? SESSION_LIFETIME
|
||||
: (get_cfg_var("session.gc_maxlifetime") < 1440
|
||||
? 1440
|
||||
: get_cfg_var("session.gc_maxlifetime"));
|
||||
|
||||
if (! $this->mysql_connect = mysqli_connect ($this->db_host, $this->db_user, $this->db_pass))
|
||||
$this->error();
|
||||
|
||||
if (! $this->mysql_db = mysqli_select_db ($this->mysql_connect, $this->db_dbase))
|
||||
$this->error();
|
||||
|
||||
$this->mysql_connect->set_charset('utf8');
|
||||
|
||||
return true;
|
||||
$this->error();
|
||||
}
|
||||
|
||||
if (! $this->mysql_db = mysqli_select_db ($this->mysql_connect, $this->db_dbase))
|
||||
{
|
||||
$this->error();
|
||||
}
|
||||
|
||||
/* Open session */
|
||||
function _open($path, $name)
|
||||
$this->mysql_connect->set_charset('utf8');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Open session */
|
||||
function _open($path, $name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Close session */
|
||||
function _close()
|
||||
{
|
||||
@mysqli_query($this->mysql_connect, "DELETE FROM " . PREFIX . "_sessions WHERE expiry < '" . time() . "'");
|
||||
|
||||
if ($this->mysql_connect !== null)
|
||||
@mysqli_close($this->mysql_connect);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Read session */
|
||||
function _read($ses_id)
|
||||
{
|
||||
$qid = @mysqli_query($this->mysql_connect, "SELECT value, Ip FROM " . PREFIX . "_sessions WHERE sesskey = '" . $ses_id . "' AND expiry > '" . time() . "'");
|
||||
|
||||
if ((list($value, $ip) = @mysqli_fetch_row($qid)) && $ip == $_SERVER['REMOTE_ADDR'])
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/* Write new data */
|
||||
function _write($ses_id, $data)
|
||||
{
|
||||
if (! $qid = @mysqli_query($this->mysql_connect, "INSERT INTO ".PREFIX."_sessions VALUES ('".$ses_id."', ".(time()+$this->sess_lifetime).", '".addslashes($data)."', '".$_SERVER['REMOTE_ADDR']."', FROM_UNIXTIME(expiry, '%d.%m.%Y, %H:%i:%s'))"))
|
||||
{
|
||||
$qid = @mysqli_query($this->mysql_connect, "UPDATE ".PREFIX."_sessions SET expiry = ".(time()+$this->sess_lifetime).", expire_datum = FROM_UNIXTIME(expiry,'%d.%m.%Y, %H:%i:%s'), value = '".addslashes($data)."', Ip = '".$_SERVER['REMOTE_ADDR']."' WHERE sesskey = '".$ses_id."' AND expiry > '".time()."'");
|
||||
}
|
||||
|
||||
return $qid;
|
||||
}
|
||||
|
||||
/* Destroy session */
|
||||
function _destroy($ses_id)
|
||||
{
|
||||
return @mysqli_query($this->mysql_connect, "DELETE FROM ".PREFIX."_sessions WHERE sesskey = '".$ses_id."'");
|
||||
}
|
||||
|
||||
/* Garbage collection, deletes old sessions */
|
||||
function _gc($maxlifetime)
|
||||
{
|
||||
$session_res = @mysqli_query($this->mysql_connect, "DELETE FROM ".PREFIX."_sessions WHERE expire < (UNIX_TIMESTAMP(NOW()) - " . (int)$maxlifetime . ")");
|
||||
|
||||
if (!$session_res) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Close session */
|
||||
function _close()
|
||||
{
|
||||
@mysqli_query($this->mysql_connect, "DELETE FROM " . PREFIX . "_sessions WHERE expiry < '" . time() . "'");
|
||||
|
||||
if ($this->mysql_connect !== null)
|
||||
@mysqli_close($this->mysql_connect);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Read session */
|
||||
function _read($ses_id)
|
||||
{
|
||||
$qid = @mysqli_query($this->mysql_connect, "SELECT value, Ip FROM " . PREFIX . "_sessions WHERE sesskey = '" . $ses_id . "' AND expiry > '" . time() . "'");
|
||||
|
||||
if ((list($value, $ip) = @mysqli_fetch_row($qid)) && $ip == $_SERVER['REMOTE_ADDR'])
|
||||
return $value;
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/* Write new data */
|
||||
function _write($ses_id, $data)
|
||||
{
|
||||
if (! $qid = @mysqli_query($this->mysql_connect, "INSERT INTO ".PREFIX."_sessions VALUES ('".$ses_id."', ".(time()+$this->sess_lifetime).", '".addslashes($data)."', '".$_SERVER['REMOTE_ADDR']."', FROM_UNIXTIME(expiry, '%d.%m.%Y, %H:%i:%s'))"))
|
||||
$qid = @mysqli_query($this->mysql_connect, "UPDATE ".PREFIX."_sessions SET expiry = ".(time()+$this->sess_lifetime).", expire_datum = FROM_UNIXTIME(expiry,'%d.%m.%Y, %H:%i:%s'), value = '".addslashes($data)."', Ip = '".$_SERVER['REMOTE_ADDR']."' WHERE sesskey = '".$ses_id."' AND expiry > '".time()."'");
|
||||
|
||||
return $qid;
|
||||
}
|
||||
|
||||
/* Destroy session */
|
||||
function _destroy($ses_id)
|
||||
{
|
||||
return @mysqli_query($this->mysql_connect, "DELETE FROM ".PREFIX."_sessions WHERE sesskey = '".$ses_id."'");
|
||||
}
|
||||
|
||||
/* Garbage collection, deletes old sessions */
|
||||
function _gc($maxlifetime)
|
||||
{
|
||||
$session_res = @mysqli_query($this->mysql_connect, "DELETE FROM ".PREFIX."_sessions WHERE expire < (UNIX_TIMESTAMP(NOW()) - " . (int)$maxlifetime . ")");
|
||||
|
||||
if (! $session_res)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
function error() {
|
||||
ob_start();
|
||||
header('HTTP/1.1 503 Service Temporarily Unavailable');
|
||||
header('Status: 503 Service Temporarily Unavailable');
|
||||
header('Retry-After: 3600');
|
||||
header('X-Powered-By:');
|
||||
display_notice("Error connect to MySQL.");
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
function error() {
|
||||
ob_start();
|
||||
header('HTTP/1.1 503 Service Temporarily Unavailable');
|
||||
header('Status: 503 Service Temporarily Unavailable');
|
||||
header('Retry-After: 3600');
|
||||
header('X-Powered-By:');
|
||||
display_notice("Error connect to MySQL.");
|
||||
die;
|
||||
}
|
||||
}
|
||||
?>
|
0
class/class.settings.php
Normal file → Executable file
0
class/class.settings.php
Normal file → Executable file
17
class/class.sysblocks.php
Normal file → Executable file
17
class/class.sysblocks.php
Normal file → Executable file
@ -38,7 +38,7 @@
|
||||
/**
|
||||
* Вывод списка системных блоков
|
||||
*/
|
||||
function sys_blockList()
|
||||
function sys_blockList ()
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
*
|
||||
* @param int $sysblock_id идентификатор системного блока
|
||||
*/
|
||||
function sys_blockSave($sysblock_id = null)
|
||||
function sys_blockSave ($sysblock_id = null)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
@ -78,10 +78,10 @@
|
||||
{
|
||||
|
||||
$_REQUEST['sysblock_external'] = (isset($_REQUEST['sysblock_external'])) ? $_REQUEST['sysblock_external'] : 0;
|
||||
$_REQUEST['sysblock_eval'] = (isset($_REQUEST['sysblock_eval'])) ? $_REQUEST['sysblock_eval'] : 0;
|
||||
$_REQUEST['sysblock_ajax'] = (isset($_REQUEST['sysblock_ajax'])) ? $_REQUEST['sysblock_ajax'] : 0;
|
||||
$_REQUEST['sysblock_visual'] = (isset($_REQUEST['sysblock_visual'])) ? $_REQUEST['sysblock_visual'] : 0;
|
||||
|
||||
$sysblock_alias = isset($_REQUEST['sysblock_alias']) ? $_REQUEST['sysblock_alias'] : '';
|
||||
$_REQUEST['sysblock_alias'] = isset($_REQUEST['sysblock_alias']) ? $_REQUEST['sysblock_alias'] : '';
|
||||
|
||||
$sql = $AVE_DB->Query("
|
||||
UPDATE
|
||||
@ -91,6 +91,7 @@
|
||||
sysblock_description = '" . addslashes($_REQUEST['sysblock_description']) . "',
|
||||
sysblock_alias = '" . $_REQUEST['sysblock_alias'] . "',
|
||||
sysblock_text = '" . $_REQUEST['sysblock_text'] . "',
|
||||
sysblock_eval = '" . (int)$_REQUEST['sysblock_eval'] . "',
|
||||
sysblock_external = '" . (int)$_REQUEST['sysblock_external'] . "',
|
||||
sysblock_ajax = '" . (int)$_REQUEST['sysblock_ajax'] . "',
|
||||
sysblock_visual = '" . (int)$_REQUEST['sysblock_visual'] . "'
|
||||
@ -140,6 +141,7 @@
|
||||
sysblock_alias = '" . $_REQUEST['sysblock_alias'] . "',
|
||||
sysblock_text = '" . $_REQUEST['sysblock_text'] . "',
|
||||
sysblock_author_id = '" . (int)$_SESSION['user_id'] . "',
|
||||
sysblock_eval = '" . (int)$_REQUEST['sysblock_eval'] . "',
|
||||
sysblock_external = '" . (int)$_REQUEST['sysblock_external'] . "',
|
||||
sysblock_ajax = '" . (int)$_REQUEST['sysblock_ajax'] . "',
|
||||
sysblock_visual = '" . (int)$_REQUEST['sysblock_visual'] . "',
|
||||
@ -163,7 +165,7 @@
|
||||
*
|
||||
* @param int $sysblock_id идентификатор системного блока
|
||||
*/
|
||||
function sys_blockEdit($sysblock_id)
|
||||
function sys_blockEdit ($sysblock_id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
@ -201,13 +203,14 @@
|
||||
/**
|
||||
* Создание системного блока
|
||||
*/
|
||||
function sys_blockNew()
|
||||
function sys_blockNew ()
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
$row['sysblock_name'] = '';
|
||||
$row['sysblock_alias'] = '';
|
||||
$row['sysblock_text'] = '';
|
||||
$row['sysblock_eval'] = '1';
|
||||
$row['sysblock_visual'] = (isset($_REQUEST['sysblock_visual']) && $_REQUEST['sysblock_visual'] != 0) ? $_REQUEST['sysblock_visual'] : '';
|
||||
|
||||
$AVE_Template->assign('sid', 0);
|
||||
@ -237,7 +240,7 @@
|
||||
*
|
||||
* @param int $sysblock_id идентификатор системного блока
|
||||
*/
|
||||
function sys_blockDelete($sysblock_id)
|
||||
function sys_blockDelete ($sysblock_id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
|
0
class/class.template.php
Normal file → Executable file
0
class/class.template.php
Normal file → Executable file
0
class/class.templates.php
Normal file → Executable file
0
class/class.templates.php
Normal file → Executable file
0
class/class.user.php
Normal file → Executable file
0
class/class.user.php
Normal file → Executable file
188
class/class.utm.php
Normal file → Executable file
188
class/class.utm.php
Normal file → Executable file
@ -1,119 +1,121 @@
|
||||
<?php
|
||||
/*
|
||||
Версия от 06.03.2018г.
|
||||
/*
|
||||
|
||||
Как это работает:
|
||||
1) Пользователь зашел на сайт первый раз.
|
||||
2) Если есть хотя бы один параметр - сохраняет cookies
|
||||
3) Если utm_history уже есть, то сохраняет данные в utm_last
|
||||
4) utm_last перезаписывается при каждом новом значении, а utm_history всегда остаётся неизменной (если был передан хотя бы один параметр)
|
||||
5) utm_source сохраняется всегда до закрытия браузера
|
||||
*/
|
||||
class UTMCookie
|
||||
Версия от 06.03.2018г.
|
||||
|
||||
Как это работает:
|
||||
1) Пользователь зашел на сайт первый раз.
|
||||
2) Если есть хотя бы один параметр - сохраняет cookies
|
||||
3) Если utm_history уже есть, то сохраняет данные в utm_last
|
||||
4) utm_last перезаписывается при каждом новом значении, а utm_history всегда остаётся неизменной (если был передан хотя бы один параметр)
|
||||
5) utm_source сохраняется всегда до закрытия браузера
|
||||
|
||||
*/
|
||||
class UTMCookie
|
||||
{
|
||||
|
||||
private $parameters = array('utm_source', 'utm_medium', 'utm_campaign');
|
||||
|
||||
private $utm_history = '';
|
||||
private $utm_last = '';
|
||||
private $utm_source = '';
|
||||
|
||||
//Проверка параметров: Если все присутствуют - true, иначе false
|
||||
private function check_parameters()
|
||||
{
|
||||
//return true; //Сохранять всегда!
|
||||
|
||||
private $parameters = array('utm_source', 'utm_medium', 'utm_campaign');
|
||||
$return = false;
|
||||
|
||||
private $utm_history = '';
|
||||
private $utm_last = '';
|
||||
private $utm_source = '';
|
||||
foreach ($this->parameters as $param)
|
||||
if (isset($_GET[$param]) && $_GET[$param] != '')
|
||||
$return = true;
|
||||
|
||||
//Проверка параметров: Если все присутствуют - true, иначе false
|
||||
private function check_parameters()
|
||||
{
|
||||
//return true; //Сохранять всегда!
|
||||
return $return;
|
||||
}
|
||||
|
||||
$return = false;
|
||||
//Создаёт строку с параметрами вот такого вида: utm_source=test; utm_medium=none; utm_campaign=kompaniya1;
|
||||
private function create_parameters()
|
||||
{
|
||||
$content = '';
|
||||
foreach($this->parameters as $param){
|
||||
|
||||
foreach ($this->parameters as $param)
|
||||
if (isset($_GET[$param]) && $_GET[$param] != '')
|
||||
$return = true;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
//Создаёт строку с параметрами вот такого вида: utm_source=test; utm_medium=none; utm_campaign=kompaniya1;
|
||||
private function create_parameters()
|
||||
{
|
||||
$content = '';
|
||||
foreach($this->parameters as $param){
|
||||
|
||||
if (isset($_GET[$param]) && $_GET[$param] != '')
|
||||
{
|
||||
$content .= $param.'='.$_GET[$param].'; ';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$content .= $param.'=none; ';
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
//Сохраняет переданные параметры, если требуется
|
||||
//Если utm_history присутствует, то сохраняет utm_last
|
||||
public function save_parameters()
|
||||
{
|
||||
if (isset($_GET['utm_source']) && trim($_GET['utm_source']) != '')
|
||||
if (isset($_GET[$param]) && $_GET[$param] != '')
|
||||
{
|
||||
setcookie('utm_source', $_GET['utm_source']);
|
||||
|
||||
$this->utm_source = $_GET['utm_source'];
|
||||
}
|
||||
|
||||
//$utm_history = '';
|
||||
|
||||
if (! isset($_COOKIE['utm_history']) || $_COOKIE['utm_history'] == '')
|
||||
{
|
||||
//Отсутствует utm_history
|
||||
if($this->check_parameters() == true)
|
||||
{
|
||||
|
||||
$utm_history = $this->create_parameters();
|
||||
setcookie('utm_history', $utm_history, time()+15552000); //На 6 месяцев
|
||||
setcookie('utm_last', '');
|
||||
|
||||
$this->utm_history = $utm_history;
|
||||
}
|
||||
$content .= $param.'='.$_GET[$param].'; ';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//utm_history присутствует
|
||||
$content .= $param.'=none; ';
|
||||
}
|
||||
}
|
||||
|
||||
$this->utm_history = $_COOKIE['utm_history'];
|
||||
return $content;
|
||||
}
|
||||
|
||||
//Перезапишем utm_last, если есть данные для этого
|
||||
if($this->check_parameters() == true){
|
||||
//Сохраняет переданные параметры, если требуется
|
||||
//Если utm_history присутствует, то сохраняет utm_last
|
||||
public function save_parameters()
|
||||
{
|
||||
if (isset($_GET['utm_source']) && trim($_GET['utm_source']) != '')
|
||||
{
|
||||
setcookie('utm_source', $_GET['utm_source']);
|
||||
|
||||
$utm_last = $this->create_parameters();
|
||||
$this->utm_source = $_GET['utm_source'];
|
||||
}
|
||||
|
||||
if($utm_last != $_COOKIE['utm_history'])
|
||||
setcookie('utm_last', $utm_last, time()+15552000); //На 6 месяцев
|
||||
//$utm_history = '';
|
||||
|
||||
$this->utm_last = $utm_last;
|
||||
if (! isset($_COOKIE['utm_history']) || $_COOKIE['utm_history'] == '')
|
||||
{
|
||||
//Отсутствует utm_history
|
||||
if($this->check_parameters() == true)
|
||||
{
|
||||
|
||||
}
|
||||
$utm_history = $this->create_parameters();
|
||||
setcookie('utm_history', $utm_history, time()+15552000); //На 6 месяцев
|
||||
setcookie('utm_last', '');
|
||||
|
||||
$this->utm_history = $utm_history;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//utm_history присутствует
|
||||
|
||||
$this->utm_history = $_COOKIE['utm_history'];
|
||||
|
||||
//Перезапишем utm_last, если есть данные для этого
|
||||
if($this->check_parameters() == true){
|
||||
|
||||
$utm_last = $this->create_parameters();
|
||||
|
||||
if($utm_last != $_COOKIE['utm_history'])
|
||||
setcookie('utm_last', $utm_last, time()+15552000); //На 6 месяцев
|
||||
|
||||
$this->utm_last = $utm_last;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Возвращает значение cookies
|
||||
public function get_value($name = '')
|
||||
{
|
||||
$name = trim($name);
|
||||
|
||||
if ($name == '' || ! in_array($name, array('utm_history', 'utm_last', 'utm_source')))
|
||||
$name = 'utm_history';
|
||||
|
||||
if (isset($this->$name) && $this->$name != '')
|
||||
return $this->$name;
|
||||
|
||||
return isset($_COOKIE[$name]) ? $_COOKIE[$name] : '';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//Возвращает значение cookies
|
||||
public function get_value($name = '')
|
||||
{
|
||||
$name = trim($name);
|
||||
|
||||
if ($name == '' || ! in_array($name, array('utm_history', 'utm_last', 'utm_source')))
|
||||
$name = 'utm_history';
|
||||
|
||||
if (isset($this->$name) && $this->$name != '')
|
||||
return $this->$name;
|
||||
|
||||
return isset($_COOKIE[$name]) ? $_COOKIE[$name] : '';
|
||||
}
|
||||
}
|
||||
?>
|
0
functions/.htaccess
Normal file → Executable file
0
functions/.htaccess
Normal file → Executable file
@ -371,7 +371,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* Ссылка на реферал
|
||||
*
|
||||
*
|
||||
* @return string ссылка
|
||||
*/
|
||||
|
@ -73,7 +73,7 @@
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_field_default($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
|
||||
function get_field_default ($field_value, $action, $field_id=0, $tpl='', $tpl_empty=0, &$maxlength=null, $document_fields=array(), $rubric_id=0, $default=null, $_tpl=null)
|
||||
{
|
||||
switch ($action)
|
||||
{
|
||||
@ -154,7 +154,7 @@
|
||||
* @param $id
|
||||
* @return string
|
||||
*/
|
||||
function get_field_alias($id)
|
||||
function get_field_alias ($id)
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
@ -177,7 +177,7 @@
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_field_num($rubric_id, $alias)
|
||||
function get_field_num ($rubric_id, $alias)
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
@ -204,13 +204,13 @@
|
||||
|
||||
|
||||
/**
|
||||
* Возвращаем
|
||||
* Возвращаем значение по умолчанию, для поля
|
||||
*
|
||||
* @param $id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_field_default_value($id)
|
||||
function get_field_default_value ($id)
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
@ -287,7 +287,7 @@
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function document_get_field($field_id, $document_id = null, $_tpl = null, $maxlength = null)
|
||||
function document_get_field ($field_id, $document_id = null, $_tpl = null, $maxlength = null)
|
||||
{
|
||||
global $AVE_Core;
|
||||
|
||||
@ -343,7 +343,7 @@
|
||||
* содержимое поля будет очищено от HTML-тегов.
|
||||
* @return string
|
||||
*/
|
||||
function document_get_field_value($field_id, $length = 0)
|
||||
function document_get_field_value ($field_id, $length = 0)
|
||||
{
|
||||
if (! is_numeric($field_id))
|
||||
return '';
|
||||
@ -382,7 +382,7 @@
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_document_field($document_id, $field)
|
||||
function get_document_field ($document_id, $field)
|
||||
{
|
||||
$document_fields = get_document_fields($document_id);
|
||||
|
||||
@ -406,7 +406,7 @@
|
||||
* @internal param int $id id документа
|
||||
* @return mixed
|
||||
*/
|
||||
function get_document_fields($document_id, $values = null)
|
||||
function get_document_fields ($document_id, $values = null)
|
||||
{
|
||||
global $AVE_DB, $AVE_Core; //$request_documents
|
||||
|
||||
@ -524,7 +524,7 @@
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_field($field_id, $doc_id = null, $parametr = null)
|
||||
function get_field ($field_id, $doc_id = null, $parametr = null)
|
||||
{
|
||||
global $req_item_id;
|
||||
|
||||
@ -539,7 +539,7 @@
|
||||
return false;
|
||||
|
||||
//-- Забираем из базы массив полей
|
||||
$field = get_document_field($doc_id, $field_id);
|
||||
$field = get_document_field ($doc_id, $field_id);
|
||||
|
||||
//-- Возвращаем нужную часть поля
|
||||
if ($parametr !== null)
|
||||
@ -562,7 +562,7 @@
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function get_true_field($field_id, $doc_id = null, $parametr = null)
|
||||
function get_true_field ($field_id, $doc_id = null, $parametr = null)
|
||||
{
|
||||
global $req_item_id, $AVE_DB;
|
||||
|
||||
@ -619,7 +619,7 @@
|
||||
* @param int $parametr ([tag:parametr:X]) - номер параметра элемента
|
||||
* @return string
|
||||
*/
|
||||
function get_element($field_id, $item_id = 0, $parametr = null, $doc_id = null)
|
||||
function get_element ($field_id, $item_id = 0, $parametr = null, $doc_id = null)
|
||||
{
|
||||
global $req_item_id;
|
||||
|
||||
@ -663,7 +663,7 @@
|
||||
* @param int $doc_id ([tag:docid]) - id документа
|
||||
* @return mixed
|
||||
*/
|
||||
function get_serialize($field_id, $item_id = null, $doc_id = null)
|
||||
function get_serialize ($field_id, $item_id = null, $doc_id = null)
|
||||
{
|
||||
global $req_item_id;
|
||||
|
||||
@ -706,7 +706,7 @@
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_field_element()
|
||||
function get_field_element ()
|
||||
{
|
||||
$param = func_get_args();
|
||||
|
||||
@ -733,7 +733,7 @@
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_field_name($field_id, $doc_id = null)
|
||||
function get_field_name ($field_id, $doc_id = null)
|
||||
{
|
||||
global $req_item_id;
|
||||
|
||||
@ -756,4 +756,73 @@
|
||||
|
||||
return $field_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Возвращает поле документа по номеру
|
||||
*
|
||||
* @param int $field_id ([tag:fld:X]) - номер поля
|
||||
* @param int $doc_id
|
||||
* @param int $parametr знчение
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function get_full_field ($field_id, $doc_id = null, $parametr = null)
|
||||
{
|
||||
global $req_item_id, $AVE_DB;
|
||||
|
||||
//-- Если не передан $doc_id, то проверяем реквест
|
||||
if (! $doc_id && $req_item_id)
|
||||
$doc_id = $req_item_id;
|
||||
//-- Или берём для текущего дока
|
||||
elseif (! $doc_id && $_REQUEST['id'] > 0)
|
||||
$doc_id = $_REQUEST['id'];
|
||||
//-- Возвращаем FALSE, если не число
|
||||
elseif (! is_numeric($doc_id))
|
||||
return false;
|
||||
|
||||
//-- Забираем поле из базы
|
||||
$sql = "
|
||||
SELECT
|
||||
doc.document_author_id,
|
||||
doc_field.document_id,
|
||||
doc_field.rubric_field_id,
|
||||
doc_field.field_value,
|
||||
doc_field.field_number_value,
|
||||
text_field.field_value AS field_value_more,
|
||||
rub_field.rubric_field_alias,
|
||||
rub_field.rubric_field_type,
|
||||
rub_field.rubric_field_default,
|
||||
rub_field.rubric_field_title,
|
||||
rub_field.rubric_field_template,
|
||||
rub_field.rubric_field_template_request
|
||||
FROM
|
||||
" . PREFIX . "_document_fields AS doc_field
|
||||
JOIN
|
||||
" . PREFIX . "_rubric_fields AS rub_field
|
||||
ON doc_field.rubric_field_id = rub_field.Id
|
||||
LEFT JOIN
|
||||
" . PREFIX . "_document_fields_text AS text_field
|
||||
ON (doc_field.rubric_field_id = text_field.rubric_field_id AND doc_field.document_id = text_field.document_id)
|
||||
JOIN
|
||||
" . PREFIX . "_documents AS doc
|
||||
ON doc.Id = doc_field.document_id
|
||||
WHERE
|
||||
doc_field.document_id = '" . $doc_id . "'
|
||||
AND
|
||||
doc_field.rubric_field_id = '" . $field_id . "'
|
||||
";
|
||||
|
||||
$field = $AVE_DB->Query($sql)->FetchRow();
|
||||
|
||||
$field->field_value = (string)$field->field_value . (string)$field->field_value_more;
|
||||
|
||||
unset ($sql);
|
||||
|
||||
//-- Возвращаем нужную часть
|
||||
if ($parametr !== null)
|
||||
return $field[$parametr];
|
||||
|
||||
return $field;
|
||||
}
|
||||
?>
|
@ -18,7 +18,7 @@
|
||||
* допустимые значения: page, apage, artpage
|
||||
* @return int номер текущей страницы
|
||||
*/
|
||||
function get_current_page($type = 'page')
|
||||
function get_current_page ($type = 'page')
|
||||
{
|
||||
if (!in_array($type, array('page', 'apage', 'artpage'))) return 1;
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
* @return string HTML-код постраничной навигации
|
||||
*/
|
||||
|
||||
function get_pagination($total_pages, $type, $template_label, $navi_box = '')
|
||||
function get_pagination ($total_pages, $type, $template_label, $navi_box = '')
|
||||
{
|
||||
$nav = '';
|
||||
|
||||
|
@ -147,31 +147,31 @@
|
||||
// обрабатываем условия
|
||||
switch ($type)
|
||||
{
|
||||
case 'N<':case '<': $where[] = "<?=\$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv < UPPER('\$v[$i]'))) $join\" : ''?>"; break;
|
||||
case 'N>':case '>': $where[] = "<?=\$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv > UPPER('\$v[$i]'))) $join\" : ''?>"; break;
|
||||
case 'N<=':case '<=': $where[] = "<?=\$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv <= UPPER('\$v[$i]'))) $join\" : ''?>"; break;
|
||||
case 'N>=':case '>=': $where[] = "<?=\$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv >= UPPER('\$v[$i]'))) $join\" : ''?>"; break;
|
||||
case 'N<':case '<': $where[] = "<?php echo \$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv < UPPER('\$v[$i]'))) $join\" : '' ?>"; break;
|
||||
case 'N>':case '>': $where[] = "<?php echo \$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv > UPPER('\$v[$i]'))) $join\" : '' ?>"; break;
|
||||
case 'N<=':case '<=': $where[] = "<?php echo \$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv <= UPPER('\$v[$i]'))) $join\" : '' ?>"; break;
|
||||
case 'N>=':case '>=': $where[] = "<?php echo \$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv >= UPPER('\$v[$i]'))) $join\" : '' ?>"; break;
|
||||
|
||||
case '==': $where[] = "<?=\$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv = UPPER('\$v[$i]'))) $join\" : ''?>"; break;
|
||||
case '!=': $where[] = "<?=\$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv != UPPER('\$v[$i]'))) $join\" : ''?>"; break;
|
||||
case '%%': $where[] = "<?=\$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv LIKE UPPER('%\$v[$i]%'))) $join\" : ''?>"; break;
|
||||
case '%': $where[] = "<?=\$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv LIKE UPPER('\$v[$i]%'))) $join\" : ''?>"; break;
|
||||
case '--': $where[] = "<?=\$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv NOT LIKE UPPER('%\$v[$i]%'))) $join\" : ''?>"; break;
|
||||
case '!-': $where[] = "<?=\$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv NOT LIKE UPPER('\$v[$i]%'))) $join\" : ''?>"; break;
|
||||
case '==': $where[] = "<?php echo \$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv = UPPER('\$v[$i]'))) $join\" : '' ?>"; break;
|
||||
case '!=': $where[] = "<?php echo \$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv != UPPER('\$v[$i]'))) $join\" : '' ?>"; break;
|
||||
case '%%': $where[] = "<?php echo \$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv LIKE UPPER('%\$v[$i]%'))) $join\" : '' ?>"; break;
|
||||
case '%': $where[] = "<?php echo \$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv LIKE UPPER('\$v[$i]%'))) $join\" : '' ?>"; break;
|
||||
case '--': $where[] = "<?php echo \$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv NOT LIKE UPPER('%\$v[$i]%'))) $join\" : '' ?>"; break;
|
||||
case '!-': $where[] = "<?php echo \$v[$i]>'' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv NOT LIKE UPPER('\$v[$i]%'))) $join\" : '' ?>"; break;
|
||||
|
||||
case 'SEGMENT': $where[] = "<?
|
||||
case 'SEGMENT': $where[] = "<?php
|
||||
\$v[$i]['seg']=@explode(',',\$v[$i]);
|
||||
\$v[$i]['seg'][0]=(int)trim(\$v[$i]['seg'][0]);
|
||||
\$v[$i]['seg'][1]=(int)trim(\$v[$i]['seg'][1]);
|
||||
echo (\$v[$i]>'' && \$v[$i]{0}!=',' && \$v[$i]['seg'][0] <= \$v[$i]['seg'][1]) ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv >= '\" . \$v[$i]['seg'][0] . \"' AND $fv <= '\" . \$v[$i]['seg'][1] . \"')) $join\" : '');?>"; break;
|
||||
case 'INTERVAL': $where[] = "<?
|
||||
echo (\$v[$i]>'' && \$v[$i]{0}!=',' && \$v[$i]['seg'][0] <= \$v[$i]['seg'][1]) ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv >= '\" . \$v[$i]['seg'][0] . \"' AND $fv <= '\" . \$v[$i]['seg'][1] . \"')) $join\" : ''); ?>"; break;
|
||||
case 'INTERVAL': $where[] = "<?php
|
||||
\$v[$i]['seg']=@explode(',',\$v[$i]);
|
||||
\$v[$i]['seg'][0]=(int)trim(\$v[$i]['seg'][0]);
|
||||
\$v[$i]['seg'][1]=(int)trim(\$v[$i]['seg'][1]);
|
||||
echo (\$v[$i]>'' && \$v[$i]{0}!=',' && \$v[$i]['seg'][0] < \$v[$i]['seg'][1]) ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv > '\" . \$v[$i]['seg'][0] . \"' AND $fv < '\" . \$v[$i]['seg'][1] . \"')) $join\" : '');?>"; break;
|
||||
echo (\$v[$i]>'' && \$v[$i]{0}!=',' && \$v[$i]['seg'][0] < \$v[$i]['seg'][1]) ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv > '\" . \$v[$i]['seg'][0] . \"' AND $fv < '\" . \$v[$i]['seg'][1] . \"')) $join\" : ''); ?>"; break;
|
||||
|
||||
case 'IN=': $where[] = "<?=(\$v[$i]>'' && \$v[$i]{0}!=',') ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv IN (\$v[$i]))) $join\" : ''?>"; break;
|
||||
case 'NOTIN=': $where[] = "<?=(\$v[$i]>'' && \$v[$i]{0}!=',') ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv NOT IN (\$v[$i]))) $join\" : ''?>"; break;
|
||||
case 'IN=': $where[] = "<?php echo (\$v[$i]>'' && \$v[$i]{0}!=',') ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv IN (\$v[$i]))) $join\" : '' ?>"; break;
|
||||
case 'NOTIN=': $where[] = "<?php echo (\$v[$i]>'' && \$v[$i]{0}!=',') ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv NOT IN (\$v[$i]))) $join\" : '' ?>"; break;
|
||||
|
||||
case 'ANY': $where[] = "<?php echo \$v[$i] > '' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND $fv=ANY(\$v[$i]))) $join\" : ''; ?>"; break;
|
||||
case 'FRE': $where[] = "<?php echo \$v[$i] > '' ? \"(t$fid.document_id = a.id AND (t$fid.rubric_field_id = '$fid' AND (\$v[$i]))) $join\" : ''; ?>"; break;
|
||||
@ -453,7 +453,12 @@
|
||||
$item = preg_replace_callback('/\[tag:block:([A-Za-z0-9-_]{1,20}+)\]/', 'parse_block', $template);
|
||||
|
||||
// Парсим теги системных блоков
|
||||
$item = preg_replace_callback('/\[tag:sysblock:([A-Za-z0-9-_]{1,20}+)\]/', 'parse_sysblock', $item);
|
||||
$item = preg_replace_callback('/\[tag:sysblock:([A-Za-z0-9-_]{1,20}+)(|:\{(.*?)\})\]/',
|
||||
function ($m)
|
||||
{
|
||||
return parse_sysblock($m[1], $m[2]);
|
||||
},
|
||||
$item);
|
||||
|
||||
// Парсим элементы полей
|
||||
$item = preg_replace_callback('/\[tag:rfld:([a-zA-Z0-9-_]+)\]\[([0-9]+)]\[([0-9]+)]/',
|
||||
@ -559,6 +564,7 @@
|
||||
$link = rewrite_link('index.php?id=' . $row->Id . '&doc=' . (empty($row->document_alias) ? prepare_url($row->document_title) : $row->document_alias));
|
||||
$item = str_replace('[tag:link]', $link, $item);
|
||||
$item = str_replace('[tag:docid]', $row->Id, $item);
|
||||
$item = str_replace('[tag:itemid]', $row->Id, $item);
|
||||
$item = str_replace('[tag:docitemnum]', $req_item_num, $item);
|
||||
$item = str_replace('[tag:adminlink]', 'index.php?do=docs&action=edit&rubric_id=' . $row->rubric_id . '&Id=' . $row->Id . '&cp=' . session_id() . '', $item);
|
||||
$item = str_replace('[tag:doctitle]', stripslashes(htmlspecialchars_decode($row->document_title)), $item);
|
||||
|
@ -18,9 +18,19 @@
|
||||
*
|
||||
* @return bool|mixed|null|string|string[]
|
||||
*/
|
||||
function parse_sysblock($id)
|
||||
function parse_sysblock ($id, $params = null)
|
||||
{
|
||||
global $AVE_DB;
|
||||
global $AVE_DB, $sysParams;
|
||||
|
||||
$sysblock_eval = _getSysBlock($id, 'sysblock_eval');
|
||||
|
||||
$sparams_id = $id . md5($params); // Создаем уникальный id для каждого набора параметров
|
||||
$sysParams[$sparams_id] = []; // Для отмены лишних ворнингов
|
||||
|
||||
$params = trim($params,':'); // Удаляем: слева ':[', справа ']'
|
||||
$params = json_decode($params, true);
|
||||
|
||||
$sysParams[$sparams_id] = $params;
|
||||
|
||||
if (is_array($id))
|
||||
$id = $id[1];
|
||||
@ -31,8 +41,6 @@
|
||||
|
||||
if ($id != '')
|
||||
{
|
||||
$eval_sysblock = true;
|
||||
|
||||
$cache = md5('sysblock' . $id);
|
||||
|
||||
$cache_file = BASE_DIR . '/tmp/cache/sql/sysblocks/' . $id . '/' . $cache . '.code';
|
||||
@ -94,16 +102,92 @@
|
||||
|
||||
$return = preg_replace_callback('/\[tag:block:([A-Za-z0-9-_]{1,20}+)\]/', 'parse_block', $return);
|
||||
|
||||
if ($eval_sysblock)
|
||||
$return = eval2var('?'.'>' . $return . '<'.'?');
|
||||
// Парсим теги системных блоков
|
||||
$return = preg_replace_callback('/\[tag:sysblock:([A-Za-z0-9-_]{1,20}+)(|:\{(.*?)\})\]/',
|
||||
function ($m)
|
||||
{
|
||||
return parse_sysblock($m[1], $m[2]);
|
||||
},
|
||||
$return);
|
||||
|
||||
$gen_time = Debug::endTime('SYSBLOCK_' . $id);
|
||||
// Если был вызов
|
||||
if ($sysParams != '')
|
||||
{
|
||||
// Заменяем
|
||||
$return = preg_replace_callback('/\[sys:param:([A-Za-z0-9-+_]+)\]/',
|
||||
function ($m) use ($sparams_id)
|
||||
{
|
||||
return params_of_sysblocks($sparams_id, $m[1]);
|
||||
},
|
||||
$return);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Если чистый запрос тизера, просто вытираем tparam
|
||||
$return = preg_replace('/\[sysparam:([A-Za-z0-9-+_]+)\]/', '', $return);
|
||||
}
|
||||
|
||||
$GLOBALS['block_generate']['SYSBLOCK'][$id] = $gen_time;
|
||||
if ($sysblock_eval)
|
||||
$return = eval2var('?'.'>' . $return . '<'.'?php ');
|
||||
|
||||
$GLOBALS['block_generate']['SYSBLOCK'][$id] = Debug::endTime('SYSBLOCK_' . $id);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Функция получения уникальных параметров для каждого
|
||||
*
|
||||
* @param $id
|
||||
* @param $el
|
||||
* @return string
|
||||
*/
|
||||
function params_of_sysblocks($id, $el)
|
||||
{
|
||||
global $sysParams;
|
||||
|
||||
if (isset($sysParams[$id][$el]))
|
||||
return $sysParams[$id][$el];
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Получение основных настроек сисблока
|
||||
*
|
||||
* @param $param string параметр настройки, если не указан - все параметры
|
||||
* @return mixed
|
||||
*/
|
||||
function _getSysBlock($id, $param = '')
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
$sys_block = null;
|
||||
|
||||
if ($sys_block === null)
|
||||
{
|
||||
$sql = "
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
" . PREFIX . "_sysblocks
|
||||
WHERE
|
||||
" . (is_numeric($id) ? 'id' : 'sysblock_alias') . " = '" . $id . "'
|
||||
";
|
||||
|
||||
$sys_block = $AVE_DB->Query($sql, -1, 'sysblocks/' . $id . '/')->FetchAssocArray();
|
||||
}
|
||||
|
||||
if ($param == '')
|
||||
return $sys_block;
|
||||
|
||||
return isset($sys_block[$param])
|
||||
? $sys_block[$param]
|
||||
: null;
|
||||
}
|
||||
?>
|
@ -291,7 +291,7 @@
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE
|
||||
TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'ave325_settings'
|
||||
AND TABLE_NAME = '" . PREFIX . "_settings'
|
||||
AND COLUMN_NAME = 'use_editor';
|
||||
")->GetCell();
|
||||
|
||||
@ -324,4 +324,27 @@
|
||||
");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
$check = $AVE_DB->Query("
|
||||
SHOW COLUMNS
|
||||
FROM
|
||||
" . PREFIX . "_sysblocks
|
||||
LIKE
|
||||
'sysblock_eval'
|
||||
")->NumRows();
|
||||
|
||||
$exist = ($check) ? true : false;
|
||||
|
||||
if ($exist === false)
|
||||
{
|
||||
$AVE_DB->Real_Query("
|
||||
ALTER TABLE
|
||||
" . PREFIX . "_sysblocks
|
||||
ADD
|
||||
`sysblock_eval` enum('0','1') NOT NULL DEFAULT '1'
|
||||
AFTER
|
||||
`sysblock_active`
|
||||
");
|
||||
}
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user