getUserData($_SESSION["IDUser"]); if($user->getNextRow()) { return $user->record["opravneni"]; } return 1000; } function goToDefaultPage() { Header("Location: http://cestovani.kamdata.com/"); Exit(); } function setStrankaNoUser() { if(!isset($_SESSION['stranka']) //default stranka || $_SESSION['stranka']=="editP.php" //vsechny edity || ( $_SESSION['stranka']=="browseP.php" && $_SESSION["IDPrehled"] == 1) //browse useru ) { $_SESSION['stranka']="index.php"; } } function goToStranka() { if(isset($_SESSION['stranka'])) { Header("Location: " . $_SESSION['stranka']); Exit(); } else { goToDefaultPage(); } } function getDefKolik() { return 20; } function getBrowsePage() { return "browseP.php"; } function setDebugLevel() { error_reporting (E_ALL & E_NOTICE); } function getQuerryType($string) { if (StrStr($string,"select")) { return 10; } if (StrStr($string,"insert")) { return 20; } if (StrStr($string,"update")) { return 30; } if (StrStr($string,"delete")) { return 40; } } function is_string_valid($string) { $string=Trim($string); return $string; } function is_login_valid($string) //string bez mezer, min 5 znaku dlouhy { if(eregi("^[a-z0-9]{4}[a-z0-9]*$", $string)) return $string; else return "chyba "; } function is_email_valid($email) { if(eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $email)) return $email; else return "chyba "; } function is_int_valid($number) { if(eregi("^[\+\-]?[0-9]+$", $number)) return $number; else return "chyba "; } function is_real_valid($number) { if(eregi("^[\+\-]?[0-9]+((\.|,){0,1}[0-9]+){0,1}$", $number)) { $number=EregI_Replace(",",".",$number); return $number; } else { return "chyba "; } } function print_string($string) { $string=StripSlashes($string); $string=HTMLSpecialChars($string); print($string); } function sprint_string($string) { $string=StripSlashes($string); $string=HTMLSpecialChars($string); return($string); } function print_textarea($string) { $string=StripSlashes($string); $string=HTMLSpecialChars($string); $string=nl2br($string); print($string); } function sprint_text($string) { $string=StripSlashes($string); $string=HTMLSpecialChars($string); return($string); } function is_in_array($string,$pole) { $byloNalezeno=false; while(list($key, $value) = each($pole)) { if ($value==$string) $byloNalezeno=true; } if ($byloNalezeno) return true; else return false; } function convert_time($mysql_timestamp) { if (ereg("^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})",$mysql_timestamp,$res)): $info["year"]=$res[1]; $info["month"]=$res[2]; $info["day"]=$res[3]; $info["hour"]=$res[4]; $info["min"]=$res[5]; $info["sec"]=$res[6]; return(($info["day"].".".$info["month"].".".$info["year"])." ".$info["hour"].":".$info["min"]); else: return("Chyba !!!"); endif; } function is_access_allowed($prava, $uzivatel) { if ((isset($prava))&&($prava<=$uzivatel)) return true; else return false; } function myAddSlashes($st) { if (get_magic_quotes_gpc()) { //get_magic_quotes_gpc - zapnute magicke uvozovky return ($st); } else { return AddSlashes($st); } } function ceske_datum($a) { return (date("j",$a).".".datum_na_cesky_mesic($a)." ".date("Y",$a)); } function datum_na_cesky_den($a) { return (cesky_den(date("D",$a))); } function datum_na_cesky_mesic($a) { return (cesky_mesic(date("F",$a))); } function cesky_mesic($a) { switch ($a) { case "January": return ("ledna"); break; case "February": return ("února"); break; case "March": return ("bøezna"); break; case "April": return ("dubna"); break; case "May": return ("kvìtna"); break; case "June": return ("èervna"); break; case "July": return ("èervence"); break; case "August": return ("srpna"); break; case "September": return ("záøí"); break; case "October": return ("øíjna"); break; case "November": return ("listopadu"); break; case "December": return ("prosince"); break; } } function cesky_den($a) { switch ($a) { case "Mon": return ("Pondìlí"); break; case "Tue": return ("Úterý"); break; case "Wed": return ("Støeda"); break; case "Thu": return ("Ètvrtek"); break; case "Fri": return ("Pátek"); break; case "Sat": return ("Sobota"); break; case "Sun": return ("Nedìle"); break; } } function TextSQL ($s) { $s="'".AddSlashes(Trim($s))."'"; return $s; } function removeCzech ($s) { return strtr ($s, "ìšèøžýáíéúùïòÌŠÈØŽÝÁÍÚÙ", "escrzyaieuudtnESCRZYAIUU"); } function Zakoduj($s) { // $s = "'".AddSlashes(HTMLentities(Trim($s)))."'"; $s = "'".AddSlashes(HTMLspecialchars(Trim($s)))."'"; return $s; } function Dorovnej($s,$i) { $s=str_pad($s,$i); return $s; } function GoodString($s) { $s=HTMLSpecialChars($s); return $s; } function LCrypt ($s) { for ($i=0;$i0) return $vysl[0]; else return 0; } function getUrlID($i,$a,$urlcoded=false) { $a=strtolower(removeCzech($a)); $a=str_replace(",","",$a); $a=str_replace("(","",$a); $a=str_replace(")","",$a); $a=str_replace("<","",$a); $a=str_replace(">","",$a); $a=str_replace("/","",$a); $a=str_replace(".","",$a); $a=str_replace(":"," ",$a); $a=str_replace("'"," ",$a); $a=str_replace("\\"," ",$a); $a=str_replace("&"," ",$a); $a=str_replace("?"," ",$a); $a=str_replace("!"," ",$a); $a=str_replace(";"," ",$a); $a=str_replace("\""," ",$a); $a=str_replace("'"," ",$a); $a=str_replace("*"," ",$a); $a=str_replace("–"," ",$a); $a=trim($a); $a=str_replace(" ","-",$a); $a = $i . '-' . $a; while (strpos($a,"--")!==false) { $a=str_replace("--","-",$a); } if ($urlcoded) $a = urlencode($a); return $a; } function MetaDescription ($s="", $od=0, $kolik=30) { if (strlen($s)>240) $s=substr($s,0,240)."..."; if (($s!="")&&($od>0)) $s=$s." [".(($od/$kolik)+1)."]"; return $s; } function MetaTitle ($s="", $od=0, $kolik=30) { if ($od>0) $s=$s." [".(($od/$kolik)+1)."]"; return $s; } function IsGooglebot(){ if(eregi("Googlebot",$_SERVER['HTTP_USER_AGENT'])){ $ip=$_SERVER['REMOTE_ADDR']; //server name e.g. crawl-66-249-66-1.googlebot.com $name=gethostbyaddr($ip); if(eregi("Googlebot",$name)){ $hosts=gethostbynamel($name); foreach($hosts as $host){ if ($host==$ip){ return true; } } return false; }else{ return false; } }else{ // Not Googlebot, take some action if needed } return false; } ?>