From 3ab430e4b194b7d741e3337aee2a0ddbcc49b9f6 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 28 Mar 2012 13:03:49 +0200 Subject: [PATCH] Adding api_not_found function --- main/inc/lib/main_api.lib.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php index 3db9fe4dcc..17ee245716 100644 --- a/main/inc/lib/main_api.lib.php +++ b/main/inc/lib/main_api.lib.php @@ -2565,6 +2565,22 @@ function api_is_anonymous($user_id = null, $db_check = false) { return isset($_user['is_anonymous']) && $_user['is_anonymous'] === true; } +/* + * Returns a not found page + * @todo use smarty to customize the not found page + */ +function api_not_found($print_headers = false) { + $origin = isset($_GET['origin']) ? $_GET['origin'] : ''; + $show_headers = 0; + if ((!headers_sent() || $print_headers) && $origin != 'learnpath') { + $show_headers = 1; + } + $tpl = new Template(null, $show_headers, $show_headers); + $msg = get_lang('NotFound'); + $tpl->assign('content', $msg); + $tpl->display_one_col_template(); +} + /** * Displays message "You are not allowed here..." and exits the entire script. * @param bool Whether or not to print headers (default = false -> does not print them)