Exemple #1
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $this->setName('pagstats');
     $id = new Zend_Form_Element_Hidden('id');
     $hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $pagStructureId = new Zend_Form_Element_Select('pagstructure_id');
     $options = new Pagstructure();
     $pagStructureId->addMultiOption('', '----------');
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         $pagStructureId->addMultiOption($k, $v['mlabel']);
     }
     $pagStructureId->setLabel('pagstructure_id');
     $views = new Zend_Form_Element_Text('views');
     $views->setLabel('views');
     $unique = new Zend_Form_Element_Text('unique');
     $unique->setLabel('unique');
     $timeOnPage = new Zend_Form_Element_Text('timeonpage');
     $timeOnPage->setLabel('timeonpage');
     $bounces = new Zend_Form_Element_Text('bounces');
     $bounces->setLabel('bounces');
     $exits = new Zend_Form_Element_Text('exits');
     $exits->setLabel('exits');
     $this->addElements(array($id, $hash, $pagStructureId, $views, $unique, $timeOnPage, $bounces, $exits));
     $this->addElements(array($submit));
 }
 public function init()
 {
     $options = new Pagstructure();
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         if (isset($v['mlabel'])) {
             $this->addMultiOption($k, $v['mlabel']);
         }
     }
 }
Exemple #3
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;
                 }
             }
         }
     }
 }
 /**
  * displays the page content in edition mode
  */
 public function editAction()
 {
     // [AS] add CKEditor (moved from the global as it was using a lot of ressource)
     $this->view->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . '/sydneyassets/jslibs/ckeditor/ckeditor.js', 'text/javascript');
     $this->view->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . '/sydneyassets/jslibs/ckeditor/adapters/jquery.js', 'text/javascript');
     $r = $this->getRequest();
     $elid = isset($r->id) && preg_match('/^[0-9]{1,50}$/', $r->id) ? $r->id : 0;
     $emodule = isset($r->emodule) ? $r->emodule : 'pages';
     $this->view->emodule = $emodule;
     $this->view->pagstructure_id = $elid;
     $this->view->customHelpers = $this->_registry->get('customhelpers');
     switch ($emodule) {
         case 'pages':
             $nodes = new Pagstructure();
             $where = 'id = ' . $elid . ' AND safinstances_id = ' . $this->safinstancesId;
             $this->view->node = $nodes->fetchRow($where);
             $this->view->pagid = $elid;
             $this->view->moduleName = 'adminpages';
             // set layout and titles properties
             $this->setSubtitle2($this->view->node->label);
             $this->setSubtitle('Edit page');
             $this->setSideBar('edit', 'pages');
             $this->layout->langswitch = true;
             $this->layout->search = true;
             // get the div content
             $cnt = new Pagdivspage();
             $this->view->contentDivs = $cnt->getDivs($this->view->node->id, false);
             // Affichage d'un design spécifique
             $layout = new Sydney_Layout_Layout();
             /* If layout if empty we will take the one in the config */
             if (!$this->view->node->layout) {
                 $this->view->node->layout = $this->_config->general->layout;
             }
             $layout->setName($this->view->node->layout);
             if ($layout->loadZones()->hasZones()) {
                 $this->view->layout = $layout;
                 $this->view->preview = $layout->calculatePreview()->getPreview();
                 $this->view->zones = $layout->getZones();
                 $this->render('editzones');
             }
             break;
     }
 }
Exemple #5
0
 public function getParent($id = 0)
 {
     if ($id == 0 && parent::getParent() !== null) {
         return parent::getParent();
     } elseif ($id > 0) {
         $pageDiv = new PagstructurePagdivs();
         $rowsetPageDiv = $pageDiv->fetchAll($pageDiv->select()->where("pagdivs_id = " . $id));
         if (count($rowsetPageDiv) > 0) {
             $page = new Pagstructure();
             $page->set($rowsetPageDiv->current()->pagstructure_id);
             if ($page->get()) {
                 return $page;
             } else {
                 return null;
             }
         } else {
             return null;
         }
     } else {
         return null;
     }
 }
Exemple #6
0
 private function _duplicateNode($id, $newParentId = null)
 {
     // Load the node data
     $node = new Pagstructure($id);
     // Duplicate node
     $duplicateNode = $node->createRow($node->__toArray());
     $duplicateNode->id = 0;
     $duplicateNode->ishome = 0;
     // avoid two homepage
     $duplicateNode->status = 'draft';
     // unpublish the copy
     if ($newParentId !== null) {
         $duplicateNode->parent_id = $newParentId;
     }
     $duplicateNode->datecreated = new Zend_Db_Expr("NOW()");
     $duplicateNode->datemodified = new Zend_Db_Expr("NOW()");
     $duplicateNode->who_modified = Sydney_Tools::who();
     $duplicateNode->save();
     // Duplicate node content
     $page = new Pagdivspage();
     $pageDivs = $page->getDivs($id, false);
     PagdivspageOp::resetFictivePagDivsOrder();
     foreach ($pageDivs as $pageDiv) {
         Pagdivspage::duplicate($pageDiv['pagdivs_id'], $duplicateNode->id, $pageDiv['order_pagstructure_pagdiv']);
     }
     // Access right to duplicate?
     // Menu presence to duplicate?
     // Duplicate child, if any
     $kids = $node->getKids($id);
     if (count($kids) > 0) {
         foreach ($kids as $kid) {
             $this->_duplicateNode($kid->id, $duplicateNode->id);
         }
     }
     return $duplicateNode->id;
 }
 /**
  *
  */
 public function editadvancedprocessAction()
 {
     $r = $this->getRequest();
     $eid = 0;
     if ($r->id > 0) {
         $nodeDB = new Pagstructure();
         $node = $nodeDB->fetchRow('id = ' . $r->id . ' AND safinstances_id = ' . $this->safinstancesId);
         $node->metakeywords = $r->metakeywords;
         $node->metadesc = $r->metadesc;
         $node->iscachable = $r->iscachable;
         $node->cachetime = $r->cachetime;
         $node->redirecttoid = $r->redirecttoid;
         $node->shortdesc = $r->shortdesc;
         $node->colorcode = $r->colorcode;
         $node->layout = $r->layout;
         $node->save();
         $eid = $r->id;
         // GDE : 27/08/2010 - Add trace of current action
         Sydney_Db_Trace::add('trace.event.update_advanced_properties' . ' [' . $node->label . ']', 'adminpages', Sydney_Tools::getTableName($nodeDB), 'editadvancedproperties', $eid);
     }
     // update the linked menu
     $mns = new PagstructurePagmenus();
     $mns->delete('pagstructure_id = ' . $eid);
     //Zend_Debug::dump($r->menus);
     if (is_array($r->menus)) {
         foreach ($r->menus as $mid) {
             $crow = $mns->createRow();
             $crow->pagstructure_id = $eid;
             $crow->pagmenus_id = $mid;
             $crow->save();
         }
     }
     PagstructureOp::cleanCache($this->safinstancesId);
     $this->redirect('/adminpages/pages/edit/id/' . $eid);
 }
Exemple #8
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;
         }
     }
 }
 /**
  * @since 19/02/2014
  */
 public function getcleanurlpagebyidnodeAction()
 {
     $id = (int) $this->_getParam('id', null);
     $page = new Pagstructure();
     $data = $page->get($id);
     $label = Sydney_Tools_Sydneyglobals::getConf('general')->url->newFormat && !empty($data['url']) ? $data['url'] : Sydney_Tools_Friendlyurls::getUrlLabel($data['label']);
     $this->view->resultSet = array('url' => Sydney_Tools_Friendlyurls::getFriendlyUrl($id, $label, 'page', new Zend_View_Helper_Url()));
 }
Exemple #10
0
 /**
  * Returns the ID of the home page for this SAF instance
  * @return int
  */
 protected function _getPageId()
 {
     $nodes = new Pagstructure();
     if (isset($this->getRequest()->slug)) {
         return $nodes->getIdBySlug($this->getRequest()->slug, $this->safinstancesId);
     } else {
         return $nodes->getHomeId($this->safinstancesId);
     }
 }
 public function sidebarAction()
 {
     $this->_helper->layout->disableLayout();
     $pgs = new Pagstructure();
     $this->view->countDeletedNodes = $pgs->countDeletedNodes();
 }
Exemple #12
0
 /**
  * Returns the ID of the home page for this SAF instance
  * @return int
  */
 protected function _getPageId()
 {
     $pages = array();
     $f = new Zend_Filter_Digits();
     if (isset($this->getRequest()->page)) {
         foreach (preg_split('/,/', $this->getRequest()->page) as $page) {
             $pages[] = $f->filter($page);
         }
     } else {
         $nodes = new Pagstructure();
         $pages[] = $nodes->getHomeId($this->safinstancesId);
     }
     return $pages;
 }
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $this->setName('pagstructure');
     $id = new Zend_Form_Element_Hidden('id');
     $hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $label = new Zend_Form_Element_Textarea('label');
     $label->setLabel('label');
     $htmlTitle = new Zend_Form_Element_Textarea('htmltitle');
     $htmlTitle->setLabel('htmltitle');
     $url = new Zend_Form_Element_Textarea('url');
     $url->setLabel('url');
     $metaDesc = new Zend_Form_Element_Textarea('metadesc');
     $metaDesc->setLabel('metadesc');
     $metaKeywords = new Zend_Form_Element_Textarea('metakeywords');
     $metaKeywords->setLabel('metakeywords');
     $parentId = new Zend_Form_Element_Select('parent_id');
     $options = new Pagstructure();
     $parentId->addMultiOption('', '----------');
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         $parentId->addMultiOption($k, $v['mlabel']);
     }
     $parentId->setLabel('parent_id');
     $safinstancesId = new Zend_Form_Element_Select('safinstances_id');
     $options = new Safinstances();
     $safinstancesId->addMultiOption('', '----------');
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         $safinstancesId->addMultiOption($k, $v['mlabel']);
     }
     $safinstancesId->setLabel('safinstances_id');
     $isHome = new Zend_Form_Element_Text('ishome');
     $isHome->setLabel('ishome');
     $status = new Zend_Form_Element_Text('status');
     $status->setLabel('status');
     $pagOrder = new Zend_Form_Element_Text('pagorder');
     $pagOrder->setLabel('pagorder');
     $dateCreated = new Zend_Form_Element_Text('datecreated');
     $dateCreated->setLabel('datecreated');
     $dateModified = new Zend_Form_Element_Text('datemodified');
     $dateModified->setLabel('datemodified');
     $dateLastUpdateContent = new Zend_Form_Element_Text('date_lastupdate_content');
     $dateLastUpdateContent->setLabel('date_lastupdate_content');
     $whoModified = new Zend_Form_Element_Text('who_modified');
     $whoModified->setLabel('who_modified');
     $whoLastUpdateContent = new Zend_Form_Element_Text('who_lastupdate_content');
     $whoLastUpdateContent->setLabel('who_lastupdate_content');
     $isCachable = new Zend_Form_Element_Text('iscachable');
     $isCachable->setLabel('iscachable');
     $cacheTime = new Zend_Form_Element_Text('cachetime');
     $cacheTime->setLabel('cachetime');
     $hits = new Zend_Form_Element_Text('hits');
     $hits->setLabel('hits');
     $redirectToId = new Zend_Form_Element_Text('redirecttoid');
     $redirectToId->setLabel('redirecttoid');
     $usersGroupsId = new Zend_Form_Element_Select('usersgroups_id');
     $options = new Usersgroups();
     $usersGroupsId->addMultiOption('', '----------');
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         $usersGroupsId->addMultiOption($k, $v['mlabel']);
     }
     $usersGroupsId->setLabel('usersgroups_id');
     $isDeleted = new Zend_Form_Element_Text('isDeleted');
     $isDeleted->setLabel('isDeleted');
     $shortDesc = new Zend_Form_Element_Textarea('shortdesc');
     $shortDesc->setLabel('shortdesc');
     $colorCode = new Zend_Form_Element_Text('colorcode');
     $colorCode->setLabel('colorcode');
     $layout = new Zend_Form_Element_Text('layout');
     $layout->setLabel('layout');
     $pagStructurePagDivs = new PagdivslistForm('PagstructurePagdivs');
     $pagStructurePagDivs->setLabel('PagstructurePagdivs');
     $pagStructurePagMenus = new PagmenuslistForm('PagstructurePagmenus');
     $pagStructurePagMenus->setLabel('PagstructurePagmenus');
     $this->addElements(array($id, $hash, $label, $htmlTitle, $url, $metaDesc, $metaKeywords, $parentId, $safinstancesId, $isHome, $status, $pagOrder, $dateCreated, $dateModified, $dateLastUpdateContent, $whoModified, $whoLastUpdateContent, $isCachable, $cacheTime, $hits, $redirectToId, $usersGroupsId, $isDeleted, $shortDesc, $colorCode, $layout, $pagStructurePagDivs, $pagStructurePagMenus));
     $this->addElements(array($submit));
 }