function _initLanguage() { $this->log("initLanguage", GLZ_LOG_SYSTEM); // inizializza la lingua $this->_language = org_glizy_Session::get('glizy.language', NULL); $this->_languageId = org_glizy_Session::get('glizy.languageId', NULL); if (is_null($this->_languageId)) { $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); // try to read the browser language $this->log("Read browser language", GLZ_LOG_SYSTEM); $ar = org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Language'); if (!$ar->find(array('language_code' => $lang, 'language_FK_site_id' => __Config::get('SITE_ID')))) { $this->log("Read defaul language", GLZ_LOG_SYSTEM); $ar->emptyRecord(); $ar->find(array('language_isDefault' => 1, 'language_FK_site_id' => __Config::get('SITE_ID'))); } $this->_language = $ar->language_code; $this->_languageId = $ar->language_id; org_glizy_Session::set('glizy.language', $this->_language); org_glizy_Session::set('glizy.languageId', $this->_languageId); } org_glizy_ObjectValues::set('org.glizy', 'languageId', $this->_languageId); // importa i file di localizzazione if (file_exists(org_glizy_Paths::getRealPath('CORE_CLASSES') . 'org/glizy/locale/' . $this->getLanguage() . '.php')) { $this->log("Import locale file", GLZ_LOG_SYSTEM); require_once org_glizy_Paths::getRealPath('CORE_CLASSES') . 'org/glizy/locale/' . $this->getLanguage() . '.php'; } else { require_once org_glizy_Paths::getRealPath('CORE_CLASSES') . 'org/glizy/locale/en.php'; } }
/** * Process * * @return boolean false if the process is aborted * @access public */ function process() { $tagContent = $this->getText(); if (empty($tagContent)) { // richiede il contenuto al padre $tagContent = $this->_parent->loadContent($this->getId()); $this->setText($tagContent); } if ($this->_parent->_tagname == 'glz:Page') { if (strpos($this->getText(), '.xml') !== false) { // crea i componenti leggendoli dal pageType specificato $fileName = org_glizy_Paths::getRealPath('APPLICATION_PAGE_TYPE', $this->getText()); if (!empty($fileName)) { $originalRootComponent =& $this->_application->getRootComponent(); $this->_pageTypeObj =& org_glizy_ObjectFactory::createPage($this->_application, preg_replace('/.xml$/', '', $this->getText())); $rootComponent =& $this->_application->getRootComponent(); $rootComponent->init(); $this->_application->_rootComponent =& $originalRootComponent; for ($i = 0; $i < count($rootComponent->childComponents); $i++) { $rootComponent->childComponents[$i]->remapAttributes($this->getId() . '-'); $this->addChild($rootComponent->childComponents[$i]); $rootComponent->childComponents[$i]->_parent =& $this; } $this->processChilds(); } } else { $newComponent =& org_glizy_ObjectFactory::createComponent($this->getText(), $this->_application, $this, '', '', ''); $newComponent->init(); $this->addChild($newComponent); $this->processChilds(); } } }
public function beforeProcess($pageId, $pageType) { $fileName = org_glizy_Paths::getRealPath('APPLICATION_PAGE_TYPE') . $pageType . '.xml'; $this->lastModifiedTime = filemtime($fileName); $this->etag = md5_file($fileName); $this->checkIfIsChanged(); }
function __construct($model, $lifeTime = null, $cacheFolder = null) { $cacheFolder = $cacheFolder ? $cacheFolder : org_glizy_Paths::getRealPath('CACHE_CODE'); $this->model = $model; $this->group = $cacheFolder . $model; $options = array('cacheDir' => $cacheFolder, 'lifeTime' => !$lifeTime ? org_glizy_Config::get('CACHE_CODE') : $lifeTime, 'readControlType' => '', 'fileExtension' => '.php'); $this->_cacheObj =& org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFile', $options); }
public function getTemplateRealpath() { if ($this->application->isAdmin()) { return org_glizy_Paths::getRealPath('APPLICATION_TO_ADMIN_TEMPLATE', $this->getSelectedTemplate()); } else { return org_glizy_Paths::getRealPath('APPLICATION_TEMPLATE'); } }
function _loadLocale() { // importa i file di localizzazione if (file_exists(org_glizy_Paths::getRealPath('CORE_CLASSES') . 'org/glizycms/locale/' . $this->getLanguage() . '.php')) { require_once org_glizy_Paths::getRealPath('CORE_CLASSES') . 'org/glizycms/locale/' . $this->getLanguage() . '.php'; } else { require_once org_glizy_Paths::getRealPath('CORE_CLASSES') . 'org/glizycms/locale/en.php'; } parent::_loadLocale(); }
function __construct($fileName = '', $defaultHtml = '') { if (!self::$isLibLoaded) { self::$isLibLoaded = true; set_include_path(get_include_path() . PATH_SEPARATOR . GLZ_LIBS_DIR . 'PHPTAL5/'); set_include_path(get_include_path() . PATH_SEPARATOR . GLZ_LIBS_DIR . 'PHPTAL5/PHPTAL/'); require_once GLZ_LIBS_DIR . 'PHPTAL5/PHPTAL.php'; } parent::__construct($fileName, $defaultHtml); $this->_templClass = new PHPTAL(); $this->_templClass->setPhpCodeDestination(org_glizy_Paths::getRealPath('CACHE'))->setTemplate($this->filePath . $this->fileName)->setForceReparse(false)->setEncoding(__Config::get('CHARSET')); }
function __construct($parent, $lifeTime = null, $memoryCache = false, $cacheFolder = null, $group = null) { $cacheFolder = $cacheFolder ? $cacheFolder : org_glizy_Paths::getRealPath('CACHE_CODE'); $this->parent = $parent; $this->memoryCache = $memoryCache; $this->group = $group ? $group : $cacheFolder . get_class($this->parent); $options = array('cacheDir' => $cacheFolder, 'lifeTime' => !$lifeTime ? org_glizy_Config::get('CACHE_CODE') : $lifeTime, 'readControlType' => '', 'fileExtension' => '.php'); if ($options['lifeTime'] == '-1') { $options['lifeTime'] = null; } $this->_cacheObj =& org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFile', $options); }
function __construct($fileName = '', $rootPath = '') { $this->fileName = org_glizy_Paths::getRealPath('APPLICATION_TEMPLATE', $this->pathPrefix . $fileName); $this->rootPath = org_glizy_Paths::get('APPLICATION_TEMPLATE'); $application =& org_glizy_ObjectValues::get('org.glizy', 'application'); $this->currentMenu = $application->getCurrentMenu(); $this->language = $application->getLanguage(); if (!file_exists($this->fileName)) { org_glizy_Exception::show(500, "Template non trovato: " . $this->rootPath . $this->pathPrefix . $fileName, "", ""); exit; } }
function __construct($fileName = '', $defaultHtml = '') { if (!self::$isLibLoaded) { self::$isLibLoaded = true; require_once GLZ_LIBS_DIR . '/Twig/Autoloader.php'; Twig_Autoloader::register(); } parent::__construct($fileName, $defaultHtml); $loader = new Twig_Loader_Filesystem($this->filePath); $this->_templClass = new Twig_Environment($loader, array('cache' => org_glizy_Paths::getRealPath('CACHE'), 'auto_reload' => true, 'debug' => true)); $this->_templClass->addExtension(new Twig_Extension_Debug()); }
function run() { $this->log("Run Rest application", GLZ_LOG_SYSTEM); if (file_exists(org_glizy_Paths::get('APPLICATION_STARTUP'))) { // if the startup folder is defined all files are included glz_require_once_dir(org_glizy_Paths::get('APPLICATION_STARTUP')); } glz_defineBaseHost(); $this->_initRequest(); glz_require_once_dir(org_glizy_Paths::getRealPath('APPLICATION_CLASSES')); $this->_startProcess(); if (file_exists(org_glizy_Paths::get('APPLICATION_SHUTDOWN'))) { // if the shutdown folder is defined all files are included glz_require_once_dir(org_glizy_Paths::get('APPLICATION_SHUTDOWN')); } }
function loadTree($forceReload = false) { if ($forceReload) { $this->init(); } $menu = $this->getEmptyMenu(); $menu['id'] = '__root__'; $this->_siteMapArray[$menu['id']] = $menu; $files = array(); $dir = org_glizy_Paths::getRealPath('APPLICATION_PAGE_TYPE'); if ($dirHandle = @opendir($dir)) { while ($fileName = readdir($dirHandle)) { if ($fileName != '.' && $fileName != '..' && !is_dir($dir . '/' . $fileName) && strstr($fileName, '.xml') !== false) { $files[] = $fileName; } } closedir($dirHandle); } //ordina il risultato alfabeticamente sort($files); // legge la localizzazione dei nomi dei pageType glz_loadLocale($dir); // crea i menù foreach ($files as $f) { $fileName = substr($f, 0, strrpos($f, '.')); $title = __T($fileName); if (empty($title)) { $title = $fileName; } $menu = $this->getEmptyMenu(); $menu['id'] = strtolower($fileName); $menu['parentId'] = $this->_searchParent($menu['id']); $menu['pageType'] = $fileName; $menu['title'] = $title; $menu['type'] = substr($fileName, 0, 1) == '_' ? 'SYSTEM' : 'PAGE'; $this->_siteMapArray[$menu['id']] = $menu; } $this->_makeChilds(); }
function __construct($fileName = '', $defaultHtml = '') { $this->filePath = org_glizy_Paths::getRealPath('APPLICATION_TEMPLATE', 'skins'); if (!empty($this->filePath)) { $this->filePath .= '/'; } if (!empty($defaultHtml)) { $compiler = org_glizy_ObjectFactory::createObject('org.glizy.compilers.Skin'); $compiledFileName = $compiler->verify($this->filePath . $fileName, array('defaultHtml' => $defaultHtml)); $this->fileName = basename($compiledFileName); $this->filePath = dirname($compiledFileName) . '/'; } else { if (org_glizy_ObjectValues::get('org.glizy.application', 'pdfMode')) { // check if is available a pdf skin $pdfFilePath = preg_replace('/\\/skins\\/$/', '/skins-pdf/', $this->filePath); if (file_exists($pdfFilePath . $fileName)) { $this->filePath = $pdfFilePath; } else { $pdfFilePath = org_glizy_Paths::getRealPath('APPLICATION_TEMPLATE_DEFAULT', 'skins-pdf') . '/'; if (file_exists($pdfFilePath . $fileName)) { $this->filePath = $pdfFilePath; } } } if (file_exists($fileName)) { $this->filePath = ''; } else { if (!file_exists($this->filePath . $fileName)) { $this->filePath = org_glizy_Paths::getRealPath('APPLICATION_TEMPLATE_DEFAULT', 'skins') . '/'; } else { if (!file_exists($this->filePath . $fileName) && file_exists(org_glizy_Paths::getRealPath('APPLICATION', 'skins') . '/' . $fileName)) { $this->filePath = org_glizy_Paths::getRealPath('APPLICATION', 'skins') . '/'; } } } $this->fileName = $fileName; } }
function apply(&$regionContent) { $this->checkRequiredValues($regionContent); $templateSource = @implode('', file($this->fileName)); $templateSource = $this->fixUrl($templateSource); $compiler = org_glizy_ObjectFactory::createObject('org.glizy.compilers.Skin'); $compiledFileName = $compiler->verify($this->fileName, array('defaultHtml' => $templateSource)); $pathInfo = pathinfo($compiledFileName); $templClass = new PHPTAL($pathInfo['basename'], $pathInfo['dirname'], org_glizy_Paths::getRealPath('CACHE_CODE')); foreach ($regionContent as $region => $content) { $templClass->set($region, $content); } $res = $templClass->execute(); if (PEAR::isError($res)) { $templateSource = $res->toString() . "\n"; } else { $templateSource = $res; } if (isset($regionContent['__body__'])) { $templateSource = $this->modifyBodyTag($regionContent['__body__'], $templateSource); } $templateSource = $this->fixLanguages($templateSource); return $templateSource; }
function _compile() { $configArray =& org_glizy_Routing::_getValuesArray(); // compila il file di routing custom $fileName = org_glizy_Paths::getRealPath('APPLICATION', 'config/routing_custom.xml'); if (file_exists($fileName)) { $compiler = org_glizy_ObjectFactory::createObject('org.glizy.compilers.Routing'); $compiledFileName = $compiler->verify($fileName); include $compiledFileName; } // compila il file di routing $fileName = org_glizy_Paths::getRealPath('APPLICATION', 'config/routing.xml'); if (file_exists($fileName)) { $compiler = org_glizy_ObjectFactory::createObject('org.glizy.compilers.Routing'); $compiledFileName = $compiler->verify($fileName); include $compiledFileName; } }
/** * @param org_glizy_application_Application $application * @param string $pageType * @param string $path * @param array $options * * @return mixed */ static function &createPage(&$application, $pageType, $path = NULL, $options = NULL) { $pageType = org_glizy_ObjectFactory::resolvePageType($pageType); $options['pageType'] = $pageType . '.xml'; $options['path'] = is_null($path) ? org_glizy_Paths::getRealPath('APPLICATION_PAGE_TYPE') : $path; $fileName = $options['path'] . $options['pageType']; if (isset($options['pathTemplate']) && isset($options['mode'])) { $verifyFileName = $options['pathTemplate'] . '/pageTypes/' . $options['pageType']; if (file_exists($verifyFileName)) { $options['verifyFileName'] = $verifyFileName; } } if (!file_exists($fileName)) { $fileName = glz_findClassPath($pageType); if (is_null($fileName)) { // TODO: file non trovato visualizzare errore } } // TODO // controllare l'esistenza del file $compiler = org_glizy_ObjectFactory::createObject('org.glizy.compilers.PageType'); $compiledFileName = $compiler->verify($fileName, $options); // TODO verificare se la pagina è stata compilata require_once $compiledFileName; $idPrefix = isset($options['idPrefix']) ? $options['idPrefix'] : ''; $className = glz_basename($compiledFileName); $newObj = new $className($application, isset($options['skipImport']) ? $options['skipImport'] : false, $idPrefix); return $newObj; }
function __construct($source = NULL) { parent::__construct(); $this->_source = is_null($source) ? org_glizy_Paths::getRealPath('APPLICATION', org_glizy_Config::get('SITEMAP')) : $source; }
private function resizeImage_im($cacheFileName, $width, $height, $crop = false, $cropOffset = 1, $forceSize = false, $usePiramidalSizes = true, $resize = true) { if (file_exists($this->getFileName())) { $originalSizes = $this->getOriginalSizes(); $finalSizes = $this->resizeImageGetFinalSizes($width, $height, $crop, $cropOffset, $forceSize); $filename = utf8_encode(realpath($this->getFileName())); $cacheFileName = str_replace(__Paths::get('CACHE'), org_glizy_Paths::getRealPath('CACHE'), $cacheFileName); $thumb = new Imagick(); $thumb->readImage($this->getFileName()); if ($resize) { $thumb->resizeImage($finalSizes['width'], $finalSizes['height'], Imagick::FILTER_LANCZOS, 1); if ($crop) { $thumb->cropImage($width, $height, -$finalSizes['cropX'], -$finalSizes['cropY']); } $thumb->setImageCompressionQuality(org_glizy_Config::get('JPG_COMPRESSION')); $thumb->stripImage(); } if ($this->watermark) { $this->insertWatermark($thumb, $crop ? $width : $finalSizes['width'], $crop ? $height : $finalSizes['height'], 'Imagick', false); } $thumb->writeImage($cacheFileName); $thumb->clear(); $thumb->destroy(); @touch($cacheFileName, filemtime($this->getFileName())); @chmod($cacheFileName, 0777); $retInfo = array('imageType' => IMG_JPG, 'fileName' => $cacheFileName, 'width' => $crop ? $width : $finalSizes['width'], 'height' => $crop ? $height : $finalSizes['height'], 'originalWidth' => $originalSizes['width'], 'originalHeight' => $originalSizes['height']); } else { $fileName = org_glizy_Assets::get('ICON_MEDIA_IMAGE'); list($width, $height, $imagetypes) = getImageSize($fileName); $retInfo = array('imageType' => IMG_GIF, 'fileName' => $fileName, 'width' => $width, 'height' => $height, 'originalWidth' => $width, 'originalHeight' => $height); } return $retInfo; }
<?php /** * This file is part of the GLIZY framework. * Copyright (c) 2005-2012 Daniele Ugoletti <*****@*****.**> * * For the full copyright and license information, please view the COPYRIGHT.txt * file that was distributed with this source code. */ define('K_PATH_CACHE', org_glizy_Paths::getRealPath('CACHE')); define('K_PATH_URL_CACHE', org_glizy_Paths::getRealPath('CACHE')); define('K_PATH_IMAGES', org_glizy_Paths::getRealPath('APPLICATION_TEMPLATE')); glz_importApplicationLib('tcpdf/tcpdf.php'); glz_importApplicationLib('tcpdf/config/lang/eng.php'); class org_glizy_template_layoutManager_PDF extends org_glizy_template_layoutManager_PHP { private $pageUrl; private $pageTitle; function __construct($fileName = '', $rootPath = '') { parent::__construct('pdf.php', $rootPath); $this->pageUrl = GLZ_HOST . "/index.php?" . __Request::get('__url__'); $this->pageUrl = str_replace('&printPdf=1', '', $this->pageUrl); $this->pageTitle = $this->currentMenu->title; } function apply(&$regionContent) { $templateSource = parent::apply($regionContent); $xml = new SimpleXMLElement(utf8_encode($templateSource)); // TCPDF stuff: // create new PDF document
function invalidateAcl() { $fileName = org_glizy_Paths::getRealPath('APPLICATION', 'config/acl.xml'); $compiler = org_glizy_ObjectFactory::createObject('org.glizy.compilers.Acl'); $compiler->invalidate($fileName); }