<commit_before><?php
	/*\
	 | ------------------------------------------------------
	 | @file : rubrique.class.php
	 | @author : fab@c++
	 | @description : class mre de l'application
	 | @version : 2.0 bta
	 | ------------------------------------------------------
	\*/
	
	class rubrique implements general{
		
		/* --- infos d'en tete -- */
		
		private $doctype;
		private $title;
		private $metaContentType;
		private $metaKeyword;
		private $metaDescription;
		private $metaRobot;
		private $metaGoogleSite;
		private $openSearch;
		private $js = array();
		private $css = array();
		private $jsInFile = array();
		private $rss = array();
		private $contentMarkupBody;
		private $localisation;
		private $otherHeader = array();
		
		private $lang; // gestion des langues via des fichiers XML
		private $langInstance;
		/* --- permet d'affiche le doctype et l'entete (avant la balise body) et </body></html> -- */
		
		private $header;
		private $footer;
		
		/* ---------- CONSTRUCTEURS --------- */
		
		public  function __construct(){
			$this->doctype='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
			$this->doctype.="\n";
			$this->doctype.='<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >';
			$this->title='Page Web';
			$this->metaContentType='text/html; charset='.CHARSET;
			$this->metaKeyword='';
			$this->metaDescription='';
			$this->metaRobot='index,follow';
			$this->metaGoogleSite='';
			$this->openSearch='';
			$this->js= array ('script.js');
			$this->css= array ('default.css');
			$this->jsInFile = array('inpage.js');
			$this->otherHeader = array();
			$this->lang = 'fr';
			$this->langInstance;
			$this->createLangInstance();
		}
		
		/* ---------- CONNEXION A LA BASE DE DONNEES --------- */
		
			public function connectDatabase($db){
				foreach ($db as $d){
					switch ($d['extension']){
						case 'pdo':
							try{
								$sql_connect[''.$d['database'].''] = new PDO('mysql:host='.$d['hostname'].';dbname='.$d['database'], $d['username'], $d['password']);
							}
							catch (PDOException $e){
								$this->setErrorLog('errors.log', 'Une exception a t lance. Message d\'erreur lors de la connexion  une base de donnes : '.$e.'');
							}	
						break;
						
						case 'mysqli':
							$sql_connect[''.$d['database'].''] = new mysqli($d['hostname'], $d['username'], $d['password'], $d['database']);
						break;
						
						case 'mysql':
							$sql_connect[''.$d['database'].''] = mysql_connect($d['hostname'], $d['username'], $d['password']);
							$sql_connect[''.$d['database'].''] = mysql_select_db($d['database']);
						break;
						
						default :
							$this->setErrorLog('errors.log', 'L\'extension de cette connexion n\'est pas gre');
						break;
					}
				}
				return $sql_connect;
			}
			
			private function createLangInstance(){
				if($this->lang=""){ $this->langInstance = new lang($this->getLangClient()); } else { $this->langInstance = new lang($this->lang); }
			}
			
			public function useLang($sentence){
				return $this->langInstance->loadSentence($sentence);
			}
			
			private function getLangClient(){
				$langcode = (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
				$langcode = (!empty($langcode)) ? explode(";", $langcode) : $langcode;
				$langcode = (!empty($langcode['0'])) ? explode(",", $langcode['0']) : $langcode;
				$langcode = (!empty($langcode['0'])) ? explode("-", $langcode['0']) : $langcode;
				return $langcode['0'];
			}
			
			public function GzipinitOutputFilter() {
				ob_start('ob_gzhandler');
				register_shutdown_function('ob_end_flush');
			}
			
			public function setView($name, $var){
				$GLOBALS[''.$name.'']=$var;<commit_msg>Signed-off-by: fab <<EMAIL>><commit_after><?php
	/*\
	 | ------------------------------------------------------
	 | @file : rubrique.class.php
	 | @author : <EMAIL>@c++
	 | @description : class mre de l'application
	 | @version : 2.0 bta
	 | ------------------------------------------------------
	\*/
	
	class rubrique implements general{
		
		/* --- infos d'en tete -- */
		
		private $doctype;
		private $title;
		private $metaContentType;
		private $metaKeyword;
		private $metaDescription;
		private $metaRobot;
		private $metaGoogleSite;
		private $openSearch;
		private $js = array();
		private $css = array();
		private $jsInFile = array();
		private $rss = array();
		private $contentMarkupBody;
		private $localisation;
		private $otherHeader = array();
		
		private $lang; // gestion des langues via des fichiers XML
		private $langInstance;
		/* --- permet d'affiche le doctype et l'entete (avant la balise body) et </body></html> -- */
		
		private $header;
		private $footer;
		
		/* ---------- CONSTRUCTEURS --------- */
		
		public  function __construct(){
			$this->doctype='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
			$this->doctype.="\n";
			$this->doctype.='<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >';
			$this->title='Page Web';
			$this->metaContentType='text/html; charset='.CHARSET;
			$this->metaKeyword='';
			$this->metaDescription='';
			$this->metaRobot='index,follow';
			$this->metaGoogleSite='';
			$this->openSearch='';
			$this->js= array ('script.js');
			$this->css= array ('default.css');
			$this->jsInFile = array('inpage.js');
			$this->otherHeader = array();
			$this->lang = 'fr';
			$this->langInstance;
			$this->createLangInstance();
		}
		
		/* ---------- CONNEXION A LA BASE DE DONNEES --------- */
		
			public function connectDatabase($db){
				foreach ($db as $d){
					switch ($d['extension']){
						case 'pdo':
							try{
								$sql_connect[''.$d['database'].''] = new PDO('mysql:host='.$d['hostname'].';dbname='.$d['database'], $d['username'], $d['password']);
							}
							catch (PDOException $e){
								$this->setErrorLog('errors.log', 'Une exception a t lance. Message d\'erreur lors de la connexion  une base de donnes : '.$e.'');
							}	
						break;
						
						case 'mysqli':
							$sql_connect[''.$d['database'].''] = new mysqli($d['hostname'], $d['username'], $d['password'], $d['database']);
						break;
						
						case 'mysql':
							$sql_connect[''.$d['database'].''] = mysql_connect($d['hostname'], $d['username'], $d['password']);
							$sql_connect[''.$d['database'].''] = mysql_select_db($d['database']);
						break;
						
						default :
							$this->setErrorLog('errors.log', 'L\'extension de cette connexion n\'est pas gre');
						break;
					}
				}
				return $sql_connect;
			}
			
			private function createLangInstance(){
				if($this->lang=""){ $this->langInstance = new lang($this->getLangClient()); } else { $this->langInstance = new lang($this->lang); }
			}
			
			public function useLang($sentence){
				return $this->langInstance->loadSentence($sentence);
			}
			
			public function GzipinitOutputFilter() {
				ob_start('ob_gzhandler');
				register_shutdown_function('ob_end_flush');
			}
			
			public function setView($name, $var){
				$GLOBALS[''.$name.'']=$var;
{'fraction_non_alphanumeric': 0.23052084795732136, 'fraction_numerical': 0.004352098834760634, 'mean_word_length': 2.779310344827586, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 66, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1761664', 'n_tokens_mistral': 2868, 'n_tokens_neox': 2271, 'n_words': 466}