Пример #1
0
 function _initSiteMap($forceReload = false)
 {
     $this->log("initSiteMap", GLZ_LOG_SYSTEM);
     $this->siteMap =& org_glizy_ObjectFactory::createObject('org.glizycms.core.application.SiteMapDB');
     $this->siteMap->getSiteArray($forceReload);
     // controlla se l'utente ha i permessi per modificare la pagina
     // per velocizzare vengono precaricate tutte le relazioni in memoria
     $this->_aclPage = array();
     if (__Config::get('ACL_ENABLED')) {
         $this->_aclPage = __Session::get('glizy.aclFront', NULL);
         if (is_null($this->_aclPage)) {
             $this->_aclPage = array();
             $it = org_glizy_ObjectFactory::createModelIterator('org.glizy.models.Join', 'all', array('filters' => array('join_objectName' => 'menus_tbl#rel_aclFront')));
             foreach ($it as $arC) {
                 if (!isset($this->_aclPage[$arC->join_FK_source_id])) {
                     $this->_aclPage[$arC->join_FK_source_id] = array();
                 }
                 $this->_aclPage[$arC->join_FK_source_id][] = $arC->join_FK_dest_id;
             }
             // scorre tutti i menù per attribuire l'acl ai menù che non ce l'hanno
             // ereditandola dal padre
             $siteMapIterator =& org_glizy_ObjectFactory::createObject('org.glizy.application.SiteMapIterator', $this->siteMap);
             while (!$siteMapIterator->EOF) {
                 $n = $siteMapIterator->getNode();
                 $siteMapIterator->moveNext();
                 if (!isset($this->_aclPage[$n->id])) {
                     $n2 = $n;
                     while (true) {
                         if ($n2->parentId == 0) {
                             break;
                         }
                         $parentNode = $n2->parentNode();
                         $n2 = $parentNode;
                         if (isset($this->_aclPage[$parentNode->id])) {
                             $this->_aclPage[$n->id] = $this->_aclPage[$parentNode->id];
                             break;
                         }
                     }
                 }
             }
             __Session::set('glizy.aclFront', $this->_aclPage);
         }
     }
 }
Пример #2
0
 function getItems()
 {
     $oldCacheValue = __Config::get('QUERY_CACHING');
     __Config::set('QUERY_CACHING', $this->getAttribute('cache'));
     if (is_null($this->iterator)) {
         $this->process();
     }
     $items = org_glizy_ObjectValues::get('org.glizy.components.DataDictionary', $this->getAttribute('recordClassName') . '.' . $this->getAttribute('field') . $this->getAttribute('query'));
     if (is_null($items)) {
         $items = __Session::get($this->getAttribute('recordClassName') . '.' . $this->getAttribute('field') . $this->getAttribute('query'));
     }
     if (is_null($items)) {
         $items = $this->loadDictionary($this->getAttribute('field'), $this->getAttribute('query'), unserialize($this->getAttribute('queryParams')), $this->getAttribute('skipEmpty'), $this->getAttribute('delimiter'));
         org_glizy_ObjectValues::set('org.glizy.components.DataDictionary', $this->getAttribute('recordClassName') . '.' . $this->getAttribute('field') . $this->getAttribute('query'), $items);
         if ($this->getAttribute('delimiter') != '') {
             __Session::set($this->getAttribute('recordClassName') . '.' . $this->getAttribute('field') . $this->getAttribute('query'), $items);
         }
     }
     __Config::set('QUERY_CACHING', $oldCacheValue);
     return $items;
 }
Пример #3
0
 static function init()
 {
     self::$method = strtolower(@$_SERVER['REQUEST_METHOD']);
     $url = '';
     $params =& org_glizy_Request::_getValuesArray(true);
     $charset = strtolower(org_glizy_Config::get('CHARSET'));
     $requestCharset = @$_SERVER['CONTENT_TYPE'];
     if ($charset != "utf-8" && stripos($requestCharset, 'utf-8') !== false) {
         self::$decodeUtf8 = true;
     }
     if (self::$skipDecode) {
         self::$decodeUtf8 = false;
     }
     foreach ($_GET as $k => $v) {
         if (!is_array($v) && get_magic_quotes_gpc()) {
             $v = stripslashes($v);
         }
         if (self::$decodeUtf8) {
             $v = org_glizy_Request::utf8_decode($v);
         }
         $url .= '&' . $k . '=' . $v;
         $params[$k] = array($v, GLZ_REQUEST_GET);
     }
     foreach ($_POST as $k => $v) {
         if (!is_array($v) && get_magic_quotes_gpc()) {
             $v = stripslashes($v);
         }
         if (self::$decodeUtf8) {
             $v = org_glizy_Request::utf8_decode($v);
         }
         $url .= '&' . $k . '=' . $v;
         $params[$k] = array($v, GLZ_REQUEST_POST);
     }
     $contentType = @$_SERVER['CONTENT_TYPE'];
     $body = @file_get_contents('php://input');
     if ($body && $contentType && $contentType != 'application/x-www-form-urlencoded') {
         $params['__postBody__'] = array($body, GLZ_REQUEST_POST);
         parse_str($body, $output);
         foreach ($output as $k => $v) {
             if (!isset($params[$k])) {
                 $url .= '&' . $k . '=' . $v;
                 $params[$k] = array($v, GLZ_REQUEST_POST);
             }
         }
     }
     $params['__url__'] = array(__Routing::$requestUrl, GLZ_REQUEST_GET);
     $params['__back__url__'] = array($url, GLZ_REQUEST_GET);
     if (self::$translateInfo && isset($params['pageId'])) {
         $pageId = strtolower($params['pageId'][GLZ_REQUEST_VALUE]);
         $translateInfo = __Session::get('__translateInfo_' . $pageId, array());
         foreach ($translateInfo as $v) {
             if (isset($params[$v['target_name']]) && $params[$v['target_name']][GLZ_REQUEST_VALUE] == $v['label']) {
                 $params[$v['target']][GLZ_REQUEST_VALUE] = $v['value'];
             }
         }
         __Session::remove('__translateInfo_' . $pageId);
     }
     $values = __Session::get('__valuesForNextRefresh');
     if (isset($values) && is_array($values)) {
         foreach ($values as $k => $v) {
             $params[$k][GLZ_REQUEST_VALUE] = $v;
         }
         __Session::remove('__valuesForNextRefresh');
     }
 }
Пример #4
0
 private function addTranslateInfo($target, $label, $buttonValue)
 {
     $infoName = '__translateInfo_' . strtolower($this->_application->getPageId());
     $translateInfo = __Session::get($infoName, array());
     $newTranslateInfo = array();
     foreach ($translateInfo as $value) {
         if ($value['target_name'] != $this->getOriginalId()) {
             $newTranslateInfo[] = $value;
         }
     }
     $newTranslateInfo[] = array('target_name' => $this->getOriginalId(), 'target' => $target, 'label' => $label, 'value' => $buttonValue);
     __Session::set($infoName, $newTranslateInfo);
 }
Пример #5
0
 function changeBackPage()
 {
     $url = __Session::get('__backUrl__', '');
     org_glizy_helpers_Navigation::gotoUrl($url);
 }