Location: PHPKode > projects > XRS - XML Publication System > xrs_rel0.2/html/functions.php
<?php
//    xrs - Keep It Simple And Stupid XML Powered Publication System
//    Copyright (C) 2002-2003 Ales Hakl <ales at hakl dot net>
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

function detectlanguage(){
  global $lang,$setlang,$langcookie,$HTTP_ACCEPT_LANGUAGE;
  if (isset($setlang)) {
    $lang=$setlang;
  }else{
    if (isset($langcookie)) {
      $lang=$langcookie;
    }else{
      if (StrPos($HTTP_ACCEPT_LANGUAGE,'cs')<StrPos($HTTP_ACCEPT_LANGUAGE,'en')){
	$lang='cs';
      }else{
	$lang='en';
      }
    } 
  }
  SetCookie("langcookie",$lang);
}


function head($title,$head){
  global $lang;
echo '<?xml version="1.0" encoding="utf-8" ?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $lang;?>" lang="<?php echo $lang;?>">
<head>
  <title><?php echo $title; ?></title>
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  <?php echo $head; ?>
</head>
<body>
<?php
}

function foot(){
  echo '</body></html>';
}

function xrs_header(){
  global $lang;
  echo '<div class="header">';
  @fpassthru(fopen('data/header.'.$lang.'.xrs','r'));
  echo '</div>';
}

function xrs_footer(){
  global $lang;
  echo '<div class="footer">';
  @fpassthru(fopen('data/footer.'.$lang.'.xrs','r'));
  echo '</div>';
}

function xrs_navig(){
  global $lang;
  echo '<div class="navig">';
  @fpassthru(fopen('data/navig.'.$lang.'.xrs','r'));
  echo '</div>';
}

function xrs_main_news(){
  global $lang;
  echo '<div class="snews">';
  @fpassthru(fopen('data/snews.pre.'.$lang.'.xrs','r'));
  if ($lang='cs') {
    echo '<ul class="snews">';
    @fpassthru(fopen('gen/snews.cs.xrs','r'));
    echo '</ul>';
    echo '<ul class="snews">';
    @fpassthru(fopen('gen/snews.en.xrs','r'));
    echo '</ul>';
  }else{
    echo '<ul class="snews">';
    @fpassthru(fopen('gen/snews.en.xrs','r'));
    echo '</ul>';
    echo '<ul class="snews">';
    @fpassthru(fopen('gen/snews.cs.xrs','r'));
    echo '</ul>';

  }
  @fpassthru(fopen('gen/snews.post.'.$lang.'.xrs','r'));
  echo '</div>';
}

function xrs_main_links(){
  global $lang;
  echo '<div class="slinks">';
  @fpassthru(fopen('data/slinks.pre.'.$lang.'.xrs','r'));
  if ($lang=='cs'){
    echo '<ul class="slinks">';
    @fpassthru(fopen('gen/slinks.cs.xrs','r'));
    echo '</ul>';
    echo '<ul class="slinks">';
    @fpassthru(fopen('gen/slinks.en.xrs','r'));
    echo '</ul>';
  }else{
    echo '<ul class="slinks">';
    @fpassthru(fopen('gen/slinks.en.xrs','r'));
    echo '</ul>';
    echo '<ul class="slinks">';
    @fpassthru(fopen('gen/slinks.cs.xrs','r'));
    echo '</ul>';
  }
  @fpassthru(fopen('gen/slinks.post.'.$lang.'.xrs','r'));
  echo '</div>';
}

function xrs_main_docs(){
  global $lang;
  echo '<div class="mdocs">';
  @fpassthru(fopen('data/mdocs.pre.'.$lang.'.xrs','r'));
  echo '<table class="docs_table">';
  @fpassthru(fopen('data/docs.cols.'.$lang.'.xrs','r'));
  if ($lang=='cs'){
    @fpassthru(fopen('gen/mdocs.cs.xrs','r'));
    @fpassthru(fopen('gen/mdocs.en.xrs','r'));
  }else{
    @fpassthru(fopen('gen/mdocs.cs.xrs','r'));
    @fpassthru(fopen('gen/mdocs.en.xrs','r'));
  }  
  echo '</table>';
  @fpassthru(fopen('gen/mdocs.post.'.$lang.'.xrs','r'));
  echo '</div>';
}

function xrs_news(){
  global $lang;
  echo '<div class="news">';
  @fpassthru(fopen('data/news.pre.'.$lang.'.xrs','r'));
  if ($lang='cs') {
    echo '<ul class="news">';
    @fpassthru(fopen('gen/news.cs.xrs','r'));
    echo '</ul>';
    echo '<ul class="news">';
    @fpassthru(fopen('gen/news.en.xrs','r'));
    echo '</ul>';
  }else{
    echo '<ul class="news">';
    @fpassthru(fopen('gen/news.en.xrs','r'));
    echo '</ul>';
    echo '<ul class="news">';
    @fpassthru(fopen('gen/news.cs.xrs','r'));
    echo '</ul>';

  }
  @fpassthru(fopen('gen/news.post.'.$lang.'.xrs','r'));
  echo '</div>';
}

function xrs_links(){
  global $lang;
  echo '<div class="links">';
  @fpassthru(fopen('data/links.pre.'.$lang.'.xrs','r'));
  if ($lang=='cs'){
    echo '<ul class="links">';
    @fpassthru(fopen('gen/links.cs.xrs','r'));
    echo '</ul>';
    echo '<ul class="links">';
    @fpassthru(fopen('gen/links.en.xrs','r'));
    echo '</ul>';
  }else{
    echo '<ul class="links">';
    @fpassthru(fopen('gen/links.en.xrs','r'));
    echo '</ul>';
    echo '<ul class="links">';
    @fpassthru(fopen('gen/links.cs.xrs','r'));
    echo '</ul>';
  }
  @fpassthru(fopen('gen/links.post.'.$lang.'.xrs','r'));
  echo '</div>';
}

function xrs_docs(){
  global $lang;
  echo '<div class="docs">';
  @fpassthru(fopen('data/docs.pre.'.$lang.'.xrs','r'));
  echo '<table class="docs_table">';
  @fpassthru(fopen('data/docs.cols.'.$lang.'.xrs','r'));
  if ($lang=='cs'){
    @fpassthru(fopen('gen/docs.cs.xrs','r'));
    @fpassthru(fopen('gen/docs.en.xrs','r'));
  }else{
    @fpassthru(fopen('gen/docs.cs.xrs','r'));
    @fpassthru(fopen('gen/docs.en.xrs','r'));
  }  
  echo '</table>';
  @fpassthru(fopen('gen/docs.post.'.$lang.'.xrs','r'));
  echo '</div>';
}


?>
Return current item: XRS - XML Publication System