query("SET NAMES 'utf8'"); mysql_query('SET character_set_results=UTF8'); mysql_query('SET character_set_connection=UTF8'); mysql_query('SET character_set_client=UTF8'); // funkce s prikazem explode - pro rozdelovani retezce function ExplodeData($what, $key, $count=1) { $explode_key = explode($key, $what); $count--; $explode_fin = $explode_key[$count]; return $explode_fin; } // pryc s parchantama function SmejdiURL($text) { $text = Str_Replace( Array("'","#","<",">","(",")","%","$","!","+","*","&","\""), Array("","","","","","","","","","","","",""), $text); return $text; } // funkce vraci pocet nabidek dle typu function NumNabidky($typ=0, $subtype=0) { $count_num = "0 nabídek"; if($typ > 0) { if($subtype == 0) { $sql_count_nabidka = "SELECT id FROM `shop_nemovitosti` WHERE data LIKE '%advert_type=".$typ.";%' AND block='0'"; } else { $sql_count_nabidka = "SELECT id FROM `shop_nemovitosti` WHERE data LIKE '%advert_type=".$typ.";%' AND data LIKE '%advert_function=".$subtype.";%' AND block='0'"; } $finl_count_nabidka = mysql_query($sql_count_nabidka) or Die ("Error SQL:
$sql_count_nabidka"); $count_num = (int) mysql_num_rows($finl_count_nabidka); if($count_num == 1) { $count_num = "1 nabídka"; } if($count_num > 1 and $count_num <= 5) { $count_num = $count_num." nabídky"; } if($count_num > 5) { $count_num = $count_num." nabídek"; } } $count_num = "".$count_num.""; return $count_num; } // funkce vraci hodnotu z ciselniku function NumCiselnik($name='', $num=0) { if($num > 0 and !empty($name)) { $sql_count_nabidka = "SELECT text FROM `shop_ciselnik` WHERE nazev='$name' AND block='0' LIMIT 1"; $finl_count_nabidka = mysql_query($sql_count_nabidka) or Die ("Error SQL:
$sql_count_nabidka"); if($row_all_nabidka = mysql_fetch_assoc($finl_count_nabidka)) { $array_nab = $row_all_nabidka['text']; $pole_load_array = explode(";", $array_nab); for($xppp=0; $xppp 0) { $sql_count_nabidka = "SELECT nazev FROM `shop_ciselnik` WHERE id='$num' AND block='0' LIMIT 1"; $finl_count_nabidka = mysql_query($sql_count_nabidka) or Die ("Error SQL:
$sql_count_nabidka"); if($row_all_nabidka = mysql_fetch_assoc($finl_count_nabidka)) { $num_name = $row_all_nabidka['nazev']; } } return $num_name; } // funkce rozdeleni ceny function prise_upd($cena=0) { if($cena > 0) { $cena_count = strlen($cena); if($cena_count <= 3) { $return = $cena; } if($cena_count == 4) { $cast1 = substr($cena, 0, 1); $cast2 = substr($cena, 1, 3); $return = $cast1." ".$cast2; } if($cena_count == 5) { $cast1 = substr($cena, 0, 2); $cast2 = substr($cena, 2, 3); $return = $cast1." ".$cast2; } if($cena_count == 6) { $cast1 = substr($cena, 0, 3); $cast2 = substr($cena, 3, 3); $return = $cast1." ".$cast2; } if($cena_count == 7) { $cast1 = substr($cena, 0, 1); $cast2 = substr($cena, 1, 3); $cast3 = substr($cena, 4, 3); $return = $cast1." ".$cast2." ".$cast3; } if($cena_count == 8) { $cast1 = substr($cena, 0, 2); $cast2 = substr($cena, 2, 3); $cast3 = substr($cena, 5, 3); $return = $cast1." ".$cast2." ".$cast3; } } else { $return = 0; } return $return; } // funkce na detekci prohlizece function BrowserDetect($ext=0) { $browsers = 'mozilla msie gecko firefox konqueror safari netscape navigator chrome opera mosaic lynx amaya omniweb'; //$browsers = split(' ', $browsers); $browsers = preg_split('/ /', $browsers); $nua = strToLower($_SERVER['HTTP_USER_AGENT']); $l = strlen($nua); for($i=0; $i0) { $version = ''; $names = $browser; $j = strpos($nua, $names)+$n+strlen($names)+1; for(; $j<=$l; $j++) { $s = substr ($nua, $j, 1); if(is_numeric($version.$s)) { $version .= $s; } else { break; } } } } if($ext == 0) { $html_out = $names; } else { $html_out = (int) $version; } return $html_out; } ?>