1
0

Use HTTP 404 where needed

This commit is contained in:
Garvin Hicking
2007-06-14 09:14:15 +00:00
parent 97410ba98d
commit 0947729d16
2 changed files with 23 additions and 4 deletions

View File

@ -3,6 +3,10 @@
Version 1.2 () Version 1.2 ()
------------------------------------------------------------------------ ------------------------------------------------------------------------
* When a category or entry does not exist, emit HTTP 404 message
template instead of "No entries to print" and HTTP 200 status.
(garvinhicking)
* Fix URL permalink lookup in some cases (garvinhicking, beta2) * Fix URL permalink lookup in some cases (garvinhicking, beta2)
* Add admin backend templates for main area and the entry editor. * Add admin backend templates for main area and the entry editor.

View File

@ -278,6 +278,9 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
if (is_array($title)) { if (is_array($title)) {
$serendipity['head_title'] = htmlspecialchars($title[0]); $serendipity['head_title'] = htmlspecialchars($title[0]);
$serendipity['head_subtitle'] = htmlspecialchars($serendipity['blogTitle']); $serendipity['head_subtitle'] = htmlspecialchars($serendipity['blogTitle']);
} else {
$serendipity['view'] = '404';
header('HTTP/1.0 404 Not found');
} }
ob_start(); ob_start();
@ -413,8 +416,14 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
} }
$cInfo = serendipity_fetchCategoryInfo($serendipity['GET']['category']); $cInfo = serendipity_fetchCategoryInfo($serendipity['GET']['category']);
$serendipity['head_title'] = $cInfo['category_name'];
$serendipity['head_subtitle'] = $serendipity['blogTitle']; if (!is_array($cInfo)) {
$serendipity['view'] = '404';
header('HTTP/1.0 404 Not found');
} else {
$serendipity['head_title'] = $cInfo['category_name'];
$serendipity['head_subtitle'] = $serendipity['blogTitle'];
}
include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php'); include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
} else if ($is_multiauth || preg_match(PAT_PERMALINK_AUTHORS, $uri, $matches)) { } else if ($is_multiauth || preg_match(PAT_PERMALINK_AUTHORS, $uri, $matches)) {
@ -452,8 +461,14 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
} }
$uInfo = serendipity_fetchUsers($serendipity['GET']['viewAuthor']); $uInfo = serendipity_fetchUsers($serendipity['GET']['viewAuthor']);
$serendipity['head_title'] = sprintf(ENTRIES_BY, $uInfo[0]['realname']);
$serendipity['head_subtitle'] = $serendipity['blogTitle']; if (!is_array($uInfo)) {
$serendipity['view'] = '404';
header('HTTP/1.0 404 Not found');
} else {
$serendipity['head_title'] = sprintf(ENTRIES_BY, $uInfo[0]['realname']);
$serendipity['head_subtitle'] = $serendipity['blogTitle'];
}
include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php'); include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
} else if (preg_match(PAT_SEARCH, $uri, $matches)) { } else if (preg_match(PAT_SEARCH, $uri, $matches)) {