示例#1
0
 function addComponentsToEdit($menu)
 {
     $templatePath = org_glizycms_Glizycms::getSiteTemplatePath();
     $originalRootComponent =& $this->_application->getRootComponent();
     $originalChildren = $this->childComponents;
     $this->childComponents = array();
     $this->addDefaultComponents($menu);
     $this->_pageTypeObj =& org_glizy_ObjectFactory::createPage($this->_application, $menu->menu_pageType, org_glizy_Paths::get('APPLICATION_TO_ADMIN_PAGETYPE'), array('idPrefix' => $this->getId() . '-', 'skipImport' => true, 'pathTemplate' => $templatePath, 'mode' => 'edit'));
     $rootComponent =& $this->_application->getRootComponent();
     $rootComponent->init();
     $this->_application->_rootComponent =& $originalRootComponent;
     $editComponents = $rootComponent->getAttribute('adm:editComponents');
     $this->allowBlocks = $rootComponent->getAttribute('allowBlocks');
     if (count($editComponents)) {
         foreach ($editComponents as $id) {
             $component =& $rootComponent->getComponentById($this->getId() . '-' . $id);
             if (!is_object($component)) {
                 continue;
             }
             $component->remapAttributes($this->getId() . '-');
             $this->addChild($component);
             $component->_parent =& $this;
             $component->setAttribute('visible', true);
         }
     } else {
         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->childComponents = array_merge($this->childComponents, $originalChildren);
 }
示例#2
0
 function _setOutputFilter()
 {
     $filterName = $this->getAttribute('filter');
     $tag = $this->getAttribute('tag');
     // risovle il nome della classe
     if (file_exists(org_glizy_Paths::get('CORE_CLASSES') . 'org/glizy/filters/' . $filterName . '.php')) {
         $filterName = 'org.glizy.filters.' . $filterName;
         glz_import($filterName);
     } else {
         glz_import($filterName);
     }
     $className = str_replace('.', '_', $filterName);
     if (class_exists($className)) {
         // aggiunge il filtro per essere processato
         if ($this->getAttribute('mode') == 'PRE') {
             $outputFilters =& org_glizy_ObjectValues::get('org.glizy:components.Component', 'OutputFilter.pre');
         } else {
             $outputFilters =& org_glizy_ObjectValues::get('org.glizy:components.Component', 'OutputFilter.post');
         }
         if (!isset($outputFilters[$tag])) {
             $outputFilters[$tag] = array();
         }
         $outputFilters[$tag][] = $className;
     }
 }
示例#3
0
文件: CSS.php 项目: GruppoMeta/Movio
 private function includeFolder($folder)
 {
     // controlla se il file in cache è valido
     $options = array('cacheDir' => org_glizy_Paths::get('CACHE_CODE'), 'lifeTime' => org_glizy_Config::get('CACHE_CODE'), 'readControlType' => '', 'fileExtension' => '.css');
     $cacheSignature = get_class($this) . $folder;
     $cacheObj = org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFile', $options);
     $cssFileName = $cacheObj->verify($cacheSignature);
     if ($cssFileName === false) {
         $cssFile = '';
         if ($dir_handle = @opendir($folder)) {
             while ($file_name = readdir($dir_handle)) {
                 if ($file_name != "." && $file_name != ".." && !is_dir("{$dir}/{$file_name}")) {
                     $f[] = $file_name;
                 }
             }
             sort($f);
             closedir($dir_handle);
             foreach ($f as $element) {
                 $cssCode = file_get_contents($folder . '/' . $element);
                 $cssFile .= $cssCode . "\n";
             }
         }
         if (__Config::get('DEBUG') !== false) {
             $cacheObj->save($cssFile, NULL, get_class($this));
         } else {
             $cacheObj->save($cssFile, NULL, $cacheSignature);
         }
         $cssFileName = $cacheObj->getFileName();
     }
     return $cssFileName;
 }
示例#4
0
 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;
     }
 }
示例#5
0
 public function init()
 {
     $options = array('cacheDir' => org_glizy_Paths::get('CACHE_CODE'), 'lifeTime' => -1, 'readControlType' => '', 'fileExtension' => '.php');
     $cacheObj =& org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFile', $options);
     $cacheFileName = $cacheObj->verify(get_class($this));
     if ($cacheFileName === false) {
         $this->rebuildLocale();
         $cacheObj->save(serialize($this->locale), NULL, get_class($this));
         $cacheObj->getFileName();
     } else {
         $this->locale = unserialize(file_get_contents($cacheFileName));
     }
 }
示例#6
0
 public function __construct()
 {
     $this->source = __Paths::get('APPLICATION_TO_ADMIN') . 'config/fieldTypes.xml';
     $options = array('cacheDir' => org_glizy_Paths::get('CACHE_CODE'), 'lifeTime' => -1, 'readControlType' => '', 'fileExtension' => '.php');
     $cacheObj =& org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFile', $options);
     $cacheFileName = $cacheObj->verify($this->source, get_class($this));
     if ($cacheFileName === false) {
         $this->loadXml();
         $cacheObj->save(serialize($this->typeMap), NULL, get_class($this));
         $cacheObj->getFileName();
     } else {
         $this->typeMap = unserialize(file_get_contents($cacheFileName));
     }
 }
示例#7
0
 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'));
     }
 }
示例#8
0
 protected function copyFileInArchive($action, $filePath, $originalFileName, $fileType)
 {
     $file_destname = md5(time()) . "_" . $originalFileName;
     $destinationFolder = org_glizy_Paths::get('APPLICATION_MEDIA_ARCHIVE') . ucfirst(strtolower($fileType));
     $fileDestinationPath = $destinationFolder . '/' . $file_destname;
     // verifica che la cartella di destinazione sia scrivibile
     if (!is_writeable($destinationFolder)) {
         return array('status' => false, 'errors' => array('Rendere scrivibile la cartella ' . $destinationFolder));
     }
     if ($action == self::MOVE_TO_CMS) {
         rename($filePath, $fileDestinationPath);
     } else {
         if ($action == self::COPY_TO_CMS) {
             copy($filePath, $fileDestinationPath);
         }
     }
     return array('status' => true, 'destName' => $file_destname, 'destPath' => $fileDestinationPath);
 }
示例#9
0
 protected function getEditForm($pageId, $formId = 'editForm', $formAction = 'edit')
 {
     $oldAction = __Request::get('action');
     __Request::set('action', $formAction);
     $application = org_glizy_ObjectValues::get('org.glizy', 'application');
     $originalRootComponent = $application->getRootComponent();
     $siteMap = $application->getSiteMap();
     $siteMapNode = $siteMap->getNodeById($pageId);
     $pageType = $siteMapNode->getAttribute('pageType');
     $path = org_glizy_Paths::get('APPLICATION_PAGETYPE');
     $templatePath = org_glizycms_Glizycms::getSiteTemplatePath();
     $options = array('skipImport' => true, 'pathTemplate' => $templatePath, 'mode' => 'edit');
     $pageTypeObj =& org_glizy_ObjectFactory::createPage($application, $pageType, $path, $options);
     $rootComponent = $application->getRootComponent();
     $rootComponent->init();
     $application->_rootComponent =& $originalRootComponent;
     __Request::set('action', $oldAction);
     return $rootComponent->getComponentById($formId);
 }
示例#10
0
 function loadTree($forceReload = false)
 {
     if ($forceReload) {
         $this->init();
     }
     $application =& org_glizy_ObjectValues::get('org.glizy', 'application');
     $lang = $application->getLanguage();
     $options = array('cacheDir' => org_glizy_Paths::get('CACHE_CODE'), 'lifeTime' => -1, 'readControlType' => '', 'fileExtension' => '.php');
     $cacheObj =& org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFile', $options);
     $cacheFileName = $cacheObj->verify($this->_source, get_class($this) . '_' . $application->getLanguage());
     if ($cacheFileName === false) {
         $this->_processSiteMapXML($this->_source);
         $customSource = preg_replace('/.xml$/i', '_custom.xml', $this->_source);
         if (file_exists($customSource)) {
             $this->_processSiteMapXML($customSource);
         }
         $cacheObj->save(serialize($this->_siteMapArray), NULL, get_class($this) . '_' . $application->getLanguage());
         $cacheObj->getFileName();
     } else {
         $this->_siteMapArray = unserialize(file_get_contents($cacheFileName));
     }
     $this->_makeChilds();
 }
示例#11
0
<?php

if (!defined('GLZ_LOADED')) {
    require_once 'core/core.inc.php';
    $application = org_glizy_ObjectFactory::createObject('org.glizycms.core.application.Application', 'application');
    org_glizy_Paths::addClassSearchPath('admin/application/classes/');
    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'));
    }
}
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : NULL;
$w = isset($_REQUEST['w']) ? intval($_REQUEST['w']) : NULL;
$h = isset($_REQUEST['h']) ? intval($_REQUEST['h']) : NULL;
$force = isset($_REQUEST['f']) ? $_REQUEST['f'] == 'true' || $_REQUEST['f'] == '1' : false;
$crop = isset($_REQUEST['c']) ? $_REQUEST['c'] == 'true' || $_REQUEST['c'] == '1' : false;
$useThumbnail = isset($_REQUEST['t']) ? $_REQUEST['t'] == 'true' || $_REQUEST['t'] == '1' : false;
$cropOffset = isset($_REQUEST['co']) ? $_REQUEST['co'] : 0;
if (is_null($id)) {
    exit;
}
glz_import('org.glizycms.mediaArchive.MediaManager');
$media = org_glizycms_mediaArchive_MediaManager::getMediaById($id);
if ($useThumbnail && !empty($media->ar->media_thumbFileName)) {
    $media->ar->media_fileName = $media->ar->media_thumbFileName;
    $media->ar->media_type = 'IMAGE';
    $media = org_glizycms_mediaArchive_MediaManager::getMediaByRecord($media->ar);
}
if (!is_null($w) && !is_null($h)) {
    //resize the image
    if ($media->type != 'IMAGE') {
示例#12
0
 function &getSkinClass()
 {
     $skin =& $this->getSkin();
     $skinFileName = NULL;
     $skinDefaultHtml = NULL;
     $skinType = __Config::get('DEFAULT_SKIN_TYPE');
     if (empty($skin)) {
         $skinFileName = str_replace(":", "", $this->_parent->_tagname);
         $skinType = "PHPTAL";
         $skinDefaultHtml = $this->getDefaultSkin();
     } else {
         if (is_object($skin)) {
             $skinType = $skin->getAttribute('skinType');
             if (empty($skinType)) {
                 $skinType = __Config::get('DEFAULT_SKIN_TYPE');
             }
             $skinFileName = $this->_parent->_application->getPageId() . '_' . $skin->getId();
             $skinDefaultHtml = $skin->getTemplateString();
         } else {
             $skin = explode(':', $skin);
             if (count($skin) > 1) {
                 $skinType = strtoupper($skin[0]);
                 $skinFileName = $skin[1];
             } else {
                 if (strpos($skin[0], '/') === false) {
                     $skinFileName = $skin[0];
                 } else {
                     $skin = explode('/', $skin[0]);
                     $skin[0] = str_replace('.', '/', $skin[0]);
                     $skinFileName = org_glizy_Paths::get('APPLICATION_CLASSES') . implode('/', $skin);
                 }
             }
         }
     }
     $skinClass = org_glizy_ObjectFactory::createObject('org.glizy.template.skin.' . strtoupper($skinType), $skinFileName, $skinDefaultHtml);
     return $skinClass;
 }
示例#13
0
 private function includeFolder($folder)
 {
     // controlla se il file in cache è valido
     $options = array('cacheDir' => org_glizy_Paths::get('CACHE_JS'), 'lifeTime' => org_glizy_Config::get('CACHE_CODE'), 'readControlType' => '', 'fileExtension' => '.js');
     $cacheSignature = get_class($this) . $folder;
     $cacheObj = org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFile', $options);
     $jsFileName = $cacheObj->verify($cacheSignature);
     if ($jsFileName === false) {
         $jsFile = '';
         $folder = glz_findClassPath($folder);
         $extension = $this->getAttribute('extension');
         foreach (glob($folder . '/*' . $extension) as $file) {
             // $file = pathinfo($file);
             // $file = str_replace('_', '.', $file['filename']);
             // $availableModules[] = $file;
             // $f[] = $file;
             $jsCode = file_get_contents($file);
             $jsCode = $this->replaceLocale($jsCode);
             $jsFile .= $jsCode . "\n";
         }
         if (__Config::get('DEBUG') || $this->getAttribute('inline')) {
             $cacheObj->save($jsFile, NULL, get_class($this));
         } else {
             require_once org_glizy_Paths::get('CORE_LIBS') . '/jsmin/jsmin.php';
             $cacheObj->save(JSMin::minify($jsFile), NULL, $cacheSignature);
         }
         $jsFileName = $cacheObj->getFileName();
     }
     return $jsFileName;
 }
示例#14
0
 function init()
 {
     $basePath = org_glizy_Paths::get('CORE') . 'static/images/';
     $pathsArray =& org_glizy_Assets::_getPathsArray(true);
     $pathsArray['ICON_ADD'] = $basePath . 'icon_add.gif';
     $pathsArray['ICON_ADD_OFF'] = $basePath . 'icon_add_off.gif';
     $pathsArray['ICON_CHECKED'] = $basePath . 'icon_checked.gif';
     $pathsArray['ICON_CHECKED_OFF'] = $basePath . 'icon_checked_off.gif';
     $pathsArray['ICON_DELETE'] = $basePath . 'icon_delete.gif';
     $pathsArray['ICON_DELETE_OFF'] = $basePath . 'icon_delete_off.gif';
     $pathsArray['ICON_DOWN'] = $basePath . 'icon_down.gif';
     $pathsArray['ICON_DOWN_OFF'] = $basePath . 'icon_down_off.gif';
     $pathsArray['ICON_DOWNLOAD'] = $basePath . 'icon_download.gif';
     $pathsArray['ICON_DOWNLOAD_OFF'] = $basePath . 'icon_download_off.gif';
     $pathsArray['ICON_EDIT'] = $basePath . 'icon_edit.gif';
     $pathsArray['ICON_EDIT_OFF'] = $basePath . 'icon_edit_off.gif';
     $pathsArray['ICON_EDITDRAFT'] = $basePath . 'icon_editDraft.gif';
     $pathsArray['ICON_EDITDRAFT_OFF'] = $basePath . 'icon_editDraft_off.gif';
     $pathsArray['ICON_INVISIBLE'] = $basePath . 'icon_invisible.gif';
     $pathsArray['ICON_INVISIBLE_OFF'] = $basePath . 'icon_invisible_off.gif';
     $pathsArray['ICON_NEW'] = $basePath . 'icon_add.gif';
     $pathsArray['ICON_NEW_OFF'] = $basePath . 'icon_add_off.gif';
     $pathsArray['ICON_ORDER_UP'] = $basePath . 'icon_orderUp.gif';
     $pathsArray['ICON_ORDER_DOWN'] = $basePath . 'icon_orderDown.gif';
     $pathsArray['ICON_ORDER_UPBLACK'] = $basePath . 'icon_orderUpBlack.gif';
     $pathsArray['ICON_ORDER_DOWNBLACK'] = $basePath . 'icon_orderDownBlack.gif';
     $pathsArray['ICON_PREVIEW'] = $basePath . 'icon_preview.gif';
     $pathsArray['ICON_PREVIEW_OFF'] = $basePath . 'icon_preview_off.gif';
     $pathsArray['ICON_PUBLISH'] = $basePath . 'icon_publish.gif';
     $pathsArray['ICON_PUBLISH_OFF'] = $basePath . 'icon_publish_off.gif';
     $pathsArray['ICON_UP'] = $basePath . 'icon_up.gif';
     $pathsArray['ICON_UP_OFF'] = $basePath . 'icon_up_off.gif';
     $pathsArray['ICON_UNCHECKED'] = $basePath . 'icon_unchecked.gif';
     $pathsArray['ICON_UNCHECKED_OFF'] = $basePath . 'icon_unchecked_off.gif';
     $pathsArray['ICON_UNPUBLISH'] = $basePath . 'icon_unpublish.gif';
     $pathsArray['ICON_UNPUBLISH_OFF'] = $basePath . 'icon_unpublish_off.gif';
     $pathsArray['ICON_VISIBLE'] = $basePath . 'icon_visible.gif';
     $pathsArray['ICON_VISIBLE_OFF'] = $basePath . 'icon_visible_off.gif';
     $pathsArray['ICON_MEDIA_IMAGE'] = $basePath . 'mediaImage.png';
     $pathsArray['ICON_MEDIA_OFFICE'] = $basePath . 'mediaOffice.png';
     $pathsArray['ICON_MEDIA_PDF'] = $basePath . 'mediaPdf.png';
     $pathsArray['ICON_MEDIA_AUDIO'] = $basePath . 'mediaAudio.png';
     $pathsArray['ICON_MEDIA_ARCHIVE'] = $basePath . 'mediaArchive.png';
     $pathsArray['ICON_MEDIA_FLASH'] = $basePath . 'mediaFlash.png';
     $pathsArray['ICON_MEDIA_VIDEO'] = $basePath . 'mediaVideo.png';
     $pathsArray['ICON_MEDIA_OTHER'] = $basePath . 'mediaOther.png';
     $pathsArray['ICON_LOCK'] = $basePath . 'icon_lock.gif';
     $pathsArray['ICON_LOCK_OFF'] = $basePath . 'icon_lock_off.gif';
     $pathsArray['ICON_GO'] = $basePath . 'icon_go.gif';
     $pathsArray['ICON_GO_OFF'] = $basePath . 'icon_go_off.gif';
     $pathsArray['ICON_DOCUMENT'] = $basePath . 'icon_document.gif';
     $pathsArray['ICON_FOLDER'] = $basePath . 'icon_folder.gif';
     $pathsArray['ICON_REENABLE'] = $basePath . 'icon_folder.gif';
     $pathsArray['ICON_OPEN'] = $basePath . 'icon_open.gif';
     $pathsArray['ICON_COD_START'] = $basePath . 'icon_cod_start.png';
     $pathsArray['ICON_COD_ALERT'] = $basePath . 'icon_cod_alert.png';
     $pathsArray['ICON_COD_STOP'] = $basePath . 'icon_cod_stop.png';
     $pathsArray['ICON_COD_WAIT'] = $basePath . 'icon_cod_wait.png';
     $pathsArray['ICON_USER'] = $basePath . 'icon_user.png';
     $pathsArray['ICON_USER_RED'] = $basePath . 'icon_user_red.png';
     $pathsArray['ICON_USER_GREEN'] = $basePath . 'icon_user_green.png';
     $pathsArray['ICON_USER_ALERT'] = $basePath . 'icon_user_alert.png';
     $pathsArray['ICON_USER_DENY'] = $basePath . 'icon_user_deny.gif';
     $pathsArray['ICON_WHEEL'] = $basePath . 'wheel.gif';
     $pathsArray['ICON_RELOAD'] = $basePath . 'icon_reload.png';
 }
示例#15
0
文件: CSS.php 项目: GruppoMeta/Movio
 static function linkStaticCSSfile($name)
 {
     $output = '<link rel="stylesheet" type="text/css" media="all" href="' . org_glizy_Paths::get('STATIC_DIR') . $name . '" />';
     return $output;
 }
示例#16
0
 private function setTemplateFolder()
 {
     // read the template name
     $this->_templateName = org_glizy_Registry::get(__Config::get('REGISTRY_TEMPLATE_NAME'), '');
     if (org_glizy_Request::get('template', '') != '') {
         $this->_templateName = org_glizy_Request::get('template', '');
     }
     $browser = strpos($_SERVER['HTTP_USER_AGENT'], "iPhone") || strpos($_SERVER['HTTP_USER_AGENT'], "Android");
     if ($browser == true) {
         if (file_exists(org_glizy_Paths::get('APPLICATION_STATIC') . 'templates/' . $this->_templateName . '-mobile')) {
             $this->_templateName .= '-iPhone';
         } else {
             if (file_exists(org_glizy_Paths::get('APPLICATION_STATIC') . 'templates/mobile')) {
                 $this->_templateName = 'iPhone';
             }
         }
     }
     if (empty($this->_templateName)) {
         $this->_templateName = __Config::get('glizycms.template.default');
     }
     org_glizy_Paths::set('APPLICATION_TEMPLATE', org_glizy_Paths::get('APPLICATION_STATIC') . 'templates/' . $this->_templateName . '/');
     org_glizy_Paths::set('APPLICATION_TEMPLATE_DEFAULT', org_glizy_Paths::get('APPLICATION_STATIC') . 'templates/Default/');
 }
示例#17
0
 private function resolveFileName()
 {
     // gestione mapping delle cartelle
     if (__Config::get('glizycms.mediaArchive.mediaMappingEnabled') && preg_match('/([^:]+):\\/\\/(.+)/', $this->fileName, $m)) {
         $application = org_glizy_ObjectValues::get('org.glizy', 'application');
         if ($application) {
             $mappingService = $application->retrieveProxy('org.glizycms.mediaArchive.services.MediaMappingService');
         } else {
             $mappingService = org_glizy_objectFactory::createObject('org.glizycms.mediaArchive.services.MediaMappingService');
         }
         $targetPath = $mappingService->getMapping($m[1]);
         $this->fileName = $targetPath . '/' . $m[2];
     }
     if (strpos($this->fileName, '/') === false) {
         $file = org_glizy_Paths::get('APPLICATION_MEDIA_ARCHIVE') . ucfirst(strtolower($this->type)) . '/' . $this->fileName;
     } else {
         $file = $this->fileName;
     }
     return $file;
 }
示例#18
0
/**
 * @param $path
 *
 * @return null
 */
function glz_importApplicationLib($path)
{
    if (!class_exists('org_glizy_Paths')) {
        return NULL;
    }
    require_once org_glizy_Paths::get('APPLICATION_LIBS') . $path;
}
示例#19
0
 public function invalidate()
 {
     $this->_cacheObj->clean(org_glizy_Paths::get('CACHE') . get_class($this));
 }
示例#20
0
文件: PDF.php 项目: GruppoMeta/Movio
    function apply(&$regionContent)
    {
        $templateSource = parent::apply($regionContent);
        $xml = new SimpleXMLElement(utf8_encode($templateSource));
        // TCPDF stuff:
        // create new PDF document
        $pdf = new GlizyPDF((string) $xml['orientation'] == 'portrait' ? 'P' : 'L', PDF_UNIT, (string) $xml['size'], true, 'UTF-8', false);
        // set document information
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor(__Config::get('APP_NAME'));
        $pdf->SetTitle($this->currentMenu->title);
        $pdf->SetSubject('');
        $pdf->SetFooterText($this->replacePlaceHolders($xml->footer));
        // set default header data
        $logo = $xml->header['logo'];
        $logoUrl = '' . $logo;
        $logoWidth = 0;
        if (file_exists($logoUrl)) {
            $logo = str_replace(org_glizy_Paths::get('APPLICATION_TEMPLATE'), '', $logo);
            if (strpos($logo, 'application/mediaArchive') !== false) {
                $logo = '../../../../' . $logo;
            }
            $imageSize = getImageSize($logoUrl);
            $logoWidth = $imageSize[0] * ((double) $xml['logoScale'] / 5);
        } else {
            $logo = '';
        }
        $pdf->SetHeaderData($logo, $logoWidth, '', '');
        // set header and footer fonts
        $pdf->setHeaderFont(array((string) $xml->header['font'], '', (int) $xml->header['fontSize']));
        $pdf->setFooterFont(array((string) $xml->footer['font'], '', (int) $xml->footer['fontSize']));
        // set default monospaced font
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        //set margins
        $margin = explode(',', $xml['margin']);
        $marginHeaderFooter = explode(',', $xml['marginHeaderFooter']);
        $pdf->SetMargins($margin[3], $margin[0], $margin[1]);
        $pdf->SetHeaderMargin($marginHeaderFooter[0]);
        $pdf->SetFooterMargin($marginHeaderFooter[1]);
        //set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, $margin[2]);
        //set image scale factor
        $pdf->setImageScale((double) $xml['imageScale']);
        //set some language-dependent strings
        $pdf->setLanguageArray($l);
        // set font
        $pdf->SetFont((string) $xml->content['font'], '', (int) $xml->content['fontSize']);
        // add a page
        $pdf->AddPage();
        $styles = $xml->styles;
        $content = $xml->content;
        $this->fixImages($content, $xml['stripImages']);
        $this->fixHtml($content);
        $html = <<<EOF
<style>
    {$styles}

h1 {
    font-size: 24pt;
    text-decoration: underline;
}
h2 {
    font-size: 20pt;
}
h3 {
    font-size: 15pt;
}
h4 {
    font-size: 10pt;
}
h5 {
    font-size: 10pt;
}
</style>
{$content}
EOF;
        $tags = array('ul' => array(0 => array('h' => '', 'n' => 0), 1 => array('h' => '', 'n' => 0)), 'ol' => array(0 => array('h' => '', 'n' => 0), 1 => array('h' => '', 'n' => 0)), 'dt' => array(0 => array('h' => '', 'n' => 0), 1 => array('h' => '', 'n' => 0)), 'dl' => array(0 => array('h' => '', 'n' => 0), 1 => array('h' => '', 'n' => 0)), 'dd' => array(0 => array('h' => '', 'n' => 0), 1 => array('h' => '', 'n' => 0)), 'div' => array(0 => array('h' => '', 'n' => 0), 1 => array('h' => '', 'n' => 0)), 'p' => array(0 => array('h' => '', 'n' => 1), 1 => array('h' => '', 'n' => 0.5)), 'h2' => array(0 => array('h' => '', 'n' => 1), 1 => array('h' => '', 'n' => 0.5)), 'h3' => array(0 => array('h' => '', 'n' => 1), 1 => array('h' => '', 'n' => 0.5)), 'h4' => array(0 => array('h' => '', 'n' => 1), 1 => array('h' => '', 'n' => 0.5)), 'h5' => array(0 => array('h' => '', 'n' => 0), 1 => array('h' => '', 'n' => 0.5)));
        $pdf->setHtmlVSpace($tags);
        // output the HTML content
        $pdf->writeHTML($html, true, false, true, false, '');
        // reset pointer to the last page
        $pdf->lastPage();
        //Close and output PDF document
        $pdf->Output($this->currentMenu->title . '.pdf', 'I');
        exit;
    }
示例#21
0
 public function exec()
 {
     if (!$this->querySqlToExec) {
         $this->finalizeQuery();
     }
     if (empty($this->unionArray)) {
         if (__Config::get('ACL_ROLES')) {
             $application = org_glizy_ObjectValues::get('org.glizy', 'application');
             $user = $application->getCurrentUser();
             if ($user->id && !$user->acl($application->getPageId(), 'all')) {
                 $this->addAcl();
             }
         }
         try {
             parent::exec();
         } catch (Exception $e) {
             require_once org_glizy_Paths::get('CORE_LIBS') . 'sql-formatter/lib/SqlFormatter.php';
             $trace = $e->getTrace();
             var_dump($trace[0]['args'][0]->errorInfo);
             echo SqlFormatter::format($sql) . '</br></br>';
             var_dump($this->unionArrayParams);
         }
     } else {
         $this->unionArray[] = $this->qb;
         $this->unionArrayParams = array_merge($this->unionArrayParams, $this->qb->getParameters());
         if (!empty($this->unionOrderBy)) {
             list($fieldName, $order) = $this->unionOrderBy;
             if (!$this->ar->getField($fieldName)->isSystemField) {
                 $indexType = $this->ar->getIndexFieldType($fieldName);
                 $documentDetailIdName = $this->ar->getDocumentDetailTableIdName();
                 $documentTableIndexPrefix = $this->ar->getDocumentIndexTablePrefix();
                 $indexAlias = 'orderIndex';
                 $indexTablePrefix = $documentTableIndexPrefix . $indexType;
                 $documentFieldIndexPrefix = $this->ar->getDocumentIndexFieldPrefix();
                 $indexFieldPrefix = $documentFieldIndexPrefix . $indexType;
                 $indexFieldPrefixAlias = $indexAlias . '.' . $indexFieldPrefix;
                 $detailAlias = $this->options['type'] == 'PUBLISHED_DRAFT' ? self::DOCUMENT_DETAIL_TABLE_PUBLISHED_ALIAS : self::DOCUMENT_DETAIL_TABLE_ALIAS;
                 foreach ($this->unionArray as $qb) {
                     $qb->addSelect('orderIndex.*');
                     $qb->join(self::DOCUMENT_TABLE_ALIAS, $indexTablePrefix . '_tbl', 'orderIndex', $this->expr->eq($detailAlias . '.' . $documentDetailIdName, $indexFieldPrefixAlias . '_FK_document_detail_id'));
                     $qb->andWhere($this->expr->eq("{$indexFieldPrefixAlias}_name", ':orderIndex'));
                 }
                 $this->unionArrayParams[":orderIndex"] = $fieldName;
                 $orderSql = "ORDER BY {$indexFieldPrefix}_value";
             } else {
                 $orderSql = "ORDER BY {$fieldName} {$order}";
             }
         }
         $sqlArray = array();
         foreach ($this->unionArray as $qb) {
             if (!$this->siteSet && $this->ar->getSiteField()) {
                 $qb->andWhere($this->expr->eq($this->ar->getSiteField(), ':site'));
                 $this->unionArrayParams[":site"] = $this->ar->getSiteid();
             }
             $sqlArray[] = $qb->getSql();
         }
         $sql = '(' . implode(') UNION (', $sqlArray) . ')';
         if (!empty($this->unionOrderBy)) {
             $sql .= $orderSql;
         }
         try {
             if (__Config::get('QUERY_CACHING') && ($cacheDriver = org_glizy_dataAccessDoctrine_DataAccess::getCache())) {
                 $lifeTime = __Config::get('QUERY_CACHING_LIFETIME');
                 $key = md5($sql);
                 $this->statement = $this->ar->getConnection()->executeQuery($sql, $this->unionArrayParams, array(), new QueryCacheProfile($lifeTime, $key, $cacheDriver));
             } else {
                 $this->statement = $this->ar->getConnection()->executeQuery($sql, $this->unionArrayParams);
             }
         } catch (Exception $e) {
             require_once org_glizy_Paths::get('CORE_LIBS') . 'sql-formatter/lib/SqlFormatter.php';
             $trace = $e->getTrace();
             var_dump($trace[0]['args'][0]->errorInfo);
             echo SqlFormatter::format($sql) . '</br></br>';
             var_dump($this->unionArrayParams);
         }
         $this->resetQuery();
     }
 }
示例#22
0
文件: JS.php 项目: GruppoMeta/Movio
 function getCompressedUrl($url, $compress = NULL)
 {
     $compress = is_null($compress) ? org_glizy_Config::get('JS_COMPRESS') : $compress;
     $url = $compress ? org_glizy_Paths::get('STATIC_DIR') . 'js.php?v=' . org_glizy_Config::get('APP_VERSION') . '&r=' . org_glizy_Paths::get('ROOT') . '&s=' . $url : $url;
     return str_replace('&', '&amp;', $url);
 }
示例#23
0
 function render()
 {
     // TODO: controllo acl
     $name = $this->getId();
     if (!$this->_user->acl($this->_application->getPageId(), 'new')) {
         $output = org_glizy_helpers_Html::hidden($name, $this->_content, array('class' => $this->getAttribute('cssClass')));
     } else {
         $pageTypes = array();
         if ($dh = @opendir(org_glizy_Paths::get('APPLICATION_TO_ADMIN_PAGETYPE'))) {
             // scan the pageType folder
             while ($fileName = readdir($dh)) {
                 // check if the item is a folder
                 if ($fileName != "." && $fileName != ".." && strpos($fileName, '.xml') !== false) {
                     if ($fileName == 'Common.xml') {
                         continue;
                     }
                     $pageTypes[] = preg_replace('/\\.xml/i', '', $fileName);
                 }
             }
             closedir($dh);
             glz_loadLocale(org_glizy_Paths::get('APPLICATION_TO_ADMIN_PAGETYPE'));
         } else {
             // can't open pageTypes folder
             // show the error
             new org_glizy_Exception(array('[%s] %s: %s', $this->getClassName(), GLZ_ERR_NO_PAGETYPE_FOLDER, org_glizy_Paths::get('APPLICATION_TO_ADMIN') . '/pageTypes/'));
         }
         $modules = org_glizy_Modules::getModules();
         foreach ($modules as $moduleVO) {
             if ($moduleVO->pageType) {
                 $pageTypes[] = $moduleVO->pageType;
             }
         }
         $output = '<option value=""></option>';
         $values = array(array($this->getAttribute('emptyValue'), '', 1, array(), 0));
         $modifyMode = $this->getAttribute('modify');
         foreach ($pageTypes as $item) {
             $moduleVO = null;
             foreach ($modules as $m) {
                 if ($m->pageType == $item) {
                     $moduleVO = $m;
                     break;
                 }
             }
             if ($moduleVO) {
                 if (!$moduleVO->show) {
                     continue;
                 }
                 if ($moduleVO->unique && (!$modifyMode || $modifyMode && $item != $this->_content)) {
                     $ar =& org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Menu');
                     $result = $ar->find(array('menu_pageType' => $item));
                     unset($ar);
                     if ($result) {
                         continue;
                     }
                 }
             }
             $pageName = __T($item);
             $output .= '<option value="' . $item . '"' . ($item == $this->_content ? ' selected' : '') . '>' . __T($item) . '</option>';
         }
         $attributes = array();
         $attributes['id'] = $this->getId();
         $attributes['name'] = $this->getOriginalId();
         $attributes['disabled'] = $this->getAttribute('disabled') ? 'disabled' : '';
         $attributes['class'] = $this->getAttribute('required') ? 'required' : '';
         $attributes['class'] .= $this->getAttribute('cssClass') != '' ? ($attributes['class'] != '' ? ' ' : '') . $this->getAttribute('cssClass') : '';
         $output = '<select ' . $this->_renderAttributes($attributes) . '>' . $output . '</select>';
         $cssClassLabel = $this->getAttribute('cssClassLabel');
         $cssClassLabel .= ($cssClassLabel ? ' ' : '') . ($this->getAttribute('required') ? 'required' : '');
         if ($this->getAttribute('wrapLabel')) {
             $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), true, $output, array('class' => $cssClassLabel), false);
             $output = '';
         } else {
             $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), false, '', array('class' => $cssClassLabel), false);
         }
         $this->addOutputCode($this->applyItemTemplate($label, $output));
     }
 }
示例#24
0
 function _compileXmlNode(&$node, $dirPath)
 {
     switch (strtolower($node->nodeName)) {
         case 'glz:import':
         case 'import':
             $appName = isset($_SERVER['GLIZY_APPNAME']) ? $_SERVER['GLIZY_APPNAME'] : '';
             $envName = getenv('GLIZY_SERVER_NAME');
             $serverName = is_null($_SERVER["SERVER_NAME"]) ? $appName ?: $envName ?: 'console' : $_SERVER["SERVER_NAME"];
             $src = str_replace('##HOST##', $serverName, $node->getAttribute('src'));
             if ($src == '##APPLICATION_TO_ADMIN##') {
                 $src = '../../' . org_glizy_Paths::get('APPLICATION_TO_ADMIN') . 'config/';
                 $configName = '';
                 if (isset($_SERVER['GLIZY_APPNAME'])) {
                     $serverName = $_SERVER['GLIZY_APPNAME'];
                     $configName = 'config_' . $serverName . '.xml';
                     if (!file_exists(realpath($dirPath . $src . $configName))) {
                         $configName = '';
                     }
                 }
                 if (!$configName) {
                     $configName = 'config_' . $serverName . '.xml';
                 }
                 if (!file_exists(realpath($dirPath . $src . $configName))) {
                     $configName = 'config.xml';
                 }
                 $src .= $configName;
             }
             $this->_compileXml(realpath($dirPath . $src));
             break;
         case 'glz:param':
         case 'param':
             $name = $node->getAttribute('name');
             $value = $node->hasAttribute('value') ? $node->getAttribute('value') : $node->firstChild->nodeValue;
             $value = str_replace('##ROOT##', org_glizy_Paths::get('ROOT'), $value);
             if ($value == "false") {
                 $value = false;
             } else {
                 if ($value == "true") {
                     $value = true;
                 }
             }
             $this->_config[$name] = $value;
             if (gettype($value) == 'string') {
                 $this->_config[$name] = '\'' . addcslashes($value, '\'') . '\'';
             } else {
                 $this->_config[$name] = $value ? 'true' : 'false';
             }
             break;
         case 'glz:configmode':
         case 'configmode':
             $modeName = $node->getAttribute('name');
             $tempConfig = $this->_config;
             $this->_config = array();
             for ($i = 0; $i < count($node->childNodes); $i++) {
                 $this->_compileXmlNode($node->childNodes[$i], $dirPath);
             }
             $this->_modes .= '$configArray[\'__modes__\'][\'' . $modeName . '\'] = array()' . GLZ_COMPILER_NEWLINE;
             foreach ($this->_config as $name => $value) {
                 $this->_modes .= '$configArray[\'__modes__\'][\'' . $modeName . '\'][\'' . $name . '\'] = ' . $value . GLZ_COMPILER_NEWLINE;
             }
             $this->_config = $tempConfig;
             if ($node->getAttribute('default') == "true") {
                 $this->_modes .= 'org_glizy_Config::setMode(\'' . $modeName . '\')' . GLZ_COMPILER_NEWLINE;
             }
             break;
     }
 }
示例#25
0
 private function invalidate()
 {
     $options = array('cacheDir' => org_glizy_Paths::get('CACHE_CODE'), 'lifeTime' => -1, 'readControlType' => '', 'fileExtension' => '.php');
     $cacheObj =& org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFile', $options);
     $cacheObj->remove($this->source, get_class($this));
 }
示例#26
0
<?php

require_once org_glizy_Paths::get('CORE_LIBS') . 'sql-formatter/lib/SqlFormatter.php';
use Doctrine\DBAL\Connection, Doctrine\DBAL\Query\Expression\CompositeExpression;
class org_glizy_dataAccessDoctrine_logging_EchoSQLLogger extends \Doctrine\DBAL\Logging\EchoSQLLogger
{
    public $start = null;
    /**
     * {@inheritdoc}
     */
    public function startQuery($sql, array $params = null, array $types = null)
    {
        $this->start = microtime(true);
        $replacedSql = $sql;
        if ($params) {
            foreach ($params as $param => $value) {
                $value = is_string($value) ? "'" . $value . "'" : $value;
                $replacedSql = str_replace($param, $value, $replacedSql);
            }
        }
        echo SqlFormatter::format($replacedSql) . '</br></br>';
        parent::startQuery($sql, $params, $types);
    }
    /**
     * {@inheritdoc}
     */
    public function stopQuery()
    {
        echo 'query time: ' . round(microtime(true) - $this->start, 3) . 's </br></br>';
    }
}
示例#27
0
 /**
  * @param string $route
  * @param array  $queryVars
  * @param array  $addParam
  *
  * @return string
  */
 public static function _makeURL_NOSEF($route = '', $queryVars = array(), $addParam = array())
 {
     $queryVars = array_merge($queryVars, $addParam);
     if (!empty($route)) {
         $configArray =& org_glizy_Routing::_getValuesArray();
         /** @var $application org_glizy_application_Application */
         $application =& org_glizy_ObjectValues::get('org.glizy', 'application');
         /** @var org_glizy_application_SiteMap $siteMap */
         $siteMap =& $application->getSiteMap();
         // TODO
         // controllare se il route richiesto esiste.
         //
         // TODO
         // ci sono molte classi che usano lo stesso concetto di memorizzare
         // i dati in un array statico
         // conviene fare una classe base e estendere questa
         //
         $url = $configArray[strtolower($route)]['value'];
         $pageId = 0;
         preg_match_all("|\\{(.*)\\}|U", $url, $match, PREG_PATTERN_ORDER);
         for ($i = 0; $i < count($match[0]); $i++) {
             $value = '';
             $key = '';
             $command = explode('=', $match[1][$i]);
             $key = $command[0];
             switch ($command[0]) {
                 case 'language':
                     $value = isset($queryVars['language']) ? $queryVars['language'] : $application->getLanguage();
                     break;
                 case '*':
                 case 'currentMenu':
                     /** @var $page org_glizy_application_SiteMapNode */
                     $page =& $application->getCurrentMenu();
                     $value = $page->id;
                     $key = 'pageId';
                     break;
                 case 'pageId':
                     // ricerca la pagina da linkare
                     if (count($command) > 1) {
                         if (is_numeric($command[1])) {
                             $page = $siteMap->getNodeById($command[1]);
                         } else {
                             $page = $siteMap->getMenuByPageType($command[1]);
                         }
                         $value = $page->id;
                     } else {
                         $pageId = $queryVars[$command[0]];
                         if (empty($pageId)) {
                             /** @var $page org_glizy_application_SiteMapNode */
                             $page =& $application->getCurrentMenu();
                             $pageId = $page->id;
                             unset($page);
                         }
                         $value = $pageId;
                     }
                     break;
                 case 'pageTitle':
                     continue;
                     break;
                 case 'value':
                 case 'integer':
                     $value = isset($queryVars[$command[1]]) ? $queryVars[$command[1]] : __Request::get($command[1], '');
                     $key = $command[1];
                     break;
                 case 'static':
                     $value = $command[2];
                     $key = $command[1];
                     break;
                 default:
                     $value = $command[1];
                     break;
             }
             if (is_string($value) && $value == "") {
                 continue;
             }
             if (!isset($queryVars[$key])) {
                 $queryVars[$key] = $value;
             }
         }
     }
     $url = '';
     foreach ($queryVars as $k => $v) {
         $url .= (!empty($url) ? '&' : '') . $k . '=' . $v;
     }
     $url = org_glizy_Paths::get('PAGE_INDEX') . '?' . $url;
     return $url;
 }
示例#28
0
 function _verifyCache($width, $height, $crop, $cropOffset, $forceSize)
 {
     $cacheOptions = array('cacheDir' => org_glizy_Paths::get('CACHE_IMAGES'), 'lifeTime' => org_glizy_Config::get('CACHE_IMAGES'), 'readControlType' => '', 'fileExtension' => '.jpg');
     $this->_cacheObj =& org_glizy_ObjectFactory::createObject('org.glizy.cache.CacheFile', $cacheOptions);
     $fileName = $this->getFileName() . $width . '_' . $height . '_' . ($crop ? '1' : '0') . '_' . $cropOffset . '_' . ($forceSize ? '1' : '0') . '_' . ($this->watermark ? '1' : '0');
     return $this->_cacheObj->verify($fileName, get_class($this), false, $this->getFileName());
 }
示例#29
0
    function render_html()
    {
        $tableClass = $this->getAttribute("cssClass");
        $id = $this->getId();
        $ajaxUrl = $this->getAjaxUrl();
        $colSpan = 0;
        $headers = '';
        $aoColumnDefs = array();
        foreach ($this->columns as $column) {
            if ($column['acl']) {
                if (!$this->_user->acl($column['acl']['service'], $column['acl']['action'])) {
                    continue;
                }
            }
            $colSpan++;
            $headers .= '<th';
            if (!$column['visible']) {
                $headers .= ' style="display:none;"';
            }
            if ($column['width']) {
                $headers .= ' width="' . $column['width'] . '%"';
            }
            $headers .= '>' . $column['headerText'] . '</th>';
            $aoColumnDefs[] = array("bSortable" => $column['sortable'], "bSearchable" => $column['searchable'], "aTargets" => array($colSpan - 1), "sType" => "html", "sClass" => $column['cssClass']);
        }
        $aoColumnDefs = json_encode($aoColumnDefs);
        if (!org_glizy_ObjectValues::get('jquery.dataTables', 'add', false)) {
            org_glizy_ObjectValues::set('jquery.dataTables', 'add', true);
            $staticDir = org_glizy_Paths::get('STATIC_DIR');
            $html = '<script type="text/javascript" src="' . $staticDir . '/jquery/datatables/media/js/jquery.dataTables.min.js"></script>';
            $html .= '<script type=""text/javascript" src="' . $staticDir . '/jquery/datatables/media/js/jquery.dataTables.bootstrap.js"></script>';
        }
        $cookieName = 'DataTables_' . __Config::get('SESSION_PREFIX') . $this->getId() . $this->_application->getPageId();
        $sLengthMenu = __T('records per page');
        $sEmptyTable = __T('No record found');
        $sZeroRecords = __T('No record found with current filters');
        $sInfo = __T('Showing _START_ to _END_ of _TOTAL_ entries');
        $sInfoEmpty = __T('Showing 0 to 0 of 0 entries');
        $sInfoFiltered = __T('filtered from _MAX_ total entries');
        $sLoadingRecords = __T('Loading...');
        $sProcessing = __T('Processing...');
        $Search = __T('Search');
        $sFirst = __T('First');
        $sLast = __T('Last');
        $sNext = __T('Next');
        $sPrevious = __T('Previous');
        $JQueryUI = $this->getAttribute('JQueryUI') ? 'true' : 'false';
        $minSearchLenght = $this->getAttribute('minSearchLenght');
        $html .= <<<EOD
        <table class="{$tableClass}" id="{$id}">
            <thead>
                <tr >
                    {$headers}
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td colspan="{$colSpan}" style="text-align: center" class="dataTables_empty">Loading data from server</td>
                </tr>
            </tbody>
        </table>
<script type="text/javascript">

// <![CDATA[
\$( function(){
    var table = \$('#{$id}').dataTable( {
        "sDom": "<'row-fluid filter-row clearfix'<'filter-box'l><'filter-box'f>r>t<'row-fluid clearfix'<'filter-box pull-left'i><'filter-box pull-right'p>>",
        "sPaginationType": "bootstrap",
        "oLanguage": {
            "sLengthMenu": "_MENU_ {$sLengthMenu}",
            "sEmptyTable": "No record found",
            "sZeroRecords": "{$sZeroRecords}",
            "sInfo": "{$sInfo}",
            "sInfoEmpty": "{$sInfoEmpty}",
            "sInfoFiltered": "({$sInfoFiltered})",
            "sLoadingRecords": "{$sLoadingRecords}",
            "sProcessing": "{$sProcessing}",
            "sSearch": "{$Search}:",
            "oPaginate": {
                "sFirst": "{$sFirst}",
                "sLast": "{$sLast}",
                "sNext": "{$sNext}",
                "sPrevious": "{$sPrevious}"
            }
        },
        "bJQueryUI": {$JQueryUI},
        "bServerSide": true,
        "sAjaxSource": "{$ajaxUrl}",
        "aoColumnDefs": {$aoColumnDefs},
        "bStateSave": true,
        "fnStateSave": function (oSettings, oData) {
            localStorage.setItem( "{$cookieName}", JSON.stringify(oData) );
        },
        "fnStateLoad": function (oSettings) {
            return JSON.parse( localStorage.getItem("{$cookieName}") );
        }
    } );

    \$('.dataTables_filter input')
        .unbind()
        .bind('keyup', function(e){
            if (\$(this).val().length > 0 && \$(this).val().length < {$minSearchLenght} && e.keyCode != 13) return;
            table.fnFilter(\$(this).val());
        })

    \$('#{$id}').data('dataTable', table);
});
// ]]>
</script>
EOD;
        $this->addOutputCode($html);
    }
示例#30
0
 /**
  * @param string $serverName
  * @throws Exception
  */
 function _parse($serverName = '')
 {
     // imposta i valori di default
     $configArray =& org_glizy_Config::_getConfigArray();
     $configArray['DEBUG'] = false;
     $configArray['DEBUG_ERROR_LEVEL'] = '';
     $configArray['ERROR_DUMP'] = '';
     $configArray['DATASOURCE_MODE'] = '';
     $configArray['SESSION_PREFIX'] = '';
     $configArray['SESSION_TIMEOUT'] = 1800;
     $configArray['DEFAULT_LANGUAGE'] = 'en';
     $configArray['DEFAULT_LANGUAGE_ID'] = '1';
     $configArray['CHARSET'] = 'utf-8';
     $configArray['DB_LAYER'] = 'pdo';
     $configArray['DB_TYPE'] = 'mysql';
     $configArray['DB_HOST'] = '';
     $configArray['DB_NAME'] = '';
     $configArray['DB_USER'] = '';
     $configArray['DB_PSW'] = '';
     $configArray['DB_MYSQL_BUFFERED_QUERY'] = false;
     $configArray['DB_ATTR_PERSISTENT'] = false;
     $configArray['DB_PREFIX'] = '';
     $configArray['DB_SOCKET'] = '';
     $configArray['SMTP_HOST'] = '';
     $configArray['SMTP_PORT'] = 25;
     $configArray['SMTP_USER'] = '';
     $configArray['SMTP_PSW'] = '';
     $configArray['SMTP_SENDER'] = '';
     $configArray['SMTP_EMAIL'] = '';
     $configArray['START_PAGE'] = 'HOME';
     $configArray['CACHE_IMAGES'] = -1;
     $configArray['CACHE_CODE'] = -1;
     $configArray['CACHE_PAGE'] = -1;
     $configArray['ACL_MODE'] = 'xml';
     $configArray['ACL_CLASS'] = 'org.glizy.application.Acl';
     $configArray['ADM_THUMBNAIL_CROP'] = false;
     $configArray['ADM_THUMBNAIL_CROPPOS'] = 1;
     $configArray['ADM_SITE_MAX_DEPTH'] = NULL;
     $configArray['HIDE_PRIVATE_PAGE'] = true;
     $configArray['APP_NAME'] = '';
     $configArray['APP_VERSION'] = '';
     $configArray['APP_AUTHOR'] = '';
     $configArray['CORE_VERSION'] = GLZ_CORE_VERSION;
     $configArray['SEF_URL'] = false;
     $configArray['PRESERVE_SCRIPT_NAME'] = false;
     $configArray['SITEMAP'] = 'config/siteMap.xml';
     $configArray['REMEMBER_PAGEID'] = false;
     $configArray['PSW_METHOD'] = 'MD5';
     $configArray['USER_LOG'] = false;
     $configArray['JS_COMPRESS'] = false;
     $configArray['JPG_COMPRESSION'] = 80;
     $configArray['THUMB_WIDTH'] = 150;
     $configArray['THUMB_HEIGHT'] = 150;
     $configArray['THUMB_SMALL_WIDTH'] = 50;
     $configArray['THUMB_SMALL_HEIGHT'] = 50;
     $configArray['IMG_LIST_WIDTH'] = 100;
     $configArray['IMG_LIST_HEIGHT'] = 100;
     $configArray['IMG_WIDTH_ZOOM'] = 800;
     $configArray['IMG_HEIGHT_ZOOM'] = 600;
     $configArray['IMG_WIDTH'] = 200;
     $configArray['IMG_HEIGHT'] = 200;
     $configArray['LOG_FILE'] = '';
     $configArray['LOG_LEVEL'] = GLZ_LOG_ALL;
     $configArray['STATIC_FOLDER'] = NULL;
     $configArray['TEMPLATE_FOLDER'] = NULL;
     $configArray['FORM_ITEM_TEMPLATE'] = '<div class="formItem">##FORM_LABEL####FORM_ITEM##<br /></div>';
     $configArray['FORM_ITEM_RIGHT_LABEL_TEMPLATE'] = '<div class="formItemRigthLabel">##FORM_LABEL####FORM_ITEM##<br /></div>';
     $configArray['FORM_ITEM_HIDEN_TEMPLATE'] = '<div class="formItemHidden">##FORM_ITEM##</div>';
     $configArray['SITE_ID'] = NULL;
     $configArray['ALLOW_MODE_OVERRIDE'] = false;
     $configArray['USER_DEFAULT_ACTIVE_STATE'] = 0;
     $configArray['USER_DEFAULT_USERGROUP'] = 4;
     $configArray['MULTILANGUAGE_ENABLED'] = false;
     $configArray['ACL_ENABLED'] = false;
     $configArray['CATEGORY_ENABLED'] = false;
     $configArray['SANITIZE_URL'] = true;
     $configArray['DEFAULT_SKIN_TYPE'] = 'PHPTAL';
     $configArray['AJAX_SKIP_DECODE'] = true;
     $configArray['GLIZY_ADD_CORE_JS'] = true;
     $configArray['GLIZY_ADD_JS_LIB'] = true;
     $configArray['GLIZY_ADD_JQUERY_JS'] = true;
     $configArray['GLIZY_ADD_JQUERYUI_JS'] = false;
     $configArray['GLIZY_ADD_VALIDATE_JS'] = true;
     $configArray['GLIZY_JQUERY'] = 'jquery-1.7.2.min.js';
     $configArray['GLIZY_JQUERYUI'] = 'jquery-ui-1.8.14.custom.min.js';
     $configArray['GLIZY_JQUERYUI_THEME'] = 'ui-lightness/jquery-ui-1.8.14.custom.css';
     $configArray['TINY_MCE_DEF_PLUGINS'] = 'inlinepopups,paste,directionality,xhtmlxtras,fullscreen,GLZ_link,GLZ_image';
     $configArray['TINY_MCE_PLUGINS'] = '';
     $configArray['TINY_MCE_BUTTONS1'] = 'bold,italic,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,outdent,indent,blockquote';
     $configArray['TINY_MCE_BUTTONS2'] = 'formatselect,|,undo,redo,pastetext,pasteword,removeformat,|,link,unlink,anchor,image,hr,charmap,|,code,fullscreen';
     $configArray['TINY_MCE_BUTTONS3'] = '';
     $configArray['TINY_MCE_INTERNAL_LINK'] = true;
     $configArray['BASE_REGISTRY_PATH'] = 'org/glizy';
     $configArray['REGISTRY_TEMPLATE_NAME'] = '{{BASE_REGISTRY_PATH}}/templateName';
     $configArray['REGISTRY_TEMPLATE_VALUES'] = '{{BASE_REGISTRY_PATH}}/templateValues/';
     $configArray['REGISTRY_SITE_PROP'] = '{{BASE_REGISTRY_PATH}}/siteProp/';
     $configArray['REGISTRY_METANAVIGATION'] = '{{BASE_REGISTRY_PATH}}/metanavigation/';
     $configArray['glizy.media.imageMagick'] = false;
     $configArray['glizy.media.image.unsharpMask'] = false;
     $configArray['glizy.routing.newParser'] = true;
     $configArray['glizy.form.cssClass'] = '';
     $configArray['glizy.formElement.cssClass'] = '';
     $configArray['glizy.formElement.cssClassLabel'] = '';
     $configArray['glizy.formElement.admCssClass'] = '';
     $configArray['glizy.formButton.cssClass'] = '';
     $configArray['glizy.datagrid.action.editCssClass'] = 'icon-pencil btn-icon';
     $configArray['glizy.datagrid.action.editDraftCssClass'] = 'icon-edit btn-icon';
     $configArray['glizy.datagrid.action.deleteCssClass'] = 'icon-trash btn-icon';
     $configArray['glizy.datagrid.action.hideCssClass'] = 'icon-eye-close btn-icon';
     $configArray['glizy.datagrid.action.showCssClass'] = 'icon-eye-open btn-icon';
     $configArray['glizy.datagrid.checkbox.on'] = 'icon-check btn-icon';
     $configArray['glizy.datagrid.checkbox.off'] = 'icon-check-empty btn-icon';
     $configArray['glizy.authentication'] = 'org.glizy.authentication.Database';
     $configArray['glizy.dataAccess.schemaManager.cacheLife'] = 36000;
     $configArray['glizy.dataAccess.serializationMode'] = 'json';
     $configArray['glizy.dataAccess.document.enableComment'] = false;
     $configArray['glizy.dataAccess.validate'] = true;
     $configArray['glizy.session.store'] = '';
     if (!$serverName) {
         $configFileName = org_glizy_Paths::get('APPLICATION') . 'config/config.xml';
         $tempName = array(isset($_SERVER['GLIZY_APPNAME']) ? $_SERVER['GLIZY_APPNAME'] : '', getenv('GLIZY_SERVER_NAME'), is_null($_SERVER["SERVER_NAME"]) ? 'console' : $_SERVER["SERVER_NAME"]);
         foreach ($tempName as $serverName) {
             if ($serverName) {
                 $tempConfigFileName = org_glizy_Paths::get('APPLICATION') . 'config/config_' . $serverName . '.xml';
                 if (file_exists($tempConfigFileName)) {
                     $configFileName = $tempConfigFileName;
                     break;
                 }
             }
         }
     } else {
         $configFileName = org_glizy_Paths::get('APPLICATION') . 'config/config_' . $serverName . '.xml';
     }
     if (!file_exists($configFileName)) {
         $configFileName = org_glizy_Paths::get('APPLICATION') . 'config/config.xml';
         if (!file_exists($configFileName)) {
             throw new Exception('Config file not found.');
         }
     }
     /** @var $compiler org_glizy_compilers_Config  */
     $compiler = org_glizy_ObjectFactory::createObject('org.glizy.compilers.Config');
     $compiledConfigFileName = $compiler->verify($configFileName);
     // TODO
     // controllare errore
     include $compiledConfigFileName;
     if (!empty($configArray['STATIC_FOLDER'])) {
         org_glizy_Paths::set('APPLICATION_STATIC', org_glizy_Config::get('STATIC_FOLDER'));
     }
     if (!empty($configArray['TEMPLATE_FOLDER'])) {
         org_glizy_Paths::set('APPLICATION_TEMPLATE', org_glizy_Config::get('TEMPLATE_FOLDER'));
     }
     if ($configArray['ALLOW_MODE_OVERRIDE'] && isset($_GET['mode'])) {
         org_glizy_Config::setMode($_GET['mode']);
     }
     define('GLZ_CHARSET', __Config::get('CHARSET'));
 }