Exemplo n.º 1
0
 /**
  * Start caching
  *
  * Determine if we have a cache hit. If so, return the response; else,
  * start caching.
  *
  * @param  Zend_Controller_Request_Abstract $request
  * @return void
  */
 public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
 {
     $request = $this->getRequest();
     // $request = new Zend_Controller_Request_Http();
     $moduleName = $request->getModuleName();
     $params = $request->getParams();
     /**
      * On récupère la homeId uniquement si on arrive à la racine du site
      * @author GDE
      * @project Belgium Telecom
      * @since 10/01/2013
      */
     $pagstrDB = new Pagstructure();
     if (count($params) == 3 && $params['module'] == 'publicms' && $params['controller'] == 'index' && $params['action'] == 'view') {
         $params['page'] = $pagstrDB->getHomeId(Sydney_Tools_Sydneyglobals::getSafinstancesId());
     }
     if ($moduleName == 'publicms' && isset($params['page'])) {
         $pagstr = $pagstrDB->find($params['page']);
         if (count($pagstr) == 1) {
             /**
              * Enregistre en session le rootid courant
              * Utilisé pour savoir quel index de recherche utiliser
              * FAR: Utile aussi pour la séparation par langue
              * @author GDE
              * @project Belgium Telecom
              * @since 10/01/2013
              */
             $breadCrumData = $pagstrDB->getBreadCrumData(Sydney_Tools_Sydneyglobals::getSafinstancesId(), $this->_treatPageData($params['page']));
             $rootid = $breadCrumData[0]['id'];
             $lucenesearch = new Zend_Session_Namespace('current-page-rootid');
             if (!empty($rootid)) {
                 $lucenesearch->rootid = $rootid;
             }
             $struct = $pagstr[0];
             $struct->hits++;
             $struct->save();
             if (!Sydney_Auth::getInstance()->hasIdentity() && $struct->iscachable != 0 && $struct->cachetime > 0) {
                 $this->cache->setLifetime($struct->cachetime);
                 if (!$request->isGet()) {
                     self::$doNotCache = true;
                     return;
                 }
                 $path = $request->getPathInfo();
                 $this->key = $moduleName . '_' . md5($path);
                 if (false !== ($response = $this->getCache())) {
                     $response->sendResponse();
                     exit;
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  *
  */
 public function unpublishpageAction()
 {
     $data = Zend_Json::decode($this->getRequest()->jsondata);
     $status = 0;
     try {
         $pagsData = new Pagstructure();
         $pagsData->unpublish($data['dbId']);
         /*
          * GDE : 27/08/2010
          * Add trace of current action
          */
         $rowPage = $pagsData->find($data['dbId']);
         Sydney_Db_Trace::add('trace.event.unpublish_page' . ' [' . $rowPage[0]->label . ']', 'adminpages', Sydney_Tools::getTableName($pagsData), 'unpublishpage', $data['dbId']);
         // */
         $msg = 'Element UNpublished.';
         //.'ID of the element '.$div->id;
         $status = 1;
         $dbId = $data['dbId'];
     } catch (Exception $e) {
         $msg = 'Error while publishing the element in the database!' . $e->getMessage();
         $status = 0;
         $dbId = '';
     }
     $this->view->ResultSet = array('message' => $msg, 'status' => $status, 'dbid' => $dbId, 'modal' => false);
 }