. */ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/actions/shownotice.php'); class FileAction extends Action { var $id = null; var $filerec = null; function prepare($args) { parent::prepare($args); $this->id = $this->trimmed('notice'); if (empty($this->id)) { $this->clientError(_('No notice id')); } $notice = Notice::staticGet('id', $this->id); if (empty($notice)) { $this->clientError(_('No notice')); } $atts = $notice->attachments(); if (empty($atts)) { $this->clientError(_('No attachments')); } foreach ($atts as $att) { if (!empty($att->filename)) { $this->filerec = $att; break; } } if (empty($this->filerec)) { $this->clientError(_('No uploaded attachments')); } return true; } function handle() { common_redirect($this->filerec->url); } /** * Is this action read-only? * * @return boolean true */ function isReadOnly($args) { return true; } }