define("MESSAGE_PAGE_ERROR_CODENAME", 1747); //RIGHTS CHECK if (!$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_REGENERATEPAGES)) { Header("Location: " . PATH_ADMIN_SPECIAL_ENTRY_WR . "?cms_message_id=" . MESSAGE_CLEARANCE_INSUFFICIENT . "&" . session_name() . "=" . session_id()); exit; } $website = new CMS_website($_GET["website"]); $grand_root = CMS_tree::getRoot(); //website root page change if ($_GET["cms_action"] == "set_root" && $_GET["website_root"]) { $page = CMS_tree::getPageByID($_GET["website_root"]); //must check that the page ain't the root of another website already $all_websites = CMS_websitesCatalog::getAll(); foreach ($all_websites as $aWebsite) { $current_root = $aWebsite->getRoot(); if ($current_root->getID() == $page->getID() && $aWebsite->getID() != $website->getID()) { Header("Location: websites.php?cms_message_id=" . MESSAGE_PAGE_ROOT_ALREADY_USED . "&" . session_name() . "=" . session_id()); exit; } } if (!$website->setRoot($page)) { Header("Location: websites.php?cms_message_id=" . MESSAGE_PAGE_ROOT_SET_ERROR . "&" . session_name() . "=" . session_id()); exit; } } $dialog = new CMS_dialog(); //Action management switch ($_POST["cms_action"]) { case "validate": //checks and assignments $cms_message = "";
/** * Returns all the websites, sorted by label. * Static function. * * @param string $orderby, order of the websites returned in : label (default) or id * @return array(CMS_website) * @access public */ static function getAll($orderby = 'label') { static $websites; if (!isset($websites[$orderby])) { $sql = "\n\t\t\t\tselect\n\t\t\t\t\tid_web\n\t\t\t\tfrom\n\t\t\t\t\twebsites\n\t\t\t\torder by\n\t\t\t\t\t" . sensitiveIO::sanitizeSQLString($orderby) . "_web\n\t\t\t"; $q = new CMS_query($sql); $websites[$orderby] = array(); while ($id = $q->getValue("id_web")) { $ws = new CMS_website($id); if (!$ws->hasError()) { $websites[$orderby][$ws->getID()] = $ws; } } } return $websites[$orderby]; }