X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fattachment.php;h=16ee723d96bb35c000008b64f0d8ee13a19cc786;hb=b4e649fe906a793cd5e62d6390065ea5d41c40db;hp=981882a5bb0e618275bc43bb1ab120c9f45de258;hpb=811cef10083f8b7824b2fd8140f940bf13b54c8d;p=quix0rs-gnu-social.git diff --git a/actions/attachment.php b/actions/attachment.php index 981882a5bb..16ee723d96 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -31,8 +31,6 @@ if (!defined('LACONICA')) { exit(1); } -//require_once INSTALLDIR.'/lib/personalgroupnav.php'; -//require_once INSTALLDIR.'/lib/feedlist.php'; require_once INSTALLDIR.'/lib/attachmentlist.php'; /** @@ -53,18 +51,6 @@ class AttachmentAction extends Action var $attachment = null; - /** - * Profile of the notice object - */ - -// var $profile = null; - - /** - * Avatar of the profile of the notice object - */ - -// var $avatar = null; - /** * Load attributes based on database arguments * @@ -79,11 +65,11 @@ class AttachmentAction extends Action { parent::prepare($args); - $id = $this->arg('attachment'); - - $this->attachment = File::staticGet($id); + if ($id = $this->trimmed('attachment')) { + $this->attachment = File::staticGet($id); + } - if (!$this->attachment) { + if (empty($this->attachment)) { $this->clientError(_('No such attachment.'), 404); return false; } @@ -112,8 +98,6 @@ class AttachmentAction extends Action return $a->title(); } - - /** * Last-modified date for page * @@ -192,10 +176,8 @@ class AttachmentAction extends Action function showContent() { - $this->elementStart('ul', array('class' => 'attachments')); $ali = new Attachment($this->attachment, $this); $cnt = $ali->show(); - $this->elementEnd('ul'); } /** @@ -213,38 +195,11 @@ class AttachmentAction extends Action * * @return void */ - - function showAside() { - $notice = new Notice; - $f2p = new File_to_post; - $f2p->file_id = $this->attachment->id; - $notice->joinAdd($f2p); - $notice->orderBy('created desc'); - $x = $notice->find(); - $this->elementStart('ol'); - while($notice->fetch()) { - $this->elementStart('li'); - $profile = $notice->getProfile(); - $this->element('a', array('href' => $notice->uri), $profile->nickname . ' on ' . $notice->created); - $this->elementEnd('li'); - } - $this->elementEnd('ol'); - $notice->free(); - $f2p->free(); - - $notice_tag = new Notice_tag; - $attachment = new File; - - $query = 'select tag,count(tag) as c from notice_tag join file_to_post on (notice_tag.notice_id=post_id) join notice on notice_id = notice.id where file_id=' . $notice_tag->escape($this->attachment->id) . ' group by tag order by c desc'; - - $notice_tag->query($query); - $this->elementStart('ol'); - while($notice_tag->fetch()) { - $this->elementStart('li'); - $href = common_local_url('tag', array('tag' => $notice_tag->tag)); - $this->element('a', array('href' => $href), $notice_tag->tag . ' (' . $notice_tag->c . ')'); - $this->elementEnd('li'); - } - $this->elementEnd('ol'); + function showSections() { + $ns = new AttachmentNoticeSection($this); + $ns->show(); + $atcs = new AttachmentTagCloudSection($this); + $atcs->show(); } } +