Example #1
0
 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();
 }
Example #2
0
/**
 * 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.
 */
function getImage($applicationPath, $corePath = '')
{
    require_once $corePath . 'core/core.inc.php';
    org_glizy_Paths::init($applicationPath, $corePath);
    org_glizy_Config::init();
    $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;
    if (is_null($id)) {
        exit;
    }
    glz_import('org.glizycms.mediaArchive.MediaManager');
    $media = org_glizycms_mediaArchive_MediaManager::getMediaById($id);
    if ($media->type != 'IMAGE') {
        exit;
    }
    if (!is_null($w) && !is_null($h)) {
        //resize the image
        $mediaInfo = $media->getResizeImage($w, $h, $crop, 0, $force);
    } else {
        // get the full image
        $mediaInfo = $media->getImageInfo();
    }
    $ext = array(IMG_GIF => '.gif', IMG_JPG => '.jpeg', IMG_PNG => '.png', IMG_WBMP => '.wbmp');
    header("location: " . GLZ_HOST . '/' . $mediaInfo['fileName']);
}
Example #3
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;
     }
 }
Example #4
0
 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;
 }
Example #5
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);
 }
Example #6
0
 /**
  * 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();
         }
     }
 }
Example #7
0
 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');
     }
 }
Example #8
0
 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);
 }
Example #9
0
 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();
 }
Example #10
0
 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'));
 }
Example #11
0
 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);
 }
Example #12
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;
     }
 }
Example #13
0
 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());
 }
Example #14
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));
     }
 }
Example #15
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));
     }
 }
Example #16
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'));
     }
 }
Example #17
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);
 }
Example #18
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);
 }
Example #19
0
 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();
 }
Example #20
0
 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;
     }
 }
Example #21
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();
 }
Example #22
0
 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;
 }
Example #23
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);
    }
Example #24
0
<?php

ob_start();
require_once "core/core.inc.php";
$application = org_glizy_ObjectFactory::createObject('org.glizycms.core.application.Application', 'application');
org_glizy_Paths::addClassSearchPath('admin/application/classes/');
$application->runAjax();
Example #25
0
 /**
  * @param $path
  */
 static function addClassSearchPath($path)
 {
     $pathsArray =& org_glizy_Paths::_getPathsArray();
     $pathsArray['SEARCH_PATH'][] = $path;
 }
Example #26
0
 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;
     }
 }
Example #27
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));
 }
Example #28
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;
 }
Example #29
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') {
Example #30
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;
 }