Example #1
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 #2
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 #3
0
/**
 * @param        $classPath
 * @param array  $classToReadFirst
 * @param string $path
 *
 * @return bool
 */
function glz_import($classPath, $classToReadFirst = array(), $path = '')
{
    static $loadedClass = array();
    $classPath = str_replace('.', '/', $classPath);
    $classPath = rtrim($classPath, '*');
    $origClassPath = $classPath;
    if (in_array($classPath, $loadedClass)) {
        return true;
    }
    if (empty($path)) {
        if (class_exists('org_glizy_Paths') && !is_null(org_glizy_Paths::get('APPLICATION_CLASSES'))) {
            $path = NULL;
            $searchPath = org_glizy_Paths::getClassSearchPath();
            foreach ($searchPath as $p) {
                $path = $p . $classPath;
                if (file_exists($p . $classPath) || file_exists($p . $classPath . '.php')) {
                    $path = $p;
                    break;
                }
            }
            if (is_null($path)) {
                // TODO
                // visualizzare errore
                echo "errore";
            }
        } else {
            $path = realpath(dirname(__FILE__)) . '/classes/';
        }
    }
    if (substr($classPath, -1, 1) == '/' || $classPath == '') {
        // import all file in the folder
        $classPath = rtrim($classPath, '/');
        glz_require_once_dir($path . $classPath, $classToReadFirst);
        glz_loadLocale($classPath);
    } else {
        // import a single file
        if (file_exists($path . $classPath . '.php')) {
            require_once $path . $classPath . '.php';
        } else {
            return false;
        }
    }
    $loadedClass[] = $origClassPath;
    return true;
}
Example #4
0
 function runSoft()
 {
     $this->log("Run application (soft mode)", 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->_initSiteMap();
     $this->_initRequest();
     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'));
     }
 }