Skip to content

Commit

Permalink
Convert a bunch of leftover kohana::show_404 calls to throw
Browse files Browse the repository at this point in the history
Kohana_404_Exception instead.  These are the ones where we used a
lower-case 'k' so my previous filter didn't catch it.
  • Loading branch information
bharat committed Dec 24, 2009
1 parent b62083b commit 057e8d0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion modules/digibug/controllers/digibug.php
Expand Up @@ -87,7 +87,7 @@ public function print_proxy($type, $uuid) {

$file = $type == "full" ? $proxy->item->file_path() : $proxy->item->thumb_path();
if (!file_exists($file)) {
kohana::show_404();
throw new Kohana_404_Exception();
}

// We don't need to save the session for this request
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/controllers/admin.php
Expand Up @@ -44,7 +44,7 @@ public function __call($controller_name, $args) {
}

if (!method_exists($controller_name, $method)) {
return kohana::show_404();
throw new Kohana_404_Exception();
}

call_user_func_array(array(new $controller_name, $method), $args);
Expand Down
16 changes: 8 additions & 8 deletions modules/gallery/controllers/file_proxy.php
Expand Up @@ -38,19 +38,19 @@ public function __call($function, $args) {
// Make sure that the request is for a file inside var
$offset = strpos($request_uri, $var_uri);
if ($offset === false) {
kohana::show_404();
throw new Kohana_404_Exception();
}

$file_uri = substr($request_uri, strlen($var_uri));

// Make sure that we don't leave the var dir
if (strpos($file_uri, "..") !== false) {
kohana::show_404();
throw new Kohana_404_Exception();
}

list ($type, $path) = explode("/", $file_uri, 2);
if ($type != "resizes" && $type != "albums" && $type != "thumbs") {
kohana::show_404();
throw new Kohana_404_Exception();
}

// If the last element is .album.jpg, pop that off since it's not a real item
Expand Down Expand Up @@ -78,7 +78,7 @@ public function __call($function, $args) {
}

if (!$item->loaded()) {
kohana::show_404();
throw new Kohana_404_Exception();
}

if ($type == "albums") {
Expand All @@ -91,21 +91,21 @@ public function __call($function, $args) {

// Make sure we have access to the item
if (!access::can("view", $item)) {
kohana::show_404();
throw new Kohana_404_Exception();
}

// Make sure we have view_full access to the original
if ($type == "albums" && !access::can("view_full", $item)) {
kohana::show_404();
throw new Kohana_404_Exception();
}

// Don't try to load a directory
if ($type == "albums" && $item->is_album()) {
kohana::show_404();
throw new Kohana_404_Exception();
}

if (!file_exists($file)) {
kohana::show_404();
throw new Kohana_404_Exception();
}

// We don't need to save the session for this request
Expand Down
4 changes: 2 additions & 2 deletions modules/tag/controllers/admin_tags.php
Expand Up @@ -45,7 +45,7 @@ public function delete($id) {

$tag = ORM::factory("tag", $id);
if (!$tag->loaded()) {
kohana::show_404();
throw new Kohana_404_Exception();
}

$form = tag::get_delete_form($tag);
Expand Down Expand Up @@ -80,7 +80,7 @@ public function rename($id) {

$tag = ORM::factory("tag", $id);
if (!$tag->loaded()) {
kohana::show_404();
throw new Kohana_404_Exception();
}

$in_place_edit = InPlaceEdit::factory($tag->name)
Expand Down
16 changes: 8 additions & 8 deletions modules/user/controllers/admin_users.php
Expand Up @@ -77,7 +77,7 @@ public function delete_user($id) {

$user = user::lookup($id);
if (empty($user)) {
kohana::show_404();
throw new Kohana_404_Exception();
}

$form = $this->_get_user_delete_form_admin($user);
Expand All @@ -98,7 +98,7 @@ public function delete_user($id) {
public function delete_user_form($id) {
$user = user::lookup($id);
if (empty($user)) {
kohana::show_404();
throw new Kohana_404_Exception();
}
print $this->_get_user_delete_form_admin($user);
}
Expand All @@ -108,7 +108,7 @@ public function edit_user($id) {

$user = user::lookup($id);
if (empty($user)) {
kohana::show_404();
throw new Kohana_404_Exception();
}

$form = $this->_get_user_edit_form_admin($user);
Expand Down Expand Up @@ -155,7 +155,7 @@ public function edit_user($id) {
public function edit_user_form($id) {
$user = user::lookup($id);
if (empty($user)) {
kohana::show_404();
throw new Kohana_404_Exception();
}

$v = new View("user_form.html");
Expand Down Expand Up @@ -224,7 +224,7 @@ public function delete_group($id) {

$group = group::lookup($id);
if (empty($group)) {
kohana::show_404();
throw new Kohana_404_Exception();
}

$form = $this->_get_group_delete_form_admin($group);
Expand All @@ -245,7 +245,7 @@ public function delete_group($id) {
public function delete_group_form($id) {
$group = group::lookup($id);
if (empty($group)) {
kohana::show_404();
throw new Kohana_404_Exception();
}

print $this->_get_group_delete_form_admin($group);
Expand All @@ -256,7 +256,7 @@ public function edit_group($id) {

$group = group::lookup($id);
if (empty($group)) {
kohana::show_404();
throw new Kohana_404_Exception();
}

$form = $this->_get_group_edit_form_admin($group);
Expand Down Expand Up @@ -288,7 +288,7 @@ public function edit_group($id) {
public function edit_group_form($id) {
$group = group::lookup($id);
if (empty($group)) {
kohana::show_404();
throw new Kohana_404_Exception();
}

print $this->_get_group_edit_form_admin($group);
Expand Down

0 comments on commit 057e8d0

Please sign in to comment.