require_once "smarty/Smarty.class.php"; //require_once "config.php"; define ('DEFAULT_ID', '1'); define ('MAIN_ID', '1'); define ('NAMAI_ID', 'namai'); define ('GYVENTOJAI_ID', 'zmones'); define ('GYVUNAI_ID', 'gyvunai'); define ('MES_ID', 'mes'); define ('SHOW_ID', '3'); define ('SHOWA_ID', '2'); define ('AUTORIAI_ID', '4'); define ('DEFAULT_V', '1'); define ('MAXF', '12'); define ('MAXC', '5'); define ('MAXR', '4'); class page { var $lang; var $id; // Gathered var $data; var $title; var $text; var $menu; var $desc; var $mmenu, $msize; function page() { $this->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 .= "
"; $t .= '' . $this->img_src($now, $cat) . ''; $t .= " | "; if ($now2 % MAXR == 0) $t .= "
";
$t .= $this->img_src2($now, $cat) . ' '; $t .= " |