Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
error.php
Go to the documentation of this file.
1 <?php
2 
3 $type = elgg_extract('type', $vars);
4 $params = elgg_extract('params', $vars);
5 
6 if (elgg_view_exists("errors/$type")) {
7  $title = elgg_echo("error:$type:title");
8  if ($title == "error:$type:title") {
9  // use default if there is no title for this error type
10  $title = elgg_echo("error:default:title");
11  }
12 
13  $content = elgg_view("errors/$type", $params);
14 } else {
15  $title = elgg_echo("error:default:title");
16  $content = elgg_view("errors/default", $params);
17 }
18 
19 $httpCodes = array(
20  '400' => 'Bad Request',
21  '401' => 'Unauthorized',
22  '403' => 'Forbidden',
23  '404' => 'Not Found',
24  '407' => 'Proxy Authentication Required',
25  '500' => 'Internal Server Error',
26  '503' => 'Service Unavailable',
27 );
28 
29 if (isset($httpCodes[$type])) {
30  header("HTTP/1.1 $type {$httpCodes[$type]}");
31 }
32 
33 $layout = elgg_in_context('admin') ? 'admin' : 'error';
34 
36  'title' => $title,
37  'content' => $content,
38 ));
elgg_view_exists($view, $viewtype= '', $recurse=true)
Returns whether the specified view exists.
Definition: views.php:299
$content
Definition: error.php:16
$httpCodes
Definition: error.php:19
if(isset($vars['class'])) $vars['class']
Definition: error.php:14
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_view_layout($layout_name, $vars=array())
Displays a layout with optional parameters.
Definition: views.php:679
$type
Definition: error.php:3
$title
Definition: save.php:22
elgg_in_context($context)
Check if this context exists anywhere in the stack.
Definition: pageowner.php:241
if(isset($httpCodes[$type])) $layout
Definition: error.php:33
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:342
$params
Definition: error.php:4
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1310
$body
Definition: error.php:35
elgg_view_page($title, $body, $page_shell= 'default', $vars=array())
Assembles and outputs a full page.
Definition: views.php:437