本文整理汇总了PHP中HTMLPage::handleFailedAuthorisation方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLPage::handleFailedAuthorisation方法的具体用法?PHP HTMLPage::handleFailedAuthorisation怎么用?PHP HTMLPage::handleFailedAuthorisation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLPage
的用法示例。
在下文中一共展示了HTMLPage::handleFailedAuthorisation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __buildPage
/**
* Given the URL path of a Symphony backend page, this function will
* attempt to resolve the URL to a Symphony content page in the backend
* or a page provided by an extension. This function checks to ensure a user
* is logged in, otherwise it will direct them to the login page
*
* @param string $page
* The URL path after the root of the Symphony installation, including a starting
* slash, such as '/login/'
* @return HTMLPage
*/
private function __buildPage($page)
{
$is_logged_in = $this->isLoggedIn();
if (empty($page) || is_null($page)) {
if (!$is_logged_in) {
$page = "/login";
} else {
// Will redirect an Author to their default area of the Backend
// Integers are indicative of section's, text is treated as the path
// to the page after `SYMPHONY_URL`
$default_area = null;
if (is_numeric($this->Author->get('default_area'))) {
$section_handle = Symphony::Database()->fetchVar('handle', 0, "SELECT `handle` FROM `tbl_sections` WHERE `id` = '" . $this->Author->get('default_area') . "' LIMIT 1");
if (!$section_handle) {
$section_handle = Symphony::Database()->fetchVar('handle', 0, "SELECT `handle` FROM `tbl_sections` ORDER BY `sortorder` LIMIT 1");
}
if (!is_null($section_handle)) {
$default_area = "/publish/{$section_handle}/";
}
} else {
if (!is_null($this->Author->get('default_area'))) {
$default_area = preg_replace('/^' . preg_quote(SYMPHONY_URL, '/') . '/i', '', $this->Author->get('default_area'));
}
}
if (is_null($default_area)) {
if ($this->Author->isDeveloper()) {
$section_handle = Symphony::Database()->fetchVar('handle', 0, "SELECT `handle` FROM `tbl_sections` ORDER BY `sortorder` LIMIT 1");
if (!is_null($section_handle)) {
// If there are sections created, redirect to the first one (sortorder)
redirect(SYMPHONY_URL . "/publish/{$section_handle}/");
} else {
// If there are no sections created, default to the Section page
redirect(SYMPHONY_URL . '/blueprints/sections/');
}
} else {
redirect(SYMPHONY_URL . "/system/authors/edit/" . $this->Author->get('id') . "/");
}
} else {
redirect(SYMPHONY_URL . $default_area);
}
}
}
if (!($this->_callback = $this->getPageCallback($page))) {
$this->errorPageNotFound();
}
include_once (isset($this->_callback['driverlocation']) ? $this->_callback['driverlocation'] : CONTENT) . '/content.' . $this->_callback['driver'] . '.php';
$this->Page = new $this->_callback['classname']($this);
if (!$is_logged_in && $this->_callback['driver'] != 'login') {
if (is_callable(array($this->Page, 'handleFailedAuthorisation'))) {
$this->Page->handleFailedAuthorisation();
} else {
include_once CONTENT . '/content.login.php';
$this->Page = new contentLogin($this);
$this->Page->build();
}
} else {
if (!is_array($this->_callback['context'])) {
$this->_callback['context'] = array();
}
// Check for update Alert
if (file_exists(DOCROOT . '/update.php') && $this->__canAccessAlerts()) {
if (file_exists(DOCROOT . '/README.markdown') && is_readable(DOCROOT . '/README.markdown')) {
$readme = file(DOCROOT . '/README.markdown', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$readme = trim(str_replace('- Version:', '', $readme[1]));
$current_version = Symphony::Configuration()->get('version', 'symphony');
// The updater contains a version higher than the current Symphony version.
if (version_compare($current_version, $readme, '<')) {
$message = __('Run the updater to update Symphony to %s. <a href="%s">View Update</a>', array($readme, URL . "/update.php"));
} else {
$message = __('Your Symphony installation is up to date, but an updater script was still detected. For security reasons, it should be removed. <a href="%s/update.php?action=remove">Remove Update Script</a>', array(URL));
}
} else {
$message = __('An updater script has been found in your installation. <a href="%s">View Update</a>', array(URL . "/update.php"));
}
$this->Page->pageAlert($message, Alert::NOTICE);
}
// Do any extensions need updating?
$extensions = Symphony::ExtensionManager()->listInstalledHandles();
if (is_array($extensions) && !empty($extensions) && $this->__canAccessAlerts()) {
foreach ($extensions as $name) {
$about = Symphony::ExtensionManager()->about($name);
if ($about['status'] == EXTENSION_REQUIRES_UPDATE) {
$this->Page->pageAlert(__('An extension requires updating. <a href="%s">View Extensions</a>', array(SYMPHONY_URL . '/system/extensions/')));
break;
}
}
}
$this->Page->build($this->_callback['context']);
}
//.........这里部分代码省略.........
示例2: __buildPage
/**
* Given the URL path of a Symphony backend page, this function will
* attempt to resolve the URL to a Symphony content page in the backend
* or a page provided by an extension. This function checks to ensure a user
* is logged in, otherwise it will direct them to the login page
*
* @param string $page
* The URL path after the root of the Symphony installation, including a starting
* slash, such as '/login/'
* @throws SymphonyErrorPage
* @throws Exception
* @return HTMLPage
*/
private function __buildPage($page)
{
$is_logged_in = self::isLoggedIn();
if (empty($page) || is_null($page)) {
if (!$is_logged_in) {
$page = "/login";
} else {
// Will redirect an Author to their default area of the Backend
// Integers are indicative of section's, text is treated as the path
// to the page after `SYMPHONY_URL`
$default_area = null;
if (is_numeric(Symphony::Author()->get('default_area'))) {
$default_section = SectionManager::fetch(Symphony::Author()->get('default_area'));
if ($default_section instanceof Section) {
$section_handle = $default_section->get('handle');
}
if (!$section_handle) {
$all_sections = SectionManager::fetch();
if (!empty($all_sections)) {
$section_handle = $all_sections[0]->get('handle');
} else {
$section_handle = null;
}
}
if (!is_null($section_handle)) {
$default_area = "/publish/{$section_handle}/";
}
} elseif (!is_null(Symphony::Author()->get('default_area'))) {
$default_area = preg_replace('/^' . preg_quote(SYMPHONY_URL, '/') . '/i', '', Symphony::Author()->get('default_area'));
}
if (is_null($default_area)) {
if (Symphony::Author()->isDeveloper()) {
$all_sections = SectionManager::fetch();
$section_handle = !empty($all_sections) ? $all_sections[0]->get('handle') : null;
if (!is_null($section_handle)) {
// If there are sections created, redirect to the first one (sortorder)
redirect(SYMPHONY_URL . "/publish/{$section_handle}/");
} else {
// If there are no sections created, default to the Section page
redirect(SYMPHONY_URL . '/blueprints/sections/');
}
} else {
redirect(SYMPHONY_URL . "/system/authors/edit/" . Symphony::Author()->get('id') . "/");
}
} else {
redirect(SYMPHONY_URL . $default_area);
}
}
}
if (!($this->_callback = $this->getPageCallback($page))) {
if ($page === '/publish/') {
$sections = SectionManager::fetch(null, 'ASC', 'sortorder');
$section = current($sections);
redirect(SYMPHONY_URL . '/publish/' . $section->get('handle'));
} else {
$this->errorPageNotFound();
}
}
include_once $this->_callback['driver_location'];
$this->Page = new $this->_callback['classname']();
if (!$is_logged_in && $this->_callback['driver'] != 'login') {
if (is_callable(array($this->Page, 'handleFailedAuthorisation'))) {
$this->Page->handleFailedAuthorisation();
} else {
include_once CONTENT . '/content.login.php';
$this->Page = new contentLogin();
$this->Page->build(array('redirect' => $page));
}
} else {
if (!is_array($this->_callback['context'])) {
$this->_callback['context'] = array();
}
// Do any extensions need updating?
$extensions = Symphony::ExtensionManager()->listInstalledHandles();
if (is_array($extensions) && !empty($extensions) && $this->__canAccessAlerts()) {
foreach ($extensions as $name) {
$about = Symphony::ExtensionManager()->about($name);
if (array_key_exists('status', $about) && in_array(EXTENSION_REQUIRES_UPDATE, $about['status'])) {
$this->Page->pageAlert(__('An extension requires updating.') . ' <a href="' . SYMPHONY_URL . '/system/extensions/">' . __('View extensions') . '</a>');
break;
}
}
}
// Check for update Alert
// Scan install/migrations directory for the most recent updater and compare
if ($this->isInstallerAvailable() && $this->__canAccessAlerts()) {
try {
//.........这里部分代码省略.........
示例3: __buildPage
/**
* Given the URL path of a Symphony backend page, this function will
* attempt to resolve the URL to a Symphony content page in the backend
* or a page provided by an extension. This function checks to ensure a user
* is logged in, otherwise it will direct them to the login page
*
* @param string $page
* The URL path after the root of the Symphony installation, including a starting
* slash, such as '/login/'
* @throws SymphonyErrorPage
* @throws Exception
* @return HTMLPage
*/
private function __buildPage($page)
{
$is_logged_in = self::isLoggedIn();
if (empty($page) || is_null($page)) {
if (!$is_logged_in) {
$page = "/login";
} else {
// Will redirect an Author to their default area of the Backend
// Integers are indicative of section's, text is treated as the path
// to the page after `SYMPHONY_URL`
$default_area = null;
if (is_numeric(Symphony::Author()->get('default_area'))) {
$default_section = SectionManager::fetch(Symphony::Author()->get('default_area'));
if ($default_section instanceof Section) {
$section_handle = $default_section->get('handle');
}
if (!$section_handle) {
$all_sections = SectionManager::fetch();
if (!empty($all_sections)) {
$section_handle = $all_sections[0]->get('handle');
} else {
$section_handle = null;
}
}
if (!is_null($section_handle)) {
$default_area = "/publish/{$section_handle}/";
}
} elseif (!is_null(Symphony::Author()->get('default_area'))) {
$default_area = preg_replace('/^' . preg_quote(SYMPHONY_URL, '/') . '/i', '', Symphony::Author()->get('default_area'));
}
if (is_null($default_area)) {
if (Symphony::Author()->isDeveloper()) {
$all_sections = SectionManager::fetch();
$section_handle = !empty($all_sections) ? $all_sections[0]->get('handle') : null;
if (!is_null($section_handle)) {
// If there are sections created, redirect to the first one (sortorder)
redirect(SYMPHONY_URL . "/publish/{$section_handle}/");
} else {
// If there are no sections created, default to the Section page
redirect(SYMPHONY_URL . '/blueprints/sections/');
}
} else {
redirect(SYMPHONY_URL . "/system/authors/edit/" . Symphony::Author()->get('id') . "/");
}
} else {
redirect(SYMPHONY_URL . $default_area);
}
}
}
if (!($this->_callback = $this->getPageCallback($page))) {
if ($page === '/publish/') {
$sections = SectionManager::fetch(null, 'ASC', 'sortorder');
$section = current($sections);
redirect(SYMPHONY_URL . '/publish/' . $section->get('handle'));
} else {
$this->errorPageNotFound();
}
}
include_once $this->_callback['driver_location'];
$this->Page = new $this->_callback['classname']();
if (!$is_logged_in && $this->_callback['driver'] !== 'login') {
if (is_callable(array($this->Page, 'handleFailedAuthorisation'))) {
$this->Page->handleFailedAuthorisation();
} else {
include_once CONTENT . '/content.login.php';
$this->Page = new contentLogin();
// Include the query string for the login, RE: #2324
if ($queryString = $this->Page->__buildQueryString(array('symphony-page', 'mode'), FILTER_SANITIZE_STRING)) {
$page .= '?' . $queryString;
}
$this->Page->build(array('redirect' => $page));
}
} else {
if (!is_array($this->_callback['context'])) {
$this->_callback['context'] = array();
}
if ($this->__canAccessAlerts()) {
// Can the core be updated?
$this->checkCoreForUpdates();
// Do any extensions need updating?
$this->checkExtensionsForUpdates();
}
$this->Page->build($this->_callback['context']);
}
return $this->Page;
}