function create_body_products($table, $id, $more, $offset = 0, $BODY = "BODY", $COND = "", $MNAME = "more", $tbody = "produkt_glowna", $tmbody = "produkt_more", $sort = "", $set_offset = 1, $ptryb = 0, $foto_force_link=0, $conv="") {
global $_REQUEST, $_POST, $_GET, $ukryty, $ukryty_err, $sql_ile, $master_name, $for_index, $c, $k, $img_dir;
if ($more)
$body_tpl = read_template("tpl/produkt/$tmbody.tpl");
else
$body_tpl = read_template("tpl/produkt/$tbody.tpl");
$index = "`index`";
if( $table == $master_name."_news" ){
$index = "`data_news` DESC, `index` ASC";
if( $id == 411385565 ){
//$index = "`data_news` ASC, `index` ASC";
}
}
if( $table == $master_name."_przetargi" ){
$index = "`data_dodania` DESC, `index` ASC";
}
if( $_GET["d"] ){
$time = strtotime($_GET["d"]);
}
$for_index["act_date"] = date("Y-m-d", ($time ? round($time) : time()));
$local_ukryty = str_replace("ukryty_check", "p.ukryty_check", $ukryty);
if( isTable($table."_kategorie") && !$more && (!$COND || preg_match("/id_obiekt/", $COND)) ){
$join = " JOIN ".$table."_kategorie s ON p.id = s.id_wpis ";
if( !$COND ){
$COND = " s.id_obiekt = '$id' ";
}
}
if($BODY == "WYDARZENIA" ) {
$LCOND = " and data_news = '".$for_index["act_date"]."'";
if( !$_GET["d"] ){
$tt = myFetch(ask_Sql("select p.* from `" . $table . "` p $join where " . (!$COND ? "`pid` = '$id' " : $COND). (isColumn($table, "ukryty_check") ? $local_ukryty : ""). (isColumn($table, "produkt_nadrzedny") ? " and `produkt_nadrzedny` = ''" : ""). " and data_news >= '".date("Y-m-d")."' order by data_news ASC LIMIT 1"));
if( $tt["id"] ){
$LCOND = " and data_news = '".$tt["data_news"]."'";
$for_index["act_date"] = $tt["data_news"];
}
}
}
$c = round($_GET["c"] ? $_GET["c"] : $c);
if( is_array($COND) || preg_match("/^SELECT/i", $COND) ){
if( is_array($COND) ){
$nr["nr"] = $COND[1];
$COND = $COND[0];
}
if( $set_offset ){
if (!$c)
$c = 0;
if( !$nr["nr"] ){
if( !preg_match("/FROM([^;]+)WHERE z/i", $COND, $r) )
preg_match("/FROM([^;]+)ORDER/i", $COND, $r);
if( $r[1] )
$nr = myFetch(ask_sql("SELECT COUNT(*) as nr FROM ".$r[1]));
}
$for_index["COUNT_PR"] = $nr["nr"];
if($nr["nr"] > 0 && $nr["nr"] <= $c )
$c = 0;
pisz_links(1, ceil($nr["nr"]/$offset), $c, "q");
$sql = $COND." LIMIT ".($c * $offset)."," . $offset;
} else {
$sql = $COND;
}
} else {
if ($more > 0){
$_GET["mode"] = $tmbody;
$sql = "select * from `" . $table . "` p where " . (!$COND ? "`id` = '$more'" : $COND). (isColumn($table, "ukryty_check") && !$_GET["allegro"] ? $local_ukryty : ""). " $LCOND order by $index";
$cache_ids["produkt"][$more] = 1;
} else if ($offset) {
if (!$c)
$c = 0;
$res = ask_sql("select count(distinct(p.id)) as `nr`".(isColumn($table, "cena_id") ? ", MAX(cena_id) as cena_max, MIN(cena_id) as cena_min" : "")." from `" . $table . "` p $join where " . (!$COND ? "`pid` = '$id'" : $COND). (isColumn($table, "ukryty_check") ? $local_ukryty : ""). (isColumn($table, "produkt_nadrzedny") ? " and `produkt_nadrzedny` = ''" : ""). $LCOND);
$nr = myFetch($res);
if($set_offset && $nr["nr"] > 0 && $nr["nr"] <= $c )
$c = 0;
if ($set_offset){
$str = round($c)+1;
pisz_links(1, ceil($nr["nr"]/$offset), $c);
if( ($BODY == "BODY2" || $BODY == "BODY") && $str >= 2){
if( $for_index["META_TITLE"] ){
$for_index["META_TITLE"] = "Str. $str ".$for_index["META_TITLE"];
}
$for_index["SCIEZKA"][] = array("TYTUL" => " Str. $str", "BLOCK" => 1);
}
}
$sql = "select distinct(p.id), p.* from `" . $table . "` p $join where " . (!$COND ? "`pid` = '$id' " : $COND). (isColumn($table, "ukryty_check") ? $local_ukryty : ""). (isColumn($table, "produkt_nadrzedny") ? " and `produkt_nadrzedny` = ''" : ""). " $LCOND order by $index LIMIT ".($c * $offset)."," . $offset;
if( $BODY == "SGLOWNE" ){
$for_index["SGLOWNE_COUNT"] = $nr['nr'];
}
if( $set_offset && ($BODY == "BODY" || $BODY == "BODY2") ) {
$for_index["COUNT_PR"] = $nr["nr"];
$for_index["COUNT_MAX"] = number_format(ceil($nr["cena_max"]), 0, ".", "");
$for_index["COUNT_MIN"] = number_format(floor($nr["cena_min"]), 0, ".", "");
} else {
$for_index[$BODY."_PR"] = $nr["nr"];
}
} else
$sql = "select p.* from `" . $table . "` p $join where " . (!$COND ? "`pid` = '$id' " : $COND). (isColumn($table, "ukryty_check") ? $local_ukryty : ""). (isColumn($table, "produkt_nadrzedny") ? " and `produkt_nadrzedny` = ''" : ""). " $LCOND order by $index";
}
$result = ask_sql($sql);
//Listing nadkategorii z subkategorii
if ($_GET["aid"] > 0)
if (($for_index["TYP_PODSTRONY"] != 2 && !$more && !$COND && $sql_ile == 0 && $id) || $_GET["all"]) {
$t = cache_structure($id);
foreach ($t as $k => $v) {
if ( preg_match("/^([a-z])id$/", $k, $r) && $v)
$lid = $r[1];
}
if ( preg_match("/^[a-z]$/", $lid)) {
if (isset($t[(chr(ord($lid) + 1)). "id"]))
$lid = (chr(ord($lid) + 1)). "id";
else
$lid = (chr(ord($lid))). "id";
}
else if (!$lid)
$lid = 'aid';
if (isset($t[$lid])) {
$res = myFetch(ask_sql("SELECT `id` FROM `" . $master_name . "_structure` WHERE `$lid` = '$id' $ukryty_err LIMIT 1"));
if ($res["id"])
$cwas = 1;
$tcond = "";
$tres = ask_sql("SELECT `id` FROM `" . $master_name . "_structure` WHERE `$lid` = '$id' $ukryty_err");
while($tt = myFetch($tres)){
$cache_ids["pid"][$tt["id"]] = 1;
$tcond .= ($tcond ? "," : "").$tt["id"];
}
if( $tcond )
$COND = " `pid` IN (".$tcond.") ";
else
$COND = " 1 == 0 ";
}
$COND .= (isColumn($table, "ukryty_check") ? $local_ukryty : ""). (isColumn($table, "produkt_nadrzedny") ? " and `produkt_nadrzedny` = ''" : "");
if ($cwas) {
if ($offset) {
if (!$c)
$c = 0;
$nr = myFetch(ask_sql("select count(*) as `nr`".(isColumn($table, "cena_id") ? ", MAX(cena_id) as cena_max, MIN(cena_id) as cena_min" : "")." from `" . $table . "` p where " . $COND.$LCOND));
if($nr["nr"] > 0 && $nr["nr"] <= $c )
$c = 0;
$sql = "select * from `" . $table . "` p where " . $COND.$LCOND . " order by $index LIMIT ".($c * $offset)."," . $offset;
pisz_links(1, ceil($nr["nr"]/$offset), $c);
if( $set_offset && ($BODY == "BODY" || $BODY == "BODY2") ) {
$for_index["COUNT_PR"] = $nr["nr"];
$for_index["COUNT_MAX"] = number_format(ceil($nr["cena_max"]), 0, ".", "");
$for_index["COUNT_MIN"] = number_format(floor($nr["cena_min"]), 0, ".", "");
}
} else
$sql = "select * from `" . $table . "` p where " . $COND.$LCOND . " order by $index";
}
$result = ask_sql($sql);
}
if( $BODY == "WYDARZENIA" ){
$for_index["PREV_DATES"] = array();
$i = 0;
$res_prev = ask_sql("SELECT DISTINCT data_news FROM ".$master_name."_news WHERE pid = $id and `data_news` < '".$for_index["act_date"]."' $ukryty ORDER BY `data_news` DESC LIMIT 2");
while ($pt = myFetch($res_prev)){
if( $i == 3 ){
$for_index["PREV_DATE_OKRES"] = $pt["data_news"];
} else {
$for_index["PREV_DATES"][]["data_news"] = $pt["data_news"];
$i++;
}
}
$for_index["PREV_DATES"] = @array_reverse($for_index["PREV_DATES"]);
$for_index["NEXT_DATES"] = array();
$i = 0;
$res_prev = ask_sql("SELECT DISTINCT data_news FROM ".$master_name."_news WHERE pid = $id and `data_news` > '".$for_index["act_date"]."' $ukryty ORDER BY `data_news` ASC LIMIT 2");
while ($pt = myFetch($res_prev)){
if( $i == 3 ){
$for_index["NEXT_DATE_OKRES"] = $pt["data_news"];
} else {
$for_index["NEXT_DATES"][]["data_news"] = $pt["data_news"];
$i++;
}
}
if( $for_index["NEXT_DATES"] || $_GET["d"] ){
while( count($for_index["NEXT_DATES"]) < 3 ){
$for_index["NEXT_DATES"][]["blank"] = 1;
}
}
}
$counter = $sql_ile;
$j = 1 + $c;
$ii = 0;
while ($t = mysqli_fetch_array($result)) {
foreach ($t as $k=>$v){
if( preg_match("/_body[0-9]$/", $k) && $v)
$t[$k] = nl2br($v);
}
$jj++;
if( $conv ){
$t["opis_html"] = iconv("utf-8", $conv, $t["opis_html"]);
$t["nazwa"] = iconv("utf-8", $conv, $t["nazwa"]);
$for_stuff = $t;
} else
$for_stuff = $t;
$for_stuff["COUNTER"] = $j;
$for_stuff["COUNTER_P2"] = $ii%2;
$for_stuff["COUNTER_P3"] = $ii%3;
$for_stuff["COUNTER_P4"] = $ii%4;
$for_stuff["COUNTER_P5"] = $ii%5;
$for_stuff["COUNT"] = $counter;
$j++;
$ii++;
if( $t["naglowek_foto"] && $more == $t["id"] ){
$for_index["ANIMKA"][0] = array("tlo_foto" => $t["naglowek_foto"]);
}
if ($more && $_GET["cid"] > 0) {
$for_stuff["CAT_LINK"] = getWiecejLink($t["pid"]);
$st = cache_structure($t["pid"], $master_name . "_structure");
$for_stuff["CAT_NAME"] = $st["title"];
}
if ($t["HREF"] > 0 || $more)
$for_stuff["BODY"] = cut_body($t["opis_html"], 0);
else
$for_stuff["BODY"] = cut_body($t["opis_html"], ($t["glowne_foto"] ? 200 : 250));
$for_stuff["HREF"] = (getWiecejLink($t["HREF"]) ? getWiecejLink($t["HREF"]) : getProductLink($t["id"], "p", $t["nazwa"], $t["pid"]));
if ($more == $t["id"]) {
list($for_stuff["IMG"], $ignore) = setFotos($t, 2);
$for_index["META_DESCRIPTION"] = prepareForMetaDescription($t["opis_html"]);
$for_index["SCIEZKA"][999]["TYTUL"] = $t["nazwa"]." ".$t['nazwa_dodatkowa'];
$for_index["SCIEZKA"][999]["HREF"] = $link;
$for_index["SCIEZKA"][999]["BLOCK"] = 1;
$for_index["NAGL"] = $t["nazwa"];
$for_stuff["PROD_LINK"] = $for_index["SCIEZKA"][999]["HREF"];
if( $t["komentarze_check"] ){
$for_stuff["KOMENTARZE_BODY"] .= komentarze($t["id"]);
$for_stuff["KOMENTARZE_FORM"] .= komentuj($t["id"]);
}
}
if( isTable($table."_do_pobrania") || $wmore && isTable($base_table."_do_pobrania") ){
if( $wmore ){
$pres = ask_sql("SELECT * FROM
(SELECT * FROM
(SELECT * FROM ".$base_table."_do_pobrania_zmiany a WHERE `pid` = '".$t["id"]."' and data_zmiany <= '".date("Y-m-d H:i:s", $wmore)."' ORDER BY `data_zmiany` DESC) b
GROUP BY `id`) b
WHERE pid = '".$t["id"]."' $ukryty order by `index`");
} else {
$pres = ask_sql("SELECT * FROM ".$table."_do_pobrania WHERE pid = '".$t["id"]."' $ukryty order by `index`");
}
$pi = 1;
while($pt = myFetch($pres)){
$pt["opis_grupy_body3"] = nl2br($pt["opis_grupy_body3"]);
$for_stuff["DO_POBRANIA"][$pi] = $pt;
if( preg_match("/\.([a-zA-Z0-9]+)$/", $pt["plik_file"], $r) ){
if( $r[1] == "docx" )
$r[1] = "doc";
if( $r[1] == "xlsx" )
$r[1] = "xls";
if( preg_match("/(mpg|wmv|avi|mp4|mp3|mov|wav)/", $r[1]) )
$r[1] = "mpg";
if( file_exists("grafika/".$r[1].".gif") ){
$for_stuff["DO_POBRANIA"][$pi]["icon"] = $r[1];
}
if( $_GET["aid"] == 8888 ){
$pt["data_dodania"] = $t["data_dodania"];
list($for_stuff["DO_POBRANIA"][$pi]["ZMIANY_INFO"], $for_stuff["data_dodania"]) = getAutorInfo($table."_do_pobrania", $pt["id"], $pt, "list", $for_stuff["data_dodania"]);
}
}
$for_stuff["DO_POBRANIA"][$pi]["name"] = ($pt["nazwa_body2"] ? $pt["nazwa_body2"] : myEreg_replace("([0-9]+)\/", "", $pt["plik_file"]));
$pi++;
}
if( $for_stuff["DO_POBRANIA"][1]["naglowek"] ){
$for_stuff["SET_HEADER"] = 1;
}
}
if( $for_index["TYP_PODSTRONY"] == 4 ){
$resd = ask_sql("SELECT * FROM ".$master_name."_przetargi_informacje_o_zmianach WHERE pid = '".$t["id"]."' $ukryty ORDER BY `index` ASC");
while ($zt = myFetch($resd)){
$zt["data_zmiany"] = date("d.m.Y", strtotime($zt["data_zmiany"]));
$zt["opis_body4"] = nl2br($zt["opis_body4"]);
$for_stuff["ZMIANY"][] = $zt;
}
}
if ( $_GET["aid"] == 8888 ) {
if( $t["autor"] ){
$a = myFetch(ask_sql("SELECT * FROM ".$master_name."_admin WHERE id = '".$t["autor"]."'"));
$for_stuff["OPUBLIKOWANE_PRZEZ"] = $a["imie_nazwisko"];
}
list($for_stuff["ZMIANY_INFO"], $for_stuff["data_dodania"]) = getAutorInfo($table, $t["id"], $t, "full", $for_stuff["data_dodania"]);
$for_stuff["data_dodania"] = $t["data_dodania"];
}
if( $more == $t["id"] && $table == $master_name."_news" ){
$sql_ser = "SELECT *,
( (CASE WHEN `data_news` >= '".date("Y-m-d", time()-30*24*60*60)."' THEN 3 ELSE 1 END) * MATCH (nazwa, tagi_long) AGAINST ('".($t["tagi_long"] ? $t["tagi_long"] : $t["nazwa"])."' ) ) as score
FROM ".$table." p WHERE id != '".$t["id"]."' and pid IN(".($_GET["aid"] == 1111 ? "411385565,1378219123" : $id).") $ukryty ORDER BY `score` DESC LIMIT 2";
create_body_products($master_name."_news", $id, "", 2, "ZOBACZ", $sql_ser, "more", "news", "news_more", "", 0, 2);
$for_stuff["ZOBACZ"] = $for_index["ZOBACZ"];
}
$for_index[$BODY] .= template($for_stuff, $body_tpl);
unset ($for_stuff);
} //End while
}
function getAutorInfo($table, $id, $t, $mode="full", $data_dodania = -1){
global $master_name, $_GET, $for_index;
if( is_array($id) ){
$id = implode(",",$id);
if( isset($t["autor_"]) ) {
$for_zmiany["AUTOR"] = $t["autor_"];
$a = cache_structure($t["autor"], $master_name."_admin");
$for_zmiany["AUTOR2"] = $a["imie_nazwisko"];
} else {
$z = myFetch(ask_sql("SELECT data_zmiany, administrator FROM ".$table."_zmiany WHERE id IN($id) ORDER BY `data_zmiany` ASC LIMIT 1"));
if( $z["administrator"] ){
$a = cache_structure($z["administrator"], $master_name."_admin");
$for_zmiany["AUTOR"] = $a["imie_nazwisko"];
}
}
$t["wyswietlen"] = $_GET["WYSWIETLEN"] ? $_GET["WYSWIETLEN"] : $for_index["WYSWIETLEN"];
} else {
if( !$t ){
$t = myFetch(ask_sql("SELECT * FROM ".$table." WHERE id = '$id'"));
}
if( isset($t["autor_"]) ) {
$for_zmiany["AUTOR"] = $t["autor_"];
$a = cache_structure($t["autor"], $master_name."_admin");
$for_zmiany["AUTOR2"] = $a["imie_nazwisko"];
} else if( $t["autor"] ){
$a = cache_structure($t["autor"], $master_name."_admin");
$for_zmiany["AUTOR"] = $a["imie_nazwisko"];
}
}
$z = myFetch(ask_sql("SELECT data_zmiany, administrator FROM ".$table."_zmiany WHERE id IN($id) and zakres LIKE 'ukryty_check:0%' ORDER BY `data_zmiany` ASC LIMIT 1"));
$for_zmiany["DATA_PUBLIKACJI"] = date("d.m.Y H:i", strtotime($z["data_zmiany"]));
if( $z["data_zmiany"] )
$for_zmiany["data_dodania"] = date("Y-m-d H:i:s", strtotime($z["data_zmiany"]));
if( $z["administrator"] ){
$a = cache_structure($z["administrator"], $master_name."_admin");
$for_zmiany["OPUBLIKOWAL"] = $a["imie_nazwisko"];
}
if( !$for_zmiany["OPUBLIKOWAL"] ){
$for_zmiany["OPUBLIKOWAL"] = $for_zmiany["AUTOR"];
}
$z = myFetch(ask_sql("SELECT data_zmiany, administrator FROM ".$table."_zmiany WHERE id IN($id) ORDER BY `data_zmiany` DESC LIMIT 1"));
$for_zmiany["DATA_MODYFIKACJI"] = date("d.m.Y H:i", strtotime($z["data_zmiany"]));
if( $z["administrator"] ){
$a = cache_structure($z["administrator"], $master_name."_admin");
$for_zmiany["OSTATNIO_ZMODYFIKOWAL"] = $a["imie_nazwisko"];
}
if( !$for_zmiany["OSTATNIO_ZMODYFIKOWAL"] ){
$for_zmiany["OSTATNIO_ZMODYFIKOWAL"] = $for_zmiany["AUTOR2"] ? $for_zmiany["AUTOR2"] : $for_zmiany["AUTOR"];
}
$for_zmiany["WYSWIETLEN"] = $t["wyswietlen"];
if( $table == $master_name ){
if( $for_index["AUTOR_"] ){
$for_zmiany["AUTOR"] = $for_index["AUTOR_"];
}
if( $for_index["OPUBLIKOWAL"] ){
$for_zmiany["OPUBLIKOWAL"] = $for_index["OPUBLIKOWAL"];
}
}
foreach ($for_zmiany as $k=>$v){
if( preg_match("/^DATA_/", $k) && preg_match("/00:00/", $v) ){
$for_zmiany[$k] = str_replace(" 00:00", "", $v);
}
}
if( preg_match("/\.-0001/", $for_zmiany["DATA_PUBLIKACJI"]) ){
$for_zmiany["DATA_PUBLIKACJI"] = $for_zmiany["DATA_MODYFIKACJI"];
}
if( $for_zmiany["DATA_PUBLIKACJI"] == '01.01.1970 01:00' || 1 ){
$for_zmiany["DATA_PUBLIKACJI"] = date("d.m.Y H:i", strtotime($t["data_dodania"]));
//$for_zmiany["OPUBLIKOWAL"] = "";
//$for_zmiany["OSTATNIO_ZMODYFIKOWAL"] = "";
}
if( $for_zmiany["DATA_MODYFIKACJI"] == '01.01.1970 01:00' ){
$for_zmiany["DATA_MODYFIKACJI"] = $for_zmiany["DATA_PUBLIKACJI"] ? $for_zmiany["DATA_PUBLIKACJI"] : $data_dodania;
}
if( $for_zmiany["DATA_PUBLIKACJI"] != '01.01.1970 01:00' ){
if( $mode == "list" ){
if( $for_zmiany["DATA_PUBLIKACJI"] )
$return = template($for_zmiany, read_template("tpl/produkt/zmiany_pobierz.tpl"));
} else
$return = template($for_zmiany, read_template("tpl/produkt/zmiany_stopka.tpl"));
}
if( $data_dodania != "-1" ){
return array($return, $for_zmiany["data_dodania"] ? $for_zmiany["data_dodania"] : $data_dodania);
} else {
return $return;
}
}
?>
function getStructureArray($name, $default, $table, $params = "", $show_default = true, $body_condition = "", $domyslny = "") {
global $_GET;
if ($table) {
$result = ask_sql("SHOW COLUMNS FROM `$table`");
while ($row = mysqli_fetch_array($result)) {
if (ereg("^([a-z]{1})(id)$", $row["Field"])) {
$cols .= " and `" . $row["Field"]. "` = 0";
}
}
$res = ask_sql("SELECT * FROM `$table` where `id` > 0 $cols " . $body_condition . " ORDER BY `index`");
while ($t = mysqli_fetch_assoc($res)) {
$ret .= "
";
$ret .= getBelowStructureArray($name, $default, 1, $t["id"], "-", $table, $body_condition);
}
return "";
}
}
function getBelowStructureArray($name, $default, $level, $id, $sep, $table, $body_condition) {
global $_GET;
if ($table == "???")
$table = $_GET["stable"];
$result = ask_sql("SHOW COLUMNS FROM `$table`");
while ($row = mysqli_fetch_array($result)) {
if (ereg(chr(ord('a') - 1 + $level). "id", $row["Field"]))
$start_show = 1;
else if ($start_show == 1 && ereg("^([a-z]{1})(id)$", $row["Field"]))
$cols .= " and `" . $row["Field"]. "` = 0";
}
$res = ask_sql("SELECT * FROM `$table` where `id` > 0 and `" . chr(ord('a') - 1 + $level). "id` = $id $cols " . $body_condition . " ORDER BY `index`");
while ($t = mysqli_fetch_assoc($res)) {
$ret .= "
";
if (isset($t[chr(ord('a') + $level). "id"]))
$ret .= getBelowStructureArray($name, $default, $level + 1, $t["id"], $sep . "-", $table, $body_condition);
}
return $ret;
}
function colorize($txt, $search) {
$search = urldecode($search);
$r = preg_split('((>)|(<))', $txt, -1, PREG_SPLIT_DELIM_CAPTURE);
for ($i = 0; $i < count($r); $i++) {
if ($r[$i] == "<") {
$i++;
continue;
}
$r[$i] = preg_replace("/($search)/i", "\\1", $r[$i]);
}
return join("", $r);
}
function szukaj($q, $in_podpowiedz = 0) {
global $_GET, $ukryty, $kat, $zsid, $for_index, $c, $w, $master_name;
if ($q == "szukana fraza")
$q = "";
$_GET["q"] = htmlspecialchars(strip_tags(urldecode(urldecode($q))), ENT_QUOTES, "UTF-8");
$q = $_GET["q"];
$qs = myEscape($q);
if( $qs )
$podpowiedz = getPodpowiedzi($qs);
if (!$qs) {
$qs = " ";
}
$qs = myEscape(urldecode($_GET["q"]));
$arr = preg_split("/ /", trim($qs));
$qss = "+".implode(" +", $arr);
$szukaj_tpl = read_template("tpl/szukaj.tpl");
$po_ile = 20;
if( $_GET["c"]){
$c = round($_GET["c"]);
}
if (!$c)
$c = "0";
$for_index["NAGL"] = "Wyniki wyszukiwania";
$for_index["SCIEZKA"]["1"]["TYTUL"] = "Szukaj";
$for_index["SCIEZKA"]["2"]["TYTUL"] = urldecode($q);
$for_index["SCIEZKA"]["2"]["HREF"] = getWiecejLink("?q=$q");
if( $_GET["producent"] )
$cond .= " and `producent` = '".$_GET["producent"]."' ";
if ( isTable($master_name."_produkty") && isColumn($master_name."_produkty", "ukryty_check") )
$cond .= " and p.ukryty_check != 1 ";
$res = ask_sql("
SELECT COUNT(DISTINCT(ps.id)) as `nr`
FROM `" . $master_name . "` p,
`" . $master_name . "_structure` ps
WHERE " . ($q ? "(
MATCH (p.naglowek, p.`tytul`, p.`opis_html`, p.`index_text`)
AGAINST ('$qss' IN BOOLEAN MODE) ) " : " 1 "). "
and p.pid = ps.id
and p.ukryty_check IN(0,3)
and ps.ukryty_check IN(0,5,3)
");
$t = mysqli_fetch_assoc($res);
if( isTable($master_name."_produkty") )
$res = ask_sql("
SELECT COUNT(*) as `nr`
FROM `" . $master_name . "_produkty` p,
`" . $master_name . "_structure` ps
WHERE " . ($qs != " " ? " (
MATCH (p.`nazwa`, p.opis_html, p.index_text)
AGAINST ('$qss' IN BOOLEAN MODE)
or p.nazwa LIKE '%$qs%'
)" : " 1 "). " and
p.pid = ps.id $cond
and p.ukryty_check IN(0,3)
and ps.ukryty_check IN(0,5,3)
");
else
$t2["nr"] = 0;
$t2 = mysqli_fetch_assoc($res);
if( isTable($master_name."_news") )
$res = ask_sql("
SELECT COUNT(*) as `nr`
FROM `" . $master_name . "_news` p,
`" . $master_name . "_structure` ps
WHERE " . ($qs != " " ? " (
MATCH (p.`nazwa`, p.opis_html, p.index_text)
AGAINST ('$qss' IN BOOLEAN MODE)
or p.nazwa LIKE '%$qs%'
)" : " 1 "). " and
p.pid = ps.id $cond
and p.ukryty_check IN(0,3)
and ps.ukryty_check IN(0,5,3)
");
else
$t3["nr"] = 0;
$t3 = mysqli_fetch_assoc($res3);
$for_szukaj["NR"] = $t["nr"] + $t2["nr"]+ $t3["nr"];
$for_szukaj["OFFSET"] = pisz_links(1, ceil($for_szukaj["NR"]/$po_ile), $c, "q");
$for_szukaj["OFFSET_L"] = $for_index["OFFSET_L"];
$for_szukaj["OFFSET_R"] = $for_index["OFFSET_R"];
$for_index["OFFSET"] = "";
$sql= "
SELECT p.id, ps.title as tytul, p.opis_html, p.1_foto as `foto`, p.pid, ps.title, ps.id as `mid`, '0' as `stype`, MATCH (p.naglowek, p.`tytul`, p.`opis_html`, p.`index_text`)
AGAINST ('$qs') +
MATCH (ps.`title`)
AGAINST ('$qs')
as `score`
FROM `" . $master_name . "` p
LEFT JOIN
`" . $master_name . "_structure` ps
on
p.pid = ps.id
WHERE " . ($q ? "
MATCH (p.naglowek, p.`tytul`, p.`opis_html`, p.`index_text`)
AGAINST ('$qss' IN BOOLEAN MODE)
" : " 1 "). "
and p.ukryty_check IN(0,3)
and ps.ukryty_check IN(0,5,3)
GROUP BY `mid`
";
if( isTable($master_name."_produkty") ){
$sql .= "
UNION
SELECT p.id, p.nazwa as tytul, p.opis_html, p.glowne_foto as `foto`, p.pid, ps.title, ps.id as `mid`, '1' as `stype`,
(
MATCH (p.`nazwa`, p.opis_html, p.index_text)
AGAINST ('$qs')
+
MATCH (ps.`title`)
AGAINST ('$qs')
+ CASE WHEN p.nazwa LIKE '%$qs%' THEN 10 ELSE 0 END
) as `score`
FROM `" . $master_name . "_produkty` p,
`" . $master_name . "_structure` ps
WHERE " . ($qs != " " ? "(
MATCH (p.`nazwa`, p.opis_html, p.index_text) AGAINST ('$qss' IN BOOLEAN MODE)
or
p.nazwa LIKE '%$qs%'
) and " : ""). "
p.pid = ps.id $cond
and p.ukryty_check IN(0,3)
and ps.ukryty_check IN(0,5,3)
";
}
if( isTable($master_name."_news") ){
$sql .= "
UNION
SELECT p.id, p.nazwa as tytul, p.opis_html, p.glowne_foto as `foto`, p.pid, ps.title, ps.id as `mid`, '1' as `stype`,
(
MATCH (p.`nazwa`, p.opis_html, p.index_text)
AGAINST ('$qs')
+
MATCH (ps.`title`)
AGAINST ('$qs')
+ CASE WHEN p.nazwa LIKE '%$qs%' THEN 10 ELSE 0 END
) as `score`
FROM `" . $master_name . "_news` p,
`" . $master_name . "_structure` ps
WHERE " . ($qs != " " ? "(
MATCH (p.`nazwa`, p.opis_html, p.index_text)AGAINST ('$qss' IN BOOLEAN MODE)
or
p.nazwa LIKE '%$qs%'
) and " : ""). "
p.pid = ps.id $cond
and p.ukryty_check IN(0,3)
and ps.ukryty_check IN(0,5,3)
";
}
$res = ask_sql($sql."order by `score` DESC LIMIT ".($c * $po_ile).",$po_ile");
$i = 1 + $c*$po_ile;
while ($t = mysqli_fetch_assoc($res)) {
$for_szukaj["LINKS"][$i] = $t;
$for_szukaj["LINKS"][$i]["NRI"] = $i;
$for_szukaj["LINKS"][$i]["TYTUL"] = $t["tytul"];
$for_szukaj["LINKS"][$i]["BODY"] = cut_body(strip_tags($t["opis_html"]), 200);
if( trim($qs) )
$for_szukaj["LINKS"][$i]["BODY"] = colorize($for_szukaj["LINKS"][$i]["BODY"], $qs);
if ($t["stype"])
$for_szukaj["LINKS"][$i]["HREF"] = getProductLink($t["id"], "p", $t["tytul"], $t["pid"]);
else
$for_szukaj["LINKS"][$i]["HREF"] = getWiecejLink($t["pid"]);
$for_szukaj["LINKS"][$i]["SCIEZKA"] = getSciezkaFromId($t["pid"], "RETURN", "", 1);
$i++;
}
if( $in_podpowiedz ) {
return $for_szukaj;
}
if( $podpowiedz && !$in_podpowiedz && !$for_szukaj["NR"] ){
$_GET["q"] = $podpowiedz;
$for_szukaj = szukaj($_GET["q"], 1);
$for_szukaj["INFO"] = ($podpowiedz ? "
Czy szukałeś: ".$podpowiedz."?
" : "");
}
$_GET["q"] = urldecode($_GET["q"]);
return template($for_szukaj, $szukaj_tpl);
}
function getPodpowiedzi($qs, $force=0){
$arr = preg_split("/ /", trim($qs));
$pspell_config = pspell_config_create("pl");
$slownik = file_get_contents("data/slownik.pws");
pspell_config_personal($pspell_config, "data/slownik.pws");
$pspell_link = pspell_new_config($pspell_config);
$podpowiedzi = Array();
$was = 0;
$frazy = array();
for ($i=0;$i
Tickets - Visit the Zoo - Zoo Warszawa
The ZOO is open every day, every Sunday and every holiday from 9:00 a.m.
Welcome to Warsaw
Zoological Garden
Tickets
TICKET PRICES
SPRING–SUMMER SEASON (APRIL – SEPTEMBER)
Regular ticket – 45 PLN
Regular ticket with Varsovian Card – 40 PLN
Reduced ticket – 35 PLN (children from 3 years of age, pupils, students up to 26 years, retirees and pensioners under 75 – only with a valid ID)
Reduced ticket with Young Varsovian Card – 30 PLN (children from 3 years of age, pupils, students up to 26 years)
Family ticket – 35 PLN per person (minimum 3 people; maximum 2 adults and children up to 16 years of age)
AUTUMN–WINTER SEASON (OCTOBER – MARCH)
Regular ticket – 35 PLN
Regular ticket with Varsovian Card – 30 PLN
Reduced ticket – 30 PLN (children from 3 years of age, pupils, students up to 26 years, retirees and pensioners under 75 – only with a valid ID)
Reduced ticket with Young Varsovian Card – 25 PLN (children from 3 years of age, pupils, students up to 26 years)
Family ticket – 30 PLN per person (minimum 3 people; maximum 2 adults and children up to 16 years of age)
ALL YEAR ROUND
Annual tickets – available daily at the Customer Service Point:
Personal adult – 150 PLN
Personal reduced – 100 PLN
For eligible persons (children up to 3 years of age and people over 75 years) – 12 PLN
Duplicate annual ticket – 12 PLN
SPECIAL OFFER
1 PLN ticket – available for children up to 3 years of age (until their 3rd birthday) and people over 75 years of age
Group discount – for every 10 reduced-fare visitors, one guardian enters for 1 PLN
Free admission (after collecting a 0 PLN ticket at the ticket office) applies to:
• persons with a disability certificate together with one adult guardian
• retirees and pensioners on the first Tuesday of each month
• children under 12 on Children’s Day (with a valid school ID)
TICKETS can be purchased:
Tickets are non-refundable and cannot be exchanged.
Download price list
Buy ticket
W kasach można płacić kartą – obsługiwane są najbardziej popularne: Visa, V Pay, Maestro i MasterCard.