Exemple #1
0
	/**
	 * Prepare user attachments list.
	 *
	 * @return void
	 */
	protected function before()
	{
		parent::before();

		$userid = $this->input->getInt('userid');
		$params = array('file' => '1', 'image' => '1', 'orderby' => 'desc', 'limit' => '30');

		$this->template = KunenaFactory::getTemplate();
		$this->me = KunenaUserHelper::getMyself();
		$this->profile = KunenaUserHelper::get($userid);
		$this->attachments = KunenaAttachmentHelper::getByUserid($this->profile, $params);

		// Pre-load messages.
		$messageIds = array();

		foreach ($this->attachments as $attachment)
		{
			$messageIds[] = (int) $attachment->mesid;
		}

		$messages = KunenaForumMessageHelper::getMessages($messageIds, 'none');

		// Pre-load topics.
		$topicIds = array();

		foreach ($messages as $message)
		{
			$topicIds[] = $message->thread;
		}

		KunenaForumTopicHelper::getTopics($topicIds, 'none');

		$this->headerText = JText::_('COM_KUNENA_MANAGE_ATTACHMENTS');
	}
Exemple #2
0
 /**
  * @return bool
  */
 function canManageAttachments()
 {
     if ($this->config->show_imgfiles_manage_profile) {
         $params = array('file' => '1', 'image' => '1', 'orderby' => 'desc', 'limit' => '30');
         $this->userattachs = KunenaAttachmentHelper::getByUserid($this->profile, $params);
         if ($this->userattachs) {
             if ($this->me->isModerator() || $this->profile->userid == $this->me->userid) {
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     }
     return false;
 }