. * * @category URL * @package StatusNet * @author Evan Prodromou * @copyright 2010 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ if (!defined('GNUSOCIAL')) { exit(1); } /** * Redirect to a given URL * * This is our internal low-budget URL-shortener * * @category Action * @package StatusNet * @author Evan Prodromou * @copyright 2010 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ class RedirecturlAction extends ManagedAction { protected $file = null; protected function doPreparation() { $this->file = File::getByID($this->int('id')); return true; } public function showPage() { common_redirect($this->file->url, 307); } function isReadOnly($args) { return true; } function lastModified() { // For comparison with If-Last-Modified // If not applicable, return null return strtotime($this->file->modified); } /** * Return etag, if applicable. * * MAY override * * @return string etag http header */ function etag() { return 'W/"' . implode(':', array($this->getActionName(), common_user_cache_hash(), common_language(), $this->file->getID())) . '"'; } }