예제 #1
0
 function getEditorFileContent()
 {
     if (!is_file($this->path)) {
         return '';
     }
     $text = file_get_contents($this->path);
     $text = preg_replace("/src=\"{#SITE_URL#}" . preg_quote(SITE, '/') . "/", "src=\"" . SITE_URL . SITE, $text);
     $text = str_replace('{$MEDIAS_URL}', POFile::getPathUrl(MEDIAS_PATH), $text);
     return $text;
 }
예제 #2
0
/**
 * images_tools_change_image_src_to_autoresize
 * Change the source of the displayed page.
 * Search for img, if param width and height is set, change the image src to imagestoolsresize.php script.
 * 
 * @param unknown_type $source
 * @param unknown_type $smarty
 * @return unknown
 */
function images_tools_change_image_src_to_autoresize($source, &$smarty)
{
    $oPlugin = new PPluginDir(dirname(__FILE__));
    $oConfigFile =& $oPlugin->oConfig;
    if ($oConfigFile->getDirectParam("SERVER_RESIZE") !== "true") {
        return $source;
    }
    $strUploadUrl = preg_quote(POFile::getPathUrl(MEDIAS_PATH), '/');
    $source = preg_replace(array('/(<img([^>]*)width="([^"]*)"([^>]*)height="([^"]*)"([^>]*)src="(' . $strUploadUrl . '[^"]*)"([^>]*)>)/', '/(<img([^>]*)src="(' . $strUploadUrl . '[^"]*)"([^>]*)style="width:[^0-9]*([0-9]*)px;\\sheight:[^0-9]*([0-9]*)px;[^"]*"([^>]*)>)/'), array('<img\\2\\4\\6src="' . SITE_URL . 'imagestoolsresize.php?img=\\7&width=\\3&height=\\5"\\8>', '<img\\2src="' . SITE_URL . 'imagestoolsresize.php?img=\\3&width=\\5&height=\\6"\\4\\7>'), $source);
    /*
    $source = preg_replace(
    	'/(<img([^>]*)width="([^"]*)"([^>]*)height="([^"]*)"([^>]*)src="('.$strUploadUrl.'[^"]*)"([^>]*)>)/',
    	'<img\2\4\6src="'.SITE_URL.'imagestoolsresize.php?src=\7&width=\3&height=\5"\8>',
    $source);
    //if modified with mouse fck set style and not width and height properties
    $source = preg_replace(
    	'/(<img([^>]*)src="('.$strUploadUrl.'[^"]*)"([^>]*)style="width:[^0-9]*([0-9]*)px;\sheight:[^0-9]*([0-9]*)px;[^"]*"([^>]*)>)/',
    	'<img\2src="'.SITE_URL.'imagestoolsresize.php?src=\3&width=\5&height=\6"\4\7>',
    $source);
    */
    return $source;
}
예제 #3
0
 /**
  * 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();
     }
 }