summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/bootstrap.inc4
-rw-r--r--includes/common.inc18
-rw-r--r--includes/menu.inc18
-rw-r--r--includes/theme.inc12
4 files changed, 39 insertions, 13 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 53289fed5..53932807d 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -168,9 +168,9 @@ function referer_uri() {
}
function arg($index) {
- static $arguments;
+ static $arguments, $q;
- if (empty($arguments)) {
+ if (empty($arguments) || $q != $_GET["q"]) {
$arguments = explode("/", $_GET["q"]);
}
diff --git a/includes/common.inc b/includes/common.inc
index 3b086f736..4376fa685 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -103,6 +103,24 @@ function drupal_rebuild_path_map() {
drupal_get_path_map("rebuild");
}
+function drupal_not_found() {
+ header("HTTP/1.0 404 Not Found");
+ watchdog("httpd", "404 error: ". $_GET['q'] ." not found");
+
+ $path = drupal_get_normal_path(variable_get('site_404', ''));
+
+ if ($path) {
+ menu_set_active_item($path);
+ }
+
+ if ($path && menu_active_handler_exists()) {
+ menu_execute_active_handler();
+ }
+ else {
+ print theme("page", '<h1>'. t('Page not found') .'</h1>');
+ }
+}
+
function error_handler($errno, $message, $filename, $line, $variables) {
$types = array(1 => "error", 2 => "warning", 4 => "parse error", 8 => "notice", 16 => "core error", 32 => "core warning", 64 => "compile error", 128 => "compile warning", 256 => "user error", 512 => "user warning", 1024 => "user notice");
$entry = $types[$errno] .": $message in $filename on line $line.";
diff --git a/includes/menu.inc b/includes/menu.inc
index 3274fdea4..e3e617e02 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -34,18 +34,28 @@ function menu_get_trail($path) {
* Returns the path of the active menu item.
*/
function menu_get_active_item() {
+ return menu_set_active_item();
+}
+
+function menu_set_active_item($path = NULL) {
global $_list;
- static $path;
+ static $stored_path;
- if (empty($path)) {
- $path = $_GET["q"];
+ if (is_null($stored_path) || !empty($path)) {
+ if (empty($path)) {
+ $path = $_GET["q"];
+ }
+ else {
+ $_GET['q'] = $path;
+ }
while ($path && !$_list[$path]) {
$path = substr($path, 0, strrpos($path, "/"));
}
+ $stored_path = $path;
}
- return $path;
+ return $stored_path;
}
/**
diff --git a/includes/theme.inc b/includes/theme.inc
index 0df0e2fba..7bb62b82d 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -131,13 +131,11 @@ function path_to_theme() {
* @return a string containing the @a header output.
*/
function theme_header() {
- global $base_url;
-
$output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
$output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
$output .= "<head>";
$output .= " <title>". drupal_get_title() ? drupal_get_title() : variable_get(site_name, "drupal") ."</title>";
- $output .= theme_head($main);
+ $output .= theme_head();
$output .= " <style type=\"text/css\" media=\"all\">";
$output .= " @import url(misc/drupal.css);";
$output .= " </style>";
@@ -366,10 +364,10 @@ function theme_box($title, $content, $region = "main") {
* @return a string containing the @a box output.
*/
function theme_block($block) {
- $output = "<div class=\"block block-$block->module\" id=\"block-$block->module-$block->delta\">";
- $output .= " <h2 class=\"title\">$block->subject</h2>";
- $output .= " <div class=\"content\">$block->content</div>";
- $output .= "</div>";
+ $output = "<div class=\"block block-$block->module\" id=\"block-$block->module-$block->delta\">\n";
+ $output .= " <h2 class=\"title\">$block->subject</h2>\n";
+ $output .= " <div class=\"content\">$block->content</div>\n";
+ $output .= "</div>\n";
return $output;
}