linea21-core
[ class tree: linea21-core ] [ index: linea21-core ] [ all elements ]

Source for file class.config_file.php

Documentation is available at class.config_file.php

  1. <?php
  2. /**
  3.  * @package linea21.core
  4.  * @subpackage config_files
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  *  Configuration Management
  10.  */
  11.  
  12. include_once('system/afiles/class.afiles.php');
  13. include_once('../lib/lib_common.php');
  14.  
  15. // should be a singleton 
  16. // but we are getting some issues converting it 
  17. // when using the installer
  18. class config_file {
  19.  
  20.   var $file_config = "config.ini"// fichier define_config
  21.   var $file_release = "release.ini";  // fichier define_release
  22.   
  23.   var $extra_configfile = false;
  24.   var $section_main = "config";
  25.   var $section_theme = "theme";  // section theme dans le fichier de configuration config
  26.   var $section_database = "database";  // section database dans le fichier de configuration define_release
  27.   var $config_path = '../config/';
  28.   var $ini_path = '../config/';
  29.   var $backup_config_path = '../tmp/backup/config/';
  30.   var $authorized_release_sections = array ('LANGUAGE_SETTINGS','NOTIFICATION_SETTINGS','LOCALES_SETTINGS','MODULES_SETTINGS','DEBUG_SETTINGS''COMMENT_SETTINGS''SYSTEM_SETTINGS''SERVER_SETTINGS','MAIL_SETTINGS','MAIL_INFORMATIONS''SUPPORT_SETTINGS','LOGS_SETTINGS')//sections autorisées dans le fichier release
  31.   var $authorized_db_sections = array ('DATABASE_SETTINGS')//sections autorisées dans le fichier release
  32.   var $authorized_theme_sections = array ('THEME_SETTINGS')//sections autorisées dans le fichier release
  33.   var $php_extension = ".php";
  34.   var $config_params;
  35.   var $release_params;
  36.   var $a_file;
  37.   var $theme_settings='THEME_SETTINGS';
  38.   var $theme_public='THEME_PUBLIC';
  39.   var $theme_list_public='THEME_LIST_PUBLIC';
  40.   var $theme_admin='THEME_ADMIN';
  41.   var $theme_list_admin='THEME_LIST_ADMIN';
  42.   protected $dispatcher = null;
  43.  
  44.   /**
  45.    * config_file::__construct()
  46.    * constructeur de classe
  47.    * @access public
  48.    * @return void 
  49.    */
  50.   public function __construct$extraconfigfile false)
  51.   {
  52.     $this->a_file=new afiles;
  53.     $this->dispatcher = $GLOBALS['dispatcher'];
  54.     
  55.     if(is_string($extraconfigfile)) {
  56.         $this->extra_configfile = $extraconfigfile;
  57.     }
  58.  
  59.     //charge les paramètres et les place en constante globale par define
  60.     $this->load_config_ini_file();
  61.     $this->load_release_ini_file();
  62.   }
  63.   
  64.   /**
  65.    * config_file::init()
  66.    * charge les paramètres des fichiers ini et les place en constante globale avec define
  67.    * @access public
  68.    * @param void 
  69.    * @return void 
  70.    */
  71.   public function init()
  72.   {
  73.   
  74.       // Notify the beginning of the current method
  75.       $this->dispatcher->notify(new sfEvent($this'config.init'));
  76.        
  77.       foreach ($this->config_params as $section => $existing_params)
  78.       {
  79.           foreach ($existing_params as $existing_param => $existing_value)
  80.           {
  81.               if(!defined($existing_param))
  82.               {
  83.                   if(is_numeric($existing_value))
  84.                   {
  85.                       $existing_value=$this->convert_type($existing_value);
  86.                   }
  87.                   define($existing_param,$existing_value);
  88.               }
  89.           }
  90.       }
  91.       foreach ($this->release_params as $section => $existing_params)
  92.       {
  93.           foreach ($existing_params as $existing_param => $existing_value)
  94.           {
  95.               if(!defined($existing_param))
  96.               {
  97.                   if(is_numeric($existing_value))
  98.                   {
  99.                       $existing_value=$this->convert_type($existing_value);
  100.                   }
  101.                   define($existing_param,$existing_value);
  102.               }
  103.           }
  104.       }
  105.   }
  106.  
  107.   /**
  108.    * config_file::setParams()
  109.    * Ecrase les valeurs contenues dans le tableau stocké dans l'attribut $this->config_params
  110.    * pour mise à jour des valeurs
  111.    * @access public
  112.    * @param array $array new values to override to params
  113.    * @return void 
  114.    */
  115.   public function setParams($array)
  116.   {
  117.     // Filter data event + return value
  118.     $r $this->dispatcher->filter(new sfEvent($this'config.set_params'array('data' => $array))$array);
  119.     $array $r->getReturnValue();
  120.      
  121.     //parse du tableau des paramètres
  122.     // ajoute les paramètres de post
  123.  
  124.     foreach ($array as $key => $value)
  125.     {
  126.         foreach ($this->config_params as $section => $existing_params)
  127.         {
  128.             foreach ($existing_params as $existing_param => $existing_value)
  129.             {
  130.                 // la clé existe dans le tableau de cache release_params, on insère la valeur dans ce tableau
  131.                 if($existing_param == $key$this->config_params[$section][$key]=$this->strip_ini_char($value);
  132.             }
  133.         }
  134.     }
  135.  
  136.     return true;
  137.   }
  138.  
  139.   /**
  140.    * config_file::load_release_ini_file()
  141.    * charge les paramètres dans l'attribut $release_params
  142.    * @access private
  143.    * @return void 
  144.    */
  145.   private function load_config_ini_file({
  146.       
  147.       // Notify the beginning of the current method
  148.       $this->dispatcher->notify(new sfEvent($this'config.load_release_params'));
  149.       
  150.     //charge les paramètres release dans un tableau $release_params
  151.     // if an extra_configfile is given, we use it
  152.     if(is_string($this->extra_configfile)) {
  153.         $this->config_params=$this->parseConfig($this->extra_configfile);
  154.     else {
  155.         $this->config_params=$this->parseConfig($this->file_config);
  156.     }
  157.   }
  158.   
  159.   /**
  160.    * config_file::load_db_ini_file()
  161.    * charge les paramètres dans l'attribut $db_params
  162.    * @access public
  163.    * @return void 
  164.    */
  165.   private function load_release_ini_file()
  166.   {
  167.       // Notify the beginning of the current method
  168.       $this->dispatcher->notify(new sfEvent($this'config.load_db_params'));
  169.       
  170.     //charge les paramètres dans un tableau $db_params
  171.     $this->release_params=$this->parseConfig($this->file_release);
  172.   }
  173.  
  174.   /**
  175.    * config_file::writeReleaseParams()
  176.    * écrit dans le fichier ini les paramètres du tableau $release_params
  177.    * @access public
  178.    * @return boolean 
  179.    */
  180.   public function writeReleaseParams({
  181.       
  182.       // Notify the beginning of the current method
  183.       $this->dispatcher->notify(new sfEvent($this'config.write_release_params'));
  184.       
  185.     //écrit les paramètres $release_params vers les fichiers release  ini et php
  186.     if($this->backupParams($this->file_config)){
  187.       //on écrit les params après avoir fait le backup
  188.       if($this->a_file->mkini($this->config_params$this->ini_path.$this->file_config))
  189.       return true;
  190.     }
  191.     return false;
  192.   }
  193.  
  194.   /**
  195.    * config_file::backupParams()
  196.    * sauvegarde le fichier $file_name dans le répertoire de backup
  197.    * @access public
  198.    * @param string $file_name 
  199.    * @return boolean 
  200.    */
  201.   public function backupParams($file_name)
  202.   {
  203.       // Notify the beginning of the current method
  204.       $this->dispatcher->notify(new sfEvent($this'config.backup_params'array('filename' => $file_name)));
  205.       
  206.       // do create backup folder is not done yet
  207.     SureCreateDir($this->backup_config_path0755);
  208.  
  209.       if(is_string($this->extra_configfile)) {
  210.           $file $this->extra_configfile;
  211.       else {
  212.           $file $this->file_config;
  213.       }
  214.       // we do backup
  215.       if(file_exists($this->ini_path.$file)) {
  216.         if ($this->a_file->cp($this->ini_path.$file,$this->backup_config_path)) return true;
  217.       }
  218.       return false;
  219.     
  220.   }
  221.   
  222.   /**
  223.    * config_file::getReleaseParams()
  224.    * retourne le contenu HTML en édition ou non des sections éditables
  225.    * @access public
  226.    * @param string $updatable : champ texte modifiable
  227.    * @param string $hidden : présence d'input type hidden
  228.    * @return string 
  229.    */
  230.   public function getReleaseParams($updatable false$hidden false{
  231.   
  232.       // Notify the beginning of the current method
  233.       $this->dispatcher->notify(new sfEvent($this'config.get_release_params'));
  234.        
  235.       return $this->getParams($this->section_main$updatable$hidden);
  236.   }
  237.   
  238.   /**
  239.    * config_file::getDatabaseParams()
  240.    * retourne le contenu HTML en édition ou non des sections éditables
  241.    * @access public
  242.    * @param string $updatable : champ texte modifiable
  243.    * @param string $hidden : présence d'input type hidden
  244.    * @return string 
  245.    */
  246.   public function getDatabaseParams($updatable false$hidden false{
  247.   
  248.       // Notify the beginning of the current method
  249.       $this->dispatcher->notify(new sfEvent($this'config.get_db_params'));
  250.        
  251.       return $this->getParams($this->section_database$updatable$hidden);
  252.   }
  253.   
  254.   /**
  255.    * config_file::getParams()
  256.    * retourne le contenu HTML en édition ou non des sections éditables
  257.    * @access private
  258.    * @param string $updatable : champ texte modifiable
  259.    * @param string $hidden : présence d'input type hidden
  260.    * @param string $file_name 
  261.    * @return string 
  262.    */
  263.   public function getParams($file_name$updatable false$hidden false)
  264.   {
  265.       // Notify the beginning of the current method
  266.       $this->dispatcher->notify(new sfEvent($this'config.get_all_params'array('filename' => $file_name)));
  267.        
  268.       $out '';
  269.       $authorized_sections=array();
  270.   
  271.       include('../languages/' U_L '/lang_system.'CHARSET .'.php');
  272.   
  273.       // le tableau de cache à utiliser est celui de realease
  274.       $content=$this->config_params;
  275.   
  276.       if($file_name == $this->section_main{
  277.           //initialisation des sections à afficher/mdofier
  278.           $authorized_sections=$this->authorized_release_sections;
  279.       }
  280.       else if($file_name == $this->section_theme)
  281.       {
  282.           $authorized_sections=$this->authorized_theme_sections;
  283.       }
  284.       else if($file_name == $this->section_database)
  285.       {
  286.           //initialisation des sections à afficher/mdofier
  287.           $authorized_sections=$this->authorized_db_sections;
  288.       }
  289.   
  290.       if (!is_array($content))
  291.           return false;
  292.   
  293.       foreach ($content as $key => $ini)
  294.       {
  295.   
  296.           if (is_array($ini))
  297.           {
  298.               if((in_array($key,$authorized_sections)))
  299.               {
  300.   
  301.                   if(isset($GLOBALS['lang']['system'][$key])) $label='<abbr title="'.$GLOBALS['lang']['system'][$key].'">'.$key.'</abbr>';
  302.                   else $label=$key;
  303.   
  304.                   $out .= "\n<br style='clear:both' />\n";
  305.                   $out .= "\n<h2>".$label."</h2>\n";
  306.                   if(!$updatable$out .="<dl>\n";
  307.                   //génération d'un bloc
  308.                   foreach ($ini as $var => $value)
  309.                   {
  310.                       $label='';
  311.                       if(isset($GLOBALS['lang']['system'][$var])) $label='<abbr title="'.$GLOBALS['lang']['system'][$var].'">'.$var.'</abbr>';
  312.                       else $label=$var;
  313.                       if(!$updatable)    {
  314.                           $out .="<dt>".$label;
  315.                           if($hidden$out .= "<input name=\"".$var."\" id=\"".$var."\" value=\"".$value."\" type=\"hidden\"  />\n";
  316.                           if($var !='LANGUAGE'{
  317.                               if($var=='DB_PASS'{
  318.                                   $out .= "</dt><dd>".preg_replace("/[a-zA-Z0-9_]/""•"$value)."</dd>\n";
  319.                               else {
  320.                                   $out .= "</dt><dd>".$value."</dd>\n";
  321.                               }
  322.                           else {
  323.                               $out .="</dt><dd>".culture::getInstance()->getCultureInfo($value'Language')."</dd>\n";
  324.                           }
  325.   
  326.                       }
  327.                       else {
  328.                           if($var=='DB_PASS'{
  329.                               $out .= "<p><label for=\"".$var."\">".$label."</label><input name=\"".$var."\" id=\"".$var."\" value=\"".$value."\" type=\"password\" class=\"textfield\" /></p>\n";
  330.                           }
  331.                           elseif($var !='LANGUAGE'{
  332.                               $out .= "<p><label for=\"".$var."\">".$label."</label><input name=\"".$var."\" id=\"".$var."\" value=\"".$value."\" type=\"text\" class=\"textfield\" /></p>\n";
  333.                           else {
  334.                               $out .= "<p><label for=\"".$var."\">".$label."</label>".CultureSelectBox($var$value)."</p>\n";
  335.                           }
  336.   
  337.                       }
  338.                   }
  339.                   if(!$updatable$out .="</dl>";
  340.               }
  341.           }
  342.           else
  343.           {
  344.               if(!$updatable && $hidden$out .= "<input name=\"".$key."\" id=\"".$key."\" value=\"".$ini."\" type=\"hidden\"  />\n";
  345.               if(!$updatable)    $out .="<dt>".$key."</dt><dd>".$ini."</dd>\n";
  346.               else $out .= "<p><label for=\"".$key."\">".$key."</label><input name=\"".$key."\" id=\"".$key."\" value=\"".$ini."\" type=\"text\" class=\"textfield\" /></p>\n";
  347.           }
  348.       }
  349.       return $out;
  350.   
  351.   }
  352.   
  353.   /**
  354.    * config_file::getThemeParams()
  355.    * retourne le contenu HTML en édition ou non des sections éditables
  356.    * @access public
  357.    * @param string $updatable : champ texte modifiable
  358.    * @param string $hidden : présence d'input type hidden
  359.    * @return string 
  360.    */
  361.   public function getThemeParams($updatable false$hidden false{
  362.   
  363.       // Notify the beginning of the current method
  364.       $this->dispatcher->notify(new sfEvent($this'config.get_theme_params'));
  365.        
  366.       $out '';
  367.       $authorized_sections=array();
  368.   
  369.       include('../languages/' U_L '/lang_system.'CHARSET .'.php');
  370.   
  371.       $content=$this->config_params;
  372.       $authorized_sections=$this->authorized_theme_sections;
  373.   
  374.       $theme_public=$content[$this->theme_settings][$this->theme_public];
  375.       $theme_admin=$content[$this->theme_settings][$this->theme_admin];
  376.   
  377.       if(isset($GLOBALS['lang']['system'][$this->theme_public])) $label='<abbr title="'.$GLOBALS['lang']['system'][$this->theme_public].'">'.$this->theme_public.'</abbr>';
  378.       else $label=$this->theme_public;
  379.   
  380.       $out .= "\n<h2 style=\"clear:both;\">".$label."</h2>\n";
  381.       $out .=$this->getOneThemeParams($updatable$hiddentrue,$theme_public,$this->theme_public,$this->theme_public"public");
  382.   
  383.       $public_themes getThemes('public');
  384.   
  385.       foreach ($public_themes as $key => $value)
  386.       {
  387.           if($value != $theme_public)
  388.               $out .=$this->getOneThemeParams($updatable$hiddenfalse,$value,$this->theme_list_public,$this->theme_public"public");
  389.       }
  390.   
  391.       if(isset($GLOBALS['lang']['system'][$this->theme_admin])) $label='<abbr title="'.$GLOBALS['lang']['system'][$this->theme_admin].'">'.$this->theme_admin.'</abbr>';
  392.       else $label=$this->theme_admin;
  393.   
  394.       $out .= "\n<h2 style=\"clear:both;\">".$label."</h2>\n";
  395.   
  396.       $out .=$this->getOneThemeParams($updatable$hiddentrue,$theme_admin,$this->theme_admin,$this->theme_admin"admin");
  397.   
  398.       $admin_themes getThemes('admin');
  399.   
  400.       foreach ($admin_themes as $key => $value)
  401.       {
  402.           if($value != $theme_admin)
  403.               $out .=$this->getOneThemeParams($updatable$hiddenfalse,$value,$this->theme_list_admin,$this->theme_admin"admin");
  404.       }
  405.   
  406.       $out .= "\n<br style=\"clear:both;\" />\n";
  407.       return $out;
  408.   }
  409.   
  410.   
  411.   /**
  412.    * config_file::getOneThemeParams()
  413.    * retourne les informations relatives à un thème
  414.    * @access private
  415.    * @param string $updatable 
  416.    * @param string $hidden 
  417.    * @param string $selected 
  418.    * @param string $value 
  419.    * @param string $field_name 
  420.    * @param string $radio_name 
  421.    * @return string 
  422.    */
  423.   public function getOneThemeParams($updatable false$hidden false$selected=false,$value,$field_name,$radio_name$type{
  424.   
  425.       // Notify the beginning of the current method
  426.       $this->dispatcher->notify(new sfEvent($this'config.get_one_theme_params'));
  427.        
  428.       include('../languages/' U_L '/lang_system.'CHARSET .'.php');
  429.   
  430.       $selected_pattern='';
  431.       $checked_pattern='';
  432.       $hidden_pattern='';
  433.       $updatable_pattern='';
  434.       $info loadThemeInfo($type$value);
  435.   
  436.       if ($selected)
  437.       {
  438.           $selected_pattern='_selected';
  439.           $checked_pattern='checked="checked"';
  440.       }
  441.       if(!$updatable)$hidden_pattern='style="display:none;"';
  442.       else $updatable_pattern="onclick=\"javascript:document.getElementById('".$type.$value."').checked='checked';\"";
  443.       $out '';
  444.       $out .="<div class=\"config_theme" $selected_pattern"\">\n";
  445.       $out .="<img src=\"../templates/" .$type"/" .$value"/preview.png\" style=\"width:250px;height:160px;\" alt=\"" .$value"\" id=\"img_" .$type."-".$value"\" ".$updatable_pattern."/>\n";
  446.   
  447.       $out .= '<input type="radio" name="' .$radio_name'" id="' .$type.'-'.$value'" value="' .$value'" ' .$checked_pattern' ' .$hidden_pattern' />';
  448.       $out .=    '<label for="' .$type.'-'.$value'" class="autowidth">' $value '</label>';
  449.       $out .= '<div class="themeinfo"><em>'._t('theme','name').'</em> : '.$info['name'].'<br />'.END_LINE;
  450.       $out .= '<em>'._t('theme','author').'</em> : <a href="'.$info['homepage'].'">'.$info['author'].'</a><br />'.END_LINE;
  451.       $out .= '<em>'._t('theme','version').'</em> : '.$info['version'].' | ';
  452.       $out .= '<em>'._t('theme','compatibility').'</em> : '.$info['compatibility'].'<br />'.END_LINE;
  453.       $out .= '<em>'._t('theme','description').'</em> : '.$info['description'].'<br />'.END_LINE;
  454.       $out .= '</div>';
  455.       $out .="</div>";
  456.       return $out;
  457.   }
  458.  
  459.   /**
  460.    * config_file::writePhpParams()
  461.    * écrit le fichier $file_name dans le répertoire de config, au format PHP
  462.    * @access public
  463.    *  méthode dépréciée
  464.    * @param string $file_name 
  465.    * @return boolean 
  466.    */
  467.   public function writePhpParams($file_name)
  468.   {
  469.       // Notify the beginning of the current method
  470.       $this->dispatcher->notify(new sfEvent($this'config.write_php_params'array('filename' => $file_name)));
  471.       
  472.     $content=$this->generateHeader($file_name);
  473.     $content.=$this->generateBody($file_name);
  474.     $content.=$this->generateFooter($file_name);
  475.     //on écrit le contenu dans le fichier php
  476.     if($this->a_file->mkfile($content,$this->config_path.$file_name.$this->php_extension)) return true;
  477.     else return false;
  478.   }
  479.   /**
  480.    * config_file::parseConfig()
  481.    * retourne un tableau contenant les paramètres du fichier ini $file_name
  482.    * @access public
  483.    * @param string $file_name 
  484.    * @return array 
  485.    */
  486.   public function parseConfig($file_name$whithsection true)
  487.   {
  488.       // Notify the beginning of the current method
  489.       $this->dispatcher->notify(new sfEvent($this'config.parse_config'array('filename' => $file_name)));
  490.       
  491.     //parse_ini_file
  492.     return $this->a_file->parse_ini($this->ini_path.$file_name$whithsection);
  493.  
  494.   }
  495.  
  496.   /**
  497.    * config_file::generateBody()
  498.    * génère le contenu d'un fichier php de configuration à parti du $file_name
  499.    * @access private
  500.    * @param string $file_name 
  501.    * @return string 
  502.    */
  503.   private function generateBody($file_name)
  504.   {
  505.       
  506.     $out '';
  507.  
  508.     if($file_name == $this->section_main$content=$this->config_params;
  509.     else $content=$this->release_params;
  510.  
  511.     if (!is_array($content))
  512.     return false;
  513.  
  514.     foreach ($content as $key => $ini)
  515.     {
  516.       if (is_array($ini))
  517.       {
  518.         $out .= "\n\n//    ".$key." /////// \n\n";
  519.  
  520.         foreach ($ini as $var => $value)
  521.         {
  522.           $out .= "define('".$var."',\t\t".$this->a_file->quote_ini($value).");\n";
  523.         }
  524.       }
  525.       else
  526.       {
  527.         $out .= "define('".$key."',\t\t".$this->a_file->quote_ini($ini).");\n";
  528.       }
  529.     }
  530.     
  531.     // Filter data event + return value
  532.     $r $this->dispatcher->filter(new sfEvent($this'config.generate_body'array('filename' => $file_name'content' => $out))$out);
  533.     $out $r->getReturnValue();
  534.  
  535.     return $out;
  536.   }
  537.   /**
  538.    * config_file::generateHeader()
  539.    * génère l'en tête d'un fichier php de configuration à partir du $file_name
  540.    * @access private
  541.    * @param string $file_name 
  542.    * @return string 
  543.    */
  544.   private function generateHeader($file_name)
  545.   {
  546.     $ret.="<?php \n";
  547.     $ret.="// Linea 21 - PHP ".$file_name."\n";
  548.     $ret.="// last_modify    : ".date("d-m-Y")."\n";
  549.     $ret.="// GPL 3\n";
  550.     $ret.="// http://opensource.org/licenses/gpl-3.0.html\n\n";
  551.     $ret.="// BE CAREFULL THIS FILE IS SYSTEM FILE : use interface or ".$file_name." FOR CONFIGURATION";
  552.     
  553.     // Filter data event + return value
  554.     $r $this->dispatcher->filter(new sfEvent($this'config.generate_header'array('filename' => $file_name'content' => $ret))$ret);
  555.     $ret $r->getReturnValue();
  556.     
  557.     return $ret;
  558.   }
  559.   /**
  560.    * config_file::generateFooter()
  561.    * génère le pied d'un fichier php de configuration à parti du $file_name
  562.    * @access private
  563.    * @param string $file_name 
  564.    * @return string 
  565.    */
  566.   private function generateFooter($file_name)
  567.   {
  568.     $s "?> \n";
  569.     
  570.     // Filter data event + return value
  571.     $r $this->dispatcher->filter(new sfEvent($this'config.generate_footer'array('filename' => $file_name'content' => $s))$s);
  572.     $s $r->getReturnValue();
  573.     
  574.     return $s;
  575.   }
  576.  
  577.   
  578.  
  579.   /**
  580.    * config_file::strip_ini_char
  581.    * suppression des caractères interdits dans un fichier ini
  582.    * @access private
  583.    * @param string $content 
  584.    * @return string 
  585.    */
  586.   function strip_ini_char($content)
  587.   {
  588.     $ret='';
  589.     // on remplace les caractères "[]; par '(),
  590.     $ret=strtr($content"\"[];""'(),");
  591.     if (get_magic_quotes_gpc()) $ret=stripslashes($ret);
  592.     
  593.     return $ret;
  594.   }
  595.  
  596.   /**
  597.    * config_file::convert_type()
  598.    * conversion d'une variable en entier ou en float selon son contenu
  599.    * @param unknown_type $var 
  600.    * @return int or float
  601.    */
  602.   public function convert_type$var )
  603.   {
  604.     ifis_numeric$var ) )
  605.     {
  606.       if(float)$var != (int)$var )
  607.       {
  608.         return (float)$var;
  609.       }
  610.       else
  611.       {
  612.         return (int)$var;
  613.       }
  614.     }
  615.     if$var == "true" )    return true;
  616.     if$var == "false" )    return false;
  617.     return $var;
  618.   }
  619.   /**
  620.    * config_file::getPhpInfo()
  621.    * Retourne un string contenant les informations php en html
  622.    * @access public
  623.    * @return string 
  624.    */
  625.   public function getPhpInfo({
  626.     ob_start();
  627.     phpinfo();
  628.     $info ob_get_contents();
  629.     ob_end_clean();
  630.     return preg_replace('%^.*<body>(.*)</body>.*$%ms''$1'$info);
  631.   }
  632. }
  633.  
  634. ?>

Documentation generated on Thu, 20 Mar 2014 16:46:06 +0100 by phpDocumentor 1.4.1