$y) $$x=$y; function Umlaut($text) { $text=preg_replace('/ä/','ä',$text); $text=preg_replace('/ö/','ö',$text); $text=preg_replace('/Ä/','Ä',$text); $text=preg_replace('/Ö/','Ö',$text); return $text; } function Content($table,$id,$lang,$menu,$submenu) { global $database; $query_a="SELECT content FROM ".$table." WHERE `id`='".$id."' "; foreach(array('lang','menu','submenu') as $x) { if(!$$x) continue; $query_b="SELECT content FROM ".$table." WHERE `id`='".$id."' AND `".$x."`='".$$x."' LIMIT 1;"; $result_b=$database->query($query_b); if($result_b->numRows()) $query_a.="AND `".$x."`='".$$x."' "; } $query_a.="LIMIT 1;"; $result_a=$database->query($query_a); $tmp_a=$result_a->fetchRow(DB_FETCHMODE_ASSOC,0); return Umlaut($tmp_a['content']); } function Menulist($menu) { global $database; $query="SELECT menu FROM data WHERE `submenu`='".$menu."' AND `position`='' ORDER BY `order` ASC;"; $result=$database->query($query); $menus=array(); for($i=0;$i<$result->numRows();$i++) { $tmp=$result->fetchRow(DB_FETCHMODE_ASSOC,$i); array_push($menus,$tmp['menu']); } return $menus; } function Menutext($menu,$lang) { global $database; $query="SELECT content FROM menus WHERE `menu`='".$menu."' AND `lang`='".$lang."' LIMIT 1;"; $result=$database->query($query); $tmp=$result->fetchRow(DB_FETCHMODE_ASSOC,0); if(!$tmp['content']) { $query="SELECT content FROM menus WHERE `menu`='".$menu."' AND `lang`='' LIMIT 1;"; $result=$database->query($query); $tmp=$result->fetchRow(DB_FETCHMODE_ASSOC,0); } return $tmp['content']; } function Datatext($menu,$submenu,$lang) { global $database; $query="SELECT content FROM data WHERE `lang`='".$lang."' AND `menu`='".$menu."' AND `submenu`='".$submenu."' LIMIT 1;"; $result=$database->query($query); if($result->numRows()) $tmp=$result->fetchRow(DB_FETCHMODE_ASSOC,0); if(!$tmp['content']) { $query="SELECT content FROM data WHERE `lang`='".$lang."' AND `menu`='".$menu."' AND `submenu`='' LIMIT 1;"; $result=$database->query($query); if($result->numRows()) $tmp=$result->fetchRow(DB_FETCHMODE_ASSOC,0); } $text=preg_replace('/^$/','
',$tmp['content']); return Umlaut($text); } function Datatextborder($position,$menu,$submenu,$lang) { global $database; $query="SELECT content,position,submenu FROM data WHERE `lang`='".$lang."' AND `menu`='".$menu."' AND `position`='".$position."' ORDER BY `order` ASC;"; $result=$database->query($query); if($result->numRows()) for($i=0;$i<$result->numRows();$i++) { $tmp=$result->fetchRow(DB_FETCHMODE_ASSOC,$i); if($tmp['submenu']=='') { print Umlaut($tmp['content']); print '
'; } } print '
'."\n"; print ''."\n"; if($result->numRows()) for($i=0;$i<$result->numRows();$i++) { $tmp=$result->fetchRow(DB_FETCHMODE_ASSOC,$i); if($tmp['submenu']!='') { print "\n"; if($submenu==$tmp['submenu']) print '\n"; } print "\n"; } print '
'."\n"; else print ''."\n"; print ''.Menutext($tmp['submenu'],$lang).'
'; print "
'."\n"; print "
"."\n"; } $reload=FALSE; foreach(array('lang','menu','submenu') as $x) { if(!isset($$x)) { $$x=''; $reload=TRUE; } if(!$$x) { if($x=='lang') { $lang=Content('header','default_lang',$lang,$menu,$submenu); $reload=TRUE; } if($x=='menu') { $menu=Content('header','default_menu',$lang,$menu,$submenu); $reload=TRUE; } } } if($reload) Header("Location: ".$_SERVER['PHP_SELF']."?lang=".$lang."&menu=".$menu."&submenu=".$submenu); foreach(array('title','author','description','keywords','generator','robots') as $x) { $$x=Content('header',$x,$lang,$menu,$submenu); } print ''."\n"; print ''."\n"; print ''."\n"; print ""; print ''."\n"; print "".$title." - ".Menutext($menu,$lang)."\n"; foreach(array('title','author','description','keywords','generator','robots') as $x) { print ''."\n"; } $href=Content('header','href',$lang,$menu,$submenu); print ''."\n"; print ''."\n"; print ''."\n"; print ""; print ''."\n"; print '
'."\n"; print '
'."\n"; // print '
'.date('d.m.Y').'
'."\n"; print '
'."\n"; print "
"."\n"; print '
'."\n"; print '
'."\n"; print ''."\n"; print "\n"; foreach(Menulist('') as $x) { if($x==$menu) print '\n"; } print "\n"; print '
'."\n"; else print ''."\n"; print ''.Menutext($x,$lang)."\n"; print "
'."\n"; print "
"."\n"; print '
'."\n"; print ''."\n"; $dataleft=Content('header','dataleft',$lang,$menu,$submenu); $dataright=Content('header','dataright',$lang,$menu,$submenu); $datacenter=100-$dataleft-$dataright; print "\n"; print '\n"; print '\n"; print '
'."\n"; print '
\n"; print ''; print "\n"; print "\n"; print '\n"; print "\n"; print "\n"; print '\n"; print "\n"; print "
'."\n"; print '
'."\n"; print '
'; print '
'; print Datatextborder('left',$menu,$submenu,$lang); print '
'; print "
'."\n"; print "\n"; print "\n"; // print '\n"; print "\n"; print "
'."\n"; print ''."\n"; print ''."\n"; print Content('header','logo_text',$lang,$menu,$submenu); print ''."\n"; print "
\n"; print '
'; print '
'; print '
'."\n"; print Datatext($menu,$submenu,$lang); print '
'."\n"; print '


'; print "
'."\n"; print "\n"; print "\n"; print ''."\n"; print "\n"; print "
'."\n"; print 'Ota yhteyttä'; print '
\n"; print Datatextborder('right',$menu,$submenu,$lang); print "
'."\n"; print ''."\n"; print "
'."\n"; print "\n"; print "\n"; print '\n"; print '\n"; print "\n"; print "
'."\n"; print ''."\n"; print 'Powered By Kivalta'."\n"; print "\n"; print "'."\n"; print ''."\n"; // print 'Copyright © Lainux Oy'."\n"; print "\n"; print "
\n"; print "
\n"; print "
"."\n"; print "\n"; print "\n"; ?>