Ejemplo n.º 1
0
$keywords = $tpl['biblio']['_Keywords'];
$correct_links = contentHelper::strtolower_ru($tpl['biblio']['data']["name"]) . "_n" . $tpl['biblio']['data']["biblio"] . ".html";
if ("/biblio/" . $correct_links != urldecode($_SERVER['REQUEST_URI'])) {
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: ' . $cfg['site_dir'] . "biblio/" . $correct_links);
    die;
}
$tpl['breadcrumbs'][] = array('text' => 'Библиотека нумизмата', 'href' => $cfg['site_dir'] . 'biblio', 'base_href' => $cfg['site_dir'] . 'biblio');
$tpl['breadcrumbs'][] = array('text' => $tpl['biblio']['data']['name'], 'href' => '', 'base_href' => "");
$mytext = str_replace(chr(13), "<br>", $tpl['biblio']['data']['text']);
$mytext = str_replace("<<<", "<img src={$biblioimagesfolder}/", $mytext);
$mytext = str_replace(">>>", ">", $mytext);
$tpl['biblio']['data']['text'] = str_replace("`", "'", $mytext);
$tpl['pages'] = array();
if (!$tpl['biblio']['data']['parent']) {
    //является вершиной дерева
    $sql = "select biblio,name from biblio where parent='{$biblio}' order by biblio;";
    $tpl['pages'] = $biblio_class->getDataSql($sql);
    foreach ($tpl['pages'] as $i => $rows1) {
        $tpl['pages'][$i]['correct_link'] = contentHelper::strtolower_ru($rows1["name"]) . "_n" . $rows1["biblio"] . ".html";
    }
} else {
    //является лепестком
    $sql = "select biblio,name from biblio where biblio='" . $tpl['biblio']['data']['parent'] . "' or parent='" . $tpl['biblio']['data']['parent'] . "' order by parent, biblio;";
    $tpl['pages'] = $biblio_class->getDataSql($sql);
    foreach ($tpl['pages'] as $i => $rows1) {
        $tpl['pages'][$i]['correct_link'] = contentHelper::strtolower_ru($rows1["name"]) . "_n" . $rows1["biblio"] . ".html";
    }
}
$biblioByKeywords = $biblio_class->getBiblioByKeywords($keywords, $biblio);
$newsbyKeywords = $biblio_class->getNewsByKeywords($keywords, $biblio);
Ejemplo n.º 2
0
        $sql = "Select count(*) from biblio where `check`=1 and parent=0;";
    }
    $count = $biblio_class->getOneSql($sql);
    $pages = ceil($count / $tpl['onpage']);
    if (!$pages) {
        $pages = 1;
    }
    if ($tpl['pagenum'] > $pages) {
        $tpl['pagenum'] = $pages;
    }
    if ($group) {
        $sql = "select biblio, FROM_UNIXTIME(date, \"%d.%m.%Y\") as t, name, text \n\t\tfrom biblio where `check`=1 and parent=0 and `group`={$group} \n\t\torder by date desc \n\t\tlimit " . ($tpl['pagenum'] - 1) * $tpl['onpage'] . "," . $tpl['onpage'];
    } else {
        $sql = "select biblio, FROM_UNIXTIME(date, \"%d.%m.%Y\") as t, name, text \n\t\tfrom biblio where `check`=1 and parent=0 order by date desc limit " . ($tpl['pagenum'] - 1) * $tpl['onpage'] . "," . $tpl['onpage'];
    }
    $tpl['result'] = $biblio_class->getDataSql($sql);
    $nnn = 0;
    foreach ($tpl['result'] as $n => $rows) {
        $text = mb_substr($rows['text'], 0, 250, 'utf8');
        while (substr_count($text, "<<<")) {
            $text = substr($text, 0, strpos($text, "<<<")) . substr(strstr($text, ">>>"), 3);
        }
        $tpl['result'][$n]['text'] = substr($text, 0, strlen($text) - strpos(strrev($text), '.'));
        $tpl['result'][$n]['namehref'] = contentHelper::strtolower_ru($rows["name"]) . "_n" . $rows["biblio"] . ".html";
    }
} elseif ($s) {
    if (strlen($s) > 3) {
        $s = str_replace("'", "", $s);
        if ($st == 1) {
            $sql1 = "name like '%{$s}%'";
        } elseif ($st == 2) {