merge -r1287 from branch-1_6 to trunk

bug 349: Nicer display messages instead of "die" when urls cannot be 
solved (also set 404 status code for bots)

git-svn-id: http://piwigo.org/svn/trunk@1288 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices 2006-04-28 05:12:25 +00:00
parent 0510cfdc5a
commit aaea0a1653
5 changed files with 34 additions and 2 deletions

View file

@ -591,4 +591,22 @@ function access_denied()
redirect($login_url);
}
}
/**
* exits the current script with 404 code when a page cannot be found
* @param string msg a message to display
* @param string alternate_url redirect to this url
*/
function page_not_found($msg, $alternate_url=null)
{
header('HTTP/1.1 404 Not found');
header('Status: 404 Not found');
if ($alternate_url==null)
$alternate_url = make_index_url();
redirect( $alternate_url,
'<div style="text-align:left; margin-left:5em;margin-bottom:5em;">
<h1 style="text-align:left; font-size:36px;">Page not found</h1><br/>'
.$msg.'</div>',
5 );
}
?>