function __construct() { parent::__construct(); $this->_query_string = parent::__buildQueryString(array('debug')); if (!empty($this->_query_string)) { $this->_query_string = '&' . General::sanitize($this->_query_string); } }
$Page->Body->appendChild($div); $ul = new XMLElement('ul', NULL, array('id' => 'details')); $errors_grouped = array(); list($key, $val) = $additional['proc']->getError(false, true); do { if (preg_match('/^loadXML\\(\\)/i', $val['message']) && preg_match_all('/line:\\s+(\\d+)/i', $val['message'], $matches)) { $errors_grouped['xml'][] = array('line' => $matches[1][0], 'raw' => $val); } elseif (preg_match_all('/pages\\/([^.\\/]+\\.xsl)\\s+line\\s+(\\d+)/i', $val['message'], $matches)) { $errors_grouped['page'][$matches[1][0]][] = array('line' => $matches[2][0], 'raw' => $val); } elseif (preg_match_all('/utilities\\/([^.\\/]+\\.xsl)\\s+line\\s+(\\d+)/i', $val['message'], $matches)) { $errors_grouped['utility'][$matches[1][0]][] = array('line' => $matches[2][0], 'raw' => $val); } else { $errors_grouped['general'][] = $val; } } while (list($key, $val) = $additional['proc']->getError()); $query_string = General::sanitize($Page->__buildQueryString()); if (strlen(trim($query_string)) > 0) { $query_string = "&{$query_string}"; } foreach ($errors_grouped as $group => $data) { switch ($group) { case 'general': $dl = new XMLElement('dl'); $dt = new XMLElement('dt', __('<a href="%s" title="Show debug view">Compile</a>', array('?debug' . $query_string))); $dl->appendChild($dt); foreach ($data as $e) { $lines[] = $e['line']; $dd = new XMLElement('dd', $e['message']); $dl->appendChild($dd); } $li = new XMLElement('li');
/** * 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; }