Exemplo n.º 1
0
 /**
  * Check the access rights agains the DB if we are in the publicms module
  *
  * @param $role
  * @return void
  */
 private function checkRightsPublicms($role)
 {
     // check if instance is offline
     $safinstanceDB = new Safinstances();
     $safinstances = $safinstanceDB->find($this->safinstancesId);
     if (count($safinstances) != 1) {
         print "FATAL ERROR 452 in Sydney_Controller_Plugin_Auth::checkRightsPublicms(" . $this->safinstancesId . ")";
         header('Location: ' . Sydney_Tools_Paths::getRootUrlCdn() . '/install/instance/index.php/referrer/PluginAuth/checkRightsPublicms/noinstancefound');
         exit;
     } elseif ($safinstances[0]->active == 0) {
         print $safinstances[0]->offlinemessage;
         if (empty($safinstances[0]->offlinemessage)) {
             print "This site is offline.";
             header('Location: ' . Sydney_Tools_Paths::getRootUrlCdn() . '/install/instance/index.php/referrer/PluginAuth/checkRightsPublicms');
         }
         exit;
     }
     // get page data
     $d = $this->request->getParams();
     if ($d['module'] == 'publicms' && $d['controller'] == 'index' && $d['action'] == 'view') {
         $nodes = new Pagstructure();
         if (!isset($d['page']) || !preg_match("/^[0-9]{1,100}\$/", $d['page'])) {
             $nodeId = $nodes->getHomeId($this->safinstancesId);
         } else {
             $nodeId = $d['page'];
         }
         $node = $nodes->fetchAll(" id = '" . $nodeId . "' AND safinstances_id = '" . $this->safinstancesId . "' ");
         if (count($node) == 1) {
             $authorizedGroupId = $node[0]->usersgroups_id;
             if (!self::isContentAccessible($authorizedGroupId, $this->userNamespace->user['member_of_groups'])) {
                 $this->redirecting('default', 'login', 'index', 'code04');
             }
         } else {
             print "Node {$nodeId} not found! (FATAL ERROR 542 in Sydney_Controller_Plugin_Auth::checkRightsPublicms)";
             header('Location: ' . Sydney_Tools_Paths::getRootUrlCdn() . '/install/instance/index.php/referrer/PluginAuth/checkRightsPublicms/nodenotfound');
             exit;
         }
     }
 }
Exemplo n.º 2
0
 /**
  *
  * Clean cache of page $pagstructure_id and all pages redirected to this page
  * @param $pageStructureId
  */
 public static function cleanPageCache($pageStructureId)
 {
     $cache = Zend_Registry::get('cache');
     $cache->remove('publicms_' . md5('/publicms/index/view/page/' . $pageStructureId));
     // search page redirected
     $page = new Pagstructure();
     $pageRowset = $page->fetchAll($page->select()->where('redirecttoid = ' . $pageStructureId));
     foreach ($pageRowset as $row) {
         $cache->remove('publicms_' . md5('/publicms/index/view/page/' . $row->id));
     }
 }
Exemplo n.º 3
0
 /**
  *
  */
 protected function setAuthPagelist()
 {
     // Get list of pages secured by groups
     $listSecuredPages = array();
     $pages = new Pagstructure();
     $selector = $pages->select(false)->from($pages->getTableName(), array('id', 'usersgroups_id'))->where('safinstances_id = ?', Sydney_Tools::getSafinstancesId())->where('usersgroups_id > ?', 1);
     $rowObjectList = $pages->fetchAll($selector);
     foreach ($rowObjectList as $rowObject) {
         $listSecuredPages[$rowObject->id] = $rowObject->usersgroups_id;
     }
     Zend_Registry::set('listSecuredPages', $listSecuredPages);
 }