X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fredirecturl.php;h=62418df21709640c2bc79f56aca461cf7928ae09;hb=261ccfac8699534ff584a2f93d5dcd384529d855;hp=0a959b074f8e69a7bd10907fe31ad435ead0e42b;hpb=27ef3b1d905cdf8f47b47293a757624dda88fdc7;p=quix0rs-gnu-social.git diff --git a/actions/redirecturl.php b/actions/redirecturl.php index 0a959b074f..62418df217 100644 --- a/actions/redirecturl.php +++ b/actions/redirecturl.php @@ -4,7 +4,7 @@ * Copyright (C) 2010, StatusNet, Inc. * * Redirect to the given URL - * + * * PHP version 5 * * This program is free software: you can redistribute it and/or modify @@ -59,21 +59,23 @@ class RedirecturlAction extends Action * * @return boolean true */ - function prepare($argarray) { parent::prepare($argarray); $this->id = $this->trimmed('id'); - + if (empty($this->id)) { - throw new ClientException(_('No id parameter')); + // TRANS: Client exception thrown when no ID parameter was provided. + throw new ClientException(_('No id parameter.')); } - $this->file = File::staticGet('id', $this->id); - + $this->file = File::getKV('id', $this->id); + if (empty($this->file)) { - throw new ClientException(sprintf(_('No such file "%d"'), + // TRANS: Client exception thrown when an invalid ID parameter was provided for a file. + // TRANS: %d is the provided ID for which the file is not present (number). + throw new ClientException(sprintf(_('No such file "%d".'), $this->id), 404); } @@ -88,11 +90,9 @@ class RedirecturlAction extends Action * * @return void */ - function handle($argarray=null) { common_redirect($this->file->url, 307); - return; } /** @@ -104,8 +104,7 @@ class RedirecturlAction extends Action * * @return boolean is read only action? */ - - function isReadOnly($args) + function isReadOnly(array $args=array()) { return true; } @@ -117,7 +116,6 @@ class RedirecturlAction extends Action * * @return string last modified http header */ - function lastModified() { // For comparison with If-Last-Modified @@ -133,7 +131,6 @@ class RedirecturlAction extends Action * * @return string etag http header */ - function etag() { return 'W/"' . implode(':', array($this->arg('action'),