public function getLang() { /* * Charge le fichier de lang par defaut et celui lié au controller * puis les stock dans un même tableau * Si la variable $_POST['LangToJs'] est définie, * alors on envoie le contenue de la langue en json */ $sRequestLang = isset($_POST['PhpLangToJs']) ? strtolower($_POST['PhpLangToJs']) : strtolower($_SESSION['class']); $sRequestLang = ucfirst($sRequestLang); DebugAppModel::logThis(__FILE__, __LINE__, 'Langue chargé: ' . $_SESSION['lang'] . ' - sRequestLang: ' . $sRequestLang); if (!is_dir($this->sLangPath)) { DebugAppModel::logThis(__FILE__, __LINE__, 'Dossier introuvable: ' . $this->sLangPath); return false; } if (!is_file($this->sLangPath . 'DefautLang.php')) { $DefautLang = array(); } else { require_once $this->sLangPath . 'DefautLang.php'; } if (!is_file($this->sLangPath . $sRequestLang . 'Lang.php')) { ${$sRequestLang . 'Lang'} = array(); } else { require_once $this->sLangPath . $sRequestLang . 'Lang.php'; } /* * Merge les deux table de lang */ $this->aLang = array_merge($DefautLang, ${$sRequestLang . 'Lang'}); if (AUTO_HTMLENTITIES_LANG) { foreach ($this->aLang as $sKey => $sValue) { $this->aLang[$sKey] = htmlentities($sValue); } } }
public function run() { /* * Lance et pilote l'application */ $this->getConfig(); $this->resetDebugMode(); DebugAppModel::logDetail(); $this->setRoutage(); $this->initController(); $this->initView(); }
public function run() { /* * Lance et pilote l'application * NB: Tout les if method_exists permette de lancer des fonction propre à chaque application * avant et/ou après chaque étape du bootstrap */ // Charge la config de l'application (et non du site) if (method_exists('PluginAppModel', 'beforeConfig')) { PluginAppModel::beforeConfig(); } $this->getConfig(); if (method_exists('PluginAppModel', 'afterConfig')) { PluginAppModel::afterConfig(); } DebugAppModel::resetDebug(); // Reset les log de debuguage DebugAppModel::logDetail(); // Log les détail si la config le demande // Initialise le routage (récupére la class et la method) if (method_exists('PluginAppModel', 'beforeRoutage')) { PluginAppModel::beforeRoutage(); } $this->setRoutage(); if (method_exists('PluginAppModel', 'afterRoutage')) { PluginAppModel::afterRoutage(); } // Initialise le controller if (method_exists('PluginAppModel', 'beforeController')) { PluginAppModel::beforeController(); } $this->initController(); if (method_exists('PluginAppModel', 'afterController')) { PluginAppModel::afterController(); } // Innitialise la view if (method_exists('PluginAppModel', 'beforeView')) { PluginAppModel::beforeView(); } $this->initView(); if (method_exists('PluginAppModel', 'afterView')) { PluginAppModel::afterView(); } }
public function logThis() { DebugAppModel::logThis(__FILE__, __LINE__, 'Class: [ ' . $_SESSION['class'] . ' ] - Method: [ ' . $_SESSION['method'] . ' ]'); }
* COnstante HTTP, permette de cibler une URL du site * n'importe ou dans l'application */ define('ROOT_HTTP', str_replace("index.php", "", 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER["PHP_SELF"])); /* * La constante ci-dessous peut être remplacer par ce code en fonction du serveur web * if (preg_match('/localhost/si', $_SERVER['SERVER_NAME'])) * define( 'ROOT_HTTP', str_replace( "index.php", "", 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER["PHP_SELF"] ) ) ; * else * define( 'ROOT_HTTP', 'http://' . $_SERVER['SERVER_NAME'] . '/' ); */ define('REQUEST_HTTP', 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); define('IMG_HTTP', ROOT_HTTP . 'public/img/'); define('CSS_HTTP', ROOT_HTTP . 'public/css/'); define('JS_HTTP', ROOT_HTTP . 'public/js/'); define('PUBLIC_HTTP', ROOT_HTTP . 'public/'); /* * Inclue les fonctions de l'application */ require_once LIBS_PATH . '/coreapp/functions/AutoloadFunction.php'; /* * Lancement de l'application */ $bootstrap = new Bootstrap(); $bootstrap->run(); /* * Fermeture du fichier de log et calcul du temps d'execution si DISPLAY_UPTIME = true */ DebugAppModel::logUptime(); DebugAppModel::logSeparateur();
public function logThis() { /* * Converti les variables $this->mSetLayout et $this->mSetView * afin de les inscrire dans le fichier de log */ if (is_bool($this->mSetLayout)) { $sSetLayout = $this->mSetLayout ? 'true' : 'false'; } else { $sSetLayout = $this->mSetLayout; } if (is_bool($this->mSetView)) { $sSetView = $this->mSetView ? 'true' : 'false'; } else { $sSetView = $this->mSetView; } $mSetView = $this->mSetView; $sAView = empty($this->aView) ? 'empty' : 'not empty'; DebugAppModel::logThis(__FILE__, __LINE__, 'mSetLayout: ' . $sSetLayout . ' - mSetView: ' . $sSetView . ' - aView: ' . $sAView); }
public function lang() { /* * Appelle la fonction lang() du modèle LanguageAppModel * et retourne le résultat en echo */ if (!USE_LANG_MODEL) { DebugAppModel::StopApp(__FILE__, __LINE__, 'Impossible d\'utiliser la fonction lang() dans la view car USE_LANG_MODEL est false'); } else { echo $this->oLang->lang(func_get_args()); } }
private function verifConfigFile($aConfig) { /* * Controle que les paramètre fourni dans COREAPP_PATH . '/configs/SecurityConfigs.php' sont au bon format */ if (!is_array($aConfig)) { DebugAppModel::stopApp(__FILE__, __LINE__, 'Erreur dans: ' . COREAPP_PATH . '/configs/SecurityConfigs.php -> $aSecurity n\'est pas un tableau'); } else { /* * Vérifie la structure des paramètre */ if ($aConfig['PROTECT_MODE'] != 'white' && $aConfig['PROTECT_MODE'] != 'black') { DebugAppModel::stopApp(__FILE__, __LINE__, 'Erreur dans: ' . COREAPP_PATH . '/configs/SecurityConfigs.php -> $aSecurity[\'PROTECT_MODE\'] n\'est pas valide'); } $aVerifConnectUrl = explode('/', $aConfig['CONNECT_URL']); if (empty($aVerifConnectUrl[0]) || empty($aVerifConnectUrl[1])) { DebugAppModel::stopApp(__FILE__, __LINE__, 'Erreur dans: ' . COREAPP_PATH . '/configs/SecurityConfigs.php -> $aSecurity[\'CONNECT_URL\'] n\'est pas valide'); } if (!is_array($aConfig['PROTECT_LIST'])) { DebugAppModel::stopApp(__FILE__, __LINE__, 'Erreur dans: ' . COREAPP_PATH . '/configs/SecurityConfigs.php -> $aSecurity[\'PROTECT_LIST\'] n\'est pas valide'); } } return $aConfig; }