Пример #1
0
} elseif (isset($_COOKIE['orderby'])) {
    $tpl['orderby'] = $_COOKIE['orderby'];
}
if (!isset($tpl['orderby'])) {
    $tpl['orderby'] = "dateinsertdesc";
}
setcookie('orderby', $tpl['orderby'], time() + 86400 * 90, '/', $domain);
$tpl['pagenum'] = request('pagenum') ? request('pagenum') : 1;
if ($tpl['pagenum'] > 1) {
    $urlParams['pagenum'] = $tpl['pagenum'];
}
$countpubs = $news_class->countallByParams($WhereParams);
if (!$countpubs) {
    $tpl['news']['errors'][] = "Новостей нет";
}
$Meta = $news_class->getMeta("keywords", "text", "`check`=1", "date desc", $tpl['pagenum'], $tpl['onpage']);
$tpl['news']['_Description'] = 'Последние новости нумизматики.' . $Meta[1];
$tpl['news']['_Title'] = "Новости нумизматики - выпуск юбилейных и памятных монет банков мира | Клуб Нумизмат";
$tpl['news']['data'] = $news_class->getItemsByParams($WhereParams, $tpl['pagenum'], $tpl['onpage']);
foreach ($tpl['news']['data'] as $key => $rows) {
    $tpl['news']['data'][$key]['img'] = $news_class->getImg($rows['news'], $rows['text']);
    //if($tpl['user']['user_id']==352480){
    if ($tpl['user']['user_id'] == 352480) {
        //var_dump($tpl['news']['data'][$key]['img']);
        //echo "<br>";
    }
    $tpl['news']['data'][$key]['img'] = imageMini::getMini($tpl['news']['data'][$key]['img'], "news_img/");
    //}
    $news_text = $rows['text'];
    $news_text = str_replace("</h1>", "</h1>. ", $news_text);
    $news_text = strip_tags($news_text);
Пример #2
0
<?php

require_once $cfg['path'] . '/models/news.php';
require_once $cfg['path'] . '/configs/config_news.php';
$id = request('id');
//для инициализации фильтров
$text = '';
$years = array();
$sp_s = array();
$news_class = new model_news($db_class, $tpl['user']['user_id']);
$tpl['news']['errors'] = false;
$Meta = $news_class->getMeta("keywords", "text", "news='{$id}'", "", 0, 0);
$tpl['news']['data'] = $news_class->getItem($id);
$correct_links = contentHelper::strtolower_ru($tpl['news']['data']["name"]) . "_n" . $tpl['news']['data']["news"] . ".html";
if ("/news/" . $correct_links != urldecode($_SERVER['REQUEST_URI'])) {
    //header('HTTP/1.1 301 Moved Permanently');
    //header('Location: '.$cfg['site_dir']."news/".$correct_links);
    //die();
}
if ($tpl['news']['data']['pagetitle']) {
    $tpl['news']['_Title'] = $tpl['news']['data']['pagetitle'];
} else {
    $tpl['news']['_Title'] = $tpl['news']['data']["name"] . " | Новости нумизматики - выпуск юбилейных и памятных монет центральных банков мира | Клуб Нумизмат";
}
if ($tpl['news']['data']['description']) {
    $tpl['news']['_Description'] = $tpl['news']['data']['description'];
} else {
    $tpl['news']['_Description'] = 'Последние новости нумизматики.' . $Meta[1];
}
$tpl['news']['data']['text'] = preg_replace_callback('#(<img\\s(?>(?!src=)[^>])*?src=")(.*?)("[^>]*>)#', "data_to_img", $tpl['news']['data']['text']);
$tpl['news']['data']['text'] = str_replace('</div><div class="sep"></div><div class="news-img">', '</div><div class="news-img">', $tpl['news']['data']['text']);