Browse Source

Fixes

master
M@d D3n 4 years ago
parent
commit
8e7952ea79
  1. 10
      class/class.core.php
  2. 6
      functions/func.breadcrumbs.php
  3. 6
      functions/func.logs.php
  4. 280
      functions/func.pagination.php

10
class/class.core.php

@ -730,6 +730,16 @@
$main_content
);
// GetField
$main_content = preg_replace_callback(
'/\[tag:get:([a-zA-Z0-9-_]+)(|:([0-9]+))+?\]/',
function ($match) {
return get_field($match[1], $match[3]);
},
$main_content
);
$main_content = str_replace('[tag:docdate]', translate_date(strftime(DATE_FORMAT, $this->curentdoc->document_published)), $main_content);
$main_content = str_replace('[tag:doctime]', translate_date(strftime(TIME_FORMAT, $this->curentdoc->document_published)), $main_content);
$main_content = str_replace('[tag:humandate]', human_date($this->curentdoc->document_published), $main_content);

6
functions/func.breadcrumbs.php

@ -55,6 +55,8 @@
$lang_home_alias = getDocument($home_id);
$number = 1;
$search = [
'[name]',
'[link]',
@ -166,7 +168,7 @@
$bread_crumb .= $bread_sepparator;
}
unset($search, $replace, $link, $number, $row_doc);
unset($search, $replace, $link, $row_doc);
}
}
}
@ -175,7 +177,7 @@
if ((isset($AVE_Core->curentdoc->bread_link_box_last) && $AVE_Core->curentdoc->bread_link_box_last == 0))
$bread_crumb .= '';
else if (get_settings('bread_link_box_last') == 1 || (isset($AVE_Core->curentdoc->bread_link_box_last) && $AVE_Core->curentdoc->bread_link_box_last == 1))
$bread_crumb .= sprintf($bread_self_box, $current->document_breadcrum_title);
$bread_crumb .= str_replace('[count]', $number+1, sprintf($bread_self_box, $current->document_breadcrum_title));
if (! $noprint)
$crumbs[$curent_document] = sprintf($bread_box, $bread_crumb);

6
functions/func.logs.php

@ -32,7 +32,7 @@
$logdata[]=array(
'log_time' => time(),
'log_ip' => $_SERVER['REMOTE_ADDR'],
'log_url' => $_SERVER['QUERY_STRING'],
'log_url' => $_SERVER['REQUEST_URI'],
'log_user_id' => (isset($_SESSION['user_id']) ? $_SESSION['user_id'] : '0'),
'log_user_name' => (isset($_SESSION['user_name']) ? $_SESSION['user_name'] : 'Anonymous'),
'log_text' => $message,
@ -65,7 +65,7 @@
$logsql[] = array(
'log_time' => time(),
'log_ip' => $_SERVER['REMOTE_ADDR'],
'log_url' => $_SERVER['QUERY_STRING'],
'log_url' => $_SERVER['REQUEST_URI'],
'log_user_id' => $_SESSION['user_id'],
'log_user_name' => $_SESSION['user_name'],
'log_text' => $message
@ -96,7 +96,7 @@
$log404[] = array(
'log_time' => time(),
'log_ip' => @$_SERVER['REMOTE_ADDR'],
'log_query' => @$_SERVER['QUERY_STRING'],
'log_query' => @$_SERVER['REQUEST_URI'],
'log_user_agent' => @$_SERVER['HTTP_USER_AGENT'],
'log_user_referer' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''),
'log_request_uri' => @$_SERVER['REQUEST_URI']

280
functions/func.pagination.php

@ -1,141 +1,141 @@
<?php
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
/**
* Текущая страница
*
* @param string $type тип постраничной навигации,
* допустимые значения: page, apage, artpage
* @return int номер текущей страницы
*/
function get_current_page ($type = 'page')
{
if (!in_array($type, array('page', 'apage', 'artpage'))) return 1;
$page = (isset($_REQUEST[$type]) && is_numeric($_REQUEST[$type])) ? $_REQUEST[$type] : 1;
return (int)$page;
}
/**
* Постраничная навигация для запросов и модулей
*
* @param int $total_pages количество страниц в документе
* @param string $type тип постраничной навигации,
* допустимые значения: page, apage, artpage
* @param string $template_label шаблон метки навигации
* @param string $navi_box контейнер постраничной навигации %s
* @return string HTML-код постраничной навигации
*/
function get_pagination ($total_pages, $type, $template_label, $navi_box = '')
{
$nav = '';
if (!in_array($type, array('page', 'apage', 'artpage'))) $type = 'page';
$curent_page = get_current_page($type);
if ($curent_page == 1) $pages = array ($curent_page, $curent_page+1, $curent_page+2, $curent_page+3, $curent_page+4);
elseif ($curent_page == 2) $pages = array ($curent_page-1, $curent_page, $curent_page+1, $curent_page+2, $curent_page+3);
elseif ($curent_page+1 == $total_pages) $pages = array ($curent_page-3, $curent_page-2, $curent_page-1, $curent_page, $curent_page+1);
elseif ($curent_page == $total_pages) $pages = array ($curent_page-4, $curent_page-3, $curent_page-2, $curent_page-1, $curent_page);
else $pages = array ($curent_page-2, $curent_page-1, $curent_page, $curent_page+1, $curent_page+2);
$pages = array_unique($pages);
$link_box = trim(get_settings('link_box')); // Контенйнер для ссылок %s
$separator_box = trim(get_settings('separator_box')); // Контенйнер для метки о наличии страниц кроме видимых %s
$total_box = trim(get_settings('total_box')); // Контенйнер для Страница ХХХ из ХХХ %s
$active_box = trim(get_settings('active_box')); // Контенйнер для активного элемента %s
$total_label = trim(get_settings('total_label')); // Текст перед номерами страниц %d
$start_label = trim(get_settings('start_label')); // Текст ссылки "Первая"
$end_label = trim(get_settings('end_label')); // Текст ссылки "Последняя"
$separator_label = trim(get_settings('separator_label')); // Текст метки о наличии страниц кроме видимых
$next_label = trim(get_settings('next_label')); // Текст ссылки "Следующая"
$prev_label = trim(get_settings('prev_label')); // Текст ссылки "Предыдущая"
// Первая
if ($total_pages > 5 && $curent_page > 3)
{
$first = str_replace('data-pagination="{s}"', 'data-pagination="1"', $template_label);
$nav .= sprintf($link_box, str_replace(array('{s}', '{t}'), $start_label, str_replace(array('&amp;'. $type .'={s}', '&' . $type .'={s}', '/' . $type . '-{s}'), '', $first)));
if ($separator_label != '')
$nav .= sprintf($separator_box, $separator_label);
}
// Предыдущая
if ($curent_page > 1)
{
if ($curent_page - 1 == 1)
$nav .= sprintf($link_box, str_replace(array('{s}', '{t}'), $prev_label, str_replace(array('&amp;'. $type .'={s}', '&' . $type .'={s}', '/' . $type . '-{s}'), '', $template_label)));
else
$nav .= sprintf($link_box, str_replace('{t}', $prev_label, str_replace('{s}', ($curent_page - 1), $template_label)));
}
foreach($pages as $val)
{
if ($val >= 1 && $val <= $total_pages)
{
if ($curent_page == $val)
{
// Текущий номер страницы (активная страница)
$nav .= sprintf($link_box, sprintf($active_box, str_replace(array('{s}', '{t}'), $val, $curent_page)));
}
else
{
if ($val == 1)
{
// Страница номер 1
$nav .= sprintf($link_box, str_replace(array('{s}', '{t}'), $val, str_replace(array('&amp;'.$type.'={s}','&'.$type.'={s}','/'.$type.'-{s}'), '', $template_label)));
}
else
{
// Остальные неактивные номера страниц
$nav .= sprintf($link_box, str_replace(array('{s}', '{t}'), $val, $template_label));
}
}
}
}
// Следующая
if ($curent_page < $total_pages)
{
$nav .= sprintf($link_box, str_replace('{t}', $next_label, str_replace('{s}', ($curent_page + 1), $template_label)));
}
// Последняя
if ($total_pages > 5 && ($curent_page < $total_pages-2))
{
if ($separator_label != '')
$nav .= sprintf($separator_box, $separator_label);
$nav .= sprintf($link_box, str_replace('{t}', $end_label, str_replace('{s}', $total_pages, $template_label)));
}
// Страница ХХХ из ХХХ
if ($nav != '')
{
if ($total_label != '')
$nav = sprintf($total_box, sprintf($total_label, $curent_page, $total_pages)) . $nav;
// Оборачиваем в общий контейнер
if ($navi_box != '')
$nav = sprintf($navi_box, $nav);
}
return $nav;
}
<?php
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
/**
* Текущая страница
*
* @param string $type тип постраничной навигации,
* допустимые значения: page, apage, artpage
* @return int номер текущей страницы
*/
function get_current_page ($type = 'page')
{
if (!in_array($type, array('page', 'apage', 'artpage'))) return 1;
$page = (isset($_REQUEST[$type]) && is_numeric($_REQUEST[$type])) ? $_REQUEST[$type] : 1;
return (int)$page;
}
/**
* Постраничная навигация для запросов и модулей
*
* @param int $total_pages количество страниц в документе
* @param string $type тип постраничной навигации,
* допустимые значения: page, apage, artpage
* @param string $template_label шаблон метки навигации
* @param string $navi_box контейнер постраничной навигации %s
* @return string HTML-код постраничной навигации
*/
function get_pagination ($total_pages, $type, $template_label, $navi_box = '')
{
$nav = '';
if (!in_array($type, array('page', 'apage', 'artpage'))) $type = 'page';
$curent_page = get_current_page($type);
if ($curent_page == 1) $pages = array ($curent_page, $curent_page+1, $curent_page+2, $curent_page+3, $curent_page+4);
elseif ($curent_page == 2) $pages = array ($curent_page-1, $curent_page, $curent_page+1, $curent_page+2, $curent_page+3);
elseif ($curent_page+1 == $total_pages) $pages = array ($curent_page-3, $curent_page-2, $curent_page-1, $curent_page, $curent_page+1);
elseif ($curent_page == $total_pages) $pages = array ($curent_page-4, $curent_page-3, $curent_page-2, $curent_page-1, $curent_page);
else $pages = array ($curent_page-2, $curent_page-1, $curent_page, $curent_page+1, $curent_page+2);
$pages = array_unique($pages);
$link_box = trim(get_settings('link_box')); // Контенйнер для ссылок %s
$separator_box = trim(get_settings('separator_box')); // Контенйнер для метки о наличии страниц кроме видимых %s
$total_box = trim(get_settings('total_box')); // Контенйнер для Страница ХХХ из ХХХ %s
$active_box = trim(get_settings('active_box')); // Контенйнер для активного элемента %s
$total_label = trim(get_settings('total_label')); // Текст перед номерами страниц %d
$start_label = trim(get_settings('start_label')); // Текст ссылки "Первая"
$end_label = trim(get_settings('end_label')); // Текст ссылки "Последняя"
$separator_label = trim(get_settings('separator_label')); // Текст метки о наличии страниц кроме видимых
$next_label = trim(get_settings('next_label')); // Текст ссылки "Следующая"
$prev_label = trim(get_settings('prev_label')); // Текст ссылки "Предыдущая"
// Первая
if ($total_pages > 5 && $curent_page > 3)
{
$first = str_replace('data-pagination="{s}"', 'data-pagination="1"', $template_label);
$nav .= sprintf($link_box, str_replace(array('{s}', '{t}'), $start_label, str_replace(array('&amp;'. $type .'={s}', '&' . $type .'={s}', '/' . $type . '-{s}'), '', $first)));
if ($separator_label != '')
$nav .= sprintf($separator_box, $separator_label);
}
// Предыдущая
if ($curent_page > 1)
{
if ($curent_page - 1 == 1)
$nav .= sprintf($link_box, str_replace(array('{s}', '{t}'), $prev_label, str_replace(array('&amp;'. $type .'={s}', '&' . $type .'={s}', '/' . $type . '-{s}'), '', $template_label)));
else
$nav .= sprintf($link_box, str_replace('{t}', $prev_label, str_replace('{s}', ($curent_page - 1), $template_label)));
}
foreach($pages as $val)
{
if ($val >= 1 && $val <= $total_pages)
{
if ($curent_page == $val)
{
// Текущий номер страницы (активная страница)
$nav .= sprintf($link_box, sprintf($active_box, str_replace(array('{s}', '{t}'), $val, $curent_page)));
}
else
{
if ($val == 1)
{
// Страница номер 1
$nav .= sprintf($link_box, str_replace(array('{s}', '{t}'), $val, str_replace(array('&amp;'.$type.'={s}','&'.$type.'={s}','/'.$type.'-{s}'), '', $template_label)));
}
else
{
// Остальные неактивные номера страниц
$nav .= sprintf($link_box, str_replace(array('{s}', '{t}'), $val, $template_label));
}
}
}
}
// Следующая
if ($curent_page < $total_pages)
{
$nav .= sprintf($link_box, str_replace('{t}', $next_label, str_replace('{s}', ($curent_page + 1), $template_label)));
}
// Последняя
if ($total_pages > 5 && ($curent_page < $total_pages-2))
{
if ($separator_label != '')
$nav .= sprintf($separator_box, $separator_label);
$nav .= sprintf($link_box, str_replace('{t}', $end_label, str_replace('{s}', $total_pages, $template_label)));
}
// Страница ХХХ из ХХХ
if ($nav != '')
{
if ($total_label != '')
$nav = sprintf($total_box, sprintf($total_label, $curent_page, $total_pages)) . $nav;
// Оборачиваем в общий контейнер
if ($navi_box != '')
$nav = sprintf($navi_box, $nav);
}
return $nav;
}
?>
Loading…
Cancel
Save