");
+ $field_value = strip_tags($field_value); // "
"
if (is_numeric($length) && $length != 0)
{
@@ -406,7 +409,7 @@
*/
function get_document_fields($document_id, $values = null)
{
- global $AVE_DB, $request_documents;
+ global $AVE_DB, $request_documents, $AVE_Core;
static $document_fields = array();
@@ -419,42 +422,64 @@
$where = "WHERE doc_field.document_id = '" . $document_id . "'";
- $query="
+ $query = "
SELECT
+ # DOC FIELDS = $document_id
+ doc.document_author_id,
doc_field.Id,
doc_field.document_id,
doc_field.rubric_field_id,
+ doc_field.field_value,
+ text_field.field_value as field_value_more,
rub_field.rubric_field_alias,
rub_field.rubric_field_type,
rub_field.rubric_field_default,
- doc_field.field_value,
- text_field.field_value as field_value_more,
- doc.document_author_id,
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)
+ 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
+ ON doc.Id = doc_field.document_id
" . $where;
- $sql = $AVE_DB->Query($query, -1, 'doc_'.$document_id);
+ $cache_id = (int)$AVE_Core->curentdoc->Id;
+ $cache_id = 'documents/fields/' . (floor($cache_id / 1000)) . '/' . $cache_id;
- //Вдруг памяти мало!!!!
- if (memory_panic() && (count($document_fields) > 3))
+ $cache_file = md5($query) . '.fields';
+
+ $cache_dir = BASE_DIR . '/tmp/cache/sql/' . (trim($cache_id) > ''
+ ? trim($cache_id) . '/'
+ : substr($cache_file, 0, 2) . '/' . substr($cache_file, 2, 2) . '/' . substr($cache_file, 4, 2) . '/');
+
+ // Наличие файла
+ if (file_exists($cache_dir . $cache_file))
{
- $document_fields = array();
+ // Получаем время создания файла
+ $file_time = filemtime($cache_dir . $cache_file);
+
+ // Получаем время для проверки
+ $cache_time = $AVE_Core->curentdoc->rubric_changed_fields;
+
+ // Сравниваем временные метки
+ if (! $cache_time || $cache_time > $file_time)
+ unlink ($cache_dir . $cache_file);
}
+ // Безусловный кеш
+ $sql = $AVE_DB->Query($query, -1, 'fld_' . $document_id, true, '.fields');
+
+ // Вдруг памяти мало!!!!
+ if (memory_panic() && (count($document_fields) > 3))
+ $document_fields = array();
+
while ($row = $sql->FetchAssocArray())
{
$row['tpl_req_empty'] = (trim($row['rubric_field_template_request']) == '');
diff --git a/functions/func.navigation.php b/functions/func.navigation.php
index cc4bc53..ad304f5 100644
--- a/functions/func.navigation.php
+++ b/functions/func.navigation.php
@@ -29,6 +29,7 @@
// Достаем для проверки тип меню
$sql = "
SELECT
+ # NAVIGATION = $navi_id
expand_ext
FROM
".PREFIX."_navigation
@@ -38,7 +39,7 @@
alias = '" . $navi_id . "'
";
- $expnad_ext = $AVE_DB->Query($sql, SYSTEM_CACHE_LIFETIME, 'nav_' . $navi_id)->GetCell();
+ $expnad_ext = $AVE_DB->Query($sql, -1, 'nav_' . $navi_id, true, '.naviagtion')->GetCell();
// извлекаем level из аргумента
$navi_print_level = (! empty($navi_tag[2]))
@@ -47,7 +48,7 @@
$navi = '';
- $cache_file = BASE_DIR . '/tmp/cache/sql/nav/template-' . $navi_id . '.cache';
+ $cache_file = BASE_DIR . '/tmp/cache/sql/navigations/' . $navi_id . '/template.cache';
// Если включен DEV MODE, то отключаем кеширование запросов
if (defined('DEV_MODE') AND DEV_MODE || $expnad_ext != 1)
@@ -108,18 +109,28 @@
// запрос для выборки по текущему алиасу
$sql_doc_active_alias = '';
+ $url_suff = '';
+
+ if (defined('URL_SUFF') AND URL_SUFF)
+ {
+ $url_suff = "
+ OR nav.alias = '" . $alias . URL_SUFF . "'
+ OR nav.alias = '/" . $alias . URL_SUFF . "'
+ ";
+ }
+
if ($AVE_Core->curentdoc->Id == $doc_active_id)
{
$sql_doc_active_alias = "
OR nav.alias = '" . $alias . "'
OR nav.alias = '/" . $alias . "'
- OR nav.alias = '" . $alias . URL_SUFF . "'
- OR nav.alias = '/" . $alias . URL_SUFF . "'
+ " . $url_suff . "
";
}
$navi_active = $AVE_DB->Query("
- SELECT CONCAT_WS(
+ SELECT
+ CONCAT_WS(
';',
CONCAT_WS(',', nav.navigation_item_id, nav.parent_id, nav2.parent_id),
CONCAT_WS(',', nav.level),
@@ -201,7 +212,7 @@
}
}
- $cache_items = BASE_DIR . '/tmp/cache/sql/nav/items-' . $navi_id . '.cache';
+ $cache_items = BASE_DIR . '/tmp/cache/sql/navigations/' . $navi_id . '/items.cache';
$navi_items = array();
@@ -216,7 +227,8 @@
{
//-- Запрос пунктов меню
$sql = "
- SELECT *
+ SELECT
+ *
FROM
" . PREFIX . "_navigation_items
WHERE
@@ -246,7 +258,8 @@
{
//-- Запрос пунктов меню
$sql = "
- SELECT *
+ SELECT
+ *
FROM
" . PREFIX . "_navigation_items
WHERE
@@ -464,7 +477,7 @@
if (empty($navi))
$navi = '';
- $navi .= eval2var(' ?>' . $item . '' . $item . '<'.'?php ');
}
// Вставляем все пункты уровня в шаблон уровня
diff --git a/functions/func.parserequest.php b/functions/func.parserequest.php
index 82ed43c..13a782e 100755
--- a/functions/func.parserequest.php
+++ b/functions/func.parserequest.php
@@ -16,14 +16,17 @@
global $AVE_DB;
// Получаем информацию о запросе
- $reqest_settings = $AVE_DB->Query("
+ $sql = "
SELECT
+ #REQUEST SETTINGS = $id
*
FROM
" . PREFIX . "_request
WHERE
" . (is_numeric($id) ? 'Id' : 'request_alias') . " = '" . $id . "'
- ", -1, 'request/settings/' . $id)->FetchRow();
+ ";
+
+ $reqest_settings = $AVE_DB->Query($sql, -1, 'rqs_' . $id, true, '.settings')->FetchRow();
// Выходим, если нет запроса
if (! is_object($reqest_settings))
@@ -197,7 +200,7 @@
Id = '" . $id . "'
");
- $AVE_DB->clear_request($id);
+ $AVE_DB->clearRequest($id);
}
return @$retval;
@@ -275,7 +278,7 @@
if ($maxlength != '')
{
- if ($maxlength == 'more' || $maxlength == 'esc'|| $maxlength == 'img')
+ if ($maxlength == 'more' || $maxlength == 'esc'|| $maxlength == 'img' || $maxlength == 'strip')
{
if ($maxlength == 'more')
{
@@ -291,6 +294,13 @@
{
$field_value = getImgSrc($field_value);
}
+ elseif ($maxlength == 'strip')
+ {
+ $field_value = str_replace(array("\r\n","\n","\r"), " ", $field_value);
+ $field_value = strip_tags($field_value, REQUEST_STRIP_TAGS);
+ $field_value = preg_replace('/ +/', ' ', $field_value);
+ $field_value = trim($field_value);
+ }
}
elseif (is_numeric($maxlength))
{
@@ -336,22 +346,23 @@
// Функция получения элемента запроса
function showrequestelement($mixed, $template = '', $tparams = '')
{
- global $AVE_DB, $req_item_num, $params_of_teaser, $use_cache;
+ global
+ $AVE_DB,
+ $req_item_num,
+ $params_of_teaser,
+ $use_cache,
+ $request_id,
+ $request_changed,
+ $request_changed_elements;
if (is_array($mixed))
- $mixed = $mixed[1];
+ $row = intval($mixed[1]);
- $row = (is_object($mixed) ? $mixed : $AVE_DB->Query("
- SELECT
- a.*
- FROM
- " . PREFIX . "_documents AS a
- WHERE
- a.Id = '" . intval($mixed) . "'
- GROUP BY
- a.Id
- LIMIT 1
- ")->FetchRow());
+ $row = (is_object($mixed)
+ ? $mixed
+ : getDocument($row));
+
+ unset ($mixed);
if (! $row)
return '';
@@ -360,17 +371,47 @@
if ($tparams != '')
{
- $tparams_id = $row->Id.md5($tparams); // Создаем уникальный id для каждого набора параметров
+ $tparams_id = $row->Id . md5($tparams); // Создаем уникальный id для каждого набора параметров
$params_of_teaser[$tparams_id] = array(); // Для отмены лишних ворнингов
$tparams = trim($tparams,'[]:'); // Удаляем: слева ':[', справа ']'
$params_of_teaser[$tparams_id] = explode('|',$tparams); // Заносим параметры в массив уникального id
}
- $template = ($template > '' ? $template : $AVE_DB->Query(
- "SELECT rubric_teaser_template FROM " . PREFIX . "_rubrics WHERE Id='" . intval($row->rubric_id) . "'"
- )->GetCell());
+ $sql = "
+ SELECT
+ rubric_teaser_template
+ FROM
+ " . PREFIX . "_rubrics
+ WHERE
+ Id = '" . intval($row->rubric_id) . "'
+ ";
+
+ $template = ($template > ''
+ ? $template
+ : $AVE_DB->Query($sql)->GetCell());
+
+ $hash = 'g-' . UGROUP; // Группа пользователей
+ $hash .= 'r-' . $request_id; // ID Запроса
+ $hash .= 't-' . $row->Id; // ID документа
+
+ $hash = md5($hash);
- $cachefile_docid = BASE_DIR . '/tmp/cache/sql/request/' . $row->Id . '/request-' . md5($template) . '.cache';
+ $cache_id = 'requests/elements/' . (floor($row->Id / 1000)) . '/' . $row->Id;
+
+ $cachefile_docid = BASE_DIR . '/tmp/cache/sql/' . $cache_id . '/' . $hash . '.element';
+
+ if (file_exists($cachefile_docid) && isset($use_cache) && $use_cache == 1)
+ {
+ $check_file = $request_changed_elements;
+
+ if ($check_file > filemtime($cachefile_docid))
+ unlink ($cachefile_docid);
+ }
+ else
+ {
+ if (file_exists($cachefile_docid))
+ unlink ($cachefile_docid);
+ }
// Если включен DEV MODE, то отключаем кеширование запросов
if (defined('DEV_MODE') AND DEV_MODE)
@@ -378,8 +419,8 @@
if (! file_exists($cachefile_docid))
{
- $template = preg_replace("/\[tag:if_notempty:rfld:([a-zA-Z0-9-_]+)]\[(more|esc|img|[0-9-]+)]/u", '<'.'?php if((htmlspecialchars(request_get_document_field(\'$1\', '.$row->Id.', \'$2\', '.(int)$row->rubric_id.'), ENT_QUOTES)) != \'\') { '.'?'.'>', $template);
- $template = preg_replace("/\[tag:if_empty:rfld:([a-zA-Z0-9-_]+)]\[(more|esc|img|[0-9-]+)]/u", '<'.'?php if((htmlspecialchars(request_get_document_field(\'$1\', '.$row->Id.', \'$2\', '.(int)$row->rubric_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(request_get_document_field(\'$1\', '.$row->Id.', \'$2\', '.(int)$row->rubric_id.'), ENT_QUOTES)) != \'\') { '.'?'.'>', $template);
+ $template = preg_replace("/\[tag:if_empty:rfld:([a-zA-Z0-9-_]+)]\[(more|esc|img|strip|[0-9-]+)]/u", '<'.'?php if((htmlspecialchars(request_get_document_field(\'$1\', '.$row->Id.', \'$2\', '.(int)$row->rubric_id.'), ENT_QUOTES)) == \'\') { '.'?'.'>', $template);
$template = str_replace('[tag:if:else]', '', $template);
$template = str_replace('[tag:/if]', '', $template);
@@ -401,7 +442,7 @@
// Парсим теги полей
$item = preg_replace_callback(
- '/\[tag:rfld:([a-zA-Z0-9-_]+)]\[(more|esc|img|[0-9-]+)]/',
+ '/\[tag:rfld:([a-zA-Z0-9-_]+)]\[(more|esc|img|strip|[0-9-]+)]/',
create_function(
'$m',
'return request_get_document_field($m[1], ' . $row->Id . ', $m[2], ' . (int)$row->rubric_id . ');'
@@ -411,7 +452,7 @@
// Повторно парсим теги полей
$item = preg_replace_callback(
- '/\[tag:rfld:([a-zA-Z0-9-_]+)]\[(more|esc|img|[0-9-]+)]/',
+ '/\[tag:rfld:([a-zA-Z0-9-_]+)]\[(more|esc|img|strip|[0-9-]+)]/',
create_function(
'$m',
'return request_get_document_field($m[1], ' . $row->Id . ', $m[2], ' . (int)$row->rubric_id . ');'
@@ -472,7 +513,6 @@
if ($tparams != '')
{
// Заменяем tparam в тизере
- // $item = preg_replace('/\[tparam:([0-9]+)\]/', '<'.'?php echo $params_of_teaser["'.$tparams_id.'"][$1]'.'?'.'>', $item); // косячная версия, пока оставил
$item = preg_replace_callback(
'/\[tparam:([0-9]+)\]/',
create_function(
@@ -715,12 +755,9 @@
$request_where[] = "a.document_published <= UNIX_TIMESTAMP() AND (a.document_expire = 0 OR a.document_expire >= UNIX_TIMESTAMP())";
// Условия запроса
- // если используется выпадающий список, получаем строку без сохранения
- if (! empty($_POST['req_' . $id]) || ! empty($_SESSION['doc_' . $AVE_Core->curentdoc->Id]['req_' . $id]))
- $where_cond = request_get_condition_sql_string($request->Id, false);
// если условия пустые, получаем строку с сохранением её в бд
- elseif (! $request->request_where_cond)
- $where_cond = request_get_condition_sql_string($request->Id, true);
+ if (! $request->request_where_cond)
+ $where_cond = request_get_condition_sql_string($request->Id, false);
// иначе, берём из запроса
else
$where_cond = unserialize($request->request_where_cond);
@@ -795,73 +832,84 @@
if ($request_select)
$request_select_str = ',' . implode(",\r\n",$request_select);
- unset($a, $t, $v);
+ unset ($a, $t, $v);
- // Составляем запрос к БД
- $sql = " ?>
- #REQUEST = $request->Id
- SELECT STRAIGHT_JOIN SQL_CALC_FOUND_ROWS
- a.*
- " . $request_select_str . "
- FROM
- " . $where_cond['from'] . "
- " . (isset($params['USER_FROM']) ? $params['USER_FROM'] : '') . "
- " . PREFIX . "_documents AS a
- " . implode(' ', $request_join) . "
- " . (isset($params['USER_JOIN']) ? $params['USER_FROM'] : '') . "
- WHERE
- " . $request_where_str . "
- GROUP BY a.Id
- " . $request_order_str . "
- " . $limit_str . "
- ";
-
- $sql_request = eval2var($sql);
+ if (! isset($params['SQL_QUERY']))
+ {
+ // Составляем запрос к БД
+ $sql = " ?>
+ SELECT STRAIGHT_JOIN SQL_CALC_FOUND_ROWS
+ #REQUEST = $request->Id
+ a.*
+ " . $request_select_str . "
+ FROM
+ " . $where_cond['from'] . "
+ " . (isset($params['USER_FROM']) ? $params['USER_FROM'] : '') . "
+ " . PREFIX . "_documents AS a
+ " . implode(' ', $request_join) . "
+ " . (isset($params['USER_JOIN']) ? $params['USER_FROM'] : '') . "
+ WHERE
+ " . $request_where_str . "
+ GROUP BY a.Id
+ " . $request_order_str . "
+ " . $limit_str . "
+ "."php ";
- unset($sql);
+ $sql_request = eval2var($sql);
- // Убираем дубли в выборе полей
- foreach(array_keys($request_join) AS $key)
- {
- $search = PREFIX . '_document_fields AS t' . $key . ',';
+ unset ($sql);
- if (preg_match('/' . $search . '/', $sql_request) > 0)
+ // Убираем дубли в выборе полей
+ foreach (array_keys($request_join) AS $key)
{
- $sql_request = str_replace($search, '', $sql_request);
+ $search = PREFIX . '_document_fields AS t' . $key . ',';
+
+ if (preg_match('/' . $search . '/', $sql_request) > 0)
+ {
+ $sql_request = str_replace($search, '', $sql_request);
+ }
}
- }
- // Если просили просто показать сформированный запрос
- if ((isset($params['DEBUG']) && $params['DEBUG'] == 1) || $request->request_show_sql == 1)
- {
- $return = Debug::_print($sql_request);
+ // Если просили просто показать сформированный запрос
+ if ((isset($params['DEBUG']) && $params['DEBUG'] == 1) || $request->request_show_sql == 1)
+ {
+ $return = Debug::_print($sql_request);
- return $return;
+ return $return;
+ }
}
+ else
+ {
+ $sql_request = $params['SQL_QUERY'];
+ }
// Выполняем запрос к бд
- $sql = $AVE_DB->Query($sql_request, (int)$request->request_cache_lifetime, 'rub_' . $request->rubric_id);
+ $sql = $AVE_DB->Query($sql_request, (int)$request->request_cache_lifetime, 'rqs_' . $id, true, '.request');
- // Если просили просто вернуть запрос, возвращаем результат
+ // Если просили просто вернуть резльтат запроса, возвращаем результат
if (isset($params['RETURN_SQL']) && $params['RETURN_SQL'] == 1)
return $AVE_DB->GetFoundRows();
+ $num_items = 0;
+
// Если есть вывод пагинации, то выполняем запрос на получение кол-ва элементов
if ($request->request_show_pagination == 1 || (isset($params['SHOW']) && $params['SHOW'] == 1))
- $num_items = $AVE_DB->NumAllRows($sql_request, (int)$request->request_cache_lifetime, 'rub_' . $request->rubric_id);
+ $num_items = $AVE_DB->NumAllRows($sql_request, (int)$request->request_cache_lifetime, 'rqs_' . $id);
else
- $num_items = $AVE_DB->GetFoundRows();
+ $num_items = ((isset($params['NO_FOUND_ROWS']) && $params['NO_FOUND_ROWS'] == 1) || ! $request->request_count_items
+ ? 0
+ : $AVE_DB->GetFoundRows());
// Если просили просто вернуть кол-во, возвращаем результат
if (isset($params['RETURN_COUNT']) && $params['RETURN_COUNT'] == 1)
return $num_items;
- unset($sql_request);
+ unset ($sql_request);
// Приступаем к обработке шаблона
$main_template = $request->request_template_main;
- //-- Если кол-во элементов больше 0
+ //-- Если кол-во элементов больше 0, удалаяем лишнее
if ($num_items > 0)
{
$main_template = preg_replace('/\[tag:if_empty](.*?)\[\/tag:if_empty]/si', '', $main_template);
@@ -903,12 +951,13 @@
}
// Запоминаем глобально
- @$GLOBALS['page_id'][$_REQUEST['id']]['apage'] = (@$GLOBALS['page_id'][$_REQUEST['id']]['apage'] > $num_pages
+ @$GLOBALS['page_id'][$_REQUEST['id']]['apage'] = (isset($GLOBALS['page_id'][$_REQUEST['id']]['apage']) && $GLOBALS['page_id'][$_REQUEST['id']]['apage'] > $num_pages
? @$GLOBALS['page_id'][$_REQUEST['id']]['apage']
: $num_pages);
$pagination = '';
+ // Если кол-во страниц больше 1й
if ($num_pages > 1)
{
$queries = '';
@@ -976,10 +1025,15 @@
//-- Общее число элементов
$items_count = count($rows);
- global $req_item_num, $use_cache;
+ global $req_item_num, $use_cache, $request_id, $request_changed, $request_changed_elements;
$use_cache = $request->request_cache_elements;
+ $request_id = $request->Id;
+
+ $request_changed = $request->request_changed;
+ $request_changed_elements = $request->request_changed_elements;
+
$item = '';
foreach ($rows as $row)
diff --git a/functions/func.watermarks.php b/functions/func.watermarks.php
index dc4e03c..8cd6901 100644
--- a/functions/func.watermarks.php
+++ b/functions/func.watermarks.php
@@ -1,213 +1,226 @@
> 8) . chr($length & 0xFF);
- }
- else
+ /**
+ * AVE.cms
+ *
+ * @package AVE.cms
+ * @version 3.x
+ * @filesource
+ * @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
+ *
+ * @license GPL v.2
+ */
+
+
+ /**
+ * Функция дописывает в JPG файлы IPTC Tag
+ *
+ * @param string $rec
+ * @param string $data
+ * @param string $value
+ * @return string
+ */
+
+ if (! function_exists('iptc_make_tag'))
{
- $retval .= chr(0x80) .
- chr(0x04) .
- chr(($length >> 24) & 0xFF) .
- chr(($length >> 16) & 0xFF) .
- chr(($length >> 8) & 0xFF) .
- chr($length & 0xFF);
- }
-
- return $retval . $value;
-}
-
-/**
- * Функция накладывает watermark на заданный файл
- *
- * @param string $file URL Файла
- * @param string $position Позиция
- * @param int $transparency Прозарчность
- * @return string link
- */
-function watermarks($file, $position='center', $transparency=100) {
+ function iptc_make_tag($rec, $data, $value)
+ {
+ $length = strlen($value);
+ $retval = chr(0x1C) . chr($rec) . chr($data);
- global $AVE_DB;
+ if ($length < 0x8000)
+ {
+ $retval .= chr($length >> 8) . chr($length & 0xFF);
+ }
+ else
+ {
+ $retval .= chr(0x80) .
+ chr(0x04) .
+ chr(($length >> 24) & 0xFF) .
+ chr(($length >> 16) & 0xFF) .
+ chr(($length >> 8) & 0xFF) .
+ chr($length & 0xFF);
+ }
- if (!defined('WATERMARKS_DIR') || !defined('WATERMARKS_FILE')) exit(0);
+ return $retval . $value;
+ }
+ }
- $save = true;
- $margin = 10;
+ /**
+ * Функция накладывает watermark на заданный файл
+ *
+ * @param string $file URL Файла
+ * @param string $position Позиция
+ * @param int $transparency Прозарчность
+ * @return string link
+ */
+ function watermarks($file, $position='center', $transparency=100)
+ {
+ global $AVE_DB;
- $file_info = pathinfo($file);
+ if (! defined('WATERMARKS_DIR') || ! defined('WATERMARKS_FILE'))
+ return $file;
- $watermarkFile = BASE_DIR . '/' . WATERMARKS_FILE;
- $watermarkDir = BASE_DIR . '/' . WATERMARKS_DIR;
+ $save = true;
- $imagePath = BASE_DIR . '/' . trim($file_info['dirname'], '/');
- $imageName = $file_info['basename'];
+ $margin = 10;
- $copyPath = $watermarkDir . '/' . trim($file_info['dirname'], '/');
- $copyName = $imageName;
+ $file_info = pathinfo($file);
- if(!is_dir($watermarkDir)) {
- @mkdir($watermarkDir, 0777, true);
- write_htaccess_deny($watermarkDir);
- }
+ $watermarkFile = BASE_DIR . '/' . WATERMARKS_FILE;
+ $watermarkDir = BASE_DIR . '/' . WATERMARKS_DIR;
- if(file_exists("$copyPath/$copyName") || !file_exists("$imagePath/$imageName")){
- $save = false;
- }
+ $imagePath = BASE_DIR . '/' . trim($file_info['dirname'], '/');
+ $imageName = $file_info['basename'];
- if(file_exists($watermarkFile) && file_exists("$imagePath/$imageName")){
+ $copyPath = $watermarkDir . '/' . trim($file_info['dirname'], '/');
+ $copyName = $imageName;
- $size_image = getimagesize("$imagePath/$imageName");
- $size_wtmrk = getimagesize($watermarkFile);
+ if (! file_exists($watermarkDir . $file))
+ return $file;
- list($xImage, $yImage) = $size_image;
- list($xWtmrk, $yWtmrk) = $size_wtmrk;
+ if (! is_dir($watermarkDir))
+ {
+ @mkdir($watermarkDir, 0777, true);
+ write_htaccess_deny($watermarkDir);
+ }
- if ($xImage < $xWtmrk || $yImage < $yWtmrk) {
+ if (file_exists("$copyPath/$copyName") || !file_exists("$imagePath/$imageName"))
$save = false;
- } else {
- $save = true;
- }
- }
- if (file_exists("$copyPath/$copyName")) $save = false;
+ if (file_exists($watermarkFile) && file_exists("$imagePath/$imageName"))
+ {
+ $size_image = getimagesize("$imagePath/$imageName");
+ $size_wtmrk = getimagesize($watermarkFile);
- if ($save){
- if (!is_dir($copyPath) && !@mkdir($copyPath, 0777, true)) exit(0);
- require_once BASE_DIR.'/class/class.thumbnail.php';
- $watermark = new Image_Toolbox("$imagePath/$imageName");
+ list($xImage, $yImage) = $size_image;
+ list($xWtmrk, $yWtmrk) = $size_wtmrk;
- if (rename("$imagePath/$imageName", "$copyPath/$copyName"))
- {
- $old = umask(0);
- chmod("$copyPath/$copyName", 0777);
- umask($old);
+ if ($xImage < $xWtmrk || $yImage < $yWtmrk)
+ $save = false;
+ else
+ $save = true;
}
- switch ($position)
+ if (file_exists("$copyPath/$copyName"))
+ $save = false;
+
+ if ($save)
{
- case 'top':
- case 'topcenter':
- $xLogoPosition = 'center -';
- $yLogoPosition = 'top +'.$margin;
- break;
-
- case 'topleft':
- $xLogoPosition = 'left +'.$margin;
- $yLogoPosition = 'top +'.$margin;
- break;
-
- case 'topright':
- $xLogoPosition = 'right -'.$margin;
- $yLogoPosition = 'top +'.$margin;
- break;
-
- case 'center':
- $xLogoPosition = 'center -';
- $yLogoPosition = 'center -';
- break;
-
- case 'centerleft':
- $xLogoPosition = 'left +'.$margin;
- $yLogoPosition = 'center -';
- break;
-
- case 'centerright':
- $xLogoPosition = 'right -'.$margin;
- $yLogoPosition = 'center -';
- break;
-
- case 'bottom':
- case 'bottomcenter':
- $xLogoPosition = 'center -';
- $yLogoPosition = 'bottom -'.$margin;
- break;
-
- case 'bottomleft':
- $xLogoPosition = 'left +'.$margin;
- $yLogoPosition = 'bottom -'.$margin;
- break;
-
- case 'bottomright':
- $xLogoPosition = 'right -'.$margin;
- $yLogoPosition = 'bottom -'.$margin;
- break;
-
- case 'repeat':
- $xLogoPosition = 'repeat ';
- $yLogoPosition = 'repeat ';
- break;
-
- default:
- $xLogoPosition = 'center -';
- $yLogoPosition = 'center -';
- break;
- }
+ if (! is_dir($copyPath) && !@mkdir($copyPath, 0777, true))
+ return $file;
- $watermark->addImage($watermarkFile);
- $watermark->blend($xLogoPosition, $yLogoPosition, IMAGE_TOOLBOX_BLEND_COPY, $transparency);
- $watermark->save("$imagePath/$imageName");
+ require_once BASE_DIR.'/class/class.thumbnail.php';
- if($watermark->_img['main']['type']==2){
- $image = getimagesize("$imagePath/$imageName", $info);
- if(!isset($info['APP13']))
+ $watermark = new Image_Toolbox("$imagePath/$imageName");
+
+ if (rename("$imagePath/$imageName", "$copyPath/$copyName"))
{
+ $old = umask(0);
+ chmod("$copyPath/$copyName", 0777);
+ umask($old);
+ }
- $sitename = get_settings('site_name');
+ switch ($position)
+ {
+ case 'top':
+ case 'topcenter':
+ $xLogoPosition = 'center -';
+ $yLogoPosition = 'top +'.$margin;
+ break;
+
+ case 'topleft':
+ $xLogoPosition = 'left +'.$margin;
+ $yLogoPosition = 'top +'.$margin;
+ break;
+
+ case 'topright':
+ $xLogoPosition = 'right -'.$margin;
+ $yLogoPosition = 'top +'.$margin;
+ break;
+
+ case 'center':
+ $xLogoPosition = 'center -';
+ $yLogoPosition = 'center -';
+ break;
+
+ case 'centerleft':
+ $xLogoPosition = 'left +'.$margin;
+ $yLogoPosition = 'center -';
+ break;
+
+ case 'centerright':
+ $xLogoPosition = 'right -'.$margin;
+ $yLogoPosition = 'center -';
+ break;
+
+ case 'bottom':
+ case 'bottomcenter':
+ $xLogoPosition = 'center -';
+ $yLogoPosition = 'bottom -'.$margin;
+ break;
+
+ case 'bottomleft':
+ $xLogoPosition = 'left +'.$margin;
+ $yLogoPosition = 'bottom -'.$margin;
+ break;
+
+ case 'bottomright':
+ $xLogoPosition = 'right -'.$margin;
+ $yLogoPosition = 'bottom -'.$margin;
+ break;
+
+ case 'repeat':
+ $xLogoPosition = 'repeat ';
+ $yLogoPosition = 'repeat ';
+ break;
+
+ default:
+ $xLogoPosition = 'center -';
+ $yLogoPosition = 'center -';
+ break;
+ }
- // установка IPTC тэгов
- $iptc = array(
- '2#120' => iconv("UTF-8","WINDOWS-1251",$sitename),
- '2#116' => "http://".$_SERVER['SERVER_NAME']
- );
+ $watermark->addImage($watermarkFile);
+ $watermark->blend($xLogoPosition, $yLogoPosition, IMAGE_TOOLBOX_BLEND_COPY, $transparency);
+ $watermark->save("$imagePath/$imageName");
- // Преобразование IPTC тэгов в двоичный код
- $data = '';
+ if ($watermark->_img['main']['type'] == 2)
+ {
+ $image = getimagesize("$imagePath/$imageName", $info);
- foreach($iptc as $tag => $string)
+ if (! isset($info['APP13']))
{
- $tag = substr($tag, 2);
- $data .= iptc_make_tag(2, $tag, $string);
+ $sitename = get_settings('site_name');
+
+ // установка IPTC тэгов
+ $iptc = array(
+ '2#120' => iconv("UTF-8","WINDOWS-1251",$sitename),
+ '2#116' => "http://".$_SERVER['SERVER_NAME']
+ );
+
+ // Преобразование IPTC тэгов в двоичный код
+ $data = '';
+
+ foreach ($iptc AS $tag => $string)
+ {
+ $tag = substr($tag, 2);
+ $data .= iptc_make_tag(2, $tag, $string);
+ }
+
+ // Встраивание IPTC данных
+ $content = iptcembed($data, "$imagePath/$imageName");
+
+ // запись нового изображения в файл
+ $fp = fopen("$imagePath/$imageName", "wb");
+ fwrite($fp, $content);
+ fclose($fp);
}
-
- // Встраивание IPTC данных
- $content = iptcembed($data, "$imagePath/$imageName");
-
- // запись нового изображения в файл
- $fp = fopen("$imagePath/$imageName", "wb");
- fwrite($fp, $content);
- fclose($fp);
}
+
+ unset($watermark);
}
- unset($watermark);
+ return $file;
}
-
- return $file;
-}
-
-?>
+?>
\ No newline at end of file
diff --git a/inc/config.php b/inc/config.php
index 24822e8..0018560 100755
--- a/inc/config.php
+++ b/inc/config.php
@@ -124,8 +124,8 @@
$GLOBALS['CMS_CONFIG']['SMARTY_USE_SUB_DIRS'] = array('DESCR' => 'Создание папок для кэширования Установите это в false если ваше окружение PHP не разрешает создание директорий от имени Smarty. Поддиректории более эффективны, так что используйте их, если можете.','default'=>true,'TYPE'=>'bool','VARIANT'=>'');
$GLOBALS['CMS_CONFIG']['CACHE_DOC_TPL'] = array('DESCR' => 'Кэширование скомпилированных шаблонов документов','default'=>true,'TYPE'=>'bool','VARIANT'=>'');
$GLOBALS['CMS_CONFIG']['CACHE_DOC_FILE'] = array('DESCR' => 'Кэширование скомпилированных шаблонов документов в файлах','default'=>true,'TYPE'=>'bool','VARIANT'=>'');
- $GLOBALS['CMS_CONFIG']['CACHE_DOC_SQL'] = array('DESCR' => 'Кэширование SQL запроса информации о документе','default'=>0,'TYPE'=>'integer','VARIANT'=>'');
- $GLOBALS['CMS_CONFIG']['SYSTEM_CACHE_LIFETIME'] = array('DESCR' => 'Время жизни кеша запроса к настройкам системы (60*60*24*14 - 2 недели)','default'=>0,'TYPE'=>'integer','VARIANT'=>'');
+
+ $GLOBALS['CMS_CONFIG']['SITEMAP_CACHE_LIFETIME'] = array('DESCR' => 'Время жизни кеша для карты сайта (60*60*24*14 - 2 недели)','default'=>0,'TYPE'=>'integer','VARIANT'=>'');
$GLOBALS['CMS_CONFIG']['YANDEX_MAP_API_KEY'] = array('DESCR' => 'Yandex MAP API REY','default'=>'','TYPE'=>'string','VARIANT'=>'');
$GLOBALS['CMS_CONFIG']['GOOGLE_MAP_API_KEY'] = array('DESCR' => 'Google MAP API REY','default'=>'','TYPE'=>'string','VARIANT'=>'');
diff --git a/inc/init.php b/inc/init.php
index b824495..0010906 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -6,7 +6,7 @@
* @package AVE.cms
* @version 3.x
* @filesource
- * @copyright © 2007-2016 AVE.cms, http://www.ave-cms.ru
+ * @copyright © 2007-2018 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
@@ -212,9 +212,12 @@
foreach (array(ATTACH_DIR, 'cache', 'backup', 'logs', 'session', 'update') as $dir)
write_htaccess_deny(BASE_DIR . '/tmp/' . $dir);
- foreach (array('combine', 'module', 'redactor', 'smarty', 'sql', 'templates', 'tpl') as $dir)
+ foreach (array('check', 'combine', 'module', 'redactor', 'smarty', 'sql', 'tpl') as $dir)
write_htaccess_deny(BASE_DIR . '/tmp/cache/' . $dir);
+ //-- Шаблоны
+ write_htaccess_deny(BASE_DIR . '/templates/' . DEFAULT_THEME_FOLDER . '/include/');
+
global $AVE_DB;
//-- Класс для работы с MySQL (Global $AVE_DB)
@@ -362,6 +365,7 @@
$sql = $AVE_DB->Query("
SELECT
+ # LANGS
*
FROM
" . PREFIX . "_settings_lang
@@ -369,7 +373,7 @@
lang_status = '1'
ORDER BY
lang_default ASC
- ", SYSTEM_CACHE_LIFETIME, 'langs');
+ ", -1, 'langs', true, '.langs');
while ($row = $sql->FetchRow())
{
@@ -406,6 +410,12 @@
//-- Класс пагинации
require (BASE_DIR . '/class/class.paginations.php');
+ // Класс UTM
+ require (BASE_DIR . '/class/class.utm.php');
+ $AVE_Utm = new UTMCookie;
+
+ $AVE_Utm->save_parameters();
+
//-- Класс Модулей
require (BASE_DIR . '/class/class.modules.php');
$AVE_Module = new AVE_Module;
diff --git a/inc/sitemap.php b/inc/sitemap.php
index c475486..3723d7f 100644
--- a/inc/sitemap.php
+++ b/inc/sitemap.php
@@ -17,7 +17,7 @@
define ('BASE_DIR', str_replace("\\", "/", rtrim($_SERVER['DOCUMENT_ROOT'],'/')));
- if (! @filesize(BASE_DIR . '/inc/db.config.php'))
+ if (! @filesize(BASE_DIR . '/config/db.config.php'))
{
header ('Location: Location:install/index.php');
exit;
@@ -32,15 +32,6 @@
$abs_path = str_ireplace(BASE_DIR, '/', str_replace("\\", "/", dirname(dirname(__FILE__))));
- if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')
- {
- $domain = 'https://'.$_SERVER['SERVER_NAME'];
- }
- else
- {
- $domain = 'http://'.$_SERVER['SERVER_NAME'];
- }
-
// Проверяем настройку на публикацию документов
$publish = get_settings('use_doctime')
? 'AND doc.document_published < UNIX_TIMESTAMP() AND doc.document_expire > UNIX_TIMESTAMP()'
@@ -67,7 +58,7 @@
// Вытаскиваем кол-во документов
$sql = "
SELECT STRAIGHT_JOIN SQL_CALC_FOUND_ROWS
- COUNT(doc.Id)
+ COUNT(doc.Id) AS count
FROM
" . PREFIX . "_documents doc
LEFT JOIN
@@ -86,7 +77,7 @@
AND (rubperm.user_group_id = 2 AND rubperm.rubric_permission LIKE '%docread%')
";
- $num = $AVE_DB->Query($sql)->GetCell();
+ $num = $AVE_DB->Query($sql, SITEMAP_CACHE_LIFETIME, 'sitemap')->GetCell();
if ($num > $_end)
$parts = ceil($num/$_end);
@@ -98,7 +89,7 @@
for ($i = 1; $i <= $parts; $i++):
?>
- = $domain . '/sitemap-' . $i . '.xml'; ?>
+ = HOST . '/sitemap-' . $i . '.xml'; ?>
= date("c"); ?>
endfor;
@@ -127,6 +118,7 @@
AND doc.document_status = 1
AND doc.document_deleted = 1
$publish
+ AND doc.Id != 1
AND doc.Id != " . PAGE_NOT_FOUND_ID . "
AND (document_meta_robots NOT LIKE '%noindex%' or document_meta_robots NOT LIKE '%nofollow%')
AND (rubperm.user_group_id = 2 AND rubperm.rubric_permission LIKE '%docread%')
@@ -134,14 +126,14 @@
LIMIT ".$_start.",".$_end."
";
- $res = $AVE_DB->Query($sql);
+ $res = $AVE_DB->Query($sql, SITEMAP_CACHE_LIFETIME, 'sitemap');
echo '' . PHP_EOL;
echo '' . PHP_EOL;
if ((int)$_REQUEST['id'] == 1):
?>
- echo $domain . '/'; ?>
+ echo HOST . '/'; ?>
echo date("c", time()); ?>
weekly
0.8
@@ -150,7 +142,7 @@
while($row = $res->FetchAssocArray()):
$document_alias = $abs_path . $row['document_alias'] . URL_SUFF;
- $document_alias = $domain . str_ireplace($abs_path . '/' . URL_SUFF, '/', $document_alias);
+ $document_alias = HOST . str_ireplace($abs_path . '/' . URL_SUFF, '/', $document_alias);
$date = $row["document_published"] ? date("c", $row["document_published"]) : date("c");
?>
diff --git a/index.php b/index.php
index a756426..bd9321f 100755
--- a/index.php
+++ b/index.php
@@ -178,6 +178,8 @@
if (
! defined('ONLYCONTENT')
&&
+ ! GZIP_COMPRESSION
+ &&
UGROUP == 1
&&
defined('PROFILING') && PROFILING
diff --git a/install/data_base.sql b/install/data_base.sql
index 4d5ee27..5d87215 100755
--- a/install/data_base.sql
+++ b/install/data_base.sql
@@ -244,18 +244,18 @@ INSERT INTO `%%PRFX%%_document_fields` VALUES
(4, 2, 2, 0, 'Извините, запрошенный Вами документ не найден.', '0');#inst#
INSERT INTO `%%PRFX%%_documents` VALUES
- (1, 1, 0, 0, '/', '0','Главная', 'Главная страница', 0, 0, 0, 1, '0', '', '', 'index,follow', '3', '0.5', '1', '0', 0, 0, 0, '', '', 'ru', '1', ''),
- (2, 1, 0, 0, '404-not-found', '0', '404 - Документ не найден', 'Ошибка 404', 0, 0, 0, 1, '0', '', '', 'noindex,nofollow', '6', '0', '1', '0', 0, 0, 0, '', '', 'ru', '2', '');#inst#
+ (1, 1, 0, 0, '/', '0', '', 'Главная', 'Главная страница', '0', '0', '0', '1', '0', '', '', 'index,follow', '3', '0.5', '1', '0', '0', '0', '0', '', '', 'ru', '1', ''),
+ (2, 1, 0, 0, '404-dokument-ne-najden', '0', '', '404 - Документ не найден', 'Ошибка 404', '0', '0', '0', '1', '0', '', '', 'noindex,nofollow', '6', '0', '1', '0', '0', '0', '0', '', '', 'ru', '2', '');#inst#
INSERT INTO `%%PRFX%%_navigation` VALUES
(1,'main','Основное меню','\n [tag:linkname]\n','','','\n [tag:linkname]\n','','','','','','','','','','','1,2,3,4,5','1');#inst#
INSERT INTO `%%PRFX%%_navigation_items` VALUES
- (1,1,1,'/','Главная','','_self','','','','',0,'1',0,'1');#inst#
+ (1,1,1,'/','Главная','','_self','','','','','0','1','0','1');#inst#
INSERT INTO `%%PRFX%%_rubric_fields` VALUES
- (1, 1, 0, 'header', 'Заголовок', 'single_line', 0, 1, '', '', '', '', ''),
- (2, 1, 0, 'text', 'Текст', 'multi_line', 0, 2, '', '', '', '', '');#inst#
+ (1, 1, 0, 'header', 'Заголовок', 'single_line', '0', '1', '', '0', '', '', ''),
+ (2, 1, 0, 'text', 'Текст', 'multi_line', '0', '2', '', '0', '', '', '');#inst#
INSERT INTO `%%PRFX%%_rubric_permissions` VALUES
(1, 1, 1, 'alles'),
@@ -265,7 +265,7 @@ INSERT INTO `%%PRFX%%_rubric_permissions` VALUES
(5, 1, 5, 'docread');#inst#
INSERT INTO `%%PRFX%%_rubrics` VALUES
- (1,'Основные страницы','','0','[tag:fld:header]
\n[tag:fld:text]',1,1,0,1,'','','','','','','','0','','0',0);#inst#
+ (1,'Основные страницы','','0','[tag:fld:header]
\n[tag:fld:text]','1','1','0','1','','','','','','','','0','','0','0','0','0');#inst#
INSERT INTO `%%PRFX%%_settings` VALUES
(
diff --git a/install/index.php b/install/index.php
index 7ddbdb4..18fe069 100644
--- a/install/index.php
+++ b/install/index.php
@@ -227,7 +227,7 @@
define('BASE_DIR', str_replace("\\", "/", dirname(dirname(__FILE__))));
- if (! is_writable(BASE_DIR . '/cache/smarty/'))
+ if (! is_writable(BASE_DIR . '/tmp/cache/smarty/'))
die('Cache folder is not writeable!');
include(BASE_DIR . '/config/db.config.php');
@@ -247,7 +247,8 @@
$db_connect = check_db_connect($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbname']);
$check_installed = check_installed($config['dbpref']);
- if ((true === $db_connect) && $_REQUEST['step'] != 'finish' && check_installed($config['dbpref'])) {
+ if ((true === $db_connect) && $_REQUEST['step'] != 'finish' && check_installed($config['dbpref']))
+ {
echo '' . $AVE_Template->get_config_vars('installed') . '
';
exit;
};
@@ -260,14 +261,15 @@
// include_once(BASE_DIR . '/inc/errors.php');
$count_error = sizeof((array) $error_is_required);
+
if (1 == $count_error)
{
$AVE_Template->assign('error_header', $AVE_Template->get_config_vars('erroro'));
}
elseif ($count_error > 1)
- {
- $AVE_Template->assign('error_header', $AVE_Template->get_config_vars('erroro_more'));
- }
+ {
+ $AVE_Template->assign('error_header', $AVE_Template->get_config_vars('erroro_more'));
+ }
if ($count_error > 0 && ! (isset($_REQUEST['force']) && 1 == $_REQUEST['force']))
{
@@ -482,9 +484,9 @@
$filename = BASE_DIR . '/install/data_demo.sql';
}
else
- {
- $filename = BASE_DIR . '/install/data_base.sql';
- }
+ {
+ $filename = BASE_DIR . '/install/data_base.sql';
+ }
$mysql_connect = @mysqli_connect($config['dbhost'], $config['dbuser'], $config['dbpass']);
@mysqli_select_db($mysql_connect, $config['dbname']);
@@ -514,11 +516,9 @@
@mysqli_query($mysql_connect, "SET COLLATION_CONNECTION = 'utf8_general_ci'");
@mysqli_query($mysql_connect, $in);
}
- /*
- $auth = base64_encode(serialize(array('id' => '1', 'hash'=>$hash)));
- @setcookie('auth', $auth);
- */
+
$AVE_Template->display('step6.tpl');
+
exit;
}
diff --git a/install/structure_base.sql b/install/structure_base.sql
index 2ea4376..93d4f62 100755
--- a/install/structure_base.sql
+++ b/install/structure_base.sql
@@ -11,6 +11,7 @@ CREATE TABLE `%%PRFX%%_blocks` (
KEY `block_alias` (`block_alias`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;#inst#
+
CREATE TABLE `%%PRFX%%_countries` (
`Id` mediumint(5) unsigned NOT NULL auto_increment,
`country_code` char(2) NOT NULL default 'RU',
@@ -20,6 +21,7 @@ CREATE TABLE `%%PRFX%%_countries` (
PRIMARY KEY (`Id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;#inst#
+
CREATE TABLE `%%PRFX%%_document_fields` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`rubric_field_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
@@ -29,11 +31,12 @@ CREATE TABLE `%%PRFX%%_document_fields` (
`document_in_search` enum('1','0') NOT NULL DEFAULT '1',
PRIMARY KEY (`Id`),
KEY `document_id` (`document_id`),
+ KEY `rubric_field_id` (`rubric_field_id`),
KEY `field_value` (`field_value`),
- KEY `field_number_value` (`field_number_value`),
- KEY `rubric_field_id` (`rubric_field_id`)
+ KEY `field_number_value` (`field_number_value`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_document_fields_text` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`rubric_field_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
@@ -44,6 +47,7 @@ CREATE TABLE `%%PRFX%%_document_fields_text` (
KEY `rubric_field_id` (`rubric_field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_document_keywords` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`document_id` int(11) NOT NULL,
@@ -53,6 +57,7 @@ CREATE TABLE `%%PRFX%%_document_keywords` (
KEY `keyword` (`keyword`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_document_remarks` (
`Id` int(10) unsigned NOT NULL auto_increment,
`document_id` int(10) unsigned NOT NULL default '0',
@@ -67,6 +72,7 @@ CREATE TABLE `%%PRFX%%_document_remarks` (
KEY `document_id` (`document_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_document_rev` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`doc_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
@@ -77,6 +83,7 @@ CREATE TABLE `%%PRFX%%_document_rev` (
KEY `doc_id` (`doc_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_documents` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`rubric_id` mediumint(5) unsigned NOT NULL DEFAULT '0',
@@ -84,6 +91,7 @@ CREATE TABLE `%%PRFX%%_documents` (
`document_parent` int(10) unsigned NOT NULL DEFAULT '0',
`document_alias` varchar(255) NOT NULL DEFAULT '',
`document_alias_history` enum('0','1','2') NOT NULL DEFAULT '0',
+ `document_short_alias` VARCHAR(10) NOT NULL DEFAULT '', # 3.24
`document_title` varchar(255) NOT NULL DEFAULT '',
`document_breadcrum_title` varchar(255) NOT NULL DEFAULT '',
`document_published` int(10) unsigned NOT NULL DEFAULT '0',
@@ -115,6 +123,7 @@ CREATE TABLE `%%PRFX%%_documents` (
KEY `document_expire` (`document_expire`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_document_alias_history` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`document_id` int(10) unsigned NOT NULL default '0',
@@ -126,15 +135,19 @@ CREATE TABLE `%%PRFX%%_document_alias_history` (
KEY `document_id` (`document_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_document_tags` (
`id` int(11) NOT NULL AUTO_INCREMENT,
+ `rubric_id` int(3) NOT NULL, # 3.24
`document_id` int(11) NOT NULL,
`tag` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
+ KEY `rubric_id` (`rubric_id`),
KEY `document_id` (`document_id`),
KEY `tag` (`tag`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_module` (
`Id` smallint(3) unsigned NOT NULL auto_increment,
`ModuleName` char(50) NOT NULL,
@@ -152,9 +165,10 @@ CREATE TABLE `%%PRFX%%_module` (
UNIQUE KEY `ModuleName` (`ModuleName`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_modules_aliases` (
`id` tinyint(5) unsigned NOT NULL AUTO_INCREMENT,
- `document_id` int(10) NOT NULL DEFAULT '0',
+ `document_id` int(10) NOT NULL DEFAULT '0', # 3.24
`module_name` char(50) NOT NULL DEFAULT '',
`module_action` varchar(255) NOT NULL DEFAULT '',
`module_link` varchar(500) NOT NULL DEFAULT '',
@@ -166,6 +180,7 @@ CREATE TABLE `%%PRFX%%_modules_aliases` (
KEY `module_name` (`module_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_navigation` (
`navigation_id` smallint(3) unsigned NOT NULL AUTO_INCREMENT,
`alias` varchar(20) NOT NULL,
@@ -190,6 +205,7 @@ CREATE TABLE `%%PRFX%%_navigation` (
KEY `alias` (`alias`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_navigation_items` (
`navigation_item_id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
`navigation_id` smallint(3) unsigned NOT NULL DEFAULT '0',
@@ -212,6 +228,7 @@ CREATE TABLE `%%PRFX%%_navigation_items` (
KEY `navi_item_status` (`status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_paginations` (
`id` tinyint(1) unsigned NOT NULL AUTO_INCREMENT,
`pagination_name` tinytext,
@@ -229,6 +246,7 @@ CREATE TABLE `%%PRFX%%_paginations` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_request` (
`Id` smallint(3) unsigned NOT NULL AUTO_INCREMENT,
`rubric_id` smallint(3) unsigned NOT NULL,
@@ -256,11 +274,14 @@ CREATE TABLE `%%PRFX%%_request` (
`request_external` enum('0','1') NOT NULL DEFAULT '0',
`request_ajax` enum('0','1') NOT NULL DEFAULT '0',
`request_show_sql` enum('0','1') NOT NULL DEFAULT '0',
+ `request_changed` int(10) unsigned NOT NULL DEFAULT '0', # 3.24
+ `request_changed_elements` int(10) unsigned NOT NULL DEFAULT '0', # 3.24
PRIMARY KEY (`Id`),
KEY `rubric_id` (`rubric_id`),
KEY `request_alias` (`request_alias`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_request_conditions` (
`Id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
`request_id` smallint(3) unsigned NOT NULL,
@@ -274,6 +295,25 @@ CREATE TABLE `%%PRFX%%_request_conditions` (
KEY `request_id` (`request_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
+# 3.24
+CREATE TABLE `%%PRFX%%_rubric_breadcrumb` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `rubric_id` smallint(3) unsigned NOT NULL,
+ `box` varchar(500) NOT NULL DEFAULT '',
+ `show_main` enum('1','0') NOT NULL DEFAULT '1',
+ `show_host` enum('1','0') NOT NULL DEFAULT '1',
+ `sepparator` varchar(255) NOT NULL,
+ `sepparator_use` enum('1','0') NOT NULL DEFAULT '1',
+ `link_box` varchar(500) NOT NULL DEFAULT '',
+ `link_template` varchar(500) NOT NULL DEFAULT '',
+ `self_box` varchar(500) NOT NULL DEFAULT '',
+ `link_box_last` enum('1','0') NOT NULL DEFAULT '1',
+ PRIMARY KEY (`id`),
+ KEY `rubric_id` (`rubric_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
+
CREATE TABLE `%%PRFX%%_rubric_fields` (
`Id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
`rubric_id` smallint(3) unsigned NOT NULL,
@@ -294,6 +334,7 @@ CREATE TABLE `%%PRFX%%_rubric_fields` (
KEY `rubric_field_alias` (`rubric_field_alias`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_rubric_fields_group` (
`Id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
`rubric_id` smallint(3) unsigned NOT NULL,
@@ -304,6 +345,7 @@ CREATE TABLE `%%PRFX%%_rubric_fields_group` (
KEY `rubric_id` (`rubric_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_rubric_permissions` (
`Id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
`rubric_id` smallint(3) unsigned NOT NULL,
@@ -313,6 +355,7 @@ CREATE TABLE `%%PRFX%%_rubric_permissions` (
KEY `rubric_id` (`rubric_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_rubric_template_cache` (
`id` bigint(15) unsigned NOT NULL AUTO_INCREMENT,
`hash` char(32) NOT NULL,
@@ -327,6 +370,7 @@ CREATE TABLE `%%PRFX%%_rubric_template_cache` (
KEY `rubric_id` (`rub_id`,`doc_id`,`wysiwyg`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_rubrics` (
`Id` smallint(3) unsigned NOT NULL AUTO_INCREMENT,
`rubric_title` varchar(255) NOT NULL,
@@ -348,10 +392,13 @@ CREATE TABLE `%%PRFX%%_rubrics` (
`rubric_description` text NOT NULL,
`rubric_meta_gen` enum('0','1') default '0' NOT NULL,
`rubric_position` int(11) unsigned NOT NULL DEFAULT '100',
+ `rubric_changed` int(10) NOT NULL DEFAULT '0', # 3.24
+ `rubric_changed_fields` int(10) NOT NULL DEFAULT '0', # 3.24
PRIMARY KEY (`Id`),
KEY `rubric_template_id` (`rubric_template_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_rubric_templates` (
`id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
`rubric_id` smallint(3) unsigned NOT NULL,
@@ -363,6 +410,7 @@ CREATE TABLE `%%PRFX%%_rubric_templates` (
KEY `rubric_id` (`rubric_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_sessions` (
`sesskey` varchar(32) NOT NULL,
`expiry` int(10) unsigned NOT NULL DEFAULT '0',
@@ -374,6 +422,7 @@ CREATE TABLE `%%PRFX%%_sessions` (
KEY `expire_datum` (`expire_datum`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;#inst#
+
CREATE TABLE `%%PRFX%%_settings` (
`Id` tinyint(1) unsigned NOT NULL AUTO_INCREMENT,
`site_name` varchar(255) NOT NULL,
@@ -421,6 +470,7 @@ CREATE TABLE `%%PRFX%%_settings` (
PRIMARY KEY (`Id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;#inst#
+
CREATE TABLE `%%PRFX%%_settings_lang` (
`Id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
`lang_key` varchar(2) NOT NULL DEFAULT 'ru',
@@ -432,6 +482,7 @@ CREATE TABLE `%%PRFX%%_settings_lang` (
UNIQUE KEY `lang_key` (`lang_key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;#inst#
+
CREATE TABLE `%%PRFX%%_settings_menu` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
@@ -441,6 +492,7 @@ CREATE TABLE `%%PRFX%%_settings_menu` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;#inst#
+
CREATE TABLE `%%PRFX%%_sysblocks` (
`id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
`sysblock_name` varchar(255) NOT NULL,
@@ -457,6 +509,7 @@ CREATE TABLE `%%PRFX%%_sysblocks` (
KEY `sysblock_alias` (`sysblock_alias`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;#inst#
+
CREATE TABLE `%%PRFX%%_templates` (
`Id` smallint(3) unsigned NOT NULL AUTO_INCREMENT,
`template_title` varchar(255) NOT NULL,
@@ -466,6 +519,7 @@ CREATE TABLE `%%PRFX%%_templates` (
PRIMARY KEY (`Id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_user_groups` (
`user_group` smallint(3) unsigned NOT NULL AUTO_INCREMENT,
`user_group_name` char(50) NOT NULL,
@@ -476,6 +530,7 @@ CREATE TABLE `%%PRFX%%_user_groups` (
PRIMARY KEY (`user_group`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;#inst#
+
CREATE TABLE `%%PRFX%%_users` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`password` char(32) NOT NULL,
@@ -513,6 +568,7 @@ CREATE TABLE `%%PRFX%%_users` (
KEY `user_group` (`user_group`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_users_session` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
@@ -524,6 +580,7 @@ CREATE TABLE `%%PRFX%%_users_session` (
KEY `user_id` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;#inst#
+
CREATE TABLE `%%PRFX%%_view_count` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`document_id` int(11) NOT NULL,
diff --git a/templates/default/css/styles.css b/templates/default/css/styles.css
index e69de29..b3b84c8 100644
--- a/templates/default/css/styles.css
+++ b/templates/default/css/styles.css
@@ -0,0 +1,33 @@
+/* Sticky footer styles
+-------------------------------------------------- */
+html {
+ position: relative;
+ min-height: 100%;
+}
+body {
+ /* Margin bottom by footer height */
+ margin-bottom: 60px;
+}
+.footer {
+ position: absolute;
+ bottom: 0;
+ width: 100%;
+ /* Set the fixed height of the footer here */
+ height: 60px;
+ line-height: 60px; /* Vertically center the text there */
+ background-color: #f5f5f5;
+}
+
+
+/* Custom page CSS
+-------------------------------------------------- */
+/* Not required for template or sticky footer method. */
+
+body > .container {
+ padding: 60px 15px 0;
+}
+
+.footer > .container {
+ padding-right: 15px;
+ padding-left: 15px;
+}
\ No newline at end of file
diff --git a/tmp/update/sql.update.php b/tmp/update/sql.update.php
new file mode 100644
index 0000000..b5703b5
--- /dev/null
+++ b/tmp/update/sql.update.php
@@ -0,0 +1,267 @@
+
+ /* -------------------------------------------------------------------------------------------------------------- */
+ /* -------------------------------------------------------3.24-------------------------------------------------- */
+ /* -------------------------------------------------------------------------------------------------------------- */
+
+
+ $check = $AVE_DB->Query("
+ SHOW COLUMNS
+ FROM
+ " . PREFIX . "_rubrics
+ LIKE
+ 'rubric_changed'
+ ")->NumRows();
+
+ $exist = ($check) ? true : false;
+
+ if ($exist === false)
+ {
+ $AVE_DB->Real_Query("
+ ALTER TABLE
+ " . PREFIX . "_rubrics
+ ADD
+ `rubric_changed` int(10) NOT NULL DEFAULT '0'
+ AFTER
+ `rubric_position`
+ ");
+
+ $AVE_DB->Real_Query("
+ UPDATE
+ " . PREFIX . "_rubrics
+ SET
+ `rubric_changed` = UNIX_TIMESTAMP()
+ ");
+ }
+
+ // ----------------------------------------------------------------------------------------
+
+ $check = $AVE_DB->Query("
+ SHOW COLUMNS
+ FROM
+ " . PREFIX . "_rubrics
+ LIKE
+ 'rubric_changed_fields'
+ ")->NumRows();
+
+ $exist = ($check) ? true : false;
+
+ if ($exist === false)
+ {
+ $AVE_DB->Real_Query("
+ ALTER TABLE
+ " . PREFIX . "_rubrics
+ ADD
+ `rubric_changed_fields` int(10) NOT NULL DEFAULT '0'
+ AFTER
+ `rubric_changed`
+ ");
+
+ $AVE_DB->Real_Query("
+ UPDATE
+ " . PREFIX . "_rubrics
+ SET
+ `rubric_changed_fields` = UNIX_TIMESTAMP()
+ ");
+ }
+
+ // ----------------------------------------------------------------------------------------
+
+ $check = $AVE_DB->Query("
+ SHOW TABLES
+ LIKE
+ '" . PREFIX . "_rubric_breadcrumb'
+ ")->NumRows();
+
+ $exist = ($check) ? true : false;
+
+ if ($exist === false)
+ {
+ $AVE_DB->Real_Query("
+ CREATE TABLE `" . PREFIX . "_rubric_breadcrumb` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `rubric_id` smallint(3) unsigned NOT NULL,
+ `box` varchar(500) NOT NULL DEFAULT '',
+ `show_main` enum('1','0') NOT NULL DEFAULT '1',
+ `show_host` enum('1','0') NOT NULL DEFAULT '1',
+ `sepparator` varchar(255) NOT NULL,
+ `sepparator_use` enum('1','0') NOT NULL DEFAULT '1',
+ `link_box` varchar(500) NOT NULL DEFAULT '',
+ `link_template` varchar(500) NOT NULL DEFAULT '',
+ `self_box` varchar(500) NOT NULL DEFAULT '',
+ `link_box_last` enum('1','0') NOT NULL DEFAULT '1',
+ PRIMARY KEY (`id`),
+ KEY `rubric_id` (`rubric_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;
+ ");
+ }
+
+ // ----------------------------------------------------------------------------------------
+
+ $check = $AVE_DB->Query("
+ SHOW COLUMNS
+ FROM
+ " . PREFIX . "_request
+ LIKE
+ 'request_changed'
+ ")->NumRows();
+
+ $exist = ($check) ? true : false;
+
+ if ($exist === false)
+ {
+ $AVE_DB->Real_Query("
+ ALTER TABLE
+ " . PREFIX . "_request
+ ADD
+ `request_changed` int(10) unsigned NOT NULL DEFAULT '0'
+ AFTER
+ `request_show_sql`
+ ");
+
+ $AVE_DB->Real_Query("
+ UPDATE
+ " . PREFIX . "_request
+ SET
+ `request_changed` = UNIX_TIMESTAMP()
+ ");
+ }
+
+ // ----------------------------------------------------------------------------------------
+
+ $check = $AVE_DB->Query("
+ SHOW COLUMNS
+ FROM
+ " . PREFIX . "_request
+ LIKE
+ 'request_changed_elements'
+ ")->NumRows();
+
+ $exist = ($check) ? true : false;
+
+ if ($exist === false)
+ {
+ $AVE_DB->Real_Query("
+ ALTER TABLE
+ " . PREFIX . "_request
+ ADD
+ `request_changed_elements` int(10) unsigned NOT NULL DEFAULT '0'
+ AFTER
+ `request_changed`
+ ");
+
+ $AVE_DB->Real_Query("
+ UPDATE
+ " . PREFIX . "_request
+ SET
+ `request_changed_elements` = UNIX_TIMESTAMP()
+ ");
+ }
+
+ // ----------------------------------------------------------------------------------------
+
+ $check = $AVE_DB->Query("
+ SHOW COLUMNS
+ FROM
+ " . PREFIX . "_documents
+ LIKE
+ 'document_short_alias'
+ ")->NumRows();
+
+ $exist = ($check) ? true : false;
+
+ if ($exist === false)
+ {
+ $AVE_DB->Real_Query("
+ ALTER TABLE
+ " . PREFIX . "_documents
+ ADD
+ `document_short_alias` VARCHAR(10) NOT NULL DEFAULT ''
+ AFTER
+ `document_alias_history`
+ ");
+ }
+
+ // ----------------------------------------------------------------------------------------
+
+ $check = $AVE_DB->Query("
+ SHOW COLUMNS
+ FROM
+ " . PREFIX . "_document_tags
+ LIKE
+ 'rubric_id'
+ ")->NumRows();
+
+ $exist = ($check) ? true : false;
+
+ if ($exist === false)
+ {
+ $AVE_DB->Real_Query("
+ ALTER TABLE
+ " . PREFIX . "_document_tags
+ ADD
+ `rubric_id` int(3) NOT NULL
+ AFTER
+ `id`
+ ");
+ }
+
+ // ----------------------------------------------------------------------------------------
+
+ $check = $AVE_DB->Query("
+ SHOW COLUMNS
+ FROM
+ " . PREFIX . "_modules_aliases
+ LIKE
+ 'document_id'
+ ")->NumRows();
+
+ $exist = ($check) ? true : false;
+
+ if ($exist === false)
+ {
+ $AVE_DB->Real_Query("
+ ALTER TABLE
+ " . PREFIX . "_modules_aliases
+ ADD
+ `document_id` int(10) NOT NULL DEFAULT '0'
+ AFTER
+ `id`
+ ");
+ }
+
+
+ // ----------------------------------------------------------------------------------------
+
+ $check = $AVE_DB->Query("
+ SHOW COLUMNS
+ FROM
+ " . PREFIX . "_request
+ LIKE
+ 'request_count_items'
+ ")->NumRows();
+
+ $exist = ($check) ? true : false;
+
+ if ($exist === false)
+ {
+ $AVE_DB->Real_Query("
+ ALTER TABLE
+ " . PREFIX . "_request
+ ADD
+ `request_count_items` enum('0','1') NOT NULL DEFAULT '0'
+ AFTER
+ `request_use_query`
+ ");
+
+ $AVE_DB->Real_Query("
+ UPDATE
+ " . PREFIX . "_request
+ SET
+ `request_changed_elements` = UNIX_TIMESTAMP()
+ ");
+ }
+
+ /* -------------------------------------------------------------------------------------------------------------- */
+ /* -------------------------------------------------------3.25---------------------------------------------------- */
+ /* -------------------------------------------------------------------------------------------------------------- */
+?>
\ No newline at end of file