get_data(); $this->set(); } function get_data() { $this->lang = "lt"; $this->data = $_GET; // Get now $pi = $_SERVER["argv"][0]; if (isset ($_GET["id"])) $this->id = $_GET["id"]; else $this->id = DEFAULT_ID; } function get_value ($wh, $def) { if (isset ($_GET[$wh])) return $_GET[$wh]; else return $def; } function add_menu ($where, $title, $link, $parent) { $this->mmenu [$where][1] = $title; $this->mmenu [$where][2] = $parent; $this->mmenu [$where][3] = $link; if ($where > $this->msize) $this->msize=$where; } function create_menu (){ $msize = 0; $this->add_menu (1,"Pradzia","index.php?id=".MAIN_ID,0); $this->add_menu (2,"Namai","index.php?id=".SHOWA_ID."&cat=".NAMAI_ID,1); $this->add_menu (3,"Gyventojai","index.php?id=".SHOWA_ID."&cat=".GYVENTOJAI_ID,1); $this->add_menu (4,"Gyvunai","index.php?id=".SHOWA_ID."&cat=".GYVUNAI_ID,1); $this->add_menu (5,"Mes","index.php?id=".SHOWA_ID."&cat=".MES_ID,1); $this->add_menu (6,"Autoriai","index.php?id=".AUTORIAI_ID."&cat=0",1); // Autoriai $this->add_menu (7,"Vilius","index.php?id=".AUTORIAI_ID."&cat=1",AUTORIAI_ID); $this->add_menu (8,"Kristine","index.php?id=".AUTORIAI_ID."&cat=2",AUTORIAI_ID); $this->add_menu (9,"Jindria","index.php?id=".AUTORIAI_ID."&cat=3",AUTORIAI_ID); $this->add_menu (10,"Jerika","index.php?id=".AUTORIAI_ID."&cat=4",AUTORIAI_ID); $this->add_menu (11,"Jovita","index.php?id=".AUTORIAI_ID."&cat=5",AUTORIAI_ID); } function menu_link($nr) { return '' . $this->mmenu[$nr][1] . ''; } function gmenu(){ $this->create_menu(); $textas = $this->menu_link(1); $textas .= " : "; for ($ind=1; $ind<=$this->msize; $ind++) { if ($this->mmenu[$ind][2] == $this->id) { $textas .= $this->menu_link($ind) . ' :: '; } } $this->menu = $textas; } function get_page($tfile) { if (file_exists($tfile)){ $cont = file($tfile); $text = ""; foreach($cont as $r) { $text .= $r; } return $text; } else return ""; } function set() { $this->gmenu(); $this->title = "Neveronys :: " . "Kaimas Sirvintu rajone"; switch ($this->id) { case SHOWA_ID: $this->text = $this->fotos(); break; case SHOW_ID: $this->text = $this->foto(); break; case MAIN_ID: $this->text = $this->get_page("menu" . $this->id . ".txt"); break; case AUTORIAI_ID: $this->text = $this->get_page("images/authors/a" . $this->get_value("cat",1) . ".txt"); break; } } function img_link ($nr, $cat) { return 'index.php?id='.SHOW_ID.'&nr='.$nr.'&cat='.$cat; } function img_src ($nr, $cat) { $kelias = 'images/' . $cat . '/foto' . $nr . '.JPG'; if (file_exists($kelias)) return ''; else return ""; } function img_src2 ($nr, $cat) { $kelias = 'images/' . $cat . '/f' . $nr . '.JPG'; if (file_exists($kelias)) return ''; else return ""; } function fotos () { $start = $this->get_value("start",1); $cat = $this->get_value("cat","namai"); $mode = $this->get_value("mode",1); $fname = "docs/" . $cat . ".txt"; // komentsai if (file_exists ($fname)) $t .= $this->get_page($fname); if ($mode == 1) { // lenteleje $t .= ""; $now = $start; $now2 = 1; $end = $start + MAXF - 1; while ($now <= $end) { if ($now2 % MAXR == 1) $t .= ""; $t .= ""; if ($now2 % MAXR == 0) $t .= ""; $now++; $now2++; } $t .= "
"; $t .= '' . $this->img_src($now, $cat) . ''; $t .= "
"; } else { // viename stulpelyje $t .= ""; $now = $start; $now2 = 1; $end = $start + MAXC - 1; while ($now <= $end) { $t .= ""; $now++; $now2++; } $t .= "
"; $t .= $this->img_src2($now, $cat) . '
'; $t .= "
"; } $t .= "
"; $t .= 'Pradzia '; $t .= 'Toliau'; if ($mode == 1) $t .= ' Ziureti dideles'; else $t .= ' Ziureti mazas'; return $t; } function foto() { $nr = $this->get_value("nr",1); $cat = $this->get_value("cat","namai"); $t = $this->img_src2($nr,$cat); $t .= '

[ Atgal ]'; return $t; } function show() { $smarty =& new Smarty; // $smarty->assign('pagem', $this->menu); $smarty->assign('path_img', PATH_IMG); // $smarty->assign('id', $this->id); // $smarty->assign('title', $this->title); $smarty->assign('text', $this->text); $smarty->display('site.tpl'); } } $smarty =& new Smarty; $page =& new page(); $page->show(); ?>