Exemplo n.º 1
0
	public function onKunenaPrepare($context, &$item, &$params, $page = 0) {
		if ($context == 'kunena.user') {
			$triggerParams = array ('userid' => $item->userid, 'userinfo' => &$item );
			$integration = KunenaFactory::getProfile();
			if ( $integration instanceof KunenaProfileComprofiler) KunenaProfileComprofiler::trigger ( 'profileIntegration', $triggerParams );
		}
	}
Exemplo n.º 2
0
 public function display($cachable = false, $urlparams = false)
 {
     // Redirect profile to integrated component if profile integration is turned on
     $redirect = 1;
     $active = $this->app->getMenu()->getActive();
     if (!empty($active)) {
         $params = $active->params;
         $redirect = $params->get('integration', 1);
     }
     if ($redirect && JRequest::getCmd('format', 'html') == 'html') {
         $profileIntegration = KunenaFactory::getProfile();
         $layout = JRequest::getCmd('layout', 'default');
         if ($profileIntegration instanceof KunenaProfileKunena) {
             // Continue
         } elseif ($layout == 'default') {
             $url = $this->me->getUrl(false);
         } elseif ($layout == 'list') {
             $url = $profileIntegration->getUserListURL('', false);
         }
         if (!empty($url)) {
             $this->setRedirect($url);
             return;
         }
     }
     $layout = JRequest::getCmd('layout', 'default');
     if ($layout == 'list') {
         if (KunenaFactory::getConfig()->userlist_allowed && JFactory::getUser()->guest) {
             $this->redirectBack();
         }
     }
     parent::display();
 }
Exemplo n.º 3
0
	protected function _getUserListLink($action, $name, $title = null, $rel = 'nofollow')
	{
		$profile = KunenaFactory::getProfile();
		$link    = $profile->getUserListURL($action, true);

		return "<a href=\"{$link}\" title=\"{$title}\" rel=\"{$rel}\">{$name}</a>";
	}
Exemplo n.º 4
0
	/**
	 * Load user profile.
	 *
	 * @return void
	 *
	 * @throws KunenaExceptionAuthorise
	 */
	protected function before()
	{
		parent::before();

		// If profile integration is disabled, this view doesn't exist.
		$integration = KunenaFactory::getProfile();

		if (get_class($integration) == 'KunenaProfileNone')
		{
			throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_PROFILE_DISABLED'), 404);
		}

		$userid = $this->input->getInt('userid');

		require_once KPATH_SITE . '/models/user.php';
		$this->model = new KunenaModelUser(array(), $this->input);
		$this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
		$this->state = $this->model->getState();

		$this->me = KunenaUserHelper::getMyself();
		$this->user = JFactory::getUser($userid);
		$this->profile = KunenaUserHelper::get($userid);
		$this->profile->tryAuthorise('read');

		// Update profile hits.
		if (!$this->profile->exists() || !$this->profile->isMyself())
		{
			$this->profile->uhits++;
			$this->profile->save();
		}

		$this->headerText = JText::sprintf('COM_KUNENA_VIEW_USER_DEFAULT', $this->profile->getName());
	}
Exemplo n.º 5
0
 public function display($cachable = false, $urlparams = false)
 {
     // Redirect profile to integrated component if profile integration is turned on
     $redirect = 1;
     $active = $this->app->getMenu()->getActive();
     if (!empty($active)) {
         if (version_compare(JVERSION, '1.6', '>')) {
             // Joomla 1.6+
             $params = $active->params;
         } else {
             // Joomla 1.5
             $params = new JParameter($active->params);
         }
         $redirect = $params->get('integration', 1);
     }
     if ($redirect && JRequest::getCmd('format') == 'html') {
         $profileIntegration = KunenaFactory::getProfile();
         if ($profileIntegration instanceof KunenaProfileKunena) {
             // Continue
         } elseif (JRequest::getCmd('layout', 'default') == 'default') {
             $url = $this->me->getUrl(false);
         } elseif (JRequest::getCmd('layout') == 'list') {
             $url = $profileIntegration->getUserListURL('', false);
         }
         if (!empty($url)) {
             $this->setRedirect($url);
             return;
         }
     }
     parent::display();
 }
Exemplo n.º 6
0
 /**
  * Prepare statistics box display.
  *
  * @return boolean
  */
 protected function before()
 {
     parent::before();
     $this->config = KunenaConfig::getInstance();
     if (!$this->config->get('showstats') || !$this->config->statslink_allowed && !KunenaUserHelper::get()->exists()) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '404');
     }
     $statistics = KunenaForumStatistics::getInstance();
     $statistics->loadGeneral();
     $this->setProperties($statistics);
     $this->latestMemberLink = KunenaFactory::getUser(intval($this->lastUserId))->getLink();
     $this->statisticsUrl = KunenaFactory::getProfile()->getStatisticsURL();
     return true;
 }
Exemplo n.º 7
0
 /**
  * Prepare user for editing.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     // If profile integration is disabled, this view doesn't exist.
     $integration = KunenaFactory::getProfile();
     if (get_class($integration) == 'KunenaProfileNone') {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_PROFILE_DISABLED'), 404);
     }
     $userid = $this->input->getInt('userid');
     $this->user = JFactory::getUser($userid);
     $this->profile = KunenaUserHelper::get($userid);
     $this->profile->tryAuthorise('edit');
     $this->headerText = JText::sprintf('COM_KUNENA_VIEW_USER_DEFAULT', $this->profile->getName());
 }
Exemplo n.º 8
0
 /**
  * Prepare general statistics display.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $this->config = KunenaConfig::getInstance();
     if (!$this->config->get('showstats')) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '404');
     }
     if (!$this->config->statslink_allowed && JFactory::getUser()->guest) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '401');
     }
     $statistics = KunenaForumStatistics::getInstance();
     $statistics->loadAll();
     $this->setProperties($statistics);
     $this->latestMemberLink = KunenaFactory::getUser((int) $this->lastUserId)->getLink();
     $this->userlistUrl = KunenaFactory::getProfile()->getUserListUrl();
 }
Exemplo n.º 9
0
 /**
  * Prepare Who is online display.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $this->config = KunenaConfig::getInstance();
     if (!$this->config->get('showwhoisonline')) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '404');
     }
     $me = KunenaUserHelper::getMyself();
     $moderator = intval($me->isModerator()) + intval($me->isAdmin());
     $users = KunenaUserHelper::getOnlineUsers();
     KunenaUserHelper::loadUsers(array_keys($users));
     $onlineusers = KunenaUserHelper::getOnlineCount();
     $who = '<strong>' . $onlineusers['user'] . ' </strong>';
     if ($onlineusers['user'] == 1) {
         $who .= JText::_('COM_KUNENA_WHO_ONLINE_MEMBER') . '&nbsp;';
     } else {
         $who .= JText::_('COM_KUNENA_WHO_ONLINE_MEMBERS') . '&nbsp;';
     }
     $who .= JText::_('COM_KUNENA_WHO_AND');
     $who .= '<strong> ' . $onlineusers['guest'] . ' </strong>';
     if ($onlineusers['guest'] == 1) {
         $who .= JText::_('COM_KUNENA_WHO_ONLINE_GUEST') . '&nbsp;';
     } else {
         $who .= JText::_('COM_KUNENA_WHO_ONLINE_GUESTS') . '&nbsp;';
     }
     $who .= JText::_('COM_KUNENA_WHO_ONLINE_NOW');
     $this->membersOnline = $who;
     $this->onlineList = array();
     $this->hiddenList = array();
     foreach ($users as $userid => $usertime) {
         $user = KunenaUserHelper::get($userid);
         if (!$user->showOnline) {
             if ($moderator) {
                 $this->hiddenList[$user->getName()] = $user;
             }
         } else {
             $this->onlineList[$user->getName()] = $user;
         }
     }
     ksort($this->onlineList);
     ksort($this->hiddenList);
     $profile = KunenaFactory::getProfile();
     $this->usersUrl = $profile->getUserListURL();
 }
Exemplo n.º 10
0
	public function display() {
		// Redirect profile to integrated component if profile integration is turned on
		$redirect = 1;
		$active = JFactory::getApplication ()->getMenu ()->getActive ();
		if (!empty($active)) {
			$params = new JParameter($active->params);
			$redirect = $params->get('integration');
		}
		if ($redirect) {
			$profileIntegration = KunenaFactory::getProfile();
			if (!($profileIntegration instanceof KunenaProfileKunena)) {
				$url = CKunenaLink::GetProfileURL(KunenaFactory::getUser()->userid, false);
				if ($url) {
					$this->setRedirect($url);
					return;
				}
			}
		}
		parent::display();
	}
Exemplo n.º 11
0
 /**
  * Get the profile URL of the current logged-in user
  */
 protected function getLink()
 {
     $user = JFactory::getUser();
     $link = $this->params->get('link', false);
     if (!$link || $user->guest) {
         return;
     }
     switch ($link) {
         case 'com_kunena':
             require_once JPATH_ADMINISTRATOR . '/components/com_kunena/libraries/factory.php';
             return KunenaFactory::getProfile()->getProfileURL($user->id);
         case 'com_community':
             return JRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
         case 'com_comprofiler':
             include_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
             cbimport('cb.database');
             return $GLOBALS['_CB_framework']->userProfileUrl($user->id);
     }
 }
Exemplo n.º 12
0
 function getMessageProfileBox()
 {
     static $profiles = array();
     $key = $this->profile->userid . '.' . $this->profile->username;
     if (!isset($profiles[$key])) {
         // Run events
         $params = new JRegistry();
         // 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 = ' ' . JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=user&task=karmadown&userid=' . $this->profile->userid . '&' . JSession::getFormToken() . '=1', '<span class="kkarma-minus" alt="Karma-" border="0" title="' . JText::_('COM_KUNENA_KARMA_SMITE') . '"> </span>');
                 $this->userkarma_plus = ' ' . JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=user&task=karmaup&userid=' . $this->profile->userid . '&' . JSession::getFormToken() . '=1', '<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) {
                 $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->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 = (string) $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];
 }
Exemplo n.º 13
0
 /**
  * @param null $tpl
  *
  * @throws Exception
  */
 protected function displayCommon($tpl = null)
 {
     $userid = JFactory::getApplication()->input->getInt('userid');
     $this->_db = JFactory::getDBO();
     $this->do = JFactory::getApplication()->input->getWord('layout');
     if (!$userid) {
         $this->user = JFactory::getUser();
     } else {
         $this->user = JFactory::getUser($userid);
     }
     if ($this->user->id == 0 || $this->me->userid == 0 && !$this->config->pubprofile) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILEPAGE_NOT_ALLOWED_FOR_GUESTS'), 'notice');
         return;
     }
     $integration = KunenaFactory::getProfile();
     $activityIntegration = KunenaFactory::getActivityIntegration();
     $template = KunenaFactory::getTemplate();
     $this->params = $template->params;
     if (get_class($integration) == 'KunenaProfileNone') {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILE_DISABLED'), 'notice');
         return;
     }
     $this->allow = true;
     $this->profile = KunenaFactory::getUser($this->user->id);
     if (!$this->profile->exists()) {
         $this->profile->save();
     }
     if ($this->profile->userid == $this->me->userid) {
         if ($this->do != 'edit') {
             $this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_EDIT') . ' &raquo;', JText::_('COM_KUNENA_EDIT') . ' &raquo;', 'nofollow', 'edit', '');
         } else {
             $this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_BACK') . ' &raquo;', JText::_('COM_KUNENA_BACK') . ' &raquo;', 'nofollow', '', '');
         }
     }
     $this->name = $this->user->username;
     if ($this->config->showuserstats) {
         $this->rank_image = $this->profile->getRank(0, 'image');
         $this->rank_title = $this->profile->getRank(0, 'title');
         $this->posts = $this->profile->posts;
         $this->thankyou = $this->profile->thankyou;
         $this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
         $this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
     }
     if ($this->config->userlist_joindate || $this->me->isModerator()) {
         $this->registerdate = $this->user->registerDate;
     }
     if ($this->config->userlist_lastvisitdate || $this->me->isModerator()) {
         $this->lastvisitdate = $this->user->lastvisitDate;
     }
     if (!isset($this->lastvisitdate) || $this->lastvisitdate == "0000-00-00 00:00:00") {
         $this->lastvisitdate = null;
     }
     $this->avatarlink = $this->profile->getAvatarImage('kavatar', 'profile');
     $this->personalText = $this->profile->personalText;
     $this->signature = $this->profile->signature;
     $this->signatureHtml = KunenaHtmlParser::parseBBCode($this->signature, null, $this->config->maxsig);
     $this->localtime = KunenaDate::getInstance('now', $this->user->getParam('timezone', $this->app->get('offset', null)));
     try {
         $offset = new DateTimeZone($this->user->getParam('timezone', $this->app->get('offset', null)));
     } catch (Exception $e) {
         $offset = null;
     }
     $this->localtime->setTimezone($offset);
     $this->moderator = KunenaAccess::getInstance()->getModeratorStatus($this->profile);
     $this->admin = $this->profile->isAdmin();
     switch ($this->profile->gender) {
         case 1:
             $this->genderclass = 'male';
             $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_MALE');
             break;
         case 2:
             $this->genderclass = 'female';
             $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_FEMALE');
             break;
         default:
             $this->genderclass = 'unknown';
             $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_UNKNOWN');
     }
     if ($this->profile->location) {
         $this->locationlink = '<a href="http://maps.google.com?q=' . $this->escape($this->profile->location) . '" target="_blank">' . $this->escape($this->profile->location) . '</a>';
     } else {
         $this->locationlink = JText::_('COM_KUNENA_LOCATION_UNKNOWN');
     }
     $this->online = $this->profile->isOnline();
     $this->showUnusedSocial = true;
     if (!preg_match("~^(?:f|ht)tps?://~i", $this->profile->websiteurl)) {
         $this->websiteurl = 'http://' . $this->profile->websiteurl;
     } else {
         $this->websiteurl = $this->profile->websiteurl;
     }
     $avatar = KunenaFactory::getAvatarIntegration();
     $this->editavatar = $avatar instanceof KunenaAvatarKunena ? true : false;
     $this->banInfo = KunenaUserBan::getInstanceByUserid($userid, true);
     $this->canBan = $this->banInfo->canBan();
     if ($this->config->showbannedreason) {
         $this->banReason = $this->banInfo->reason_public;
     }
     // Which tabs to show?
     $this->showUserPosts = true;
     $this->showSubscriptions = $this->config->allowsubscriptions && $this->me->userid == $this->profile->userid;
     $this->showFavorites = $this->config->allowfavorites && $this->me->userid == $this->profile->userid;
     $this->showThankyou = $this->config->showthankyou && $this->me->exists();
     $this->showUnapprovedPosts = $this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus();
     // || $this->me->userid == $this->profile->userid;
     $this->showAttachments = $this->canManageAttachments() && ($this->me->isModerator() || $this->me->userid == $this->profile->userid);
     $this->showBanManager = $this->me->isModerator() && $this->me->userid == $this->profile->userid;
     $this->showBanHistory = $this->me->isModerator() && $this->me->userid != $this->profile->userid;
     $this->showBanUser = $this->canBan;
     if ($this->me->userid != $this->profile->userid) {
         $this->profile->uhits++;
         $this->profile->save();
     }
     $private = KunenaFactory::getPrivateMessaging();
     if ($this->me->userid == $this->user->id) {
         $this->pmCount = $private->getUnreadCount($this->me->userid);
         $this->pmLink = $private->getInboxLink($this->pmCount ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $this->pmCount) : JText::_('COM_KUNENA_PMS_INBOX'));
     } else {
         $this->pmLink = $this->profile->profileIcon('private');
     }
     $this->_prepareDocument('common');
     $layout = $this->getLayout() != 'default' ? "User/{$this->getLayout()}" : 'User/Item';
     $this->render($layout, $tpl);
 }
Exemplo n.º 14
0
	public function loadTopProfiles($limit=0) {
		$limit = $limit ? $limit : $this->_config->popusercount;
		if (count($this->topProfiles) < $limit) {
			$this->topProfiles = KunenaFactory::getProfile()->getTopHits($limit);
			$top = reset($this->topProfiles);
			if (empty($top->count)) {
				$this->topProfiles = array();
				return;
			}
			foreach ($this->topProfiles as $item) {
				$item->link = CKunenaLink::GetProfileLink($item->id);
				$item->percent = round(100 * $item->count / $top->count);
			}
			$top->title = JText::_('COM_KUNENA_STAT_TOP') .' '. $limit .' '. JText::_('COM_KUNENA_STAT_POPULAR') .' '. JText::_('COM_KUNENA_STAT_POPULAR_USER_GSG');
			$top->titleName = JText::_('COM_KUNENA_USRL_USERNAME');
			$top->titleCount =  JText::_('COM_KUNENA_USRL_HITS');
		}
		return array_slice($this->topProfiles, 0, $limit);
	}
Exemplo n.º 15
0
 function __construct($userid, $do = '')
 {
     $this->_app = JFactory::getApplication();
     $this->my = JFactory::getUser();
     $this->do = $do;
     if ($this->do == 'login') {
         return $this->login();
     } elseif ($this->do == 'logout') {
         return $this->logout();
     }
     kimport('html.parser');
     require_once KPATH_SITE . '/lib/kunena.timeformat.class.php';
     $this->_db = JFactory::getDBO();
     $this->config = KunenaFactory::getConfig();
     if (!$userid) {
         $this->user = $this->my;
     } else {
         $this->user = JFactory::getUser($userid);
     }
     if ($this->user->id == 0 || $this->my->id == 0 && !$this->config->pubprofile) {
         $this->allow = false;
         $this->header = JText::_('COM_KUNENA_LOGIN_NOTIFICATION');
         $this->body = JText::_('COM_KUNENA_PROFILEPAGE_NOT_ALLOWED_FOR_GUESTS') . ' ' . JText::_('COM_KUNENA_NO_ACCESS');
         CKunenaTools::loadTemplate('/login.php');
         return;
     }
     $integration = KunenaFactory::getProfile();
     $activityIntegration = KunenaFactory::getActivityIntegration();
     $template = KunenaFactory::getTemplate();
     $this->params = $template->params;
     if (get_class($integration) == 'KunenaProfileNone') {
         $this->allow = false;
         $this->header = JText::_('COM_KUNENA_PROFILE_DISABLED');
         $this->body = JText::_('COM_KUNENA_PROFILE_DISABLED') . ' ' . JText::_('COM_KUNENA_NO_ACCESS');
         CKunenaTools::loadTemplate('/login.php');
         return;
     }
     $this->allow = true;
     $this->profile = KunenaFactory::getUser($this->user->id);
     if (!$this->profile->exists()) {
         $this->profile->save();
     }
     if ($this->profile->userid == $this->my->id) {
         if ($this->do != 'edit') {
             $this->editlink = CKunenaLink::GetMyProfileLink($this->profile->userid, JText::_('COM_KUNENA_EDIT'), 'nofollow', 'edit');
         } else {
             $this->editlink = CKunenaLink::GetMyProfileLink($this->profile->userid, JText::_('COM_KUNENA_BACK'), 'nofollow');
         }
     }
     $this->name = $this->user->username;
     if ($this->config->userlist_name) {
         $this->name = $this->user->name . ' (' . $this->name . ')';
     }
     if ($this->config->showuserstats) {
         if ($this->config->userlist_usertype) {
             $this->usertype = $this->user->usertype;
         }
         $this->rank_image = $this->profile->getRank(0, 'image');
         $this->rank_title = $this->profile->getRank(0, 'title');
         $this->posts = $this->profile->posts;
         $this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
         $this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
     }
     if ($this->config->userlist_joindate || CKunenaTools::isModerator($this->my->id)) {
         $this->registerdate = $this->user->registerDate;
     }
     if ($this->config->userlist_lastvisitdate || CKunenaTools::isModerator($this->my->id)) {
         $this->lastvisitdate = $this->user->lastvisitDate;
     }
     $this->avatarlink = $this->profile->getAvatarLink('kavatar', 'profile');
     $this->personalText = $this->profile->personalText;
     $this->signature = $this->profile->signature;
     $this->timezone = $this->user->getParam('timezone', $this->_app->getCfg('offset', 0));
     $this->moderator = CKunenaTools::isModerator($this->profile->userid);
     $this->admin = CKunenaTools::isAdmin($this->profile->userid);
     switch ($this->profile->gender) {
         case 1:
             $this->genderclass = 'male';
             $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_MALE');
             break;
         case 2:
             $this->genderclass = 'female';
             $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_FEMALE');
             break;
         default:
             $this->genderclass = 'unknown';
             $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_UNKNOWN');
     }
     if ($this->profile->location) {
         $this->locationlink = '<a href="http://maps.google.com?q=' . kunena_htmlspecialchars($this->profile->location) . '" target="_blank">' . kunena_htmlspecialchars($this->profile->location) . '</a>';
     } else {
         $this->locationlink = JText::_('COM_KUNENA_LOCATION_UNKNOWN');
     }
     $this->online = $this->profile->isOnline();
     $this->showUnusedSocial = true;
     $avatar = KunenaFactory::getAvatarIntegration();
     $this->editavatar = is_a($avatar, 'KunenaAvatarKunena') ? true : false;
     kimport('userban');
     $this->banInfo = KunenaUserBan::getInstanceByUserid($userid, true);
     $this->canBan = $this->banInfo->canBan();
     if ($this->config->showbannedreason) {
         $this->banReason = $this->banInfo->reason_public;
     }
 }
Exemplo n.º 16
0
 public function getLink()
 {
     if ($this->komentoprofile) {
         return JRoute::_('index.php?option=com_komento&view=profile&id=' . $this->profile->id);
     }
     //return JRoute::_('index.php?option=com_kunena&func=fbprofile&userid=' . $this->id, false);
     $profileKNN = KunenaFactory::getProfile($this->profile->id);
     return $profileKNN->getProfileURL($this->profile->id, '');
 }
Exemplo n.º 17
0
 private static function kunena($profile)
 {
     $userKNN = KunenaFactory::getUser($profile->id);
     $avatarLink = $userKNN->getAvatarURL('kavatar');
     $profileKNN = KunenaFactory::getProfile($profile->id);
     $profileLink = $profileKNN->getProfileURL($profile->id, '');
     return array($avatarLink, $profileLink);
 }
Exemplo n.º 18
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];
	}
Exemplo n.º 19
0
 public function getURL($xhtml = true)
 {
     if (!$this->exists()) {
         return;
     }
     return KunenaFactory::getProfile()->getProfileURL($this->userid, '', $xhtml);
 }
Exemplo n.º 20
0
	/**
	 * Method to display a view.
	 *
	 * @return	void
	 * @since	1.6
	 */
	public function display() {
		KUNENA_PROFILER ? $this->profiler->mark('beforeDisplay') : null;
		KUNENA_PROFILER ? KunenaProfiler::instance()->start('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
		$app = JFactory::getApplication();
		if ($app->isAdmin()) {
			// Version warning
			require_once KPATH_ADMIN . '/install/version.php';
			$version = new KunenaVersion();
			$version_warning = $version->getVersionWarning('COM_KUNENA_VERSION_INSTALLED');
			if (! empty ( $version_warning )) {
				$app->enqueueMessage ( $version_warning, 'notice' );
			}
		} else {
			// Initialize profile integration
			$integration = KunenaFactory::getProfile();
			$integration->open();

			/*if (!$app->getMenu ()->getActive ()) {
				// FIXME:
				JError::raiseError ( 500, JText::_ ( 'COM_KUNENA_NO_ACCESS' ) );
			}*/
		}

		// Get the document object.
		$document = JFactory::getDocument ();

		// Set the default view name and format from the Request.
		$vName = JRequest::getWord ( 'view', 'none' );
		$lName = JRequest::getWord ( 'layout', 'default' );
		$vFormat = $document->getType ();

		$view = $this->getView ( $vName, $vFormat );
		if ($view) {
			if ($app->isSite() && $vFormat=='html') {
				$view->template = KunenaFactory::getTemplate();
				$common = $this->getView ( 'common', $vFormat );
				$common->setModel ( $this->getModel ( 'common' ), true );
				$view->common = $common;
				$templatepath = KPATH_SITE."/{$view->template->getPath()}/html/";
				$view->addTemplatePath($templatepath.$vName);
				$view->common->addTemplatePath($templatepath.'common');
			}

			// Do any specific processing for the view.
			switch ($vName) {
				default :
					// Get the appropriate model for the view.
					$model = $this->getModel ( $vName );
					break;
			}

			// Push the model into the view (as default).
			$view->setModel ( $model, true );

			// Set the view layout.
			$view->setLayout ( $lName );

			// Push document object into the view.
			$view->assignRef ( 'document', $document );

			// Render the view.
			if ($vFormat=='html') {
				$view->displayAll ();
			} else {
				$view->displayLayout ();
			}
		}

		if ($app->isSite()) {
			// Close profile integration
			$integration = KunenaFactory::getProfile();
			$integration->close();
		}
		KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
	}
Exemplo n.º 21
0
	protected function displayCommon($tpl = null) {
		$userid = JRequest::getInt('userid');

		$this->_db = JFactory::getDBO ();
		$this->_app = JFactory::getApplication ();
		$this->config = KunenaFactory::getConfig ();
		$this->my = JFactory::getUser ();
		$this->me = KunenaUserHelper::getMyself();
		$this->do = JRequest::getWord('layout');

		if (!$userid) {
			$this->user = $this->my;
		} else {
			$this->user = JFactory::getUser( $userid );
		}
		if ($this->user->id == 0|| ($this->my->id == 0 && !$this->config->pubprofile)) {
			$this->_app->enqueueMessage ( JText::_('COM_KUNENA_PROFILEPAGE_NOT_ALLOWED_FOR_GUESTS'), 'notice' );
			return;
		}

		$integration = KunenaFactory::getProfile();
		$activityIntegration = KunenaFactory::getActivityIntegration();
		$template = KunenaFactory::getTemplate();
		$this->params = $template->params;

		if (get_class($integration) == 'KunenaProfileNone') {
			$this->_app->enqueueMessage ( JText::_('COM_KUNENA_PROFILE_DISABLED'), 'notice' );
			return;
		}

		$this->allow = true;

		$this->profile = KunenaFactory::getUser ( $this->user->id );
		if (!$this->profile->exists()) {
			$this->profile->save();
		}
		if ($this->profile->userid == $this->my->id) {
			if ($this->do != 'edit') $this->editLink = CKunenaLink::GetMyProfileLink ( $this->profile->userid, JText::_('COM_KUNENA_EDIT').' &raquo;', 'nofollow', 'edit', 'kheader-link' );
			else $this->editLink = CKunenaLink::GetMyProfileLink ( $this->profile->userid, JText::_('COM_KUNENA_BACK').' &raquo;', 'nofollow', '', 'kheader-link' );

			// TODO: Deprecated
			if ($this->do != 'edit') $this->editlink = CKunenaLink::GetMyProfileLink ( $this->profile->userid, JText::_('COM_KUNENA_EDIT'), 'nofollow', 'edit' );
			else $this->editlink = CKunenaLink::GetMyProfileLink ( $this->profile->userid, JText::_('COM_KUNENA_BACK'), 'nofollow' );
		}
		$this->name = $this->user->username;
		if ($this->config->userlist_name) $this->name = $this->user->name . ' (' . $this->name . ')';
		if ($this->config->showuserstats) {
			if ($this->config->userlist_usertype) $this->usertype = $this->user->usertype;
			$this->rank_image = $this->profile->getRank (0, 'image');
			$this->rank_title = $this->profile->getRank (0, 'title');
			$this->posts = $this->profile->posts;
			$this->thankyou = $this->profile->thankyou;
			$this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
			$this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
		}
		if ($this->config->userlist_joindate || $this->me->isModerator()) $this->registerdate = $this->user->registerDate;
		if ($this->config->userlist_lastvisitdate || $this->me->isModerator()) $this->lastvisitdate = $this->user->lastvisitDate;
		if ($this->lastvisitdate == "0000-00-00 00:00:00") $this->lastvisitdate = null;
		$this->avatarlink = $this->profile->getAvatarImage('kavatar','profile');
		$this->personalText = $this->profile->personalText;
		$this->signature = $this->profile->signature;
		$this->localtime = KunenaDate::getInstance();
		$this->localtime->setOffset($this->user->getParam('timezone', $this->_app->getCfg ( 'offset', 0 )));
		$this->moderator = $this->profile->isModerator();
		$this->admin = $this->profile->isAdmin();
		switch ($this->profile->gender) {
			case 1:
				$this->genderclass = 'male';
				$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_MALE');
				break;
			case 2:
				$this->genderclass = 'female';
				$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_FEMALE');
				break;
			default:
				$this->genderclass = 'unknown';
				$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_UNKNOWN');
		}
		if ($this->profile->location)
			$this->locationlink = '<a href="http://maps.google.com?q='.$this->escape($this->profile->location).'" target="_blank">'.$this->escape($this->profile->location).'</a>';
		else
			$this->locationlink = JText::_('COM_KUNENA_LOCATION_UNKNOWN');

		$this->online = $this->profile->isOnline();
		$this->showUnusedSocial = true;

		$avatar = KunenaFactory::getAvatarIntegration();
		$this->editavatar = is_a($avatar, 'KunenaAvatarKunena') ? true : false;

		$this->banInfo = KunenaUserBan::getInstanceByUserid($userid, true);
		$this->canBan = $this->banInfo->canBan();
		if ( $this->config->showbannedreason ) $this->banReason = $this->banInfo->reason_public;

		$user = JFactory::getUser();
		if ($user->id != $this->profile->userid)
		{
			$this->profile->uhits++;
			$this->profile->save();
		}

		$this->canManageAttachs = $this->canManageAttachments ();

		$private = KunenaFactory::getPrivateMessaging();
		if ($this->my->id == $this->user->id) {
			$this->pmCount = $private->getUnreadCount($this->my->id);
			$this->pmLink = $private->getInboxLink($this->pmCount ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $this->pmCount) : JText::_('COM_KUNENA_PMS_INBOX'));
		} else {
			$this->pmLink = $this->profile->profileIcon('private');
		}
		$this->setTitle(JText::sprintf('COM_KUNENA_VIEW_USER_DEFAULT', $this->profile->getName()));
		parent::display();
	}
Exemplo n.º 22
0
	public function getUserlistLink($action, $name, $rel = 'nofollow', $class = '') {
		$link = KunenaFactory::getProfile ()->getUserListURL ( $action );
		if ($link) {
			return '<a href="'. $link .'" rel="'.$rel.'" class="'.$class.'">'.$name.'</a>';
		}
		return $name;
	}
Exemplo n.º 23
0
 /**
  * @param bool   $xhtml
  * @param string $task
  *
  * @return mixed
  */
 public function getURL($xhtml = true, $task = '')
 {
     // Note: We want to link also existing users who have never visited Kunena before.
     if (!$this->userid || !$this->registerDate) {
         return;
     }
     return KunenaFactory::getProfile()->getProfileURL($this->userid, $task, $xhtml);
 }
Exemplo n.º 24
0
	public function getUserlistLink($action, $name, $rel = 'nofollow', $class = '')
	{
		$my = KunenaFactory::getUser();

		if ($name == $this->memberCount) {
			$link = KunenaFactory::getProfile ()->getUserListURL ( $action );

			if ($link)
			{
				return '<a href="' . $link . '" rel="' . $rel . '" class="' . $class . '">' . $name . '</a>';
			}
			else {
				return  $name;
			}
		}
		elseif ($my->userid == 0 && KunenaFactory::getConfig()->userlist_allowed) {
			return false;
		}
		else {
			$link = KunenaFactory::getProfile ()->getUserListURL ( $action );
			return '<a href="'. $link .'" rel="'.$rel.'" class="'.$class.'">'.$name.'</a>';
		}
	}
Exemplo n.º 25
0
 public function getUserlistLink($action, $name, $rel = 'nofollow', $class = '')
 {
     if (KunenaFactory::getConfig()->userlist_allowed && JFactory::getUser()->guest) {
         return false;
     }
     $link = KunenaFactory::getProfile()->getUserListURL($action);
     if ($link) {
         return '<a href="' . $link . '" rel="' . $rel . '" class="' . $class . '">' . $name . '</a>';
     }
     return $name;
 }
Exemplo n.º 26
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);
 }
Exemplo n.º 27
0
	static function GetUserlistURL($action = '', $xhtml = true) {
		$profile = KunenaFactory::getProfile ();
		return $profile->getUserListURL ( $action, $xhtml );
	}
Exemplo n.º 28
0
	/**
	 * @param bool   $xhtml
	 * @param string $task
	 *
	 * @return mixed
	 */
	public function getURL($xhtml = true, $task = '')
	{
		// Note: We want to link also existing users who have never visited Kunena before.
		if (!$this->userid || !$this->registerDate)
		{
			return;
		}

		$config = KunenaConfig::getInstance();
		$me = KunenaUserHelper::getMyself();
		if (!$config->pubprofile && !$me->exists())
		{
			return false;
		}

		return KunenaFactory::getProfile ()->getProfileURL ( $this->userid, $task, $xhtml );
	}
Exemplo n.º 29
0
 /**
  * @param int $limit
  *
  * @return array
  */
 public function loadTopProfiles($limit = 0)
 {
     $limit = $limit ? $limit : $this->_config->popusercount;
     if (count($this->topProfiles) < $limit) {
         $this->topProfiles = KunenaFactory::getProfile()->getTopHits($limit);
         $top = reset($this->topProfiles);
         if (!$top) {
             return array();
         }
         $top->title = JText::_('COM_KUNENA_LIB_STAT_TOP_PROFILES');
         $top->titleName = JText::_('COM_KUNENA_USERNAME');
         $top->titleCount = JText::_('COM_KUNENA_USRL_HITS');
         foreach ($this->topProfiles as &$item) {
             $item = clone $item;
             $item->link = KunenaUserHelper::get($item->id)->getLink();
             $item->percent = round(100 * $item->count / $top->count);
         }
     }
     return array_slice($this->topProfiles, 0, $limit);
 }
Exemplo n.º 30
0
 function loadTopProfiles($PopUserCount = 0)
 {
     if (!$PopUserCount) {
         $PopUserCount = $this->_config->popusercount;
     }
     if (count($this->topprofiles) < $PopUserCount) {
         $profile = KunenaFactory::getProfile();
         $this->topprofiles = $profile->getProfileView($PopUserCount);
         $this->topprofilehits = !empty($this->topprofiles[0]->hits) ? $this->topprofiles[0]->hits : 0;
     }
 }