mirror of
https://github.com/avecms/AVE.cms.git
synced 2025-01-22 07:20:07 +00:00
Fix AND Update
This commit is contained in:
parent
1af00561bd
commit
62ff1353ad
@ -717,7 +717,7 @@
|
||||
/**
|
||||
* Метод, предназначенный для получения функции из которой пришел запрос с ошибкой
|
||||
*
|
||||
* @return string
|
||||
* @return array|string
|
||||
*/
|
||||
public function getCaller()
|
||||
{
|
||||
@ -741,12 +741,11 @@
|
||||
$function = $call['class'] . "->$function";
|
||||
}
|
||||
|
||||
$caller[] =
|
||||
(array (
|
||||
'call_file' => (isset($call['file']) ? $call['file'] : 'Unknown'),
|
||||
'call_func' => $function,
|
||||
'call_line' => (isset($call['line']) ? $call['line'] : 'Unknown')
|
||||
));
|
||||
$caller[] = [
|
||||
'call_file' => (isset($call['file']) ? $call['file'] : 'Unknown'),
|
||||
'call_func' => $function,
|
||||
'call_line' => (isset($call['line']) ? $call['line'] : 'Unknown')
|
||||
];
|
||||
}
|
||||
|
||||
return $caller;
|
||||
@ -782,9 +781,7 @@
|
||||
$this->_error('query', $query);
|
||||
|
||||
if (is_object($result) && $result instanceof mysqli_result)
|
||||
{
|
||||
return new AVE_DB_Result($result);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
@ -820,13 +817,6 @@
|
||||
return $cache_id = 'documents/' . (floor($cache_id / 1000)) . '/' . $cache_id;
|
||||
}
|
||||
|
||||
//-- Если это хлебные крошки, то меняем расположение
|
||||
if (substr($cache_id, 0, 3) == 'brd')
|
||||
{
|
||||
$cache_id = (int)str_replace('brd_', '', $cache_id);
|
||||
return $cache_id = 'documents/' . (floor($cache_id / 1000)) . '/' . $cache_id;
|
||||
}
|
||||
|
||||
//-- Если это рубрика, то меняем расположение
|
||||
if (substr($cache_id, 0, 3) == 'rub')
|
||||
{
|
||||
@ -878,7 +868,7 @@
|
||||
* @param integer $TTL - время жизни кеша (-1 безусловный кеш)
|
||||
* @param string $cache_id - Id файла кеша
|
||||
* @param bool $log - записать ошибки в лог? по умолчанию включено
|
||||
* @return array - асоциативный массив с результом запроса
|
||||
* @return array|AVE_DB_Result
|
||||
*/
|
||||
public function Query ($query, $TTL = null, $cache_id = '', $log = true, $ext = '')
|
||||
{
|
||||
@ -956,7 +946,7 @@
|
||||
* @param integer $TTL - время жизни кеша (-1 безусловный кеш)
|
||||
* @param string $cache_id - Id файла кеша
|
||||
* @param bool $log - записать ошибки в лог? по умолчанию включено
|
||||
* @return array - асоциативный массив с результом запроса
|
||||
* @return void
|
||||
*/
|
||||
public function Queries ($array)
|
||||
{
|
||||
@ -1085,7 +1075,7 @@
|
||||
$url = trim($url);
|
||||
|
||||
// Условия
|
||||
$search = array('<', ';', '|', '&', '>', "'", '"', ')', '(', '{', '}', '$', '=');
|
||||
$search = ['<', ';', '|', '&', '>', "'", '"', ')', '(', '{', '}', '$', '='];
|
||||
|
||||
// Убираем пробелы
|
||||
$url = preg_replace('/[\s,]+/i', '', $url);
|
||||
@ -1109,7 +1099,7 @@
|
||||
// Иначе вообще очищаем строку
|
||||
else
|
||||
{
|
||||
$url = array_map(array($AVE_DB, 'Escape'), $url);
|
||||
$url = array_map([$AVE_DB, 'Escape'], $url);
|
||||
}
|
||||
|
||||
return $url;
|
||||
@ -1138,7 +1128,7 @@
|
||||
* @param string $cache_id
|
||||
* @return int
|
||||
*/
|
||||
public function NumAllRows($query, $TTL = null, $cache_id = '')
|
||||
public function NumAllRows ($query, $TTL = null, $cache_id = '')
|
||||
{
|
||||
$cache_id = $this->cacheId($cache_id);
|
||||
|
||||
@ -1180,12 +1170,12 @@
|
||||
{
|
||||
$_caller = $this->getCaller();
|
||||
|
||||
$this->_query_list[] = array(
|
||||
$this->_query_list[] = [
|
||||
'caller' => $_caller,
|
||||
'query' => 'SELECT FOUND_ROWS();',
|
||||
'ttl' => $TTL,
|
||||
'cache' => $cache_dir . $cache_file
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return file_get_contents($cache_dir . $cache_file);
|
||||
@ -1553,7 +1543,6 @@
|
||||
$this->clearCache('doc_' . $doc_id); // Прочее
|
||||
$this->clearCache('fld_' . $doc_id); // Поля
|
||||
$this->clearCache('cmd_' . $doc_id); // Компиляция
|
||||
$this->clearCache('brd_' . $doc_id); // Хлебные крошки
|
||||
$this->clearCache('rqe_' . $doc_id); // Элемент запроса
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
$bread_self_box = trim(get_settings('bread_self_box'));
|
||||
|
||||
static $crumbs = array();
|
||||
static $crumbs = [];
|
||||
|
||||
$curent_document = get_current_document_id();
|
||||
|
||||
@ -49,30 +49,23 @@
|
||||
|
||||
if ($bread_show_main)
|
||||
{
|
||||
$sql = "
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
" . PREFIX . "_documents
|
||||
WHERE
|
||||
document_alias = '" . ($_SESSION['user_language'] == DEFAULT_LANGUAGE ? '/' : $_SESSION['accept_langs'][$_SESSION['user_language']]) . "'
|
||||
AND
|
||||
document_lang = '" . $_SESSION['user_language'] . "'
|
||||
";
|
||||
$home_id = ($_SESSION['user_language'] == DEFAULT_LANGUAGE)
|
||||
? 1
|
||||
: $curent_document;
|
||||
|
||||
$lang_home_alias = $AVE_DB->Query($sql)->FetchRow();
|
||||
$lang_home_alias = getDocument($home_id);
|
||||
|
||||
$search = array(
|
||||
$search = [
|
||||
'[name]',
|
||||
'[link]',
|
||||
'[count]'
|
||||
);
|
||||
];
|
||||
|
||||
$replace = array(
|
||||
$replace = [
|
||||
$lang_home_alias->document_breadcrum_title,
|
||||
$bread_show_host ? HOST . '/' . ltrim($lang_home_alias->document_alias, '/') : $lang_home_alias->document_alias,
|
||||
1
|
||||
);
|
||||
];
|
||||
|
||||
$link = str_replace($search, $replace, $bread_link_template);
|
||||
|
||||
@ -89,18 +82,7 @@
|
||||
if ($curent_document == 1 || $curent_document == PAGE_NOT_FOUND_ID)
|
||||
$noprint = 1;
|
||||
|
||||
$sql_document = $AVE_DB->Query("
|
||||
SELECT
|
||||
document_title,
|
||||
document_breadcrum_title,
|
||||
document_parent
|
||||
FROM
|
||||
" . PREFIX . "_documents
|
||||
WHERE
|
||||
Id = '" . $curent_document . "'", -1, 'brd_' . $curent_document, true, '.breadcrumbs'
|
||||
);
|
||||
|
||||
$row_document = $sql_document->FetchRow();
|
||||
$row_document = getDocument($curent_document);
|
||||
|
||||
$current = new stdClass();
|
||||
|
||||
@ -120,21 +102,7 @@
|
||||
|
||||
while ($current->document_parent != 0)
|
||||
{
|
||||
$sql_doc = $AVE_DB->Query("
|
||||
SELECT
|
||||
Id,
|
||||
document_alias,
|
||||
document_breadcrum_title,
|
||||
document_title,
|
||||
document_parent,
|
||||
document_status
|
||||
FROM
|
||||
" . PREFIX . "_documents
|
||||
WHERE
|
||||
Id = '" . $current->document_parent . "'", -1, 'brd_' . $current->document_parent, true, '.item'
|
||||
);
|
||||
|
||||
$row_doc = $sql_doc->FetchRow();
|
||||
$row_doc = getDocument($current->document_parent);
|
||||
|
||||
$current->document_parent = $row_doc->document_parent;
|
||||
|
||||
@ -156,7 +124,7 @@
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($row_doc->document_parent==0 AND $row_doc->Id != 1)
|
||||
if ($row_doc->document_parent == 0 AND $row_doc->Id != 1)
|
||||
$current->document_parent = 1;
|
||||
}
|
||||
|
||||
@ -179,8 +147,8 @@
|
||||
|
||||
$url = rewrite_link('index.php?id=' . $crumb['Id'][$n] . '&doc=' . $crumb['document_alias'][$n]);
|
||||
|
||||
$search = array('[name]', '[link]', '[count]');
|
||||
$replace = array($crumb['document_breadcrum_title'][$n], $bread_show_host ? HOST . '/' . ltrim($url, '/') : $url, $number);
|
||||
$search = ['[name]', '[link]', '[count]'];
|
||||
$replace = [$crumb['document_breadcrum_title'][$n], $bread_show_host ? HOST . '/' . ltrim($url, '/') : $url, $number];
|
||||
|
||||
$link = str_replace($search, $replace, $bread_link_template);
|
||||
|
||||
@ -198,7 +166,7 @@
|
||||
$bread_crumb .= $bread_sepparator;
|
||||
}
|
||||
|
||||
unset($search, $replace, $link, $number);
|
||||
unset($search, $replace, $link, $number, $row_doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -418,4 +418,28 @@
|
||||
`document_property`
|
||||
");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
$check = $AVE_DB->Query("
|
||||
SHOW COLUMNS
|
||||
FROM
|
||||
" . PREFIX . "_document_alias_history
|
||||
LIKE
|
||||
'document_alias_header'
|
||||
")->NumRows();
|
||||
|
||||
$exist = ($check) ? true : false;
|
||||
|
||||
if ($exist === false)
|
||||
{
|
||||
$AVE_DB->Real_Query("
|
||||
ALTER TABLE
|
||||
" . PREFIX . "_documents
|
||||
ADD
|
||||
`document_alias_header` int(3) NOT NULL DEFAULT '301'
|
||||
AFTER
|
||||
`document_alias`
|
||||
");
|
||||
}
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user