Browse Source

Fixes

pull/3/head
M@dD3n 7 years ago
parent
commit
7e3cda3a39
  1. 5
      class/class.paginations.php
  2. 17
      functions/func.parserequest.php
  3. 7
      inc/sitemap.php

5
class/class.paginations.php

@ -91,7 +91,7 @@
if ($curent_page - 1 == 1)
{
$search = array('[link]', '[page]', '[name]');
$replace = array($template_label, $curent_page, $pagination_prev_label);
$replace = array($template_label, $curent_page-1, $pagination_prev_label);
$link = str_replace($search, $replace, $pagination_link_template);
@ -100,6 +100,7 @@
// Если больше 2х
else
{
$search = array('[link]', '[page]', '[name]');
$replace = array($template_label, $curent_page - 1, $pagination_prev_label);
@ -181,7 +182,7 @@
// Если пришел внешний контейнер для
if ($pagination_box_ext != '')
$pagination = sprintf($pagination_box_ext, $pagination);
else if (pagination_box != '')
else if ($pagination_box != '')
$pagination = sprintf($pagination_box, $pagination);
}

17
functions/func.parserequest.php

@ -370,7 +370,7 @@ function showrequestelement($mixed, $template = '', $tparams = '')
// Возвращаем поле из БД документа
$item = preg_replace_callback('/\[tag:doc:([a-zA-Z0-9-_]+)\]/u',
function ($match)
function ($match) use ($row)
{
return isset($row->{$match[1]})
? $row->{$match[1]}
@ -570,11 +570,11 @@ function request_parse($id, $params = array())
{
foreach($params['SORT'] as $fid => $sort)
{
if (is_numeric($fid))
$fid = (int)get_field_num($request->rubric_id, $fid);
if ((int)$fid <= 0)
continue;
if ((int)$fid > 0)
{
$sort = strtolower($sort);
$request_join[$fid] = "<? if (preg_match('t[]'))?><?=(! isset(\$t[$fid])) ? \"LEFT JOIN " . PREFIX . "_document_fields AS t$fid ON (t$fid.document_id = a.Id AND t$fid.rubric_field_id='$fid')\" : ''?>";
@ -585,13 +585,20 @@ function request_parse($id, $params = array())
$request_order_fields[] = $fid;
}
else
{
$asc_desc = strpos(strtolower($sort),'asc') !== false ? 'ASC' : 'DESC';
$request_order[$param] = "$fid " . $asc_desc;
}
}
}
// Сортировка по полю из настроек (только если не передана другая в параметрах)
elseif ($request->request_order_by_nat)
{
$fid = (int)$request->request_order_by_nat;
// Добавляем с учётом переменной $t из условий, чтобы не выбирать те же таблиы заново - это оптимизирует время
$request_join[$fid] = "<?=(! isset(\$t[$fid])) ? \"LEFT JOIN " . PREFIX . "_document_fields AS t$fid ON (t$fid.document_id = a.Id AND t$fid.rubric_field_id='$fid')\" : ''?>";
$request_join[$fid] = "<?= (! isset(\$t[$fid])) ? \"LEFT JOIN " . PREFIX . "_document_fields AS t$fid ON (t$fid.document_id = a.Id AND t$fid.rubric_field_id='$fid')\" : ''?>";
$request_order['field-' . $fid] = "t$fid.field_value " . $request->request_asc_desc;
$request_order_fields[] = $fid;

7
inc/sitemap.php

@ -31,8 +31,7 @@
require_once (BASE_DIR . '/inc/init.php');
if (! defined('ABS_PATH'))
define ('ABS_PATH', str_ireplace(BASE_DIR,'/',str_replace("\\", "/", dirname(dirname(__FILE__)))));
$abs_path = str_ireplace(BASE_DIR, '/', str_replace("\\", "/", dirname(dirname(__FILE__))));
if (isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')
{
@ -92,8 +91,8 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';
$res = $AVE_DB->Query($sql);
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 = $abs_path . $row['document_alias'] . URL_SUFF;
$document_alias = $domain . str_ireplace($abs_path . '/' . URL_SUFF, '/', $document_alias);
$date = $row["document_changed"] ? date("Y-m-d", $row["document_changed"]) : date("Y-m-d");
?>
<url>

Loading…
Cancel
Save