Example #1
0
	public function displayEdit()
	{
		$this->setToolBarEdit();
		$this->user         = $this->get('user');
		$this->sub          = $this->get('subscriptions');
		$this->subscatslist = $this->get('catsubcriptions');
		$this->ipslist      = $this->get('IPlist');

		$avatarint        = KunenaFactory::getAvatarIntegration();
		$this->editavatar = ($avatarint instanceof KunenaAvatarKunena) ? true : false;
		$this->avatar     = $avatarint->getLink($this->user, '', 'users');

		// make the select list for the moderator flag
		$yesnoMod [] = JHtml::_('select.option', '1', JText::_('COM_KUNENA_YES'));
		$yesnoMod [] = JHtml::_('select.option', '0', JText::_('COM_KUNENA_NO'));

		// build the html select list
		$this->selectMod = JHtml::_('select.genericlist', $yesnoMod, 'moderator', 'class="inputbox" size="2"', 'value', 'text', $this->user->moderator);

		// make the select list for the moderator flag
		$yesnoOrder [] = JHtml::_('select.option', '0', JText::_('COM_KUNENA_USER_ORDER_ASC'));
		$yesnoOrder [] = JHtml::_('select.option', '1', JText::_('COM_KUNENA_USER_ORDER_DESC'));

		// build the html select list
		$this->selectOrder = JHtml::_('select.genericlist', $yesnoOrder, 'neworder', 'class="inputbox" size="2"', 'value', 'text', $this->user->ordering);
		$this->modCats     = $this->get('listmodcats');
		$this->selectRank  = $this->get('listuserranks');
		$this->display();
	}
Example #2
0
 /**
  * Prepare avatar form.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $avatar = KunenaFactory::getAvatarIntegration();
     if (!$avatar instanceof KunenaAvatarKunena) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_AUTH_ERROR_USER_EDIT_AVATARS'), 404);
     }
     $path = JPATH_ROOT . '/media/kunena/avatars/gallery';
     $this->gallery = $this->input->getString('gallery', '');
     $this->galleries = $this->getGalleries($path);
     $this->galleryOptions = $this->getGalleryOptions($path);
     $this->galleryImages = isset($this->galleries[$this->gallery]) ? $this->galleries[$this->gallery] : reset($this->galleries);
     $this->galleryUri = JUri::root(true) . '/media/kunena/avatars/gallery';
     $this->headerText = JText::_('COM_KUNENA_PROFILE_EDIT_AVATAR_TITLE');
 }
Example #3
0
 /**
  * @param string|int $sizex
  * @param int	$sizey
  *
  * @return string
  */
 public function getAvatarURL($sizex = 'thumb', $sizey = 90)
 {
     $avatars = KunenaFactory::getAvatarIntegration();
     return $avatars->getURL($this, $sizex, $sizey);
 }
Example #4
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') . ' »', JText::_('COM_KUNENA_EDIT') . ' »', 'nofollow', 'edit', '');
         } else {
             $this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_BACK') . ' »', JText::_('COM_KUNENA_BACK') . ' »', '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);
 }
Example #5
0
 public static function loadUsers(array $userids = array())
 {
     // Make sure that userids are unique and that indexes are correct
     $e_userids = array();
     foreach ($userids as &$userid) {
         if (!$userid || $userid != intval($userid)) {
             unset($userid);
         } elseif (empty(self::$_instances[$userid])) {
             $e_userids[$userid] = $userid;
         }
     }
     if (!empty($e_userids)) {
         $userlist = implode(',', $e_userids);
         $db = JFactory::getDBO();
         $query = "SELECT u.name, u.username, u.email, u.block as blocked, u.registerDate, u.lastvisitDate, ku.*\n\t\t\t\tFROM #__users AS u\n\t\t\t\tLEFT JOIN #__kunena_users AS ku ON u.id = ku.userid\n\t\t\t\tWHERE u.id IN ({$userlist})";
         $db->setQuery($query);
         $results = $db->loadAssocList();
         KunenaError::checkDatabaseError();
         foreach ($results as $user) {
             $instance = new KunenaUser(false);
             $instance->setProperties($user);
             $instance->exists(true);
             self::$_instances[$instance->userid] = $instance;
         }
         // Preload avatars if configured
         $avatars = KunenaFactory::getAvatarIntegration();
         $avatars->load($e_userids);
     }
     $list = array();
     foreach ($userids as $userid) {
         if (isset(self::$_instances[$userid])) {
             $list[$userid] = self::$_instances[$userid];
         }
     }
     return $list;
 }
Example #6
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;
     }
 }
Example #7
0
 /**
  * @param array $userids
  *
  * @return array
  */
 public static function loadUsers(array $userids = array())
 {
     KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     // Make sure that userids are unique and that indexes are correct
     $e_userids = array();
     foreach ($userids as $userid) {
         // Ignore guests and imported users, which haven't been mapped to Joomla (id<0).
         if ($userid > 0 && empty(self::$_instances[$userid])) {
             $e_userids[(int) $userid] = (int) $userid;
         }
     }
     if (!empty($e_userids)) {
         $userlist = implode(',', $e_userids);
         $db = JFactory::getDBO();
         $query = "SELECT u.name, u.username, u.email, u.block as blocked, u.registerDate, u.lastvisitDate, ku.*, u.id AS userid\n\t\t\t\tFROM #__users AS u\n\t\t\t\tLEFT JOIN #__kunena_users AS ku ON u.id = ku.userid\n\t\t\t\tWHERE u.id IN ({$userlist})";
         $db->setQuery($query);
         $results = $db->loadAssocList();
         KunenaError::checkDatabaseError();
         foreach ($results as $user) {
             $instance = new KunenaUser(false);
             $instance->setProperties($user);
             $instance->exists(isset($user['posts']));
             self::$_instances[$instance->userid] = $instance;
         }
         // Preload avatars if configured
         $avatars = KunenaFactory::getAvatarIntegration();
         $avatars->load($e_userids);
     }
     $list = array();
     foreach ($userids as $userid) {
         if (isset(self::$_instances[$userid])) {
             $list[$userid] = self::$_instances[$userid];
         }
     }
     KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     return $list;
 }
Example #8
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();
	}
Example #9
0
					<li>
						<ul class="kposthead">
							<li class="kposthead-replytitle"><h3><?php echo !isset($this->mesid) ? $this->escape($this->message->subject) : $this->escape($this->topic->subject)  ?></h3></li>
						</ul>

						<div class="kmod-container">
						<?php if (isset($this->message)) : ?>
							<p><?php echo JText::_('COM_KUNENA_MODERATION_TITLE_SELECTED') ?>:</p>
							<div class="kmoderate-message">
								<h4><?php echo $this->message->subject ?></h4>
								<div class="kmessage-timeby">
									<span class="kmessage-time" title="<?php echo KunenaDate::getInstance($this->message->time)->toKunena('config_post_dateformat_hover'); ?>">
										<?php echo JText::_('COM_KUNENA_POSTED_AT')?> <?php echo KunenaDate::getInstance($this->message->time)->toKunena('config_post_dateformat'); ?>
									</span>
								<span class="kmessage-by"><?php echo JText::_('COM_KUNENA_BY')?> <?php echo CKunenaLink::GetProfileLink($this->message->userid, $this->message->name) ?></span></div>
								<div class="kmessage-avatar"><?php echo KunenaFactory::getAvatarIntegration()->getLink(KunenaFactory::getUser($this->message->userid)); ?></div>
								<div class="kmessage-msgtext"><?php echo KunenaHtmlParser::stripBBCode ($this->message->message, 300) ?></div>
								<div class="clr"></div>
							</div>

							<p>
							<?php echo JText::_('COM_KUNENA_MODERATE_THIS_USER') ?>:
								<strong><?php echo CKunenaLink::GetProfileLink($this->message->userid, $this->escape($this->message->name).' ('.$this->message->userid.')') ?></strong>
							</p>

							<ul>
								<li><label for="kmoderate-mode-selected" class="hasTip" title="<?php echo JText::_('COM_KUNENA_MODERATION_MOVE_SELECTED') ?> :: "><input type="radio" value="0" checked="checked" name="mode" id="kmoderate-mode-selected"><?php echo JText::_('COM_KUNENA_MODERATION_MOVE_SELECTED') ?></label></li>
								<li><label for="kmoderate-mode-newer" class="hasTip" title="<?php echo JText::sprintf ( 'COM_KUNENA_MODERATION_MOVE_NEWER', $this->escape($this->replies) ) ?> :: "><input type="radio" value="2" name="mode" id="kmoderate-mode-newer"><?php echo JText::sprintf ( 'COM_KUNENA_MODERATION_MOVE_NEWER', $this->escape($this->replies) ) ?></label></li>
							</ul>
							<br/>
							<?php else: ?>
Example #10
0
	static public function loadUsers($userids = array()) {
		if (!is_array($userids)) {
			JError::raiseError ( 500, __CLASS__ . '::' . __FUNCTION__.'(): Parameter $userids is not array' );
		}

		// Make sure that userids are unique and that indexes are correct
		$e_userids = array();
		foreach($userids as $userid){
			if (empty ( self::$_instances [intval($userid)] )) $e_userids[intval($userid)] = intval($userid);
		}
		unset($e_userids[0]);
		if (empty($e_userids)) return array();

		$userlist = implode ( ',', $e_userids );

		$db = JFactory::getDBO ();
		$query = "SELECT u.name, u.username, u.email, u.block as blocked, u.registerDate, u.lastvisitDate, ku.*
			FROM #__users AS u
			LEFT JOIN #__kunena_users AS ku ON u.id = ku.userid
			WHERE u.id IN ({$userlist})";
		$db->setQuery ( $query );
		$results = $db->loadAssocList ();
		KunenaError::checkDatabaseError ();

		$list = array ();
		foreach ( $results as $user ) {
			$instance = new KunenaUser (false);
			$instance->setProperties ( $user );
			$instance->exists(true);
			self::$_instances [$instance->userid] = $instance;
		}

		// Finally call integration preload as well
		// Preload avatars if configured
		$avatars = KunenaFactory::getAvatarIntegration();
		$avatars->load($userids);

		foreach ($userids as $userid) {
			if (isset(self::$_instances [$userid])) $list [$userid] = self::$_instances [$userid];
		}
		return $list;
	}
Example #11
0
    function editUserProfile($option, $user, $subslist, $subscatslist, $selectRank, $selectPref, $selectMod, $selectOrder, $uid, $modCats, $useriplist)
    {
        $kunena_config = KunenaFactory::getConfig();
        $kunena_db =& JFactory::getDBO();
        //fill the variables needed later
        $signature = $user->signature;
        $username = $user->username;
        $avatarint = KunenaFactory::getAvatarIntegration();
        $editavatar = is_a($avatarint, 'KunenaAvatarKunena') ? true : false;
        $avatar = $avatarint->getLink($user->id, '', 'profile');
        $ordering = $user->ordering;
        //that's what we got now; later the 'future_use' columns can be used..
        $csubslist = count($subslist);
        //        include_once ('components/com_kunena/bb_adm.js');
        ?>
		<div class="kadmin-functitle icon-profiles"> <?php 
        echo JText::_('COM_KUNENA_PROFFOR');
        ?>
: <?php 
        echo kescape($user->name) . ' (' . kescape($user->username) . ')';
        ?>
</div>
		<form action="index.php?option=<?php 
        echo $option;
        ?>
" method="post" name="adminForm">
		<?php 
        jimport('joomla.html.pane');
        $myTabs =& JPane::getInstance('tabs', array('startOffset' => 0));
        ?>
		<dl class="tabs" id="pane">

		<dt title="<?php 
        echo JText::_('COM_KUNENA_A_BASIC_SETTINGS');
        ?>
"><?php 
        echo JText::_('COM_KUNENA_A_BASIC_SETTINGS');
        ?>
</dt>
		<dd>
		<fieldset>
		<legend><?php 
        echo JText::_('COM_KUNENA_A_BASIC_SETTINGS');
        ?>
</legend>
		<table cellpadding="4" cellspacing="0" border="0" width="100%" class="kadmin-adminform">
			<tr>
				<th colspan="3" class="title"><?php 
        echo JText::_('COM_KUNENA_GENPROF');
        ?>
</th>
			</tr>
			<tr>
				<td width="150" class="contentpane"><?php 
        echo JText::_('COM_KUNENA_PREFOR');
        ?>
</td>
				<td align="left" valign="top" class="contentpane"><?php 
        echo $selectOrder;
        ?>
</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td width="150" class="contentpane"><?php 
        echo JText::_('COM_KUNENA_RANKS');
        ?>
</td>
				<td align="left" valign="top" class="contentpane"><?php 
        echo $selectRank;
        ?>
</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td width="150" valign="top" class="contentpane"><?php 
        echo JText::_('COM_KUNENA_GEN_SIGNATURE');
        ?>
:
				</td>
				<td align="left" valign="top" class="contentpane">

<script type="text/javascript">
var current_count = <?php 
        echo JString::strlen($signature);
        ?>
;
var max_count = <?php 
        echo $kunena_config->maxsig;
        ?>
;

function textCounter(field, target) {
	if (field.value.length > max_count) {
		field.value = field.value.substring(0, max_count);
	} else {
		current_count = max_count - field.value.length;
		target.value = current_count;
	}
}
</script>

	<textarea class="inputbox" name="message" cols="50" rows="6"
	onkeyup="textCounter(this, this.form.current_count);"><?php 
        echo kescape($signature);
        ?>
</textarea>
	<br /><br />
	<div><?php 
        echo JText::sprintf('COM_KUNENA_SIGNATURE_LENGTH_COUNTER', intval($kunena_config->maxsig), '<input readonly="readonly" type="text" name="current_count" value="' . (intval($kunena_config->maxsig) - JString::strlen($signature)) . '" size="3" />');
        ?>
	</div>
	<br />
	<div> <input type="checkbox" value="1" name="deleteSig" /> <em><?php 
        echo JText::_('COM_KUNENA_DELSIG');
        ?>
</em></div>

	</td>
	</tr>
	</table>
</fieldset>
</dd>
<dt title="<?php 
        echo JText::_('COM_KUNENA_A_AVATARS');
        ?>
"><?php 
        echo JText::_('COM_KUNENA_A_AVATARS');
        ?>
</dt>
			<dd>
			<fieldset>
				<legend><?php 
        echo JText::_('COM_KUNENA_A_AVATARS');
        ?>
</legend>
				<table cellpadding="4" cellspacing="0" border="0" width="100%" class="kadmin-adminform">
				<tr>
				<th colspan="2" class="title"><?php 
        echo JText::_('COM_KUNENA_UAVATAR');
        ?>
</th>
			</tr>
			<tr>
				<td class="contentpane">
				<?php 
        echo $avatar;
        if ($editavatar) {
            ?>
					<p><input type="checkbox" value="1"
					name="deleteAvatar" /> <em><?php 
            echo JText::_('COM_KUNENA_DELAV');
            ?>
</em></p></td>
				<?php 
        } else {
            echo "<td>&nbsp;</td>";
            echo '<input type="hidden" value="" name="avatar" />';
        }
        ?>

				<td><?php 
        if ($editavatar) {
        } else {
            echo "<td>&nbsp;</td>";
        }
        ?>
</td>
			</tr>
		</table>

	</fieldset>
</dd>

<dt title="<?php 
        echo JText::_('COM_KUNENA_MOD_NEW');
        ?>
"><?php 
        echo JText::_('COM_KUNENA_MOD_NEW');
        ?>
</dt>
		<dd>
			<fieldset>
				<legend><?php 
        echo JText::_('COM_KUNENA_MOD_NEW');
        ?>
</legend>
				<table cellpadding="4" cellspacing="0" border="0" width="100%" class="kadmin-adminform">
					<tr>
						<th colspan="2" class="title"><?php 
        echo JText::_('COM_KUNENA_MODCHANGE');
        ?>
</th>
					</tr>
					<tr>
						<td width="150" class="contentpane"><?php 
        echo JText::_('COM_KUNENA_ISMOD');
        ?>
</td>
						<td><?php 
        echo JText::_('COM_KUNENA_MODCATS');
        ?>
</td>
					</tr>
					<tr>
						<td width="150" class="contentpane"><?php 
        echo $selectMod;
        ?>
						</td>
						<td><?php 
        echo $modCats;
        ?>
</td>
					</tr>
				</table>
				<input type="hidden" name="uid" value="<?php 
        echo kescape($uid);
        ?>
" />
				<input type="hidden" name="task" value="" />
				<input type="hidden" name="option" value="com_kunena" />
				<input type="hidden" name="boxchecked" value="1" />
			</fieldset>
		</dd>
<dt title="<?php 
        echo JText::_('COM_KUNENA_CATEGORIES_SUBSCRIPTIONS');
        ?>
"><?php 
        echo JText::_('COM_KUNENA_CATEGORIES_SUBSCRIPTIONS');
        ?>
</dt>
			<dd>
			<fieldset>
				<legend><?php 
        echo JText::_('COM_KUNENA_CATEGORIES_SUBSCRIPTIONS');
        ?>
</legend>
				<table cellpadding="4" cellspacing="0" border="0" width="100%" class="kadmin-adminform">
					<tr>
						<th colspan="2" class="title"><?php 
        echo JText::_('COM_KUNENA_SUBFOR') . ' ' . kescape($username);
        ?>
						</th>
					</tr>
					<?php 
        $enum = 1;
        //reset value
        $k = 0;
        //value for alternating rows
        if (!empty($subscatslist)) {
            foreach ($subscatslist as $subscats) {
                //get all category details for each subscription
                $kunena_db->setQuery("select cat.name AS catname, cat.id, msg.subject, msg.id, msg.catid, msg.name AS username from #__kunena_categories AS cat INNER JOIN #__kunena_messages AS msg ON cat.id=msg.catid where cat.id='{$subscats->catid}' GROUP BY cat.id");
                $catdetail = $kunena_db->loadObjectList();
                if (KunenaError::checkDatabaseError()) {
                    break;
                }
                foreach ($catdetail as $cat) {
                    $k = 1 - $k;
                    echo "<tr class=\"row{$k}\">";
                    echo "  <td width=\"30\">{$enum}</td>";
                    echo " <td><strong>" . kescape($cat->catname) . "</strong>" . " &nbsp;" . JText::_('COM_KUNENA_LAST_MESSAGE') . "<em>" . kescape($cat->subject) . "</em>" . " &nbsp;" . JText::_('COM_KUNENA_BY') . " &nbsp;" . "<em>" . kescape($cat->username) . "</em></td>";
                    echo "</tr>";
                    $enum++;
                }
            }
        } else {
            echo "<tr><td class=\"message\">" . JText::_('COM_KUNENA_NOCATSUBS') . "</td></tr>";
        }
        ?>
				</table>
			</fieldset>
			</dd>
<dt title="<?php 
        echo JText::_('COM_KUNENA_SUBSCRIPTIONS');
        ?>
"><?php 
        echo JText::_('COM_KUNENA_SUBSCRIPTIONS');
        ?>
</dt>
			<dd>
			<fieldset>
				<legend><?php 
        echo JText::_('COM_KUNENA_SUBSCRIPTIONS');
        ?>
</legend>
				<table cellpadding="4" cellspacing="0" border="0" width="100%" class="kadmin-adminform">
					<tr>
						<th colspan="2" class="title"><?php 
        echo JText::_('COM_KUNENA_SUBFOR') . ' ' . kescape($username);
        ?>
						</th>
					</tr>
					<?php 
        $enum = 1;
        //reset value
        $k = 0;
        //value for alternating rows
        if ($csubslist > 0) {
            foreach ($subslist as $subs) {
                //get all message details for each subscription
                $kunena_db->setQuery("select * from #__kunena_messages where id={$subs->thread}");
                $subdet = $kunena_db->loadObjectList();
                if (KunenaError::checkDatabaseError()) {
                    break;
                }
                foreach ($subdet as $sub) {
                    $k = 1 - $k;
                    echo "<tr class=\"row{$k}\">";
                    echo "  <td width=\"30\">{$enum}</td>";
                    echo " <td><strong>" . kescape($sub->subject) . "</strong>" . " &nbsp;" . JText::_('COM_KUNENA_BY') . " &nbsp;" . "<em>" . kescape($sub->name) . "</em></td>";
                    echo "</tr>";
                    $enum++;
                }
            }
        } else {
            echo "<tr><td class=\"message\">" . JText::_('COM_KUNENA_NOSUBS') . "</td></tr>";
        }
        ?>
				</table>
			</fieldset>
		</dd>
<dt title="<?php 
        echo JText::_('COM_KUNENA_TRASH_IP');
        ?>
"><?php 
        echo JText::_('COM_KUNENA_TRASH_IP');
        ?>
</dt>
			<dd>
			<fieldset>
				<legend><?php 
        echo JText::_('COM_KUNENA_TRASH_IP');
        ?>
</legend>
				<table cellpadding="4" cellspacing="0" border="0" width="100%" class="kadmin-adminform">
					<tr>
						<th colspan="3" class="title"><?php 
        echo JText::sprintf('COM_KUNENA_IPFOR', kescape($username));
        ?>
						</th>
					</tr>
					<?php 
        $i = 0;
        $k = 0;
        //value for alternating rows
        $userids = '';
        foreach ($useriplist as $ip => $list) {
            $k = 1 - $k;
            $i++;
            $userlist = array();
            $mescnt = 0;
            foreach ($list as $curuser) {
                if ($curuser->userid == $user->id) {
                    $mescnt += intval($curuser->mescnt);
                    continue;
                }
                $userlist[] = kescape($curuser->username) . ' (' . kescape($curuser->mescnt) . ')';
            }
            $userlist = implode(', ', $userlist);
            echo "<tr class=\"row{$k}\">";
            echo "  <td width=\"30\">" . $i . "</td>";
            echo "  <td width=\"60\"><strong>" . kescape($ip) . "</strong></td>";
            echo "  <td>(" . JText::sprintf('COM_KUNENA_IP_OCCURENCES', $mescnt) . (!empty($userlist) ? " " . JText::sprintf('COM_KUNENA_USERIDUSED', kescape($userlist)) : '') . ")</td>";
            //echo "  <td>&nbsp;</td>";
            echo "</tr>";
        }
        ?>
				</table>
			</fieldset>
		</dd>
	</dl>
<?php 
        echo JHTML::_('form.token');
        ?>
</form>
	<?php 
    }