Hôpital 2.0

 

 Handlers/page/generer.php

<?php /* generer.php */
//vérification de sécurité
if (!eregi("index.php"$_SERVER['PHP_SELF'])) {die ("acc&egrave;s direct interdit");}


/* variables */

/* si fichier exist > générer page correspondante */
if(file_exists($this->tag)){
 
//récupérer fichier source
 
$fp =  fopen($this->tag,"r"); 
 
$body="";
 while (!
feof($fp)){$body .= fgets($fp,4096);}
 
fclose($fp);
}else{
 
// sinon créer fichier
 
$fp fopen($this->tag,"w");
 
$body="fichier généré avec succès disponible à cette adresse : ".$this->GetConfigValue("base_url").$this->tag;
 
fwrite($fp,$body);
 
fclose($fp);
}
  
// add page (revisions)
  
$this->SavePage($this->tag$body);
  
// now we render it internally so we can write the updated link table.
  
$this->ClearLinkTable();
  
$this->StartLinkTracking();
  
$dummy $this->Header();
  
$dummy .= $this->Format($body);
  
$dummy .= $this->Footer();
  
$this->StopLinkTracking();
  
$this->WriteLinkTable();
  
$this->ClearLinkTable();
  
// redirection
  
$this->Redirect($this->href());
?>