예제 #1
0
 function displayMessage($id, $message, $template = null)
 {
     $layout = $this->getLayout();
     if (!$template) {
         $template = $this->state->get('profile.location');
         $this->setLayout('default');
     }
     $this->mmm++;
     $this->message = $message;
     $this->profile = $this->message->getAuthor();
     $this->replynum = $id + 1;
     $usertype = $this->me->getType($this->category->id, true);
     if ($usertype == 'user' && $this->message->userid == $this->profile->userid) {
         $usertype = 'owner';
     }
     // Thank you info and buttons
     $this->thankyou = array();
     if (isset($message->thankyou)) {
         if ($this->config->showthankyou && $this->profile->userid) {
             $task = "index.php?option=com_kunena&view=topic&task=%s&catid={$this->category->id}&id={$this->topic->id}&mesid={$this->message->id}&" . JUtility::getToken() . '=1';
             // for normal users, show only limited number of thankyou (config->thankyou_max)
             if (!$this->me->isAdmin() || !$this->me->isModerator()) {
                 $message->thankyou = array_slice($message->thankyou, 0, $this->config->thankyou_max, true);
             }
             foreach ($message->thankyou as $userid => $time) {
                 $thankyou_delete = $this->me->isModerator() ? ' <a title="' . JText::_('COM_KUNENA_BUTTON_THANKYOU_REMOVE_LONG') . '" href="' . KunenaRoute::_(sprintf($task, "unthankyou&userid={$userid}")) . '"><img src="' . $this->ktemplate->getImagePath('icons/publish_x.png') . '" title="" alt="" /></a>' : '';
                 $this->thankyou[] = KunenaFactory::getUser(intval($userid))->getLink() . $thankyou_delete;
             }
         }
     }
     // TODO: add context (options, template) to caching
     $cache = JFactory::getCache('com_kunena', 'output');
     $cachekey = "message.{$this->getTemplateMD5()}.{$layout}.{$template}.{$usertype}.c{$this->category->id}.m{$this->message->id}.{$this->message->modified_time}";
     $cachegroup = 'com_kunena.messages';
     $contents = false;
     //$cache->get($cachekey, $cachegroup);
     if (!$contents) {
         //Show admins the IP address of the user:
         if ($this->message->ip && ($this->category->authorise('admin') || $this->category->authorise('moderate') && !$this->config->hide_ip)) {
             $this->ipLink = CKunenaLink::GetMessageIPLink($this->message->ip);
         }
         $this->signatureHtml = KunenaHtmlParser::parseBBCode($this->profile->signature, null, $this->config->maxsig);
         $this->attachments = $this->message->getAttachments();
         // Link to individual message
         if ($this->config->ordering_system == 'replyid') {
             $this->numLink = CKunenaLink::GetSamePageAnkerLink($message->id, '#[K=REPLYNO]');
         } else {
             $this->numLink = CKunenaLink::GetSamePageAnkerLink($message->id, '#' . $message->id);
         }
         if ($this->message->hold == 0) {
             $this->class = 'kmsg';
         } elseif ($this->message->hold == 1) {
             $this->class = 'kmsg kunapproved';
         } else {
             if ($this->message->hold == 2 || $this->message->hold == 3) {
                 $this->class = 'kmsg kdeleted';
             }
         }
         // New post suffix for class
         $this->msgsuffix = '';
         if ($this->message->isNew()) {
             $this->msgsuffix = '-new';
         }
         $contents = $this->loadTemplateFile($template);
         if ($usertype == 'guest') {
             $contents = preg_replace_callback('|\\[K=(\\w+)(?:\\:(\\w+))?\\]|', array($this, 'fillMessageInfo'), $contents);
         }
         // FIXME: enable caching after fixing the issues
         //if ($this->cache) $cache->store($contents, $cachekey, $cachegroup);
     } elseif ($usertype == 'guest') {
         echo $contents;
         $this->setLayout($layout);
         return;
     }
     $contents = preg_replace_callback('|\\[K=(\\w+)(?:\\:(\\w+))?\\]|', array($this, 'fillMessageInfo'), $contents);
     echo $contents;
     $this->setLayout($layout);
 }
예제 #2
0
 function display($mode = '')
 {
     $message = $this->msg;
     $this->id = $message->id;
     $this->catid = $message->catid;
     $this->thread = $message->thread;
     // Link to individual message
     if ($this->config->ordering_system == 'replyid') {
         $this->numLink = CKunenaLink::GetSamePageAnkerLink($this->id, '#' . $this->replynum);
     } else {
         $this->numLink = CKunenaLink::GetSamePageAnkerLink($this->id, '#' . $this->id);
     }
     // New post suffix for class
     if ($message->new) {
         $this->msgsuffix = '-new';
     }
     // Add attachments
     if (!empty($message->attachments)) {
         $this->attachments = $message->attachments;
     }
     $subject = $message->subject;
     $this->resubject = JString::strtolower(JString::substr($subject, 0, JString::strlen(JText::_('COM_KUNENA_POST_RE')))) == JString::strtolower(JText::_('COM_KUNENA_POST_RE')) ? $subject : JText::_('COM_KUNENA_POST_RE') . ' ' . $subject;
     $this->subjectHtml = KunenaParser::parseText($subject);
     $this->messageHtml = KunenaParser::parseBBCode($message->message, $this);
     //Show admins the IP address of the user:
     if ($message->ip && (CKunenaTools::isAdmin() || CKunenaTools::isModerator($this->my->id, $this->catid) && !$this->config->hide_ip)) {
         $this->ipLink = CKunenaLink::GetMessageIPLink($message->ip);
     }
     $this->profile = KunenaFactory::getUser($message->userid);
     // Modify profile values by integration
     $triggerParams = array('userid' => $message->userid, 'userinfo' => &$this->profile);
     $integration = KunenaFactory::getProfile();
     $integration->trigger('profileIntegration', $triggerParams);
     // Choose username
     $this->userid = $this->profile->userid;
     $this->username = $this->config->username ? $this->profile->username : $this->profile->name;
     if ((!$this->username || !$message->userid || $this->config->changename) && $message->name) {
         $this->username = $message->name;
     }
     if ($this->params->get('avatarPosition') == 'left' || $this->params->get('avatarPosition') == 'right') {
         $avatar = $this->profile->getAvatarLink('kavatar', 'post');
     } else {
         $avatar = $this->profile->getAvatarLink('kavatar', 'welcome');
     }
     if ($avatar) {
         $this->avatar = '<span class="kavatar">' . $avatar . '</span>';
     }
     if ($this->config->showuserstats) {
         $activityIntegration = KunenaFactory::getActivityIntegration();
         if ($this->config->userlist_usertype) {
             $this->usertype = $this->profile->getType($this->catid);
         }
         $this->userrankimage = $this->profile->getRank($this->catid, 'image');
         $this->userranktitle = $this->profile->getRank($this->catid, 'title');
         $this->userposts = $this->profile->posts;
         $this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
         $this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
     }
     //karma points and buttons
     $this->userkarma_minus = $this->userkarma_plus = '';
     if ($this->config->showkarma && $this->profile->userid) {
         $this->userkarma = JText::_('COM_KUNENA_KARMA') . ": " . $this->profile->karma;
         if ($this->my->id && $this->my->id != $this->profile->userid) {
             $this->userkarma_minus = CKunenaLink::GetKarmaLink('decrease', $this->catid, $this->id, $this->userid, '<span class="kkarma-minus" alt="Karma-" border="0" title="' . JText::_('COM_KUNENA_KARMA_SMITE') . '"> </span>');
             $this->userkarma_plus = CKunenaLink::GetKarmaLink('increase', $this->catid, $this->id, $this->userid, '<span class="kkarma-plus" alt="Karma+" border="0" title="' . JText::_('COM_KUNENA_KARMA_APPLAUD') . '"> </span>');
         }
     }
     $this->profilelink = $this->profile->profileIcon('profile');
     $this->personaltext = $this->profile->personalText;
     $this->signatureHtml = KunenaParser::parseBBCode($this->profile->signature);
     //Thankyou info and buttons
     if ($this->config->showthankyou && $this->profile->userid && $mode != 'threaded') {
         require_once KPATH_SITE . '/lib/kunena.thankyou.php';
         $thankyou = new CKunenaThankyou();
         $this->total_thankyou = $thankyou->getThankYouUser($this->id);
         $this->thankyou = array_slice($this->total_thankyou, 0, $this->config->thankyou_max);
         if ($this->my->id && $this->my->id != $this->profile->userid) {
             $this->message_thankyou = CKunenaLink::GetThankYouLink($this->catid, $this->id, $this->userid, CKunenaTools::showButton('thankyou', JText::_('COM_KUNENA_BUTTON_THANKYOU')), JText::_('COM_KUNENA_BUTTON_THANKYOU_LONG'), 'kicon-button kbuttonuser btn-left');
         }
     }
     if (!$message->hold && (CKunenaTools::isModerator($this->my->id, $this->catid) || !$this->topicLocked)) {
         //user is allowed to reply/quote
         $this->captcha = KunenaSpamRecaptcha::getInstance();
         if ($this->my->id && (CKunenaTools::isModerator($this->my->id, $this->catid) || $this->me->posts >= $this->config->captcha_post_limit)) {
             $this->message_quickreply = CKunenaLink::GetTopicPostReplyLink('reply', $this->catid, $this->id, CKunenaTools::showButton('reply', JText::_('COM_KUNENA_BUTTON_QUICKREPLY')), 'nofollow', 'kicon-button kbuttoncomm btn-left kqreply', JText::_('COM_KUNENA_BUTTON_QUICKREPLY_LONG'), ' id="kreply' . $this->id . '"');
         }
         $this->message_reply = CKunenaLink::GetTopicPostReplyLink('reply', $this->catid, $this->id, CKunenaTools::showButton('reply', JText::_('COM_KUNENA_BUTTON_REPLY')), 'nofollow', 'kicon-button kbuttoncomm btn-left', JText::_('COM_KUNENA_BUTTON_REPLY_LONG'));
         $this->message_quote = CKunenaLink::GetTopicPostReplyLink('quote', $this->catid, $this->id, CKunenaTools::showButton('quote', JText::_('COM_KUNENA_BUTTON_QUOTE')), 'nofollow', 'kicon-button kbuttoncomm btn-left', JText::_('COM_KUNENA_BUTTON_QUOTE_LONG'));
     } else {
         //user is not allowed to write a post
         if ($this->topicLocked) {
             $this->message_closed = JText::_('COM_KUNENA_POST_LOCK_SET');
         } else {
             $this->message_closed = JText::_('COM_KUNENA_VIEW_DISABLED');
         }
     }
     $this->msgclass = 'kmsg';
     //Offer an moderator a few tools
     if (CKunenaTools::isModerator($this->my->id, $this->catid)) {
         unset($this->message_closed);
         $this->message_edit = CKunenaLink::GetTopicPostReplyLink('edit', $this->catid, $this->id, CKunenaTools::showButton('edit', JText::_('COM_KUNENA_BUTTON_EDIT')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_EDIT_LONG'));
         $this->message_moderate = CKunenaLink::GetTopicPostReplyLink('moderate', $this->catid, $this->id, CKunenaTools::showButton('moderate', JText::_('COM_KUNENA_BUTTON_MODERATE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_MODERATE_LONG'));
         if ($message->hold == 1) {
             $this->message_publish = CKunenaLink::GetTopicPostLink('approve', $this->catid, $this->id, CKunenaTools::showButton('approve', JText::_('COM_KUNENA_BUTTON_APPROVE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_APPROVE_LONG'));
             $this->msgclass .= ' kunapproved';
         }
         if ($message->hold == 2 || $message->hold == 3) {
             $this->msgclass .= ' kunapproved kdeleted';
             $this->message_undelete = CKunenaLink::GetTopicPostLink('undelete', $this->catid, $this->id, CKunenaTools::showButton('undelete', JText::_('COM_KUNENA_BUTTON_UNDELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_UNDELETE_LONG'));
             $this->message_permdelete = CKunenaLink::GetTopicPostLink('permdelete', $this->catid, $this->id, CKunenaTools::showButton('permdelete', JText::_('COM_KUNENA_BUTTON_PERMDELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_PERMDELETE_LONG'));
         } else {
             $this->message_delete = CKunenaLink::GetTopicPostLink('delete', $this->catid, $this->id, CKunenaTools::showButton('delete', JText::_('COM_KUNENA_BUTTON_DELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_DELETE_LONG'));
         }
     } else {
         if ($this->config->useredit && $this->my->id && $this->my->id == $this->profile->userid) {
             //Now, if the viewer==author and the viewer is allowed to edit his/her own post then offer an 'edit' link
             if ($message->hold != 2 && CKunenaTools::editTimeCheck($message->modified_time, $message->time)) {
                 $this->message_edit = CKunenaLink::GetTopicPostReplyLink('edit', $this->catid, $this->id, CKunenaTools::showButton('edit', JText::_('COM_KUNENA_BUTTON_EDIT')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_EDIT_LONG'));
                 if ($this->config->userdeletetmessage == '1') {
                     if ($this->replynum == $this->replycnt) {
                         $this->message_delete = CKunenaLink::GetTopicPostLink('delete', $this->catid, $this->id, CKunenaTools::showButton('delete', JText::_('COM_KUNENA_BUTTON_DELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_DELETE_LONG'));
                     }
                 } else {
                     if ($this->config->userdeletetmessage == '2') {
                         $this->message_delete = CKunenaLink::GetTopicPostLink('delete', $this->catid, $this->id, CKunenaTools::showButton('delete', JText::_('COM_KUNENA_BUTTON_DELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_DELETE_LONG'));
                     }
                 }
             }
         }
     }
     $this->class = 'class="' . $this->msgclass . '"';
     if (!$mode) {
         $templatefile = '/view/message.php';
     } else {
         $templatefile = "/view/message.{$mode}.php";
     }
     CKunenaTools::loadTemplate($templatefile, false, $this->templatepath);
 }
예제 #3
0
                   <?php 
if ($fbConfig->reportmsg && $kunena_my->id > 1) {
    echo CKunenaLink::GetReportMessageLink($catid, $msg_id, _KUNENA_REPORT);
}
?>

                            <?php 
echo isset($fbIcons['msgip']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['msgip'] . '" border="0" alt="' . _KUNENA_REPORT_LOGGED . '" />' : ' <img src="' . KUNENA_URLEMOTIONSPATH . 'ip.gif" border="0" alt="' . _KUNENA_REPORT_LOGGED . '" />';
?>
 <span class="fb_smalltext"> <?php 
echo _KUNENA_REPORT_LOGGED;
?>
</span>
                            <?php 
if (!empty($msg_ip)) {
    echo CKunenaLink::GetMessageIPLink($msg_ip);
}
?>
                            </div>
       </td>
        </tr>
<?php 
if ($fmessage->modified_by) {
    ?>
        <tr>
            <td class = "fb-msgview-left-c">&nbsp;
            </td>
            <td class = "fb-msgview-right-c" >
                    <div class="fb_message_editMarkUp_cover">
                    <span class="fb_message_editMarkUp" ><?php 
    echo _KUNENA_EDITING_LASTEDIT;
예제 #4
0
	<tr><td class = "fb-msgview-right-b" >
		<div class="fb_message_editMarkUp_cover">
<?php 
if ($fmessage->modified_by) {
    echo '<span class="fb_message_editMarkUp">' . _KUNENA_EDITING_LASTEDIT . ': ' . date(_DATETIME, $fmessage->modified_time) . ' ' . _KUNENA_BY . ' ' . CKunenaTools::whoisID($fmessage->modified_by) . '.';
    if ($fmessage->modified_reason) {
        echo _KUNENA_REASON . ': ' . kunena_htmlspecialchars(stripslashes($fmessage->modified_reason));
    }
    echo '</span>';
}
if ($fbConfig->reportmsg && $kunena_my->id > 1) {
    echo '<span class="fb_message_informMarkUp">' . CKunenaLink::GetReportMessageLink($catid, $msg_id, _KUNENA_REPORT) . '</span>';
}
if (isset($msg_ip)) {
    echo '<span class="fb_message_informMarkUp">' . CKunenaLink::GetMessageIPLink($msg_ip) . '</span>';
}
?>
		</div>
		<div class="fb_message_buttons_cover">
			<div class="fb_message_buttons_row">
                <?php 
//we should only show the Quick Reply section to registered users. otherwise we are missing too much information!!
/*    onClick="expandcontent(this, 'sc<?php echo $msg_id;?>')" */
if ($kunena_my->id > 0 && !isset($msg_closed)) {
    ?>
                <span id = "fb_qr_sc__<?php 
    echo $msg_id;
    ?>
" class = "fb_qr_fire" style = "cursor:hand; cursor:pointer">
                <?php 
예제 #5
0
	function displayMessage($id, $message, $template=null) {
		$layout = $this->getLayout();
		if (!$template) {
			$template = $this->state->get('profile.location');
			$this->setLayout('default');
		}

		$this->mmm ++;
		$this->message = $message;
		$this->profile = $this->message->getAuthor();
		$this->replynum = $id;
		$usertype = $this->me->getType($this->category->id, true);
		if ($usertype == 'user' && $this->message->userid == $this->profile->userid) $usertype = 'owner';

		// TODO: add context (options, template) to caching
		$cache = JFactory::getCache('com_kunena', 'output');
		$cachekey = "message.{$this->getTemplateMD5()}.{$layout}.{$template}.{$usertype}.c{$this->category->id}.m{$this->message->id}.{$this->message->modified_time}";
		$cachegroup = 'com_kunena.messages';

		$contents = $cache->get($cachekey, $cachegroup);
		if (!$contents) {

			//Show admins the IP address of the user:
			if ($this->message->ip && ($this->category->authorise('admin') || ($this->category->authorise('moderate') && !$this->config->hide_ip))) {
				$this->ipLink = CKunenaLink::GetMessageIPLink ( $this->message->ip );
			}
			$this->signatureHtml = KunenaHtmlParser::parseBBCode ( $this->profile->signature );
			$this->attachments = $this->message->getAttachments();

			// Link to individual message
			if ($this->config->ordering_system == 'replyid') {
				$this->numLink = CKunenaLink::GetSamePageAnkerLink( $message->id, '#[K=REPLYNO]' );
			} else {
				$this->numLink = CKunenaLink::GetSamePageAnkerLink ( $message->id, '#' . $message->id );
			}

			if ($this->message->hold == 0) {
				$this->class = 'kmsg';
			} elseif ($this->message->hold == 1) {
				$this->class = 'kmsg kunapproved';
			} else if ($this->message->hold == 2 || $this->message->hold == 3) {
				$this->class = 'kmsg kdeleted';
			}

			// New post suffix for class
			$this->msgsuffix = '';
			if ($this->message->isNew()) {
				$this->msgsuffix = '-new';
			}

			$contents = $this->loadTemplate($template);
			if ($usertype == 'guest') $contents = preg_replace_callback('|\[K=(\w+)(?:\:(\w+))?\]|', array($this, 'fillMessageInfo'), $contents);
			if ($this->cache) $cache->store($contents, $cachekey, $cachegroup);
		} elseif ($usertype == 'guest') {
			echo $contents;
			$this->setLayout($layout);
			return;
		}
		$contents = preg_replace_callback('|\[K=(\w+)(?:\:(\w+))?\]|', array($this, 'fillMessageInfo'), $contents);
		echo $contents;
		$this->setLayout($layout);
	}