/** * Enter description here... * * @param unknown_type $strDirSum * @param unknown_type $oDir */ function checkDir($strDirSum, &$oDir) { echo _('Checking ' . $strDirSum . ' directory ....'); //if directory not exists, try to create it if (!$oDir->isDir()) { if (!$oDir->mkdir()) { printFatalError(); } } //check if directory is writable if (!is_writable($oDir->path)) { printFatalError('[FALSE] ' . sprintf(_('%s directory %s is not writable. Please Check permissions.'), $strDirSum, $oDir->getRelativePath())); } echo "[ OK ]\n"; }
/*Security, can't browse .. directory*/ if (!isset($_GET["file"]) || $_GET["file"] == '' || eregi("\\.\\.", $_GET["file"])) { printFatalError(_('You should specified a file to edit')); } $pFileTemp =& getFileObject(SITE_PATH . urldecode($_GET["file"])); $pfile =& getFileObjectAndFind($pFileTemp->path, 'file'); if ($pfile === false) { if ($pFileTemp->is_configfile()) { //must create it $pfile =& $pFileTemp; } else { if (preg_match('/index\\.htm[l]?$/', basename($pFileTemp->path)) !== false) { //if index file create it $pfile =& $pFileTemp; } else { printFatalError(); } } } //url back $pdirparent =& getFileObject($pfile->getParentPath()); if (isConnected()) { echo ' <div id="path"> <div id="imgHome"></div> '; $strPath = $pfile->path; $oRoot = new PDir(strstr($pfile->path, PAGES_PATH) !== false ? PAGES_PATH : (strpos($pfile->path, PAGES_MODELS_PATH) !== false ? PAGES_MODELS_PATH : SITE_PATH)); $tabGuid = array(); while ($oRoot->path != $strPath && strlen($strPath) > 1) { $o =& getFileObject($strPath);
function printFatalHtmlError($strMore = '', $iErrorType = 500) { setError(getError() . $strMore); header("HTTP/1.0 {$iErrorType} Server Error"); printFatalError(); }
/** * Function: display * If page has not been cached, calculate it. * Then call the smarty display fonction * * * param: &$oPage, a reference to the object page to display */ function displayPage(&$oPage) { $strTemplateName = $oPage->getTemplateName(); $strCompiledId = $this->getCompiledId(); $this->oPageCurrent =& $oPage; $this->register_object('oPageCurrent', $oPage); //if page must not be cached, set the site cache to 0 $this->caching = $this->caching && $oPage->isCached() ? 1 : 0; //on regénére le menu si le menu n'existe pas en cache ou si la page courante a été modifiée après le menu $bGenerateMenu = !is_file(SMARTY_CACHE_DIR . 'menu.cache'); //|| (is_file(SMARTY_CACHE_DIR.'menu.cache') && $oPage->getModifiedTime()>filemtime(SMARTY_CACHE_DIR.'menu.cache')); //rebuild menu not exist (a page has been updated) or the page if cache not exists or page not use cache if ($bGenerateMenu || $this->caching == 0 || $this->force_compile || !$this->is_cached($strTemplateName, $strCompiledId)) { //check that the template file exists if (!is_file($this->template_dir . SLASH . $strTemplateName)) { setError(sprintf(_("The template file %s doesn't exist."), $strTemplateName)); printFatalHtmlError(); } //si on doit regénérer le menu, on le supprime avant if ($bGenerateMenu) { if (!deleteMenuCache()) { printFatalError(); } } //assign the menu $this->assign_by_ref("menu", $this->getMenu(isConnected())); $this->assign("PAGE_PATH", $oPage->path); $this->assign("PAGE_CONTENU", $oPage->path); $this->assign("PAGE_PATH_TITLE", $oPage->getPagePathForTitle()); $this->assign('MEDIAS_URL', POFile::getPathUrl(MEDIAS_PATH)); $oPageConfigFile = $oPage->getConfigFileObject(); if (is_file($oPageConfigFile->path)) { $this->assign("CONFIG_FILE_PAGE", $oPageConfigFile->path); } $oCatConfigFile = $oPage->getConfigFileObjectCategory(); if (is_file($oCatConfigFile->path)) { $this->assign("CONFIG_FILE_CATAGORY", $oCatConfigFile->path); } //we load filter only in case of cache $this->loadAdminFilters(); } //end calcul if (true || checkKey()) { //display the page !! $strContent = parent::fetch($strTemplateName, $strCompiledId); doEventAction('beforedisplay', array(&$strContent, &$this)); echo $strContent; } else { printError(); } }