From acd36698b40ef9e4ae68bf806658353e4a2b8b5d Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 29 Jan 2015 23:35:49 +0100 Subject: [PATCH] A bunch of clientError that were called as serverError Calling serverError with a clientError status code (4xx) means it will automatically default to Internal Server Error (500) which is in the server error status code range (5xx). That is undesirable. --- actions/all.php | 4 ++-- actions/public.php | 4 ++-- actions/replies.php | 4 ++-- actions/showprofiletag.php | 4 ++-- actions/tag.php | 4 ++-- plugins/Favorite/actions/showfavorites.php | 4 ++-- plugins/Oembed/actions/oembed.php | 13 +++++++------ 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/actions/all.php b/actions/all.php index d6dd8e8af5..fb0b63577a 100644 --- a/actions/all.php +++ b/actions/all.php @@ -57,8 +57,8 @@ class AllAction extends ProfileAction NOTICES_PER_PAGE + 1); if ($this->page > 1 && $this->notice->N == 0) { - // TRANS: Server error when page not found (404). - $this->serverError(_('No such page.'), 404); + // TRANS: Client error when page not found (404). + $this->clientError(_('No such page.'), 404); } return true; diff --git a/actions/public.php b/actions/public.php index 4f91b77e1e..06ee75b8d1 100644 --- a/actions/public.php +++ b/actions/public.php @@ -84,8 +84,8 @@ class PublicAction extends ManagedAction } if ($this->page > 1 && $this->notice->N == 0){ - // TRANS: Server error when page not found (404). - $this->serverError(_('No such page.'),$code=404); + // TRANS: Client error when page not found (404). + $this->clientError(_('No such page.'), 404); } return true; diff --git a/actions/replies.php b/actions/replies.php index 4932520fd6..2b5455e23c 100644 --- a/actions/replies.php +++ b/actions/replies.php @@ -90,8 +90,8 @@ class RepliesAction extends Action NOTICES_PER_PAGE + 1); if($this->page > 1 && $this->notice->N == 0){ - // TRANS: Server error when page not found (404) - $this->serverError(_('No such page.'),$code=404); + // TRANS: Client error when page not found (404) + $this->clientError(_('No such page.'), 404); } return true; diff --git a/actions/showprofiletag.php b/actions/showprofiletag.php index d96acec590..6ba0c18f90 100644 --- a/actions/showprofiletag.php +++ b/actions/showprofiletag.php @@ -96,8 +96,8 @@ class ShowprofiletagAction extends Action NOTICES_PER_PAGE + 1); if ($this->page > 1 && $this->notice->N == 0) { - // TRANS: Server error when page not found (404). - $this->serverError(_('No such page.'), $code = 404); + // TRANS: Client error when page not found (404). + $this->clientError(_('No such page.'), 404); } return true; diff --git a/actions/tag.php b/actions/tag.php index 0fc2c5152e..09de8b3c25 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -49,8 +49,8 @@ class TagAction extends ManagedAction $this->notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1); if($this->page > 1 && $this->notice->N == 0){ - // TRANS: Server error when page not found (404). - $this->serverError(_('No such page.'),$code=404); + // TRANS: Client error when page not found (404). + $this->clientError(_('No such page.'), 404); } return true; diff --git a/plugins/Favorite/actions/showfavorites.php b/plugins/Favorite/actions/showfavorites.php index cc355b1bef..98a6bfc5bf 100644 --- a/plugins/Favorite/actions/showfavorites.php +++ b/plugins/Favorite/actions/showfavorites.php @@ -130,8 +130,8 @@ class ShowfavoritesAction extends Action } if($this->page > 1 && $this->notice->N == 0){ - // TRANS: Server error when page not found (404) - $this->serverError(_('No such page.'),$code=404); + // TRANS: Client error when page not found (404) + $this->clientError(_('No such page.'), 404); } return true; diff --git a/plugins/Oembed/actions/oembed.php b/plugins/Oembed/actions/oembed.php index 509c3a73ee..bf3e71c505 100644 --- a/plugins/Oembed/actions/oembed.php +++ b/plugins/Oembed/actions/oembed.php @@ -51,9 +51,9 @@ class OembedAction extends Action $proxy_args = $r->map($path); if (!$proxy_args) { - // TRANS: Server error displayed in oEmbed action when path not found. + // TRANS: Client error displayed in oEmbed action when path not found. // TRANS: %s is a path. - $this->serverError(sprintf(_('"%s" not found.'),$path), 404); + $this->clientError(sprintf(_('"%s" not found.'),$path), 404); } $oembed=array(); @@ -67,9 +67,9 @@ class OembedAction extends Action $id = $proxy_args['notice']; $notice = Notice::getKV($id); if(empty($notice)){ - // TRANS: Server error displayed in oEmbed action when notice not found. + // TRANS: Client error displayed in oEmbed action when notice not found. // TRANS: %s is a notice. - $this->serverError(sprintf(_("Notice %s not found."),$id), 404); + $this->clientError(sprintf(_("Notice %s not found."),$id), 404); } $profile = $notice->getProfile(); if (empty($profile)) { @@ -91,9 +91,9 @@ class OembedAction extends Action $id = $proxy_args['attachment']; $attachment = File::getKV($id); if(empty($attachment)){ - // TRANS: Server error displayed in oEmbed action when attachment not found. + // TRANS: Client error displayed in oEmbed action when attachment not found. // TRANS: %d is an attachment ID. - $this->serverError(sprintf(_('Attachment %s not found.'),$id), 404); + $this->clientError(sprintf(_('Attachment %s not found.'),$id), 404); } if (empty($attachment->filename) && $file_oembed = File_oembed::getKV('file_id', $attachment->id)) { // Proxy the existing oembed information @@ -174,6 +174,7 @@ class OembedAction extends Action } } else { // TRANS: Error message displaying attachments. %s is the site's base URL. + // FIXME: 404 not found?! (this will automatically become a 500 because it's not a serverError!) $this->serverError(sprintf(_('Only %s URLs over plain HTTP please.'), common_root_url()), 404); } }