示例#1
0
文件: Page.php 项目: GruppoMeta/Movio
 /**
  * Process
  *
  * @return	boolean	false if the process is aborted
  * @access	public
  */
 function process()
 {
     if (!$this->_application->canViewPage()) {
         org_glizy_Session::set('glizy.loginUrl', org_glizy_helpers_Link::scriptUrl());
         org_glizy_helpers_Navigation::gotoUrl(org_glizy_helpers_Link::makeUrl('accessDenied'));
     }
     $this->processChilds();
 }
示例#2
0
 function switchEditingLanguage($id)
 {
     $ar = org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Language');
     $ar->load($id);
     org_glizy_Session::set('glizy.editingLanguage', $ar->language_code);
     org_glizy_Session::set('glizy.editingLanguageId', $ar->language_id);
     org_glizy_Session::set('glizy.editingLanguageIsDefault', $ar->language_isDefault);
     org_glizy_ObjectValues::set('org.glizy', 'editingLanguageId', $ar->language_id);
 }
示例#3
0
 static function reset($type = NULL)
 {
     $messages =& org_glizy_Session::get('org.glizy.application.MessageStack', array());
     if (is_null($type) || $type == 'ALL') {
         $messages = array();
     } else {
         $messages[$type] = array();
     }
     org_glizy_Session::set('org.glizy.application.MessageStack', $messages);
 }
示例#4
0
文件: Page.php 项目: GruppoMeta/Movio
 protected function loadContentFromDB()
 {
     if (!$this->_application->canViewPage()) {
         //$this->setAttribute('templateFileName', 'accessDenaied' );
         org_glizy_Session::set('glizy.loginUrl', org_glizy_helpers_Link::scriptUrl());
         org_glizy_helpers_Navigation::gotoUrl(org_glizy_helpers_Link::makeUrl('accessDenied'));
     }
     // if ($this->_user->backEndAccess && org_glizy_Request::get( 'draft', '' ) == '1')
     // {
     // 	$versionStatus = 'DRAFT';
     // }
     // TODO gestire lo stato PUBLISHED E DRAFT
     $contentProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.ContentProxy');
     $this->_content = $contentProxy->readContentFromMenu($this->_application->getPageId(), org_glizy_ObjectValues::get('org.glizy', 'languageId'));
 }
示例#5
0
 function process()
 {
     $allowGroups = $this->getAttribute('allowGroups') != '' ? explode(',', $this->getAttribute('allowGroups')) : array();
     if ((!org_glizy_Session::get('glizy.userLogged') || !(count($allowGroups) ? in_array($this->_user->groupId, $allowGroups) : true)) && $this->getAttribute('enabled')) {
         if (org_glizy_helpers_Link::scriptUrl() != org_glizy_helpers_Link::makeUrl('link', array('pageId' => org_glizy_Config::get('START_PAGE')))) {
             if ($this->getAttribute('showErrorMessage')) {
                 org_glizy_Session::set('glizy.loginError', org_glizy_locale_Locale::get('GLZ_LOGIN_NOACCESS'));
             }
             org_glizy_Session::set('glizy.loginUrl', __Request::get('__url__'));
         }
         org_glizy_helpers_Navigation::gotoUrl(org_glizy_helpers_Link::makeUrl('link', array('pageId' => $this->getAttribute('accessPageId'))));
         exit;
     }
     if ($this->getAttribute('checkAcl') && !$this->_user->acl($this->_application->getPageId(), 'visible')) {
         header('HTTP/1.0 403 Forbidden');
         exit;
     }
 }
示例#6
0
 function __construct($id, $groupId)
 {
     parent::__construct($id, $groupId);
     $this->roles = array();
     $this->aclMatrix = array();
     if ($id) {
         // TODO ora la matrice è memorizzata nella sessione
         // e non può essere invalidata dal gestore dei ruoli per tutti gli utenti
         $roles = org_glizy_Session::exists('glizy.roles');
         if (!empty($roles)) {
             $this->roles = org_glizy_Session::get('glizy.roles');
             $this->aclMatrix = org_glizy_Session::get('glizy.aclMatrix');
         } else {
             $it = org_glizy_ObjectFactory::createModelIterator('org.glizy.models.Role', 'getPermissions', array('params' => array('id' => $id, 'groupId' => $groupId)));
             foreach ($it as $ar) {
                 // se il ruolo non è attivo passa al prossimo
                 if (!$ar->role_active) {
                     continue;
                 }
                 // se il ruolo non è stato ancora processato
                 if (!$this->roles[$ar->role_id]) {
                     $this->roles[$ar->role_id] = true;
                     $permissions = unserialize($ar->role_permissions);
                     // unione delle matrici dei permessi
                     foreach ($permissions as $name => $actions) {
                         foreach ((array) $actions as $action => $value) {
                             $this->aclMatrix[strtolower($name)][$action] |= $value;
                         }
                     }
                 }
             }
             org_glizy_Session::set('glizy.roles', $this->roles);
             org_glizy_Session::set('glizy.aclMatrix', $this->aclMatrix);
         }
     }
 }
示例#7
0
 /**
  * @param string     $key
  * @param mixed $defaultValue
  * @param bool $readFromParams
  * @param bool $writeDefaultValue
  * @return mixed
  */
 static function get($key, $defaultValue = NULL, $readFromParams = false, $writeDefaultValue = false)
 {
     org_glizy_Session::start();
     if (!array_key_exists(org_glizy_Config::get('SESSION_PREFIX') . $key, $_SESSION)) {
         $value = $readFromParams ? org_glizy_Request::get($key, $defaultValue) : $defaultValue;
         if ($writeDefaultValue) {
             org_glizy_Session::set($key, $value);
         }
     } else {
         $value = $_SESSION[org_glizy_Config::get('SESSION_PREFIX') . $key];
     }
     return $value;
 }
示例#8
0
 protected function setSession($user)
 {
     org_glizy_Session::set('glizy.userLogged', true);
     org_glizy_Session::set('glizy.user', $user);
 }
示例#9
0
 private function checkSwitchLanguage()
 {
     $language = org_glizy_Request::get('language', NULL);
     if (!is_null($language) && $language != $this->_language) {
         // cambio lingua
         $this->log("change language", GLZ_LOG_SYSTEM);
         $ar = org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Language');
         $ar->language_code = $language;
         $ar->find();
         org_glizy_Session::set('glizy.language', $ar->language_code);
         org_glizy_Session::set('glizy.languageId', $ar->language_id);
         org_glizy_ObjectValues::set('org.glizy', 'languageId', $ar->language_id);
         $this->_languageId = $ar->language_id;
         $this->_language = $ar->language_code;
         // ricarica la struttura del sito per avere i titoli aggiornati
         $this->_initSiteMap(true);
         // controlla se il routing ha definito un urlResolver
         $speakingUrlManager = $this->retrieveProxy('org.glizycms.speakingUrl.Manager');
         $urlResolver = $speakingUrlManager->getResolver(__Request::get('cms:urlResolver', 'org.glizycms.core.models.Content'));
         $url = $urlResolver->makeUrlFromRequest();
         org_glizy_helpers_Navigation::gotoUrl($url);
     }
 }
示例#10
0
 function set($name, $value, $type = GLZ_SESSION_EX_VOLATILE)
 {
     $name = $this->_componentId . '_' . $name;
     if (!array_key_exists($name, $this->_values)) {
         $tempValue = array();
         $tempValue['value'] = $value;
         $tempValue['type'] = $type;
         $this->_values[$name] = $tempValue;
     } else {
         $this->_values[$name]['value'] = $value;
     }
     org_glizy_Session::set(GLZ_SESSION_EX_PREFIX, $this->_allValues);
 }
示例#11
0
 function _readPageId()
 {
     $this->log("readPageId", GLZ_LOG_SYSTEM);
     // legge il pageId della pagina da visualizzare
     $this->_pageId = org_glizy_Request::get('pageId', NULL);
     if (empty($this->_pageId)) {
         $this->_pageId = org_glizy_Config::get('REMEMBER_PAGEID') ? org_glizy_Session::get('glizy.pageId', org_glizy_Config::get('START_PAGE')) : org_glizy_Config::get('START_PAGE');
     }
     if (org_glizy_Config::get('REMEMBER_PAGEID')) {
         org_glizy_Session::set('glizy.pageId', $this->_pageId);
     }
     if (!is_numeric($this->_pageId) && $this->getClassName() == 'org_glizycms_core_application_application') {
         $this->siteMapMenu =& $this->siteMap->getMenuByPageType($this->_pageId);
         $this->_pageId = $this->siteMapMenu->id;
     } else {
         $this->siteMapMenu =& $this->siteMap->getNodeById($this->_pageId);
     }
     if (!is_object($this->siteMapMenu) || !$this->siteMapMenu->isVisible) {
         $report = array();
         $report['Request'] = var_export(__Request::getAllAsArray(), true);
         $report['_SERVER'] = var_export($_SERVER, true);
         $this->log($report, GLZ_LOG_SYSTEM, 'glizy.404');
         if (!$this->getCurrentUser()->acl($this->siteMapMenu->id, "visible")) {
             org_glizy_helpers_Navigation::gotoUrl(__Link::makeUrl('link', array('pageId' => __Config::get('START_PAGE'))));
         }
         $error404Page = __Config::get('ERROR_404');
         if (!empty($error404Page)) {
             org_glizy_helpers_Navigation::gotoUrl(__Link::makeUrl('link', array('pageId' => $error404Page)));
         }
         new org_glizy_Exception(__T('GLZ_ERR_404') . '</br>' . __Request::get('pageId'), GLZ_E_404);
     }
     if (!empty($this->siteMapMenu->select)) {
         if ($this->siteMapMenu->select == '*') {
             $menu = $this->siteMapMenu->firstChild(true);
         } else {
             $menu = $this->siteMap->getNodeById($this->siteMapMenu->select);
         }
         org_glizy_helpers_Navigation::gotoUrl(__Link::makeUrl('link', array('pageId' => $menu->id)));
     }
 }