Browse Source

Fixes

pull/3/head
M@dD3n 5 years ago
parent
commit
6a7a7e0688
  1. 2
      admin/templates/js/main.js
  2. 2
      admin/templates/request/form.tpl
  3. 194
      class/class.request.php
  4. 14
      functions/func.parserequest.php
  5. 126
      install/structure_base.sql

2
admin/templates/js/main.js

@ -185,6 +185,8 @@ function openFileWindow(target, id, document_alias) {
ui.item.find(' tr:first td').each(function(index, element) { ui.item.find(' tr:first td').each(function(index, element) {
$(element).width(''); $(element).width('');
}); });
$('.tipsy').remove();
}, },
update: function(event, ui) { update: function(event, ui) {
// отправляем результаты сортировки // отправляем результаты сортировки

2
admin/templates/request/form.tpl

@ -211,7 +211,7 @@ function changeRub(select) {ldelim}
<td>{#REQUEST_SORT_BY_NAT#}</td> <td>{#REQUEST_SORT_BY_NAT#}</td>
<td> <td>
<select {$dis} style="width: 250px" name="request_order_by_nat" id="request_order_by_nat" class="mousetrap"> <select {$dis} style="width: 250px" name="request_order_by_nat" id="request_order_by_nat" class="mousetrap">
<option>&nbsp;</option> <option value="">&nbsp;</option>
{foreach from=$fields_list item=field_group} {foreach from=$fields_list item=field_group}
{if $groups_count > 1} {if $groups_count > 1}

194
class/class.request.php

@ -25,6 +25,8 @@
* Метод, предназначенный для получения и вывода списка Запросов * Метод, предназначенный для получения и вывода списка Запросов
* *
* @param boolean $pagination признак формирования постраничного списка * @param boolean $pagination признак формирования постраничного списка
*
* @return array
*/ */
function _requestListGet($pagination = true) function _requestListGet($pagination = true)
{ {
@ -76,6 +78,7 @@
return $items; return $items;
} }
/** /**
* Получить наименование и описание Запроса по идентификатору * Получить наименование и описание Запроса по идентификатору
* *
@ -106,8 +109,14 @@
return $requests[$request_id]; return $requests[$request_id];
} }
/** /**
* Проверка алиаса тега на валидность и уникальность * Проверка алиаса тега на валидность и уникальность
*
* @param string $alias
* @param int $id
*
* @return bool|string
*/ */
function requestValidate ($alias = '', $id = 0) function requestValidate ($alias = '', $id = 0)
{ {
@ -129,9 +138,6 @@
")->GetCell(); ")->GetCell();
} }
/**
* Внешние методы класса
*/
/** /**
* Метод, предназначенный для формирования списка Запросов * Метод, предназначенный для формирования списка Запросов
@ -144,6 +150,7 @@
$AVE_Template->assign('conditions', $this->_requestListGet(false)); $AVE_Template->assign('conditions', $this->_requestListGet(false));
} }
/** /**
* Метод, предназначенный для отображения списка Запросов * Метод, предназначенный для отображения списка Запросов
* *
@ -161,6 +168,7 @@
$AVE_Template->assign('content', $AVE_Template->fetch('request/list.tpl')); $AVE_Template->assign('content', $AVE_Template->fetch('request/list.tpl'));
} }
/** /**
* Метод, предназначенный для создания нового Запроса * Метод, предназначенный для создания нового Запроса
* *
@ -185,26 +193,26 @@
$save = true; $save = true;
$errors = array(); $errors = array();
$row->request_template_item = pretty_chars($_REQUEST['request_template_item']); $row = new stdClass();
$row->request_template_item = stripslashes($row->request_template_item);
$row->request_template_main = pretty_chars($_REQUEST['request_template_main']); $row->request_template_item = stripslashes(pretty_chars($_REQUEST['request_template_item']));
$row->request_template_main = stripslashes($row->request_template_main); $row->request_template_main = stripslashes(pretty_chars($_REQUEST['request_template_main']));
$row->request_title = stripslashes($_REQUEST['request_title']); $row->request_title = stripslashes($_REQUEST['request_title']);
$row->rubric_id = stripslashes($_REQUEST['rubric_id']); $row->rubric_id = stripslashes($_REQUEST['rubric_id']);
$row->request_items_per_page = stripslashes($_REQUEST['request_items_per_page']); $row->request_items_per_page = stripslashes($_REQUEST['request_items_per_page']);
$row->request_order_by = stripslashes($_REQUEST['request_order_by']); $row->request_order_by = stripslashes($_REQUEST['request_order_by']);
$row->request_order_by_nat = stripslashes($_REQUEST['request_order_by_nat']); $row->request_order_by_nat = stripslashes($_REQUEST['request_order_by_nat']);
$row->request_asc_desc = stripslashes($_REQUEST['request_asc_desc']); $row->request_asc_desc = stripslashes($_REQUEST['request_asc_desc']);
$row->request_description = stripslashes($_REQUEST['request_description']); $row->request_description = stripslashes($_REQUEST['request_description']);
$row->request_show_pagination = (isset($_REQUEST['request_show_pagination']) ? (int)($_REQUEST['request_show_pagination']) : 0); $row->request_show_pagination = (isset($_REQUEST['request_show_pagination']) ? (int)($_REQUEST['request_show_pagination']) : 0);
$row->request_pagination = (isset($_REQUEST['request_pagination']) ? (int)($_REQUEST['request_pagination']) : 1); $row->request_pagination = (isset($_REQUEST['request_pagination']) ? (int)($_REQUEST['request_pagination']) : 1);
$row->request_only_owner = (isset($_REQUEST['request_only_owner']) ? (int)($_REQUEST['request_only_owner']) : 0); $row->request_only_owner = (isset($_REQUEST['request_only_owner']) ? (int)($_REQUEST['request_only_owner']) : 0);
$row->request_cache_lifetime = (int)($_REQUEST['request_cache_lifetime']); $row->request_cache_lifetime = (int)($_REQUEST['request_cache_lifetime']);
$row->request_lang = (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0); $row->request_lang = (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0);
$row->request_cache_elements = (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0); $row->request_cache_elements = (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0);
$row->request_external = (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0); $row->request_external = (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0);
$row->request_ajax = (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0); $row->request_ajax = (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0);
$row->request_show_sql = (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0); $row->request_show_sql = (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0);
if (empty($_REQUEST['rubric_id'])) if (empty($_REQUEST['rubric_id']))
{ {
@ -245,36 +253,40 @@
} }
else else
{ {
// Выполняем запрос к БД и сохраняем введенную пользователем информацию $sql = "
$AVE_DB->Query("
INSERT " . PREFIX . "_request INSERT " . PREFIX . "_request
SET SET
rubric_id = '" . (int)$_REQUEST['rubric_id'] . "', rubric_id = '" . (int)$_REQUEST['rubric_id'] . "',
request_alias = '" . $_REQUEST['request_alias'] . "', request_alias = '" . (isset($_REQUEST['request_alias']) ? stripslashes($_REQUEST['request_alias']) : '') . "',
request_title = '" . $_REQUEST['request_title'] . "', request_title = '" . (isset($_REQUEST['request_title']) ? stripslashes($_REQUEST['request_title']) : '') . "',
request_items_per_page = '" . $_REQUEST['request_items_per_page'] . "', request_items_per_page = '" . (isset($_REQUEST['request_items_per_page']) ? stripslashes($_REQUEST['request_items_per_page']) : 0) . "',
request_template_item = '" . $_REQUEST['request_template_item'] . "', request_template_item = '" . (isset($_REQUEST['request_template_item']) ? stripslashes(pretty_chars($_REQUEST['request_template_item'])) : '') . "',
request_template_main = '" . $_REQUEST['request_template_main'] . "', request_template_main = '" . (isset($_REQUEST['request_template_main']) ? stripslashes(pretty_chars($_REQUEST['request_template_main'])) : '') . "',
request_order_by = '" . $_REQUEST['request_order_by'] . "', request_order_by = '" . (isset($_REQUEST['request_order_by']) ? stripslashes($_REQUEST['request_order_by']) : '') . "',
request_order_by_nat = '" . $_REQUEST['request_order_by_nat'] . "', request_order_by_nat = '" . (isset($_REQUEST['request_order_by_nat']) ? (int)trim($_REQUEST['request_order_by_nat']) : 0) . "',
request_asc_desc = '" . $_REQUEST['request_asc_desc'] . "', request_description = '" . (isset($_REQUEST['request_description']) ? stripslashes($_REQUEST['request_description']) : '') . "',
request_author_id = '" . (int)$_SESSION['user_id'] . "', request_author_id = '" . (int)$_SESSION['user_id'] . "',
request_created = '" . time() . "', request_created = '" . time() . "',
request_description = '" . $_REQUEST['request_description'] . "', request_asc_desc = '" . (isset($_REQUEST['request_asc_desc']) ? stripslashes($_REQUEST['request_asc_desc']) : 'DESC') . "',
request_show_pagination = '" . (isset($_REQUEST['request_show_pagination']) ? (int)$_REQUEST['request_show_pagination'] : 0) . "', request_show_pagination = '" . (isset($_REQUEST['request_show_pagination']) ? (int)$_REQUEST['request_show_pagination'] : 0) . "',
request_pagination = '" . (isset($_REQUEST['request_pagination']) ? (int)$_REQUEST['request_pagination'] : 1) . "', request_pagination = '" . (isset($_REQUEST['request_pagination']) ? (int)$_REQUEST['request_pagination'] : 1) . "',
request_use_query = '" . (isset($_REQUEST['request_use_query']) ? (int)$_REQUEST['request_use_query'] : 0) . "', request_use_query = '" . (isset($_REQUEST['request_use_query']) ? (int)$_REQUEST['request_use_query'] : 0) . "',
request_count_items = '" . (isset($_REQUEST['request_count_items']) ? (int)$_REQUEST['request_count_items'] : 0) . "', request_count_items = '" . (isset($_REQUEST['request_count_items']) ? (int)$_REQUEST['request_count_items'] : 0) . "',
request_hide_current = '" . (int)$_REQUEST['request_hide_current'] . "', request_hide_current = '" . (isset($_REQUEST['request_hide_current']) ? (int)($_REQUEST['request_hide_current']) : 0) . "',
request_only_owner = '" . (int)$_REQUEST['request_only_owner'] . "', request_only_owner = '" . (isset($_REQUEST['request_only_owner']) ? (int)($_REQUEST['request_only_owner']) : 0) . "',
request_cache_lifetime = '" . (int)$_REQUEST['request_cache_lifetime'] . "', request_cache_lifetime = '" . (isset($_REQUEST['request_cache_lifetime']) ? (int)($_REQUEST['request_cache_lifetime']) : 0) . "',
request_lang = '" . (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0) . "', request_lang = '" . (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0). "',
request_cache_elements = '" . (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0). "', request_cache_elements = '" . (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0). "',
request_show_statistic = '" . (isset($_REQUEST['request_show_statistic']) ? (int)$_REQUEST['request_show_statistic'] : 0). "', request_show_statistic = '" . (isset($_REQUEST['request_show_statistic']) ? (int)$_REQUEST['request_show_statistic'] : 0). "',
request_external = '" . (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0). "', request_external = '" . (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0). "',
request_ajax = '" . (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0). "', request_ajax = '" . (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0). "',
request_show_sql = '" . (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0). "' request_show_sql = '" . (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0). "',
"); request_changed = '" . time() . "',
request_changed_elements = '" . time() . "'
";
// Выполняем запрос к БД и сохраняем введенную пользователем информацию
$AVE_DB->Query($sql);
// Получаем id последней записи // Получаем id последней записи
$iid = $AVE_DB->InsertId(); $iid = $AVE_DB->InsertId();
@ -302,6 +314,7 @@
} }
} }
/** /**
* Метод, предназначенный для редактирования Запроса * Метод, предназначенный для редактирования Запроса
* *
@ -382,7 +395,7 @@
$row->rubric_id = (isset($_REQUEST['rubric_id']) ? stripslashes($_REQUEST['rubric_id']) : 0); $row->rubric_id = (isset($_REQUEST['rubric_id']) ? stripslashes($_REQUEST['rubric_id']) : 0);
$row->request_items_per_page = (isset($_REQUEST['request_items_per_page']) ? stripslashes($_REQUEST['request_items_per_page']) : 0); $row->request_items_per_page = (isset($_REQUEST['request_items_per_page']) ? stripslashes($_REQUEST['request_items_per_page']) : 0);
$row->request_order_by = (isset($_REQUEST['request_order_by']) ? stripslashes($_REQUEST['request_order_by']) : ''); $row->request_order_by = (isset($_REQUEST['request_order_by']) ? stripslashes($_REQUEST['request_order_by']) : '');
$row->request_order_by_nat = (isset($_REQUEST['request_order_by_nat']) ? stripslashes($_REQUEST['request_order_by_nat']) : ''); $row->request_order_by_nat = (isset($_REQUEST['request_order_by_nat']) ? (int)trim($_REQUEST['request_order_by_nat']) : 0);
$row->request_asc_desc = (isset($_REQUEST['request_asc_desc']) ? stripslashes($_REQUEST['request_asc_desc']) : 'DESC'); $row->request_asc_desc = (isset($_REQUEST['request_asc_desc']) ? stripslashes($_REQUEST['request_asc_desc']) : 'DESC');
$row->request_description = (isset($_REQUEST['request_description']) ? stripslashes($_REQUEST['request_description']) : ''); $row->request_description = (isset($_REQUEST['request_description']) ? stripslashes($_REQUEST['request_description']) : '');
$row->request_show_pagination = (isset($_REQUEST['request_show_pagination']) ? $_REQUEST['request_show_pagination'] : 0); $row->request_show_pagination = (isset($_REQUEST['request_show_pagination']) ? $_REQUEST['request_show_pagination'] : 0);
@ -398,6 +411,8 @@
$row->request_ajax = (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0); $row->request_ajax = (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0);
$row->request_show_sql = (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0); $row->request_show_sql = (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0);
$message = '';
if (empty($_REQUEST['rubric_id'])) if (empty($_REQUEST['rubric_id']))
{ {
$save = false; $save = false;
@ -447,40 +462,44 @@
else else
{ {
// Выполняем запрос к БД и обновляем имеющиеся данные // Выполняем запрос к БД и обновляем имеющиеся данные
$AVE_DB->Query(" $sql = "
UPDATE " . PREFIX . "_request UPDATE " . PREFIX . "_request
SET SET
rubric_id = '" . (int)$_REQUEST['rubric_id'] . "', rubric_id = '" . (int)$_REQUEST['rubric_id'] . "',
request_alias = '" . $_REQUEST['request_alias'] . "', request_alias = '" . (isset($_REQUEST['request_alias']) ? $_REQUEST['request_alias'] : '') . "',
request_title = '" . $_REQUEST['request_title'] . "', request_title = '" . (isset($_REQUEST['request_title']) ? $_REQUEST['request_title'] : '') . "',
request_items_per_page = '" . $_REQUEST['request_items_per_page'] . "', request_items_per_page = '" . (isset($_REQUEST['request_items_per_page']) ? $_REQUEST['request_items_per_page'] : 0) . "',
request_template_item = '" . $_REQUEST['request_template_item'] . "', request_template_item = '" . (isset($_REQUEST['request_template_item']) ? $_REQUEST['request_template_item'] : '') . "',
request_template_main = '" . $_REQUEST['request_template_main'] . "', request_template_main = '" . (isset($_REQUEST['request_template_main']) ? $_REQUEST['request_template_main'] : '') . "',
request_order_by = '" . $_REQUEST['request_order_by'] . "', request_order_by = '" . (isset($_REQUEST['request_order_by']) ? $_REQUEST['request_order_by'] : '') . "',
request_order_by_nat = '" . $_REQUEST['request_order_by_nat'] . "', request_order_by_nat = '" . (isset($_REQUEST['request_order_by_nat']) ? (int)trim($_REQUEST['request_order_by_nat']) : 0) . "',
request_description = '" . $_REQUEST['request_description'] . "', request_description = '" . (isset($_REQUEST['request_description']) ? $_REQUEST['request_description'] : '') . "',
request_asc_desc = '" . $_REQUEST['request_asc_desc'] . "', request_asc_desc = '" . (isset($_REQUEST['request_asc_desc']) ? $_REQUEST['request_asc_desc'] : 'DESC') . "',
request_show_pagination = '" . (isset($_REQUEST['request_show_pagination']) ? (int)$_REQUEST['request_show_pagination'] : 0) . "', request_show_pagination = '" . (isset($_REQUEST['request_show_pagination']) ? (int)$_REQUEST['request_show_pagination'] : 0) . "',
request_pagination = '" . (isset($_REQUEST['request_pagination']) ? (int)$_REQUEST['request_pagination'] : 1) . "', request_pagination = '" . (isset($_REQUEST['request_pagination']) ? (int)$_REQUEST['request_pagination'] : 1) . "',
request_use_query = '" . (isset($_REQUEST['request_use_query']) ? (int)$_REQUEST['request_use_query'] : 0) . "', request_use_query = '" . (isset($_REQUEST['request_use_query']) ? (int)$_REQUEST['request_use_query'] : 0) . "',
request_count_items = '" . (isset($_REQUEST['request_count_items']) ? (int)$_REQUEST['request_count_items'] : 0) . "', request_count_items = '" . (isset($_REQUEST['request_count_items']) ? (int)$_REQUEST['request_count_items'] : 0) . "',
request_hide_current = '" . @(int)$_REQUEST['request_hide_current'] . "', request_hide_current = '" . (isset($_REQUEST['request_hide_current']) ? (int)($_REQUEST['request_hide_current']) : 0) . "',
request_only_owner = '" . @(int)$_REQUEST['request_only_owner'] . "', request_only_owner = '" . (isset($_REQUEST['request_only_owner']) ? (int)($_REQUEST['request_only_owner']) : 0) . "',
request_cache_lifetime = '" . (int)($_REQUEST['request_cache_lifetime']>'' ? $_REQUEST['request_cache_lifetime'] : '-1') . "', request_cache_lifetime = '" . (isset($_REQUEST['request_cache_lifetime']) ? (int)($_REQUEST['request_cache_lifetime']) : '-1') . "',
request_lang = '" . (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0). "', request_lang = '" . (isset($_REQUEST['request_lang']) ? (int)$_REQUEST['request_lang'] : 0). "',
request_cache_elements = '" . (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0). "', request_cache_elements = '" . (isset($_REQUEST['request_cache_elements']) ? (int)$_REQUEST['request_cache_elements'] : 0). "',
request_show_statistic = '" . (isset($_REQUEST['request_show_statistic']) ? (int)$_REQUEST['request_show_statistic'] : 0). "', request_show_statistic = '" . (isset($_REQUEST['request_show_statistic']) ? (int)$_REQUEST['request_show_statistic'] : 0). "',
request_external = '" . (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0). "', request_external = '" . (isset($_REQUEST['request_external']) ? (int)$_REQUEST['request_external'] : 0). "',
request_ajax = '" . (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0). "', request_ajax = '" . (isset($_REQUEST['request_ajax']) ? (int)$_REQUEST['request_ajax'] : 0). "',
request_show_sql = '" . (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0). "', request_show_sql = '" . (isset($_REQUEST['request_show_sql']) ? (int)$_REQUEST['request_show_sql'] : 0). "',
request_changed = '" . time() . "', request_changed = '" . time() . "',
request_changed_elements = '" . time() . "' request_changed_elements = '" . time() . "'
WHERE WHERE
Id = '" . $request_id . "' Id = '" . $request_id . "'
"); ";
$AVE_DB->Query($sql);
$AVE_DB->clearRequest($request_id); $AVE_DB->clearRequest($request_id);
// ToDO Сделать проверку на сохранение
// Сохраняем системное сообщение в журнал // Сохраняем системное сообщение в журнал
reportLog($AVE_Template->get_config_vars('REQUEST_SAVE_CHA_SUC') . ' (' . stripslashes(htmlspecialchars($_REQUEST['request_title'], ENT_QUOTES)) . ') (Id:' . $request_id . ')'); reportLog($AVE_Template->get_config_vars('REQUEST_SAVE_CHA_SUC') . ' (' . stripslashes(htmlspecialchars($_REQUEST['request_title'], ENT_QUOTES)) . ') (Id:' . $request_id . ')');
@ -503,6 +522,7 @@
} }
} }
/** /**
* Метод, предназначенный для создания копии Запроса * Метод, предназначенный для создания копии Запроса
* *
@ -588,6 +608,7 @@
exit; exit;
} }
/** /**
* Метод, предназначенный для удаления запроса * Метод, предназначенный для удаления запроса
* *
@ -625,6 +646,7 @@
exit; exit;
} }
/** /**
* Метод, предназначенный для редактирования условий Запроса * Метод, предназначенный для редактирования условий Запроса
* *
@ -653,9 +675,7 @@
// Обрабатываем полученные данные и формируем массив // Обрабатываем полученные данные и формируем массив
while ($row = $sql->FetchRow()) while ($row = $sql->FetchRow())
{
array_push($fields, $row); array_push($fields, $row);
}
$conditions = array(); $conditions = array();
@ -709,7 +729,6 @@
exit; exit;
// Если пользователь нажал кнопку Сохранить изменения // Если пользователь нажал кнопку Сохранить изменения
case 'save': case 'save':
// Если существует хотя бы одно условие, тогда // Если существует хотя бы одно условие, тогда
@ -798,7 +817,7 @@
$AVE_DB->clearRequest($request_id); $AVE_DB->clearRequest($request_id);
if (!isAjax() && $_REQUEST['ajax'] != '1') if (! isAjax())
{ {
// Выполняем обновление страницы // Выполняем обновление страницы
header('Location:index.php?do=request&action=conditions&rubric_id=' . $_REQUEST['rubric_id'] . '&Id=' . $request_id . '&cp=' . SESSION . ($_REQUEST['pop'] ? '&pop=1' : '')); header('Location:index.php?do=request&action=conditions&rubric_id=' . $_REQUEST['rubric_id'] . '&Id=' . $request_id . '&cp=' . SESSION . ($_REQUEST['pop'] ? '&pop=1' : ''));
@ -886,6 +905,10 @@
} }
/**
* @param $field_id
* @param $cond_id
*/
function conditionFieldChange($field_id, $cond_id) function conditionFieldChange($field_id, $cond_id)
{ {
global $AVE_DB, $AVE_Template; global $AVE_DB, $AVE_Template;
@ -897,10 +920,15 @@
} }
/**
* @param $field_id
* @param $cond_id
*/
function conditionFieldChangeSave($field_id, $cond_id) function conditionFieldChangeSave($field_id, $cond_id)
{ {
global $AVE_DB, $AVE_Template; global $AVE_DB, $AVE_Template;
// ToDo
$sql = $AVE_DB->Query(" $sql = $AVE_DB->Query("
UPDATE UPDATE
" . PREFIX . "_request_conditions " . PREFIX . "_request_conditions

14
functions/func.parserequest.php

@ -267,11 +267,13 @@
* *
* @return string * @return string
*/ */
function request_get_document_field($field_id, $document_id, $maxlength = '', $rubric_id = 0) function request_get_document_field($field_id, $document_id, $maxlength = null, $rubric_id = 0)
{ {
if (! is_numeric($document_id) || $document_id < 1) if (! is_numeric($document_id) || $document_id < 1)
return ''; return '';
$_maxlength = $maxlength;
$document_fields = get_document_fields($document_id); $document_fields = get_document_fields($document_id);
if (! is_array($document_fields[$field_id])) if (! is_array($document_fields[$field_id]))
@ -290,7 +292,7 @@
if (! is_callable($func)) if (! is_callable($func))
$func = 'get_field_default'; $func = 'get_field_default';
$field_value = $func($field_value, 'req', $field_id, $document_fields[$field_id]['rubric_field_template_request'], $document_fields[$field_id]['tpl_req_empty'], $maxlength, $document_fields, $rubric_id, $document_fields[$field_id]['rubric_field_default']); $field_value = $func($field_value, 'req', $field_id, $document_fields[$field_id]['rubric_field_template_request'], $document_fields[$field_id]['tpl_req_empty'], $_maxlength, $document_fields, $rubric_id, $document_fields[$field_id]['rubric_field_default']);
if ($maxlength != '') if ($maxlength != '')
{ {
@ -435,6 +437,7 @@
if (! file_exists($cachefile_docid)) if (! file_exists($cachefile_docid))
{ {
// Если включено в настройках, проверять поле по содержимому
if (defined('USE_GET_FIELDS') && USE_GET_FIELDS) if (defined('USE_GET_FIELDS') && USE_GET_FIELDS)
{ {
$template = preg_replace("/\[tag:if_notempty:rfld:([a-zA-Z0-9-_]+)]\[(more|esc|img|strip|[0-9-]+)]/u", '<'.'?php if((htmlspecialchars(get_field(\'$1\', '.$row->Id.'), ENT_QUOTES)) != \'\') { '.'?'.'>', $template); $template = preg_replace("/\[tag:if_notempty:rfld:([a-zA-Z0-9-_]+)]\[(more|esc|img|strip|[0-9-]+)]/u", '<'.'?php if((htmlspecialchars(get_field(\'$1\', '.$row->Id.'), ENT_QUOTES)) != \'\') { '.'?'.'>', $template);
@ -470,9 +473,9 @@
// Парсим теги полей // Парсим теги полей
$item = preg_replace_callback('/\[tag:rfld:([a-zA-Z0-9-_]+)]\[(more|esc|img|strip|[0-9-]+)]/', $item = preg_replace_callback('/\[tag:rfld:([a-zA-Z0-9-_]+)]\[(more|esc|img|strip|[0-9-]+)]/',
function ($m) use ($row) function ($match) use ($row)
{ {
return request_get_document_field($m[1], (int)$row->Id, $m[2], (int)$row->rubric_id); return request_get_document_field($match[1], (int)$row->Id, $match[2], (int)$row->rubric_id);
}, },
$item); $item);
@ -484,7 +487,6 @@
}, },
$item); $item);
// Возвращаем поле документа из БД (document_***) // Возвращаем поле документа из БД (document_***)
$item = preg_replace_callback('/\[tag:doc:([a-zA-Z0-9-_]+)\]/u', $item = preg_replace_callback('/\[tag:doc:([a-zA-Z0-9-_]+)\]/u',
function ($m) use ($row) function ($m) use ($row)
@ -708,7 +710,7 @@
: 'DESC'; : 'DESC';
// ToDo - ХЗ что это // ToDo - ХЗ что это
$request_order[$param] = "$fid " . $asc_desc; $request_order[$sort] = "$fid " . $asc_desc;
} }
} }
} }

126
install/structure_base.sql

@ -23,18 +23,18 @@ CREATE TABLE `%%PRFX%%_countries` (
CREATE TABLE `%%PRFX%%_document_fields` ( CREATE TABLE `%%PRFX%%_document_fields` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`rubric_field_id` mediumint(5) unsigned NOT NULL DEFAULT '0', `rubric_field_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
`document_id` int(10) unsigned NOT NULL DEFAULT '0', `document_id` int(10) unsigned NOT NULL DEFAULT '0',
`field_number_value` decimal(18,4) NOT NULL DEFAULT '0.0000', `field_number_value` decimal(18,4) NOT NULL DEFAULT '0.0000',
`field_value` varchar(500) NOT NULL, `field_value` varchar(500) NOT NULL,
`document_in_search` enum('1','0') NOT NULL DEFAULT '1', `document_in_search` enum('1','0') NOT NULL DEFAULT '1',
PRIMARY KEY (`Id`), PRIMARY KEY (`Id`),
KEY `document_id` (`document_id`), KEY `document_id` (`document_id`),
KEY `field_value` (`field_value`(333)), KEY `field_id` (`rubric_field_id`),
KEY `field_number_value` (`field_number_value`), KEY `value` (`field_value`),
KEY `rubric_field_id` (`rubric_field_id`), KEY `number_value` (`field_number_value`),
KEY `queries` (`document_id`,`rubric_field_id`) KEY `queries` (`document_id`, `rubric_field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst# ) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
@ -86,46 +86,44 @@ CREATE TABLE `%%PRFX%%_document_rev` (
CREATE TABLE `%%PRFX%%_documents` ( CREATE TABLE `%%PRFX%%_documents` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`rubric_id` mediumint(5) unsigned NOT NULL DEFAULT '0', `rubric_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
`rubric_tmpl_id` mediumint(5) unsigned NOT NULL DEFAULT '0', `rubric_tmpl_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
`document_parent` int(10) unsigned NOT NULL DEFAULT '0', `document_parent` int(10) unsigned NOT NULL DEFAULT '0',
`document_alias` varchar(255) NOT NULL, `document_alias` varchar(255) NOT NULL DEFAULT '',
`document_alias_history` enum('0','1','2') NOT NULL DEFAULT '0', `document_alias_history` enum('0','1','2') NOT NULL DEFAULT '0',
`document_short_alias` varchar(10) NOT NULL DEFAULT '', `document_short_alias` VARCHAR(10) NOT NULL DEFAULT '', # 3.24
`document_title` varchar(255) NOT NULL, `document_title` varchar(255) NOT NULL DEFAULT '',
`document_breadcrum_title` varchar(255) NOT NULL, `document_breadcrum_title` varchar(255) NOT NULL DEFAULT '',
`document_published` int(10) unsigned NOT NULL DEFAULT '0', `document_published` int(10) unsigned NOT NULL DEFAULT '0',
`document_expire` int(10) unsigned NOT NULL DEFAULT '0', `document_expire` int(10) unsigned NOT NULL DEFAULT '0',
`document_changed` int(10) unsigned NOT NULL DEFAULT '0', `document_changed` int(10) unsigned NOT NULL DEFAULT '0',
`document_author_id` mediumint(5) unsigned NOT NULL DEFAULT '1', `document_author_id` mediumint(5) unsigned NOT NULL DEFAULT '1',
`document_in_search` enum('1','0') NOT NULL DEFAULT '1', `document_in_search` enum('1','0') NOT NULL DEFAULT '1',
`document_meta_keywords` text NOT NULL, `document_meta_keywords` text NOT NULL DEFAULT '',
`document_meta_description` text NOT NULL, `document_meta_description` text NOT NULL DEFAULT '',
`document_meta_robots` enum('index,follow','index,nofollow','noindex,nofollow') NOT NULL DEFAULT 'index,follow', `document_meta_robots` enum('index,follow','index,nofollow','noindex,nofollow') NOT NULL DEFAULT 'index,follow',
`document_sitemap_freq` tinyint(1) NOT NULL DEFAULT '3', `document_sitemap_freq` tinyint(1) NOT NULL DEFAULT '3',
`document_sitemap_pr` float NOT NULL DEFAULT '0.5', `document_sitemap_pr` float NOT NULL DEFAULT '0.5',
`document_status` enum('1','0') NOT NULL DEFAULT '1', `document_status` enum('1','0') NOT NULL DEFAULT '1',
`document_deleted` enum('0','1') NOT NULL DEFAULT '0', `document_deleted` enum('0','1') NOT NULL DEFAULT '0',
`document_count_print` int(10) unsigned NOT NULL DEFAULT '0', `document_count_print` int(10) unsigned NOT NULL DEFAULT '0',
`document_count_view` int(10) unsigned NOT NULL DEFAULT '0', `document_count_view` int(10) unsigned NOT NULL DEFAULT '0',
`document_linked_navi_id` mediumint(5) unsigned NOT NULL DEFAULT '0', `document_linked_navi_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
`document_teaser` text NOT NULL, `document_teaser` text NOT NULL DEFAULT '',
`document_tags` text NOT NULL, `document_tags` text NOT NULL DEFAULT '',
`document_lang` varchar(5) NOT NULL, `document_lang` varchar(5) NOT NULL DEFAULT '',
`document_lang_group` int(10) NOT NULL DEFAULT '0', `document_lang_group` int(10) NOT NULL DEFAULT '0',
`document_property` text, `document_property` text,
`document_rating` int(3) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`Id`), PRIMARY KEY (`Id`),
UNIQUE KEY `document_alias` (`document_alias`), UNIQUE KEY `alias` (`document_alias`),
KEY `rubric_id` (`rubric_id`), KEY `rubric_id` (`rubric_id`),
KEY `document_parent` (`document_parent`), KEY `parent` (`document_parent`),
KEY `document_published` (`document_published`), KEY `published` (`document_published`),
KEY `document_expire` (`document_expire`), KEY `expire` (`document_expire`),
KEY `document_status` (`document_status`), KEY `status` (`document_status`),
KEY `document_deleted` (`document_deleted`), KEY `deleted` (`document_deleted`),
KEY `document_count_view` (`document_count_view`), KEY `count_view` (`document_count_view`)
KEY `document_rating` (`document_rating`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst# ) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
@ -269,7 +267,7 @@ CREATE TABLE `%%PRFX%%_request` (
`request_show_pagination` enum('0','1') NOT NULL DEFAULT '0', `request_show_pagination` enum('0','1') NOT NULL DEFAULT '0',
`request_pagination` smallint(3) unsigned NOT NULL DEFAULT '1', `request_pagination` smallint(3) unsigned NOT NULL DEFAULT '1',
`request_use_query` enum('0','1') NOT NULL DEFAULT '0', `request_use_query` enum('0','1') NOT NULL DEFAULT '0',
`request_where_cond` text NOT NULL, `request_where_cond` text NOT NULL DEFAULT '', # 3.26
`request_hide_current` enum('0','1') NOT NULL DEFAULT '1', `request_hide_current` enum('0','1') NOT NULL DEFAULT '1',
`request_only_owner` enum('0','1') NOT NULL DEFAULT '0', `request_only_owner` enum('0','1') NOT NULL DEFAULT '0',
`request_cache_lifetime` int(11) NOT NULL DEFAULT '0', `request_cache_lifetime` int(11) NOT NULL DEFAULT '0',
@ -363,24 +361,24 @@ CREATE TABLE `%%PRFX%%_rubric_permissions` (
CREATE TABLE `%%PRFX%%_rubrics` ( CREATE TABLE `%%PRFX%%_rubrics` (
`Id` smallint(3) unsigned NOT NULL AUTO_INCREMENT, `Id` smallint(3) unsigned NOT NULL AUTO_INCREMENT,
`rubric_title` varchar(255) NOT NULL, `rubric_title` varchar(255) NOT NULL DEFAULT '', # 3.26
`rubric_alias` varchar(255) NOT NULL, `rubric_alias` varchar(255) NOT NULL DEFAULT '', # 3.26
`rubric_alias_history` enum('0','1') default '0' NOT NULL, `rubric_alias_history` enum('0','1') NOT NULL DEFAULT '0',
`rubric_template` text NOT NULL, `rubric_template` longtext NOT NULL DEFAULT '', # 3.26
`rubric_template_id` smallint(3) unsigned NOT NULL DEFAULT '1', `rubric_template_id` smallint(3) unsigned NOT NULL DEFAULT '1',
`rubric_author_id` int(10) unsigned NOT NULL DEFAULT '1', `rubric_author_id` int(10) unsigned NOT NULL DEFAULT '1',
`rubric_created` int(10) unsigned NOT NULL DEFAULT '0', `rubric_created` int(10) unsigned NOT NULL DEFAULT '0',
`rubric_docs_active` int(1) unsigned NOT NULL DEFAULT '1', `rubric_docs_active` int(1) unsigned NOT NULL DEFAULT '1',
`rubric_start_code` text NOT NULL, `rubric_start_code` text NOT NULL DEFAULT '', # 3.26
`rubric_code_start` text NOT NULL, `rubric_code_start` text NOT NULL DEFAULT '', # 3.26
`rubric_code_end` text NOT NULL, `rubric_code_end` text NOT NULL DEFAULT '', # 3.26
`rubric_teaser_template` text NOT NULL, `rubric_teaser_template` text NOT NULL DEFAULT '', # 3.26
`rubric_admin_teaser_template` text NOT NULL, `rubric_admin_teaser_template` text NOT NULL DEFAULT '', # 3.26
`rubric_header_template` text NOT NULL, `rubric_header_template` text NOT NULL DEFAULT '', # 3.26
`rubric_footer_template` text NOT NULL, `rubric_footer_template` text NOT NULL DEFAULT '', # 3.26
`rubric_linked_rubric` varchar(255) NOT NULL DEFAULT '0', `rubric_linked_rubric` varchar(255) NOT NULL DEFAULT '0',
`rubric_description` text NOT NULL, `rubric_description` text NOT NULL DEFAULT '', # 3.26
`rubric_meta_gen` enum('0','1') default '0' NOT NULL, `rubric_meta_gen` enum('0','1') NOT NULL DEFAULT '0',
`rubric_position` int(11) unsigned NOT NULL DEFAULT '100', `rubric_position` int(11) unsigned NOT NULL DEFAULT '100',
`rubric_changed` int(10) NOT NULL DEFAULT '0', # 3.24 `rubric_changed` int(10) NOT NULL DEFAULT '0', # 3.24
`rubric_changed_fields` int(10) NOT NULL DEFAULT '0', # 3.24 `rubric_changed_fields` int(10) NOT NULL DEFAULT '0', # 3.24

Loading…
Cancel
Save