Exemple #1
0
 function displayKarma()
 {
     $userkarma = '';
     if ($this->config->showkarma && $this->profile->userid) {
         $userkarma = '<strong>' . JText::_('COM_KUNENA_KARMA') . "</strong>: " . $this->profile->karma;
         if ($this->my->id && $this->my->id != $this->profile->userid) {
             $userkarma .= ' ' . CKunenaLink::GetKarmaLink('decrease', '', '', $this->profile->userid, '<span class="kkarma-minus" title="' . JText::_('COM_KUNENA_KARMA_SMITE') . '"> </span>');
             $userkarma .= ' ' . CKunenaLink::GetKarmaLink('increase', '', '', $this->profile->userid, '<span class="kkarma-plus" title="' . JText::_('COM_KUNENA_KARMA_APPLAUD') . '"> </span>');
         }
     }
     return $userkarma;
 }
Exemple #2
0
 function getMessageProfileBox()
 {
     static $profiles = array();
     $key = $this->profile->userid . '.' . $this->profile->username;
     if (!isset($profiles[$key])) {
         // Run events
         if (version_compare(JVERSION, '1.6', '>')) {
             // Joomla 1.6+
             $params = new JRegistry();
         } else {
             // Joomla 1.5
             $params = new JParameter('');
         }
         // Modify profile values by integration
         $params->set('ksource', 'kunena');
         $params->set('kunena_view', 'topic');
         $params->set('kunena_layout', $this->state->get('layout'));
         JPluginHelper::importPlugin('kunena');
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('onKunenaPrepare', array('kunena.user', &$this->profile, &$params, 0));
         //karma points and buttons
         $this->userkarma_title = $this->userkarma_minus = $this->userkarma_plus = '';
         if ($this->config->showkarma && $this->profile->userid) {
             $this->userkarma_title = JText::_('COM_KUNENA_KARMA') . ": " . $this->profile->karma;
             if ($this->me->userid && $this->me->userid != $this->profile->userid) {
                 $this->userkarma_minus = ' ' . CKunenaLink::GetKarmaLink('decrease', $this->topic->category_id, $this->message->id, $this->profile->userid, '<span class="kkarma-minus" alt="Karma-" border="0" title="' . JText::_('COM_KUNENA_KARMA_SMITE') . '"> </span>');
                 $this->userkarma_plus = ' ' . CKunenaLink::GetKarmaLink('increase', $this->topic->category_id, $this->message->id, $this->profile->userid, '<span class="kkarma-plus" alt="Karma+" border="0" title="' . JText::_('COM_KUNENA_KARMA_APPLAUD') . '"> </span>');
             }
         }
         if ($this->me->exists() && $this->message->userid == $this->me->userid) {
             $usertype = 'me';
         } else {
             $usertype = $this->profile->getType($this->category->id, true);
         }
         // TODO: add context (options) to caching
         $cache = JFactory::getCache('com_kunena', 'output');
         $cachekey = "profile.{$this->getTemplateMD5()}.{$this->profile->userid}.{$usertype}";
         $cachegroup = 'com_kunena.messages';
         // FIXME: enable caching after fixing the issues
         $contents = false;
         //$cache->get($cachekey, $cachegroup);
         if (!$contents) {
             $this->userkarma = "{$this->userkarma_title} {$this->userkarma_minus} {$this->userkarma_plus}";
             // Use kunena profile
             if ($this->config->showuserstats) {
                 if ($this->config->userlist_usertype) {
                     $this->usertype = $this->profile->getType($this->topic->category_id);
                 } else {
                     $this->usertype = null;
                 }
                 $this->userrankimage = $this->profile->getRank($this->topic->category_id, 'image');
                 $this->userranktitle = $this->profile->getRank($this->topic->category_id, 'title');
                 $this->userposts = $this->profile->posts;
                 $activityIntegration = KunenaFactory::getActivityIntegration();
                 $this->userthankyou = $this->profile->thankyou;
                 $this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
                 $this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
             } else {
                 $this->usertype = null;
                 $this->userrankimage = null;
                 $this->userranktitle = null;
                 $this->userposts = null;
                 $this->userthankyou = null;
                 $this->userpoints = null;
                 $this->usermedals = null;
             }
             $this->personalText = KunenaHtmlParser::parseText($this->profile->personalText);
             $contents = trim(KunenaFactory::getProfile()->showProfile($this, $params));
             if (!$contents) {
                 $contents = $this->loadTemplateFile('profile');
             }
             $contents .= implode(' ', $dispatcher->trigger('onKunenaDisplay', array('topic.profile', $this, $params)));
             // FIXME: enable caching after fixing the issues (also external profile stuff affects this)
             //if ($this->cache) $cache->store($contents, $cachekey, $cachegroup);
         }
         $profiles[$key] = $contents;
     }
     return $profiles[$key];
 }
Exemple #3
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);
 }
Exemple #4
0
     //height of the bar
     $myGraphAUP->SetBorderColor("#333333");
     $myGraphAUP->SetBarBorderWidth(0);
     $myGraphAUP->SetGraphWidth(64);
     //should match column width in the <TD> above -5 pixels
     $useGraph = 1;
 }
 // End Integration AlphaUserPoints
 //karma points and buttons
 if ($fbConfig->showkarma && $userinfo->userid != '0') {
     $karmaPoints = $userinfo->karma;
     $karmaPoints = (int) $karmaPoints;
     $msg_karma = "<strong>" . _KARMA . ":</strong> {$karmaPoints}";
     if ($kunena_my->id != '0' && $kunena_my->id != $userinfo->userid) {
         $msg_karmaminus = CKunenaLink::GetKarmaLink('decrease', $catid, $fmessage->id, $userinfo->userid, '<img src="' . (isset($fbIcons['karmaminus']) ? KUNENA_URLICONSPATH . $fbIcons['karmaminus'] : KUNENA_URLEMOTIONSPATH . "karmaminus.gif") . '" alt="Karma-" border="0" title="' . _KARMA_SMITE . '" align="middle" />');
         $msg_karmaplus = CKunenaLink::GetKarmaLink('increase', $catid, $fmessage->id, $userinfo->userid, '<img src="' . (isset($fbIcons['karmaplus']) ? KUNENA_URLICONSPATH . $fbIcons['karmaplus'] : KUNENA_URLEMOTIONSPATH . "karmaplus.gif") . '" alt="Karma+" border="0" title="' . _KARMA_APPLAUD . '" align="middle" />');
     }
 }
 /*let's see if we should use Missus integration */
 if ($fbConfig->pm_component == "missus" && $userinfo->userid && $kunena_my->id) {
     //we should offer the user a Missus link
     //first get the username of the user to contact
     $PMSName = $userinfo->username;
     $msg_pms = "<a href=\"" . JRoute::_('index.php?option=com_missus&amp;func=newmsg&amp;user='******'&amp;subject=' . _GEN_FORUM . ': ' . urlencode(utf8_encode($fmessage->subject))) . "\"><img src='";
     if ($fbIcons['pms']) {
         $msg_pms .= KUNENA_URLICONSPATH . $fbIcons['pms'];
     } else {
         $msg_pms .= KUNENA_URLICONSPATH . $fbIcons['pms'];
     }
     $msg_pms .= "' alt=\"" . _VIEW_PMS . "\" border=\"0\" title=\"" . _VIEW_PMS . "\" /></a>";
 }
Exemple #5
0
	function getMessageProfileBox() {
		static $profiles = array ();

		$key = $this->profile->userid.'.'.$this->profile->username;
		if (! isset ( $profiles [$key] )) {
			// Modify profile values by integration
			$triggerParams = array ('userid' => $this->profile->userid, 'userinfo' => &$this->profile );
			$integration = KunenaFactory::getProfile();
			$integration->trigger ( 'profileIntegration', $triggerParams );

			//karma points and buttons
			$me = KunenaUserHelper::getMyself();
			$this->userkarma_title = $this->userkarma_minus = $this->userkarma_plus = '';
			if ($this->config->showkarma && $this->profile->userid) {
				$this->userkarma_title = JText::_ ( 'COM_KUNENA_KARMA' ) . ": " . $this->profile->karma;
				if ($me->userid && $me->userid != $this->profile->userid) {
					$this->userkarma_minus = ' ' . CKunenaLink::GetKarmaLink ( 'decrease', $this->topic->category_id, $this->message->id, $this->profile->userid, '<span class="kkarma-minus" alt="Karma-" border="0" title="' . JText::_ ( 'COM_KUNENA_KARMA_SMITE' ) . '"> </span>' );
					$this->userkarma_plus = ' ' . CKunenaLink::GetKarmaLink ( 'increase', $this->topic->category_id, $this->message->id, $this->profile->userid, '<span class="kkarma-plus" alt="Karma+" border="0" title="' . JText::_ ( 'COM_KUNENA_KARMA_APPLAUD' ) . '"> </span>' );
				}
			}

			// FIXME: we need to change how profilebox integration works
			/*
			$integration = KunenaFactory::getProfile();
			$triggerParams = array(
				'username' => &$this->username,
				'messageobject' => &$this->msg,
				'subject' => &$this->subjectHtml,
				'messagetext' => &$this->messageHtml,
				'signature' => &$this->signatureHtml,
				'karma' => &$this->userkarma_title,
				'karmaplus' => &$this->userkarma_plus,
				'karmaminus' => &$this->userkarma_minus,
				'layout' => $direction
			);

			$profileHtml = $integration->showProfile($this->msg->userid, $triggerParams);
			*/
			$profileHtml = '';
			if ($profileHtml) {
				// Use integration
				$profiles [$key] = $profileHtml;
			} else {
				$usertype = $this->profile->getType($this->category->id, true);
				if ($me->exists() && $this->message->userid == $me->userid) $usertype = 'me';

				// TODO: add context (options, template) to caching
				$cache = JFactory::getCache('com_kunena', 'output');
				$cachekey = "profile.{$this->getTemplateMD5()}.{$this->profile->userid}.{$usertype}";
				$cachegroup = 'com_kunena.messages';

				$contents = $cache->get($cachekey, $cachegroup);
				if (!$contents) {
					$this->userkarma = "{$this->userkarma_title} {$this->userkarma_minus} {$this->userkarma_plus}";
					// Use kunena profile
					if ($this->config->showuserstats) {
						if ($this->config->userlist_usertype) {
							$this->usertype = $this->profile->getType ( $this->topic->category_id );
						} else {
							$this->usertype = null;
						}
						$this->userrankimage = $this->profile->getRank ( $this->topic->category_id, 'image' );
						$this->userranktitle = $this->profile->getRank ( $this->topic->category_id, 'title' );
						$this->userposts = $this->profile->posts;
						$activityIntegration = KunenaFactory::getActivityIntegration ();
						$this->thankyou = $this->profile->thankyou;
						$this->userpoints = $activityIntegration->getUserPoints ( $this->profile->userid );
						$this->usermedals = $activityIntegration->getUserMedals ( $this->profile->userid );
					} else {
						$this->usertype = null;
						$this->userrankimage = null;
						$this->userranktitle = null;
						$this->userposts = null;
						$this->thankyou = null;
						$this->userpoints = null;
						$this->usermedals = null;
					}
					$this->personalText = KunenaHtmlParser::parseText ( $this->profile->personalText );

					$contents = $this->loadTemplate('profile');
					if ($this->cache) $cache->store($contents, $cachekey, $cachegroup);
				}
				$profiles [$key] = $contents;
			}
		}
		return $profiles [$key];
	}