/** * Constructeur, * initialise le moteur smarty, définie le répertoire du cache, des plugins .... */ function PPollenCms() { $this->cache_dir = SMARTY_CACHE_DIR . "cache"; $this->compile_dir = SMARTY_CACHE_DIR . "compiled"; $this->compile_id = SITENAME ? SITENAME : 'default'; $this->template_dir = THEME_DIR . 'templates'; $this->assign('THEME_URL', THEME_URL); $this->assign('CONFIG_FILE_SITE', CONFIG_FILE); $configDescr = SITE_PATH . 'core' . SLASH . 'default_config.ini'; if (is_file($configDescr)) { $this->assign('DEFAULT_CONFIG_FILE_SITE', $configDescr); } //try to create the cache dir and compile dir if not exists! if (!is_dir($this->cache_dir)) { $pdirCache = new PDir($this->cache_dir); if (!$pdirCache->mkdir()) { printFatalError(sprintf(_('can not create the cache dir %s. Please check permissions.'), $pdirCache->getRelativePath())); } } if (!is_dir($this->compile_dir)) { $pdirComile = new PDir($this->compile_dir); $pdirComile->mkdir(); } $this->caching = 1; $this->cache_lifetime = -1; $this->force_compile = isConnected(); $this->plugins_dir[] = SITE_PATH . 'core' . SLASH . 'lib' . SLASH . 'smartyplugins' . SLASH; //filters defined in plugins $this->loadDefaultFilters(); }
if (strpos($proot_dir->path, MEDIAS_PATH) !== FALSE || strpos($pcurrent_dir->path, PAGES_MODELS_PATH . SLASH . 'images') !== FALSE) { ?> <a href="javascript:clickSWFUpload('<?php echo session_id() . '\', \'' . urljsencode($pcurrent_dir->getRelativePath()); ?> ');" class="btnNewSmall" id="btnUploadFileSmall" title="<?php echo _('upload file'); ?> "></a> <?php } ?> </div> <div id="imgHome"></div><a href="<?php echo $_SERVER["PHP_SELF"] . "?rootpath=" . urlencode($proot_dir->getRelativePath()); ?> "> <?php echo strstr($proot_dir->path, PAGES_PATH) !== false ? _('Site Pages') : $proot_dir->getPrintedName(); ?> </a><?php echo $pcurrent_dir->getLinkPath($rootpath); ?> </div><!--end divpath --> <div id="browser" class="sortable"> <div id="menu_browser" class="contextMenu"> <ul> <li><a id="newdir" href="javascript:createDir('<?php echo urljsencode($pcurrent_dir->getRelativePath());
/** * Rename a file. If the newname has no file extension, use the current file extension. * If destDir not set, use the current file directory. If set move the file to the * destdir. * * @param string $strNewName, the new name of the file. * @param string $destDir, the path of the destination directory, if false, the parent path * @return true if succeed, else false */ function Rename($strNewName, $destDir = false) { $strNewName = $this->getUnixName($strNewName); $strActionName = !$destDir || $destDir == $this->getParentPath() ? 'rename' : 'move'; //check name if (!$this->checkname($strNewName)) { return false; } //check extension $oFile = new PFile($strNewName); $strNewName .= $oFile->getExtension() == '' ? '.' . $this->getExtension() : ''; if (strlen($oFile->getNameWithoutExt()) == 0) { return setError(_("Can not {$strActionName} with empty name.")); } //check destDir $destDir = !$destDir ? $this->getParentPath() : $destDir; $objDstDir = new PDir($destDir); if (!$objDstDir->isDir()) { return setError(sprintf(_("Can not {$strActionName} file.\nDirectory not %s exists."), $objDstDir->getRelativePath())); } if (!is_writable($objDstDir->path)) { return setError(sprintf(_("Can not {$strActionName} file %s.\nDirectory is not %s writable."), $objDstDir->getRelativePath())); } //check write accesses if (!is_writable($this->path)) { return setError(sprintf(_("Can not {$strActionName} file %s.\n"), $this->getRelativePath())); } $newfile = $destDir . SLASH . $strNewName; if ($this->path == $newfile) { return true; } if (file_exists($newfile)) { return setError(sprintf(_("File: %s exists."), basename($newfile))); } if (!@rename($this->path, $newfile)) { return setError(_("An error occured while renaming file")); } $this->path = $newfile; return true; }
function getLinkPath($rootpath = false) { $oDir = new PDir($this->path); $root = $rootpath != false ? $rootpath : SITE_PATH . SITE . PAGES; $tabPath = explode(SLASH, $oDir->getRelativePath($root)); $pdirroot = new PDir($rootpath); $rootpath = $pdirroot->getRelativePath(); $parent = ''; $isize = sizeof($tabPath); for ($i = 0; $i < $isize; $i++) { $path = $tabPath[$i]; if ($path != '') { $parent .= $path; $obj = getFileObject($root . SLASH . $parent); echo " > <a href=\"" . $_SERVER["PHP_SELF"] . "?current_dir=" . urlencode($parent) . ($rootpath == false ? "" : "&rootpath=" . $rootpath) . "\" >" . $obj->getPrintedName(); echo "</a>"; $parent .= SLASH; } } }
$rootpath = SITE_PATH . (isset($_GET["rootpath"]) ? urldecode($_GET["rootpath"]) : ''); } if (!isset($_GET["current_dir"]) || $_GET["current_dir"] == '' || preg_match("/\\.\\./", urldecode($_GET["current_dir"]))) { $current_dir = $rootpath; } else { $current_dir = $rootpath . SLASH . urljsdecode($_GET["current_dir"]); } $pcurrent_dir =& getFileObject($current_dir); $proot_dir = new PDir($rootpath); if (!is_dir($rootpath)) { die('root path not exists.'); } if (!$pcurrent_dir) { die('current directory not found'); } $rootpathdir = $proot_dir->getRelativePath(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <link rel="stylesheet" href="<?php echo SITE_URL; ?> core/admin/theme/css/admin.css" /> <?php $strUiTheme = $configFile->getDirectParam('UI_THEME');