<?PHP
/************************************************************************/
/* DUNE by NPDS                                                         */
/* ===========================                                          */
/*                                                                      */
/* DYNAMIC THEME engine for NPDS                                        */
/* NPDS Copyright (c) 2002-2007 by Philippe Brunier                     */
/*                                                                      */
/* 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.       */
/************************************************************************/
// intégration dans sable de adv-meta-lang
global $meta_glossaire;
// intégration dans sable de adv-meta-lang
function local_var($Xcontent) {
   if (strstr($Xcontent,"!var!")) {
      $deb=strpos($Xcontent,"!var!",0)+5;
      $fin=strpos($Xcontent," ",$deb);
      if ($fin) {$H_var=substr($Xcontent,$deb,$fin-$deb);}
      else {$H_var=substr($Xcontent,$deb);}
      return ($H_var);
   }
}
function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext, $id) {
   global $tipath, $theme, $nuke_url;
   $inclusion=false;
   if (file_exists("themes/".$theme."/html/index-news.html")) {$inclusion="themes/".$theme."/html/index-news.html";}
   elseif (file_exists("themes/default/html/index-news.html")) {$inclusion="themes/default/html/index-news.html";}
   else {
      echo "index-news.html manquant / not find !<br />";
      die();
   }
   $H_var=local_var($thetext);
   if ($H_var!="") {
      ${$H_var}=true;
      $thetext=str_replace("!var!$H_var","",$thetext);
   }
   if ($notes!= "") $notes="<div class=\"aide\">".translate("Note")." : \"$notes\"</div>";
   ob_start();
   include($inclusion);
   $Xcontent=ob_get_contents();
   ob_end_clean();
   $npds_METALANG_words=array(
   "'!N_publicateur!'i"=>"$aid",
   "'!N_emetteur!'i"=>"<a href=\"user.php?op=userinfo&amp;uname=$informant\">$informant</a>",
   "'!N_date!'i"=>"$time",
   "'!N_titre!'i"=>"$title",
   "'!N_texte!'i"=>"$thetext",
   "'!N_id!'i"=>"$id",
   "'!N_sujet!'i"=>"<a href=\"search.php?query=&amp;topic=$topic\"><img src=\"".$tipath.$topicimage."\" alt=\"".translate("Search in")."&nbsp;".$topictext."\" title=\"".translate("Search in")."&nbsp;".$topictext."\" border=\"0\" /></a>",
   "'!N_note!'i"=>"$xnotes",
   "'!N_nb_lecture!'i"=>"$counter",
   "'!N_suite!'i"=>"$morelink"
   );
   echo meta_lang(aff_langue(preg_replace(array_keys($npds_METALANG_words),array_values($npds_METALANG_words), $Xcontent)));
}
function themearticle ($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext, $id, $previous_sid, $next_sid) {
   global $tipath, $theme, $nuke_url, $counter;
   $inclusion=false;
   if (file_exists("themes/".$theme."/html/detail-news.html")) {$inclusion="themes/".$theme."/html/detail-news.html";}
   elseif (file_exists("themes/default/html/detail-news.html")) {$inclusion="themes/default/html/detail-news.html";}
   else {
      echo "detail-news.html manquant / not find !<br />";
      die();
   }
   $H_var=local_var($thetext);
   if ($H_var!="") {
      ${$H_var}=true;
      $thetext=str_replace("!var!$H_var","",$thetext);
   }
   ob_start();
   include($inclusion);
   $Xcontent=ob_get_contents();
   ob_end_clean();
   if ($previous_sid) {
      $prevArt="<a href=\"article.php?sid=".$previous_sid."\" class=\"noir\">".translate("Previous")."</a>";
      if ($next_sid) {$prevArt.="&nbsp;|&nbsp;";}
   }
   else $prevArt="";
   if ($next_sid) {$nextArt="<a href=\"article.php?sid=".$next_sid."\"  class=\"noir\">".translate("Next")."</a>";}
   else $nextArt="";
   $npds_METALANG_words=array(
   "'!N_publicateur!'i"=>"$aid",
   "'!N_emetteur!'i"=>"<a href=\"user.php?op=userinfo&amp;uname=$informant\">$informant</a>",
   "'!N_date!'i"=>"$datetime",
   "'!N_titre!'i"=>"$title",
   "'!N_id!'i"=>"$id",
   "'!N_previous_article!'i"=>"$prevArt",
   "'!N_next_article!'i"=>"$nextArt",
   "'!N_sujet!'i"=>"<a href=\"search.php?query=&amp;topic=$topic\"><img src=\"".$tipath.$topicimage."\" alt=\"".translate("Search in")."&nbsp;".$topictext."\" title=\"".translate("Search in")."&nbsp;".$topictext."\" border=\"0\" /></a>",
   "'!N_texte!'i"=>"$thetext",
   "'!N_nb_lecture!'i"=>"$counter",
   "'!N_note!'i"=>"$notes"
   );
   echo meta_lang(aff_langue(preg_replace(array_keys($npds_METALANG_words),array_values($npds_METALANG_words), $Xcontent)));
}
function themesidebox($title, $content) {
   global $theme, $B_class_title, $B_class_content, $bloc_side;
   $inclusion=false;
   if (file_exists("themes/".$theme."/html/bloc-right.html") and ($bloc_side=="RIGHT")) {$inclusion="themes/".$theme."/html/bloc-right.html";}
   if (file_exists("themes/".$theme."/html/bloc-left.html") and ($bloc_side=="LEFT")) {$inclusion="themes/".$theme."/html/bloc-left.html";}
   if (!$inclusion) {
      if (file_exists("themes/".$theme."/html/bloc.html")) {$inclusion="themes/".$theme."/html/bloc.html";}
      elseif (file_exists("themes/default/html/footer.html")) {$inclusion="themes/default/html/bloc.html";}
      else {
         echo "bloc.html manquant / not find !<br />";
         die();
      }
   }
   ob_start();
   include($inclusion);
   $Xcontent=ob_get_contents();
   ob_end_clean();
   $npds_METALANG_words=array(
   "'!B_title!'i"=>"$title",
   "'!B_class_title!'i"=>"$B_class_title",
   "'!B_class_content!'i"=>"$B_class_content",
   "'!B_content!'i"=>"$content"
   );
   echo meta_lang(preg_replace(array_keys($npds_METALANG_words),array_values($npds_METALANG_words), $Xcontent));
}
function themedito($content) {
   global $theme;
   $inclusion=false;
   if (file_exists("themes/".$theme."/html/editorial.html")) {$inclusion="themes/".$theme."/html/editorial.html";}
   if ($inclusion) {
      ob_start();
      include($inclusion);
      $Xcontent=ob_get_contents();
      ob_end_clean();
      $npds_METALANG_words=array(
      "'!editorial_content!'i"=>"$content"
      );
      echo meta_lang(aff_langue(preg_replace(array_keys($npds_METALANG_words),array_values($npds_METALANG_words), $Xcontent)));
   }
   return ($inclusion);
}
?>