connect($db_host, $db_user, $db_pass, $db_db); class PageController extends Smarty { function begin() { $this->template_dir = 'engine/szablony2'; $this->compile_dir = 'engine/szablony_c'; $this->plugins_dir[] = 'engine/wtyczki'; $this->cache_dir = 'engine/cache'; } } function mod_rewrite($str) { $trans = array( 'Ą' => 'A', 'ą' => 'a', 'Ó' => 'O', 'ó' => 'o', 'Ę' => 'E', 'ę' => 'e', 'Ś' => 'S', 'ś' => 's', 'Ł' => 'L', 'ł' => 'l', 'Ń' => 'N', 'ń' => 'n', 'Ż' => 'z', 'ż' => 'z', 'Ź' => 'Z', 'ź' => 'z', 'Ć' => 'C', 'ć' => 'c' ); $str = strtr($str, $trans); $new_string = preg_replace("/[^a-zA-Z0-9\s]/", "_", $str); $new_string = str_replace(' ', '_', $new_string); return $new_string; } $tpl = new PageController; $tpl->begin(); if (($_GET['typ'] == 'lokal' ) && !empty($_GET['id'])) { $id = $_GET['id'] + 0; $baza->query("select o.*, f.id, f.nazwa, f.miasto from lokal_ocena as o left join lokal as f on f.id = o.id_lokalu where f.id = '$id' order by o.id desc limit 5"); while ($row = $baza->get_array()) { $row['opis'] = strip_tags($row['tekst']); $tab[] = array('title' => $row['nazwa'] . ' / ' . $row['miasto'], 'description' => $row['opis'], 'pubdate' => $row['data'], 'link' => site_path . 'lokal,' . mod_rewrite($row['nazwa']) . ',' . $row['id'] . '.html'); } } elseif ($_GET['typ'] == 'profil') { $id = $_GET['id'] + 0; $baza->query("select o.*, l.nazwa, l.id as id_lokalu, l.miasto from lokal_ocena as o left join lokal as l on l.id = o.id_lokalu where o.autor = '$id' order by o.id desc limit 10"); while ($row = $baza->get_array()) { $row['opis'] = strip_tags($row['tekst']); $tab[] = array('title' => $row['nazwa'] . ' / ' . $row['miasto'], 'description' => $row['opis'], 'pubdate' => $row['data'], 'link' => site_path . 'lokal,' . mod_rewrite($row['nazwa']) . ',' . $row['id_lokalu'] . '.html'); } } elseif ($_GET['typ'] == 'lokale') { $baza->Query("select * from " . $prefix . "lokal where aktywny = 1 order by id desc limit 10"); while ($row = $baza->get_array()) { $row['opis'] = strip_tags($row['opis']); $tab[] = array('title' => $row['nazwa'], 'description' => $row['miasto'] . ',' . $row['lokalizacja'] . '
' . $row['telefon'], 'pubdate' => $row['data'], 'link' => site_path . 'lokal,' . mod_rewrite($row['nazwa']) . ',' . $row['id'] . '.html'); } foreach ($tab as $id => $rss) { $czas = explode("-", $rss['pubdate']); $rss['pubdate'] = date('D, d M Y H:i:s O', mktime(0, 0, 0, $czas[1], $czas[2], $czas[0])); $tab[$id] = $rss; } } elseif ($_GET['typ'] == 'opinie') { $baza->query("select o.*, f.id, f.nazwa, f.miasto from lokal_ocena as o left join lokal as f on f.id = o.id_lokalu order by o.id desc limit 5"); while ($row = $baza->get_array()) { $row['opis'] = strip_tags($row['tekst']); $tab[] = array('title' => $row['nazwa'] . ' / ' . $row['miasto'], 'description' => $row['opis'], 'pubdate' => $row['data'], 'link' => site_path . '' . mod_rewrite($row['nazwa']) . ',f' . $row['id'] . '.html'); } } elseif ($_GET['typ'] == 'news') { $baza->Query("select * from nowosci order by id desc limit 5"); while ($row = $baza->get_array()) { $row['opis'] = mb_substr(strip_tags($row['tekst']), 0, 100, 'utf-8') . '...'; $tab[] = array('title' => $row['tytul'], 'description' => $row['opis'], 'pubdate' => $row['data'], 'link' => site_path . 'news/' . $row['id'] . '/' . mod_rewrite($row['tytul']) . '.html'); } } elseif ($_GET['typ'] == 'art') { $baza->Query("select * from arty order by id desc limit 15"); while ($row = $baza->get_array()) { $row['opis'] = mb_substr(strip_tags($row['tekst']), 0, 180, 'utf-8') . '...'; $tab[] = array('title' => $row['tytul'], 'description' => $row['opis'], 'pubdate' => $row['data'], 'link' => site_path . 'artykuly/' . $row['id'] . '/' . mod_rewrite($row['tytul']) . '.html'); } } $tpl->assign('site_path', site_path); $tpl->Assign('rss', $tab); echo $tpl->fetch('rss.tpl'); ?>