pluf2

pluf2 Commit Details


Date:2008-11-30 04:20:30 (16 years 22 days ago)
Author:Loic d'Anterroches
Branch:master
Commit:964dc2d87da9c823572ce892d4b57aea048127b1
Parents: 3fb39807c9713cfd926592223c37d19b76c43f5d
Message:Improved the handling of the 404 errors to be simple by default.

Changes:

File differences

src/Pluf/Dispatcher.php
116116
117117
118118
119
119
120120
121121
122122
}
}
}
return new Pluf_HTTP_Response_NotFound(sprintf(__('The page <em>%s</em> was not found on the server.'), htmlspecialchars($req->query)));
return new Pluf_HTTP_Response_NotFound($req);
}
/**
src/Pluf/HTTP/Response/NotFound.php
2323
2424
2525
26
26
2727
28
29
30
31
32
33
34
35
36
37
38
39
2840
2941
3042
class Pluf_HTTP_Response_NotFound extends Pluf_HTTP_Response
{
function __construct($content, $mimetype=null)
function __construct($request)
{
$content = '';
try {
$context = new Pluf_Template_Context(array('query' => $request->query));
$tmpl = new Pluf_Template('404.html');
$content = $tmpl->render($context);
$mimetype = null;
} catch (Exception $e) {
$mimetype = 'text/plain';
$content = sprintf('The requested URL %s was not found on this server.'."\n"
.'Please check the URL and try again.'."\n\n".'404 - Not Found',
Pluf_esc($request->query));
}
parent::__construct($content, $mimetype);
$this->status_code = 404;
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.06622s using 13 queries.