示例#1
0
 /**
  * Returns an array containing the list of modules as key and controllers in a sub array
  * Example:
  * <code>
  * Array
  * (
  *     [admin] => Array
  *         (
  *             [0] => Index
  *             [1] => Jscripts
  *             [2] => Servicesfolder
  *         )
  *
  * </code>
  * @param string $modulesPath
  * @return array
  */
 public function getModulesAndControllersList($introspect = false, $modulesPath = '/core/application/modules/')
 {
     $rdir = Sydney_Tools_Paths::getCorePath() . '/../' . $modulesPath;
     $dirs = array();
     // get the module directory
     if ($handle = opendir($rdir)) {
         while (false !== ($file = readdir($handle))) {
             if (!preg_match('/^\\./', $file)) {
                 $dirs[$file] = array();
                 if ($handle2 = opendir($rdir . $file . '/controllers/')) {
                     while (false !== ($cntrl = readdir($handle2))) {
                         if (!preg_match('/^\\./', $cntrl)) {
                             $cnl = preg_split('/Controller.php/', $cntrl);
                             if (count($cnl) == 2) {
                                 if ($introspect) {
                                     $dirs[$file][$cnl[0]] = $this->introspect($file, $cnl[0], $rdir . $file . '/controllers/' . $cntrl);
                                 } else {
                                     $dirs[$file][] = $cnl[0];
                                 }
                             }
                         }
                     }
                 }
             }
         }
         closedir($handle);
     }
     return $dirs;
 }
示例#2
0
 /**
  * @param $fullpath
  * @param null $cachpath
  * @param null $fdb
  */
 public function __construct($fullpath, $cachpath = null, $fdb = null)
 {
     // AS : 01/01/11 : quick fix for problem path in the DB vs mac sym links impossible to create in /home
     $this->fullpath = preg_replace('/\\/home\\/www\\/sydneyFramework\\/trunk\\/webinstances/', '/www/sydney/webinstances', $fullpath);
     $this->assetsPath = Sydney_Tools_Paths::getCorePath() . '/library/Sydney/Medias/Assets/';
     $this->fdb = $fdb;
     $this->setPath($fullpath, $cachpath);
 }
示例#3
0
 private function setLayoutLoginAdmin()
 {
     $this->view->headLink()->appendStylesheet($this->view->cdn . '/sydneyassets/styles/reset.css');
     $this->view->headLink()->appendStylesheet($this->view->cdn . '/sydneyassets/styles/main.css');
     $this->view->headLink()->appendStylesheet($this->view->cdn . '/sydneyassets/styles/antidot.css');
     $this->view->headLink()->appendStylesheet($this->view->cdn . '/sydneyassets/styles/antidotprint.css', 'print');
     $this->view->headLink()->appendStylesheet('/sydneyassets/jslibs/jquery/css/smoothness/jquery-ui-1.10.4.min.css');
     $this->view->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . '/sydneyassets/scripts/sydneyscripts.js', 'text/javascript');
     $this->_helper->layout->setLayoutPath(Sydney_Tools_Paths::getCorePath() . '/webinstances/sydney/layouts');
     $this->_helper->layout->setLayout('login');
 }
示例#4
0
<?php

include_once Sydney_Tools_Paths::getCorePath() . '/application/modules/adminfiles/controllers/FileController.php';
/**
 * Controller Adminfiles Files
 */
/**
 * Displays the file to the stout (or upload it to the stdout depending on the file).
 * The file is defined according to it's ID.
 *
 * @package Adminfiles
 * @subpackage Controller
 * @author Arnaud Selvais
 * @since 13/08/09
 * @copyright Antidot Inc. / S.A.
 *
 * @todo check the permission of the file here
 */
class Publicms_FileController extends Sydney_Controller_Actionpublic
{
    public function init()
    {
        parent::init();
        $this->loadInstanceViewHelpers();
    }
    /**
     * List of the folders (tags) in an structured array (arborescence)
     * @return void
     */
    public function folderslistAction()
    {
示例#5
0
 public function uploadscreenAction()
 {
     $this->_helper->layout->setLayoutPath(Sydney_Tools_Paths::getCorePath() . '/webinstances/sydney/layouts');
     $this->_helper->layout->setLayout('layoutBlank');
 }
示例#6
0
 /**
  *
  * @param unknown_type $type
  * @param Zend_View $zview
  * @param unknown_type $useCompression
  * @param unknown_type $useConcatenation
  * @param unknown_type $ctrl
  */
 public static function concatScripts($type, Zend_View $zview, $useConcatenation = true)
 {
     $r = '';
     $path = Sydney_Tools_Paths::getCorePath() . '/webinstances/sydney/html';
     $path2 = Sydney_Tools_Paths::getJslibsPath();
     $arrayOrig['jsOrig'] = Zend_Registry::getInstance()->get('config')->admin->js->orig;
     $arrayOrig['cssOrig'] = Zend_Registry::getInstance()->get('config')->admin->css->orig;
     $arrayLibs['jsLibs'] = Zend_Registry::getInstance()->get('config')->admin->js->libs;
     $arrayLibs['cssLibs'] = Zend_Registry::getInstance()->get('config')->admin->css->libs;
     /**
      * CSS + JS
      */
     // adding the main files from the jslibs
     foreach ($arrayLibs[$type . 'Libs'] as $file) {
         if ($useConcatenation) {
             if (file_exists($path2 . $file)) {
                 $tcnt = file_get_contents($path2 . $file);
                 if ($type == 'css' && preg_match('#sydneyassets\\/jslibs\\/jquery#', $file)) {
                     $needleStr = "#url\\(\"images\\/([a-zA-Z0-9_-]+)\\.(png|gif|jpg)\"#";
                     $replaceStr = "url(" . Sydney_Tools_Paths::getRootUrlCdn() . "\\/sydneyassets\\/jslibs\\/jquery\\/css\\/smoothness\\/images\\/\$1.\$2";
                     $tcnt = preg_replace($needleStr, $replaceStr, $tcnt);
                 }
                 if ($type == 'css' && preg_match('/skins\\/sam/', $file)) {
                     $pht = preg_replace("/^\\/assets\\/yui\\/build\\/([A-z]{1,50})\\/assets\\/skins\\/sam\\/([A-z-_]{1,50}(\\.css))/", "/sydneyassets/yui/build/\\1/assets/skins/sam/", $file);
                     $tcnt = str_replace('../../../../assets/skins/sam/', Sydney_Tools::getRootUrlCdn() . '/sydneyassets/yui/build/assets/skins/sam/', $tcnt);
                     $tcnt = preg_replace("/url\\(([A-z0-9_-]{1,50})\\.(png)\\)/", "url(" . $pht . "\\1.\\2)", $tcnt);
                 }
                 $r .= "/* =========== File: " . $path2 . $file . " ================ */ \n\n\n" . $tcnt . "\n\n\n\n";
             }
         } else {
             if ($type == 'css') {
                 $zview->headLink()->appendStylesheet($file);
             } else {
                 // GDE - 19/08/2013 - On va chercher "jslibs" sur le cdn (com.antidot.sydney)
                 $zview->headScript()->appendFile(Zend_Registry::getInstance()->get('config')->general->cdn . $file, 'text/javascript');
             }
         }
     }
     // adding the main files
     foreach ($arrayOrig[$type . 'Orig'] as $file) {
         if ($useConcatenation) {
             $tcnt = file_get_contents($path . $file);
             $r .= "/* =========== File: " . $path . $file . " ================ */ \n\n\n" . $tcnt . "\n\n\n\n";
         } else {
             if ($type == 'css') {
                 $zview->headLink()->appendStylesheet($file);
             } else {
                 $zview->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . $file, 'text/javascript');
             }
         }
     }
     // END Foreach
     /**
      * JS
      */
     if ($type == 'js') {
         // adding the UI files
         $t = self::getDirList($path . '/sydneyassets/scripts/ui/');
         foreach ($t as $file) {
             if ($useConcatenation) {
                 $r .= "/* =========== File: " . $path . '/sydneyassets/scripts/ui/' . $file . " ================ */ \n\n\n" . file_get_contents($path . '/sydneyassets/scripts/ui/' . $file) . "\n\n\n\n";
             } else {
                 $zview->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . '/sydneyassets/scripts/ui/' . $file, 'text/javascript');
             }
         }
         // add the launcher
         $launchFile = '/sydneyassets/scripts/zLauncher.js';
         if ($useConcatenation) {
             $r .= "/* =========== File: " . $path . $launchFile . " ================ */ \n\n\n" . file_get_contents($path . $launchFile) . "\n\n\n\n";
         } else {
             $zview->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . $launchFile, 'text/javascript');
         }
     }
     return $r;
 }
示例#7
0
 /**
  * Auto initialization of important params for sydney
  * @return void
  */
 public function init()
 {
     // register general sydney helpers
     $this->view->addHelperPath(Sydney_Tools_Paths::getCorePath() . '/library/Sydney/View/Helper', 'Sydney_View_Helper');
     $this->_initWebInstanceHelpers();
     // setup the basics
     $this->_registry = Zend_Registry::getInstance();
     $this->_config = $this->_registry->get('config');
     $this->_db = $this->_registry->get('db');
     $this->safinstancesId = $this->_config->db->safinstances_id;
     $this->_translate = $this->_registry->get('Zend_Translate');
     $this->view->translate = $this->_registry->get('Zend_Translate');
     $this->_auth = Sydney_Auth::getInstance();
     // Auto Login if identity and credentials stored in cookie
     $u = $this->getRequest()->getParam('username');
     $p = $this->getRequest()->getParam('password');
     if (!$this->_auth->hasIdentity() && $this->_getParam('action') != 'login' && $this->_getParam('action') != 'logout' && empty($u) && empty($p)) {
         $adapter = Sydney_Auth_Adaptater_DbTable::getAuthAdapter($this->getRequest());
         if ($adapter instanceof Zend_Auth_Adapter_Interface) {
             $auth = Sydney_Auth::getInstance();
             if ($auth->authenticate($adapter)->isValid()) {
                 $this->_helper->redirector->gotoUrl($this->getRequest()->getRequestUri());
                 exit;
             }
         }
     }
     // Init list secured pages
     $this->setAuthPagelist();
     // setup user
     $udata = new Zend_Session_Namespace('userdata');
     if (isset($udata->user)) {
         $this->usersData = $udata->user;
     }
     if (isset($this->usersData['users_id'])) {
         $this->usersId = $this->usersData['users_id'];
     }
     // sets some interesting vars in the view
     $this->view->config = $this->_config;
     $this->view->cdn = $this->_config->general->cdn;
     $this->view->users_data = $this->usersData;
     $this->view->safinstances_id = $this->safinstancesId;
     $this->view->auth = $this->_auth;
     $this->view->siteTitle = $this->_config->general->siteTitle;
     $this->view->printme = $this->_getParam('printme', 'no');
     // @todo TODO change this ...
     $llg = 'en';
     if (isset($this->_config->general->lang) && $this->_config->general->lang != '') {
         $llg = $this->_config->general->lang;
     }
     $this->view->headScript()->appendFile($this->view->cdn . '/sydneyassets/scripts/i18n/' . $llg . '.js', 'text/javascript');
     // setup some layout vars
     if ($this->layout !== null) {
         $this->layout->registry = $this->_registry;
         $this->layout->auth = $this->_auth;
         $this->layout->translate = $this->_registry->get('Zend_Translate');
         $this->layout->avmodules = $this->availableModules;
     }
     $this->view->moduleName = $this->_getParam('module');
     $this->view->controllerName = $this->_getParam('controller');
     $this->view->actionName = $this->_getParam('action');
     // set up the log
     $this->logger = new Sydney_Log();
     $this->logger->setEventItem('className', get_class($this));
     $this->logger->addFilterDatabase();
     if (isset($this->getRequest()->sydneylayout) && $this->getRequest()->sydneylayout == 'no') {
         $this->_helper->layout->disableLayout();
         $this->sydneyLayout = 'no';
     }
     if (isset($this->getRequest()->sydneylayout) && $this->getRequest()->sydneylayout != 'no' && $this->getRequest()->sydneylayout != 'yes') {
         $this->_helper->layout->setLayout('layout-' . $this->getRequest()->sydneylayout);
     }
     $this->view->sydneylayout = $this->sydneyLayout;
     /**
      * load structure if not exist
      */
     if (!is_array($this->view->structure) && $this->getRequest()->layout != 'no') {
         $this->structure = new Pagstructure();
         $this->view->adminmode = false;
         // if identified then get structure from database
         if (Sydney_Auth::getInstance()->hasIdentity()) {
             $this->structure->setFilter('status', 'published');
             $this->view->structure = $this->structure->toArray($this->safinstancesId);
         } else {
             // else use structure cached or build cache
             $cache = Zend_Registry::get('cache');
             $cn = PagstructureOp::getCacheNames($this->safinstancesId);
             $this->view->structure = $cache->load($cn[0]);
             //cn[0] > cachename
             $this->structure->stringNodes = $cache->load($cn[1]);
             //cn[1] > cachename2
             if (!is_array($this->view->structure)) {
                 $this->structure->setFilter('status', 'published');
                 $this->view->structure = $this->structure->toArray($this->safinstancesId);
                 $cache->save($this->view->structure, $cn[0]);
                 $cache->save($this->structure->getStringNodes(), $cn[1]);
             }
         }
         $r = $this->getRequest();
         if (isset($r->layout) && $r->layout == 'no') {
             Zend_Layout::getMvcInstance()->disableLayout(true);
         }
         $pages = $this->_getPageId();
         $this->view->breadCrumData = $this->structure->getBreadCrumData($this->safinstancesId, $pages[0]);
     }
     // change language if necessary
     $settingsNms = new Zend_Session_Namespace('appSettings');
     $curLang = $this->getCurrentLangCode();
     if ($settingsNms->ApplicationLanguage != $curLang) {
         $settingsNms->ApplicationLanguage = $curLang;
         $bootstrapper = Zend_Registry::get('bootstrapper');
         $bootstrapper->setRequestLang($curLang);
         $bootstrapper->setTranslationObject();
     }
     $this->view->lang = $settingsNms->ApplicationLanguage;
     $pages = isset($pages) ? $pages : $this->_getPageId();
     $this->_manageCanonicalLinks($pages[0]);
 }
示例#8
0
 /**
  *
  * @return void
  */
 public function setUpLayoutProps()
 {
     $this->layout = $this->_helper->layout();
     // setup the layout
     if (isset($this->_config->general->sydneylayout) && $this->_config->general->sydneylayout == 'no' || isset($this->sydneyLayout) && $this->sydneyLayout == 'no') {
         // do not use the sydney layout if it is defined as it in the ini file
     } else {
         $this->layout->setLayoutPath(Sydney_Tools_Paths::getCorePath() . '/webinstances/sydney/layouts');
         $this->layout->setLayout('layoutSydney');
     }
     $this->view->cdnurl = $this->_config->general->cdn;
     $this->layout->cdnurl = $this->_config->general->cdn;
     $this->setupCSS();
     // setup some layout vars
     $this->layout->registry = $this->_registry;
     $this->layout->_config = $this->_config;
     $this->layout->auth = $this->_auth;
     $this->layout->users_id = $this->usersId;
     $this->layout->translate = $this->_registry->get('Zend_Translate');
     $this->view->translate = $this->_registry->get('Zend_Translate');
     $this->layout->avmodules = $this->availableModules;
     // define the current module
     $this->layout->currentModule = $this->_request->getModuleName();
     $this->setupScripts();
     // set up the title
     $this->view->headTitle()->setSeparator(' / ');
 }