tance"; $loc["menu.machol"] = "machol čechia"; $loc["menu.links"] = "odkazy"; $loc["photo.DateTimeOriginal"] = "Čas focení"; $loc["photo.FNumber"] = "Clona"; $loc["photo.ExposureTime"] = "Délka expozice"; $loc["photo.Flash"] = "Blesk"; $loc[".yes"] = "ano"; $loc[".no"] = "ne"; if ($ctx["lang"] == "en") { $loc["menu.about"] = "about us"; $loc["menu.ifd"] = "israeli folk
  dance"; $loc["menu.machol"] = "machol czechia"; $loc["menu.links"] = "links"; $loc["photo.DateTimeOriginal"] = "Photo time"; $loc["photo.FNumber"] = "F-number"; $loc["photo.ExposureTime"] = "Exposure time"; $loc["photo.Flash"] = "Flash"; $loc[".yes"] = "yes"; $loc[".no"] = "no"; } } function create_ctx() { global $context, $ctx, $ctxParam, $defaults; $context = array("page","lang","blog"); $defaults = array("page" => "about", "lang" => "cz", "blog" => 0); $ctx = array(); foreach($context as $p) { if (isset($_REQUEST[$p])) { preg_match("/^([^\:]*)(\:(.*))?$/i", $_REQUEST[$p], $out); $ctx[$p] = $out[1]; //print $ctx[$p]."AAA".$_REQUEST[$p]; if (isset($out[3])) { $ctxParam[$ctx[$p]] = $out[3]; } } else $ctx[$p] = $defaults[$p]; } //if (!isset($ctx["page"]) || strlen($ctx["page"]) == 0) $ctx["page"] = "about"; //if (!isset($ctx["lang"]) || strlen($ctx["lang"]) == 0) $ctx["lang"] = "cz"; //if (!isset($ctx["blog"]) || strlen($ctx["blog"]) == 0) $ctx["blog"] = 0; } function inc_file($file) { global $context, $ctx; $lang = $ctx["lang"]; if (!$file || $file == "") $file = "about"; if ($lang == "cz") $lang = ""; else $lang = ".".$lang; return "content/$file$lang"; } function inc_file_default($file) { global $context, $ctx; if (!$file || $file == "") $file = "about"; return "content/$file"; } function inc($file) { if (file_exists(inc_file($file))) { include(inc_file($file)); } else if (file_exists(inc_file_default($file))) { include(inc_file_default($file)); } else return false; return true; } function go($param, $value) { global $context, $ctx, $ctxParam, $defaults; $url = "?"; $first = 1; foreach ($context as $c) { if (isset($ctx[$c])) { $v = $ctx[$c]; if ($c == $param) { $v = $value; } else if (isset($ctxParam[$v])) { $v .= ":".$ctxParam[$v]; } if ($v != $defaults[$c]) { if ($first == 0) $url .= "&"; $url .= "$c=$v"; $first = 0; } } } return $url; } function loc($text) { global $loc; return $loc[$text]; } function menusel($page) { global $ctx; return $ctx["page"] == $page ? 'id="menusel"' : ''; } function para($lang, $msg) { global $blog_link, $ctx, $path; global $blog_out; if (!$blog_out) return; if ($blog_link !== false) { //$msg = preg_replace("/_/","",$msg, 1); //$msg = preg_replace("/_/","",$msg, 1); $msg = preg_replace("/_([^_]+)_/","$1",$msg, 1); } if ($ctx["lang"] == $lang) { print "
"; print $msg; print "
\n"; } } function text($id, $text) { global $loc; $id = strtolower($id); $loc["text.$id"] = $text; } function hr() { global $blog_out; global $blog_link; global $max_blog; global $ctx; global $config; global $path; $blog_link = false; $path = "content/images"; $blog_out = false; if ($max_blog >= $ctx["blog"] * $config->blog_page_size) $blog_out = true; if ($max_blog >= ($ctx["blog"]+1) * $config->blog_page_size) $blog_out = false; //print $max_blog." | ".$ctx["blog"]." | ".($blog_out?"tr":"fl"); $max_blog++; if (!$blog_out) return; print "
\n"; } function path($p) { global $path; $path = $p; } function img($src, $float, $type) { global $path; global $blog_link; global $blog_out; if (!$blog_out) return; $dims = ""; if (isset($type) && strlen($type) > 0) { if ($type == "portrait") { $dims="&width=64&height=80"; } if ($type == "landscape") { $dims="&width=80&height=56"; } } if ($blog_link !== false) { print ""; } print "\n"; if ($blog_link !== false) { print ""; } } function href() { global $ctx; global $path; global $blog_link; global $blog_out; if (!$blog_out) return; list($page) = func_get_args(); $path = "content/images"; if (!isset($page) || strlen($page) == 0) { $blog_link = false; } else { if (preg_match("/^http:\/\//", $page)) { $blog_link = $page; } else { $blog_link = go("page", $page); } if ($page == "gallery") { $blog_link = false; } } } function blogdate($d) { global $blog_out; //print "$d ... $blog_out"; if (strlen($d) > 0 && $blog_out) print "$d"; } function gcd($a, $b){ $b = ( $a == 0 )? 0 : $b; return ( $a % $b )? gcd($b, abs($a - $b)) : $b; } function gallery() { global $ctx, $ctxParam, $loc; require("gallery.inc.html"); $path = "images/"; $gal = $ctxParam["gallery"]; if (isset($gal) && strlen($gal) > 0) { $path .= $gal; if(!inc($path."/_gallery")) { print "

$path

"; } $path = "content/".$path; //print $path; if ($dir = opendir($path)) { $fileArray = array(); while (($file = readdir($dir)) !== false) $fileArray[] = $file; closedir($dir); sort($fileArray); $photoID = 1; foreach ($fileArray as $file) { if (preg_match("/\.jpg|\.png/i",$file)) { $exif = exif_read_data("$path/$file", 0, true); $fn = "$path/$file"; $alt=""; $using_alt = 0; $file = strtolower($file); if (isset($loc["text.$file"])) { $alt .= "
".$loc["text.$file"]."
"; $using_alt = 1; } foreach ($exif as $sec=>$chunk) if ($sec == "EXIF") foreach ($chunk as $name=>$val) { if (preg_match("/^ExposureTime|FNumber|DateTimeOriginal|Flash$/i",$name,$out)) { $loc_name = loc("photo.".$out[0]); if ($out[0] == "ExposureTime" || $out[0] == "FNumber") { if (preg_match("/^\s*(\d+)\s*\/\s*(\d+)\s*$/",$val,$out2)) { $a = $out2[1]; $b = $out2[2]; $c = gcd($a, $b); $a /= $c; $b /= $c; //$alt .= $a." |".$b." |".$c." | ".$val; if ($out[0] == "FNumber") { $val = $a/$b; } else { $val = "$a/$b s"; } } } if ($out[0] == "Flash") { if ($val > 0) $val = loc(".yes"). " ($val)"; if ($val === 0) $val = loc(".no"); } $val = preg_replace("/\s+/"," ",$val); $alt .= "$loc_name: $val
\n"; $using_alt = 1; } } $label1 = ""; $label2 = ""; if ($using_alt == 1) { $label1 = ' onmousemove=\'showLabel("lab'.$photoID.'", "ph'.$photoID.'", event.clientX, event.clientY)\' onmouseout=\'hideLabel("lab'.$photoID.'")\''; $label2 = '"; } print "\n"; print "$label2\n"; ++$photoID; } } } else { print "Adresář s fotkami '$path' neexistuje."; } } else { // neuvedena galerie, co tady delame?? pssst! print ""; } } function generateCode() { srand(); $code = ""; $r = rand(0,35); if ($r<10) $code .= $r; else $code .= chr($r+55); $r = rand(0,35); if ($r<10) $code .= $r; else $code .= chr($r+55); $r = rand(0,35); if ($r<10) $code .= $r; else $code .= chr($r+55); $r = rand(0,35); if ($r<10) $code .= $r; else $code .= chr($r+55); return $code; } ?>