} if ($newsite != 0) { $siteID = $newsite; foreach ($sites as $currSite) { if ($siteID == $currSite['PNAME']) { $sitePNAME = $currSite['PNAME']; } } $sitePNAME = ''; } else { $siteID = $sites[0]['ID']; $sitePNAME = $sites[0]['PNAME']; } $icons = new Icons(); $PageMgr = new PageMgr($siteID); $pages = $PageMgr->getTree($node_id, 2, 1); $xml_tree = array(); $tree_id = 0; $tree_level = 0; if ($node_id) { $root_id = 'page_' . $pages[0]['ID']; $root_name = htmlspecialchars($pages[0]['NAME']); $root_cststyle = ''; $sitePNAME = $pages[0]['PNAME']; } else { $node_id = 1; $root_id = 'root_1'; $root_name = $itext['TXT_PAGES'] != '' ? $itext['TXT_PAGES'] : '$TXT_PAGES'; $root_cststyle = 'root'; if (!$pages[0]['RSUB']) { $root_cststyle .= ' nosub';
$jsQueue->add($source, HISTORYTYPE_PAGE, 'PAGE_MOVE', sGuiUS(), $target . '-' . $targetsite, 1); } else { $jsQueue->add($source, HISTORYTYPE_PAGE, 'PAGE_MOVE', sGuiUS(), $target . '-' . $targetsite); } } break; case 'pageSelectNode': $node = $this->params['node']; $siteID = $this->params['siteID']; $wid = $this->params['wid']; if ($node == 'trash') { break; } // Pages $pageMgr = new PageMgr($siteID); $root_node = $pageMgr->getTree(NULL, 0); $page = $pageMgr->getPage($node); // 1 = rsub // 2 = rread // 3 = rdelete // 4 = parent -> rsub & rwrite // 5 = parent -> rsub & rwrite // 6 = rdelete $buttons = array(); // Get Parents $parents = $pageMgr->getParents($node); $parentid = $parents[0][0]['ID']; // Check rights $rread = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $node, "RREAD"); $rwrite = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $node, "RWRITE"); $rsub = $page->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $node, "RSUB");
/** * Moves this Page to the trashcan * * @return array Array with all elements which were successfully deleted */ function delete() { $pageID = (int) $this->_id; $pageMgr = new PageMgr($this->getSite()); $rootNode = $pageMgr->tree->getRoot(); if ($pageID == $rootNode) { return array(); } // Check if object is a folder $successNodes = array(); $subNodes = $pageMgr->getTree($pageID, 1000, false, true); if (count($subNodes) > 0) { array_shift($subNodes); foreach ($subNodes as $subNode) { if ($this->permissions->checkInternal($this->_uid, $subNode['ID'], "RDELETE")) { $page = $pageMgr->getPage($subNode['ID']); $successfullyDeleted = $page->delete(); if (in_array($subNode['ID'], $successfullyDeleted) === true) { foreach ($successfullyDeleted as $successfullyDeletedItem) { $successNodes[] = $successfullyDeletedItem; } } } } } if ($this->permissions->checkInternal($this->_uid, $pageID, "RDELETE")) { // Move to root level $pageMgr->tree->moveTo($pageID, $rootNode); // Set to "DELETED" $sql = "UPDATE yg_site_" . $this->_site . "_properties SET DELETED = 1 WHERE OBJECTID = ?;"; sYDB()->Execute($sql, $pageID); $successNodes[] = $pageID; $pageMgr->callExtensionHook("onDelete", $this->getSite(), $this->_id, $version); } if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/PAGE_DELETE") == "true") { Singleton::FC()->emptyBucket(); } return $successNodes; }
$sites = $siteMgr->getList(); if ($newsite != 0) { $siteID = $newsite; foreach ($sites as $currSite) { if ($siteID == $currSite['ID']) { $sitePNAME = $currSite['PNAME']; } } } else { $siteID = $sites[0]['ID']; $sitePNAME = $sites[0]['PNAME']; } $icons = new Icons(); $pageMgr = new PageMgr($siteID); // All pages $pagesList = $pageMgr->getTree($node_id, 2); $xml_tree = array(); $tree_id = 0; $tree_level = 0; if ($node_id) { $root_id = 'page_' . $pagesList[0]['ID']; $root_name = htmlspecialchars($pagesList[0]['NAME']); $root_cststyle = ''; $sitePNAME = $pagesList[0]['PNAME']; } else { $node_id = 1; $root_id = 'root_1'; $root_name = $itext['TXT_PAGES'] != '' ? $itext['TXT_PAGES'] : '$TXT_PAGES'; $root_cststyle = 'root'; if (!$pagesList[0]['RSUB']) { $root_cststyle .= ' nosub';
} if ($pagePName) { // Throw status 301 and redirect $header = $_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently'; $qs = ""; if ($_SERVER['QUERY_STRING'] != "") { $qs = "?" . $_SERVER['QUERY_STRING']; } header($header); header('Location: ' . $webroot_path_string . '/' . $sinfo['PNAME'] . '/' . $pagePName . '/' . $qs); die; } else { // Throw status 403 sUserMgr()->impersonate(sUserMgr()->getAdministratorID()); $pageMgr = new PageMgr($siteID); $pagesList = $pageMgr->getTree($pageMgr->tree->getRoot(), 2); foreach ($pagesList as $currPage) { $tmpPage = $pageMgr->getPage($currPage['ID']); if ($tmpPage) { $pageInfo = $tmpPage->get(); if ($pageInfo && $pageInfo['DELETED'] == 0 && $currPage['LEVEL'] == 2 && $pageID == 0) { $pageID = $currPage['ID']; } } } $tmpPage = $pageMgr->getPublishedPage($pageID); if ($tmpPage) { $tmpPageinfo = $tmpPage->get(); } // Call callback $pageMgr->callExtensionHook("onAccessDenied", $siteID, $pageID, $tmpPageinfo['VERSION'], array("FILTER" => $filter, "CONTENTAREAS" => &$inhalte));
$koala->queueScript('Koala.windows[\'wid_' . $this->request->parameters['win_no'] . '\'].setStageButton( \'' . $pageInfo['RSTAGE'] . '\' );'); } if (strlen($pageInfo['PNAME']) < 1) { $pageInfo['PNAME'] = $page->calcPName(); } $templateid = $pageInfo["TEMPLATEID"]; $naviid = $pageInfo["NAVIGATIONID"]; $templateInfo = $templateMgr->getTemplate($templateid); $templateInfo["PREVIEWPATH"] = $templateMgr->getPreviewPath($templateid); $navis = $templateMgr->getNavis($templateid); for ($i = 0; $i < count($navis); $i++) { if ($navis[$i]["ID"] == $naviid) { $naviinfo = $navis[$i]; } } $pageList = $pageMgr->getTree($pageID, 1); for ($i = 0; $i < count($pageList); $i++) { if ($pageList[$i]["PARENT"] == $pageID) { $currentPage = $pageMgr->getPage($pageList[$i]["ID"]); $pageList[$i]["INFO"] = $currentPage->get(); if ($pageList[$i]["VERSIONPUBLISHED"] == $pageList[$i]["VERSION"] - 1) { $pageList[$i]["APPROVED"] = 1; } $children[] = $pageList[$i]; } } $koala->queueScript('Koala.windows[\'wid_' . $this->request->parameters['win_no'] . '\'].setLocked( \'' . $lockedByUser['ID'] . '\' );'); $smarty->assign("children", $children); $smarty->assign("page_id", $pageID); $smarty->assign("site_id", $siteID); $smarty->assign("site", $siteID);