Example #1
0
 /**
  * Computes the target of the tag.
  *
  * @param CMS_page $page The page where the linx tag is.
  * @param string $publicTree Is the calculus made in the public or edited tree ?
  * @return CMS_page The target page, of false if no target.
  * @access public
  */
 function getTarget(&$page, $publicTree)
 {
     $pg = false;
     switch ($this->_type) {
         case "node":
             $pg = CMS_tree::getPageByID($this->_value);
             if ($pg && !$pg->hasError()) {
                 return $pg;
             } else {
                 return false;
             }
             break;
         case "codename":
             if ($this->_website) {
                 $website = CMS_websitesCatalog::getByCodename($this->_website);
                 if ($website) {
                     $pg = CMS_tree::getPageByCodename($this->_value, $website, $publicTree, true);
                 }
             } else {
                 if ($this->_crosswebsite) {
                     return CMS_tree::getPagesByCodename($this->_value, $publicTree, true);
                 } else {
                     $pg = CMS_tree::getPageByCodename($this->_value, $page->getWebsite(), $publicTree, true);
                 }
             }
             if ($pg && !$pg->hasError()) {
                 return $pg;
             } else {
                 return false;
             }
             break;
         case "relative":
             switch ($this->_value) {
                 case "root":
                     if ($this->_website) {
                         $website = CMS_websitesCatalog::getByCodename($this->_website);
                         if ($website) {
                             $pg = $website->getRoot();
                         }
                     } else {
                         $offset = abs($this->_relativeOffset) * -1;
                         $pg = CMS_tree::getAncestor($page, $offset, !$this->_crosswebsite, false);
                         //here we do not want to use public tree because, in public tree, some page may be unpublished or in this case, it break the lineage and root page cannot be found
                     }
                     break;
                 case "father":
                     $offset = abs($this->_relativeOffset);
                     $pg = CMS_tree::getAncestor($page, $offset, !$this->_crosswebsite, $publicTree);
                     break;
                 case "self":
                     $pg = $page;
                     break;
                 case "brother":
                     $pg = CMS_tree::getBrother($page, $this->_relativeOffset, $publicTree);
                     break;
             }
             if ($this->_website && is_a($pg, 'CMS_page') && !$pg->hasError()) {
                 if ($pg->getCodename()) {
                     $website = CMS_websitesCatalog::getByCodename($this->_website);
                     $pg = $website ? CMS_tree::getPageByCodename($pg->getCodename(), $website, $publicTree, true) : false;
                 } else {
                     $pg = false;
                 }
             }
             if (is_a($pg, 'CMS_page') && !$pg->hasError()) {
                 return $pg;
             } else {
                 return false;
             }
             break;
     }
 }
Example #2
0
         $lockUser = CMS_profile_usersCatalog::getById($hasLock);
         $panelContent .= "\n\t\t\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_UNLOCK_LOCKED_PAGE, array(io::htmlspecialchars($lockUser->getFullName()))) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_UNLOCK_PAGE) . "</span>',\n\t\t\t\t\t\t\t\ticonCls: 'atm-pic-unlock',\n\t\t\t\t\t\t\t\thandler: function(){\n\t\t\t\t\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\t\t\t\t\tmsg: \t\t\t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_UNLOCK_CONFIRM, array(io::htmlspecialchars($lockUser->getFullName()))) . "',\n\t\t\t\t\t\t\t\t\t\tbuttons: \t\t\tExt.MessageBox.OKCANCEL,\n\t\t\t\t\t\t\t\t\t\tanimEl: \t\t\tthis.getEl(),\n\t\t\t\t\t\t\t\t\t\tclosable: \t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\ticon: \t\t\t\tExt.MessageBox.WARNING,\n\t\t\t\t\t\t\t\t\t\tfn: \t\t\t\tfunction (button) {\n\t\t\t\t\t\t\t\t\t\t\tif (button == 'ok') {\n\t\t\t\t\t\t\t\t\t\t\t\tAutomne.server.call({\n\t\t\t\t\t\t\t\t\t\t\t\t\turl:\t\t\t\t'resource-controler.php',\n\t\t\t\t\t\t\t\t\t\t\t\t\tparams: \t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tresource:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmodule:\t\t\t'standard',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taction:\t\t\t'unlock'\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tcallBackScope:\t\tthis\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}));";
     } elseif ($fromtab == 'edit' && $cms_user->getUserID() == $hasLock) {
         $panelContent .= $pageDraft;
     }
 } else {
     if ($cms_page->getProposedLocation() == RESOURCE_LOCATION_DELETED) {
         //undelete
         $panelContent .= "\n\t\t\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_UNDO_DELETION_INFO) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_UNDO_DELETION) . "</span>',\n\t\t\t\t\t\t\t\ticonCls: 'atm-pic-undelete',\n\t\t\t\t\t\t\t\thandler: function () {\n\t\t\t\t\t\t\t\t\tAutomne.server.call({\n\t\t\t\t\t\t\t\t\t\turl:\t\t\t\t'page-controler.php',\n\t\t\t\t\t\t\t\t\t\tparams: \t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcurrentPage:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\taction:\t\t\t\t'undelete'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}));";
     } elseif ($cms_page->getProposedLocation() == RESOURCE_LOCATION_ARCHIVED) {
         //unarchive
         $panelContent .= "\n\t\t\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_UNDO_ARCHIVING_INFO) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_UNDO_ARCHIVING) . "</span>',\n\t\t\t\t\t\t\t\ticonCls: 'atm-pic-unarchive',\n\t\t\t\t\t\t\t\thandler: function () {\n\t\t\t\t\t\t\t\t\tAutomne.server.call({\n\t\t\t\t\t\t\t\t\t\turl:\t\t\t\t'page-controler.php',\n\t\t\t\t\t\t\t\t\t\tparams: \t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcurrentPage:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\taction:\t\t\t\t'unarchive'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}));";
     } else {
         if (!$cms_page->isProtected()) {
             //move page
             $father = CMS_tree::getAncestor($cms_page, 1);
             $draggable = is_object($father) && $cms_user->hasPageClearance($father->getID(), CLEARANCE_PAGE_EDIT) && (!$hasSiblings || $cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_REGENERATEPAGES) && $cms_page->getID() != APPLICATION_ROOT_PAGE_ID);
             if ($draggable) {
                 $panelContent .= "\n\t\t\t\t\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_MOVE_PAGE_INFO) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_MOVE_PAGE) . "</span>',\n\t\t\t\t\t\t\t\t\t\ticonCls: 'atm-pic-move',\n\t\t\t\t\t\t\t\t\t\thandler: function() {\n\t\t\t\t\t\t\t\t\t\t\t//create window element\n\t\t\t\t\t\t\t\t\t\t\tvar win = new Automne.Window({\n\t\t\t\t\t\t\t\t\t\t\t\tid:\t\t\t\t'pageMoveWindow',\n\t\t\t\t\t\t\t\t\t\t\t\tcurrentPage:\t" . $cms_page->getID() . ",\n\t\t\t\t\t\t\t\t\t\t\t\tautoLoad:\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\turl:\t\t'tree.php',\n\t\t\t\t\t\t\t\t\t\t\t\t\tparams:\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\twinId:\t\t'pageMoveWindow',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurrentPage:" . $cms_page->getID() . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tenableDD:\ttrue,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\theading:\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_MOVE_PAGE_USING_ICONS) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle:\t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_MOVING_PAGE) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tnocache:\ttrue,\n\t\t\t\t\t\t\t\t\t\t\t\t\tscope:\t\tthis\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\twin.show(this.getEl());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}));";
             }
         }
         //page copy
         $panelContent .= $pageCopy;
         if (!$cms_page->isProtected()) {
             //archiving
             if (!$hasSiblings) {
                 $panelContent .= "\n\t\t\t\t\t\t\t\t\tmenu.addSeparator();\n\t\t\t\t\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_ARCHIVING_PAGE_INFO) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_ARCHIVING_PAGE) . "</span>',\n\t\t\t\t\t\t\t\t\t\ticonCls: 'atm-pic-archiving',\n\t\t\t\t\t\t\t\t\t\thandler: function(){\n\t\t\t\t\t\t\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\t\t\t\t\t\t\tmsg: \t\t\t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_ARCHIVING_PAGE_CONFIRM) . "',\n\t\t\t\t\t\t\t\t\t\t\t\tbuttons: \t\t\tExt.MessageBox.OKCANCEL,\n\t\t\t\t\t\t\t\t\t\t\t\tanimEl: \t\t\tthis.getEl(),\n\t\t\t\t\t\t\t\t\t\t\t\tclosable: \t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\t\t\ticon: \t\t\t\tExt.MessageBox.QUESTION,\n\t\t\t\t\t\t\t\t\t\t\t\tfn: \t\t\t\tfunction (button) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (button == 'ok') {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAutomne.server.call({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\turl:\t\t\t\t'page-controler.php',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: \t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurrentPage:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taction:\t\t\t\t'archive'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}));";
             }
             //deletion
             if (!$hasSiblings && !CMS_websitesCatalog::isWebsiteRoot($cms_page->getID())) {
                 $panelContent .= "\n\t\t\t\t\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_DELETING_PAGE_INFO) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_DELETING_PAGE) . "</span>',\n\t\t\t\t\t\t\t\t\t\ticonCls: 'atm-pic-deletion',\n\t\t\t\t\t\t\t\t\t\thandler: function(){\n\t\t\t\t\t\t\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\t\t\t\t\t\t\tmsg: \t\t\t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_DELETING_PAGE_CONFIRM) . "',\n\t\t\t\t\t\t\t\t\t\t\t\tbuttons: \t\t\tExt.MessageBox.OKCANCEL,\n\t\t\t\t\t\t\t\t\t\t\t\tanimEl: \t\t\tthis.getEl(),\n\t\t\t\t\t\t\t\t\t\t\t\tclosable: \t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\t\t\ticon: \t\t\t\tExt.MessageBox.QUESTION,\n\t\t\t\t\t\t\t\t\t\t\t\tfn: \t\t\t\tfunction (button) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (button == 'ok') {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAutomne.server.call({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\turl:\t\t\t\t'page-controler.php',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: \t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurrentPage:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taction:\t\t\t\t'delete'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}));";
Example #3
0
 /**
  * Process the daily routine unpublication part : unpublish page that needs to be
  *
  * @return void
  * @access private
  */
 protected function _dailyRoutineUnpublish()
 {
     $today = new CMS_date();
     $today->setNow();
     //process all pages that are to be unpublished
     $sql = "\n\t\t\tselect\n\t\t\t\tid_pag\n\t\t\tfrom\n\t\t\t\tpages,\n\t\t\t\tresources,\n\t\t\t\tresourceStatuses\n\t\t\twhere\n\t\t\t\tresource_pag=id_res\n\t\t\t\tand status_res=id_rs\n\t\t\t\tand location_rs='" . RESOURCE_LOCATION_USERSPACE . "'\n\t\t\t\tand publication_rs='" . RESOURCE_PUBLICATION_PUBLIC . "'\n\t\t\t\tand\t(publicationDateStart_rs > '" . $today->getDBValue(true) . "'\n\t\t\t\t\tor (publicationDateEnd_rs < '" . $today->getDBValue(true) . "' and publicationDateEnd_rs!='0000-00-00'))\n\t\t";
     $q = new CMS_query($sql);
     $unpublished = array();
     while ($id = $q->getValue("id_pag")) {
         $unpublished[] = $id;
     }
     $regen_pages = array();
     foreach ($unpublished as $page_id) {
         $page = CMS_tree::getPageByID($page_id);
         //calculate the pages to regenerate
         $temp_regen = CMS_linxesCatalog::getLinkers($page);
         if ($temp_regen) {
             $regen_pages = array_merge($regen_pages, $temp_regen);
         }
         $father = CMS_tree::getAncestor($page, 1);
         if ($father) {
             $temp_regen = CMS_linxesCatalog::getWatchers($father);
             if ($temp_regen) {
                 $regen_pages = array_merge($regen_pages, $temp_regen);
             }
         }
         //apply changes on the page
         $page->deleteFiles();
         CMS_linxesCatalog::deleteLinxes($page, true);
         CMS_tree::detachPageFromTree($page, true);
     }
     //regenerate the pages that needs to be, but first pull off the array the ids of the unpublished pages
     $regen_pages = array_unique(array_diff($regen_pages, $unpublished));
     CMS_tree::submitToRegenerator($regen_pages, false);
 }
Example #4
0
//then display all Trees (queried Root and other user sections)
$content .= '<table border="0" cellpadding="2" cellspacing="0">';
foreach ($getRoot as $aRootID) {
    if ($pages[$aRootID]) {
        $treeRoot = $pages[$aRootID];
    } else {
        $treeRoot = CMS_tree::getPageByID($aRootID);
        $pages[$aRootID] = $treeRoot;
    }
    $pl = SensitiveIO::sanitizeHTMLString($pageLink);
    $pl = str_replace(chr(167) . chr(167), "?", $pl);
    $pl = str_replace(chr(167), "&amp;", $pl);
    $lineage = is_array($lineages[$aRootID]) ? $lineages[$aRootID] : CMS_tree::getLineage($cms_root->getID(), $treeRoot->getID(), false);
    $grand_grand_father = CMS_tree::getAncestor($treeRoot, '3', false);
    $grand_father = CMS_tree::getAncestor($treeRoot, '2', false);
    $father = CMS_tree::getAncestor($treeRoot, '1', false);
    if ($grand_grand_father && $cms_user->hasPageClearance($grand_grand_father->getID(), CLEARANCE_PAGE_VIEW)) {
        $brothers = CMS_tree::getSiblings($grand_grand_father, '0');
    } elseif ($grand_father && $cms_user->hasPageClearance($grand_father->getID(), CLEARANCE_PAGE_VIEW)) {
        $brothers = array($grand_father);
    } elseif ($father && $cms_user->hasPageClearance($father->getID(), CLEARANCE_PAGE_VIEW)) {
        $brothers = array($father);
    } else {
        $brothers = array($treeRoot);
    }
    foreach ($brothers as $aBrother) {
        if ($cms_user->hasPageClearance($aBrother->getID(), CLEARANCE_PAGE_VIEW)) {
            if (!in_array($aBrother->getID(), $displayed)) {
                $displayed[] = $aBrother->getID();
                getBigTree($cms_user, $content, $aBrother, '0', $pl, $pageProperty, false);
            }
Example #5
0
 /**
  * Deletes a page from the tree (it will not be deleted, only detached).
  * Static function.
  *
  * @param CMS_page $page The page to delete
  * @param boolean $publicTree Do we want to fetch the public tree or the edited one ?
  * @return boolean true on success, false on failure
  * @access public
  */
 static function detachPageFromTree(&$page, $publicTree = false)
 {
     //check argument is a page
     if (!is_a($page, "CMS_page")) {
         CMS_grandFather::raiseError("Page must be instance of CMS_page");
         return false;
     }
     //check that the page to detach ain't the root.
     $root = CMS_tree::getRoot();
     if ($root->getID() == $page->getID()) {
         CMS_grandFather::raiseError("Can't detach root");
         return false;
     }
     $table = $publicTree ? "linx_tree_public" : "linx_tree_edited";
     $father = CMS_tree::getAncestor($page, 1);
     if (!$father) {
         //page is not in the tree
         return true;
     }
     //get the current sibling order of the page
     $sql = "\n\t\t\tselect\n\t\t\t\torder_ltr\n\t\t\tfrom\n\t\t\t\t" . $table . "\n\t\t\twhere\n\t\t\t\tfather_ltr='" . $father->getID() . "'\n\t\t";
     $q = new CMS_query($sql);
     $current_sibling_order = $q->getValue("order_ltr");
     //delete page from the table
     $sql = "\n\t\t\tdelete from\n\t\t\t\t" . $table . "\n\t\t\twhere\n\t\t\t\tsibling_ltr='" . $page->getID() . "'\n\t\t";
     $q = new CMS_query($sql);
     //compact siblings orders of father
     CMS_tree::compactSiblingOrder($father, $publicTree);
     return true;
 }