/** * Prepare login display. * * @return boolean */ protected function before() { parent::before(); $login = KunenaLogin::getInstance(); if (!$login->enabled()) { return false; } $this->me = KunenaUserHelper::getMyself(); $this->name = $this->me->exists() ? 'Widget/Login/Logout' : 'Widget/Login/Login'; $this->my = JFactory::getUser(); if ($this->my->guest) { $this->registrationUrl = $login->getRegistrationUrl(); $this->resetPasswordUrl = $login->getResetUrl(); $this->remindUsernameUrl = $login->getRemindUrl(); $this->rememberMe = $login->getRememberMe(); } else { $this->lastvisitDate = KunenaDate::getInstance($this->my->lastvisitDate); $private = KunenaFactory::getPrivateMessaging(); if ($private) { $count = $private->getUnreadCount($this->me->userid); $this->inboxCount = $count ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $count) : JText::_('COM_KUNENA_PMS_INBOX'); $this->pm_link = $private->getInboxURL(); } // Display announcements. if ($this->me->isModerator()) { $this->announcementsUrl = KunenaForumAnnouncementHelper::getUrl('list'); } } return true; }
function display() { KunenaForum::setup(); KunenaFactory::loadLanguage(); KunenaFactory::loadLanguage('com_kunena.templates'); $this->params->def('greeting', 1); $this->document = JFactory::getDocument(); $this->me = KunenaFactory::getUser(); $token = JUtility::getToken(); // Load CSS only once if (self::$cssadded == false) { $this->document->addStyleSheet(JURI::root(true) . '/modules/mod_kunenalogin/tmpl/css/kunenalogin.css'); self::$cssadded = true; } $cache = JFactory::getCache('com_kunena', 'output'); if ($cache->start("{$this->me->userid}.{$token}", 'mod_kunenalogin')) { return; } $login = KunenaLogin::getInstance(); if (!$this->me->exists()) { $this->type = 'login'; $this->login = null; if ($login) { $this->lostPasswordUrl = $login->getResetURL(); $this->lostUsernameUrl = $login->getRemindURL(); $this->registerUrl = $login->getRegistrationURL(); $this->remember = JPluginHelper::isEnabled('system', 'remember'); } } else { $this->type = 'logout'; $this->logout = null; $this->lastvisitDate = new KunenaDate($this->me->lastvisitDate); if ($login) { $this->logout = $login->getLogoutURL(); $this->recentPosts = JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=topics', JText::_('MOD_KUNENALOGIN_RECENT')); $this->myPosts = JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=topics&layout=user&mode=default', JText::_('MOD_KUNENALOGIN_MYPOSTS')); } // Private messages $private = KunenaFactory::getPrivateMessaging(); $this->privateMessages = ''; if ($this->params->get('showmessage') && $private) { $count = $private->getUnreadCount($this->me->userid); $this->privateMessages = $private->getInboxLink($count ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $count) : JText::_('COM_KUNENA_PMS_INBOX')); } } $this->return = $this->getReturnURL(); require JModuleHelper::getLayoutPath('mod_kunenalogin'); $cache->end(); }
function display() { $this->login = CKunenaLogin::getloginFields(); $this->logout = CKunenaLogin::getlogoutFields(); $this->my = JFactory::getUser(); $this->private = KunenaFactory::getPrivateMessaging(); $this->PMCount = $this->private->getUnreadCount($this->my->id); $this->PMlink = $this->private->getInboxLink($this->PMCount ? JText::sprintf('MOD_KUNENALOGIN_NEW_MESSAGE', $this->PMCount) : JText::_('MOD_KUNENALOGIN_MYMESSAGES')); $this->params->def('greeting', 1); $this->type = $this->getType(); $this->return = $this->getReturnURL(); $this->loadCSS = $this->loadCSS('mod_kunenalogin'); // load CSS stylesheet $this->user = KunenaFactory::getUser(); require JModuleHelper::getLayoutPath('mod_kunenalogin'); }
protected function _display() { // Load language files. KunenaFactory::loadLanguage(); KunenaFactory::loadLanguage('com_kunena.templates'); $this->params->def('greeting', 1); $this->document = JFactory::getDocument(); $this->me = KunenaFactory::getUser(); $token = JSession::getFormToken(); $login = KunenaLogin::getInstance(); if (!$this->me->exists()) { $this->type = 'login'; $this->login = null; if ($login) { $this->lostPasswordUrl = $login->getResetURL(); $this->lostUsernameUrl = $login->getRemindURL(); $this->registerUrl = $login->getRegistrationURL(); $this->remember = JPluginHelper::isEnabled('system', 'remember'); } } else { $this->type = 'logout'; $this->logout = null; $this->lastvisitDate = KunenaDate::getInstance($this->me->lastvisitDate); if ($login) { $this->logout = $login->getLogoutURL(); $this->recentPosts = JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=topics', JText::_('MOD_KUNENALOGIN_RECENT')); $this->myPosts = JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=topics&layout=user&mode=default', JText::_('MOD_KUNENALOGIN_MYPOSTS')); } // Private messages $private = KunenaFactory::getPrivateMessaging(); $this->privateMessages = ''; if ($this->params->get('showmessage') && $private) { $count = $private->getUnreadCount($this->me->userid); $this->privateMessages = $private->getInboxLink($count ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $count) : JText::_('COM_KUNENA_PMS_INBOX')); } } $this->return = $this->getReturnURL(); require JModuleHelper::getLayoutPath('mod_kunenalogin'); }
function displayLoginBox($tpl = null) { $my = JFactory::getUser (); $cache = JFactory::getCache('com_kunena', 'output'); $cachekey = "{$this->template->name}.common.loginbox.u{$my->id}"; $cachegroup = 'com_kunena.template'; $contents = $cache->get($cachekey, $cachegroup); if (!$contents) { require_once KPATH_SITE . '/lib/kunena.link.class.php'; $this->assign ( 'moduleHtml', $this->getModulePosition('kunena_profilebox')); $login = KunenaFactory::getLogin(); if ($my->get ( 'guest' )) { $this->setLayout('login'); if ($login) { $this->assignRef ( 'login', $login->getLoginFormFields() ); $this->assignRef ( 'register', $login->getRegistrationURL() ); $this->assignRef ( 'lostpassword', $login->getResetURL() ); $this->assignRef ( 'lostusername', $login->getRemindURL() ); } } else { $this->setLayout('logout'); if ($login) $this->assignRef ( 'logout', $login->getLogoutFormFields() ); $this->lastvisitDate = KunenaDate::getInstance($this->me->lastvisitDate); // Private messages $private = KunenaFactory::getPrivateMessaging(); if ($private) { $count = $private->getUnreadCount($this->me->userid); $this->assign ( 'privateMessagesLink', $private->getInboxLink($count ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $count) : JText::_('COM_KUNENA_PMS_INBOX'))); } // TODO: Edit profile (need to get link to edit page, even with integration) //$this->assign ( 'editProfileLink', '<a href="' . CKunenaLink::GetAnnouncementURL ( 'show' ).'">'. JText::_('COM_KUNENA_PROFILE_EDIT').'</a>'); // Announcements if ( $this->me->isModerator()) { $this->assign ( 'announcementsLink', '<a href="' . CKunenaLink::GetAnnouncementURL ( 'show' ).'">'. JText::_('COM_KUNENA_ANN_ANNOUNCEMENTS').'</a>'); } } $contents = $this->loadTemplate($tpl); if (JError::isError($contents)) { return $contents; } $cache->store($contents, $cachekey, $cachegroup); } $contents = preg_replace_callback('|\[K=(\w+)(?:\:([\w-_]+))?\]|', array($this, 'fillLoginBoxInfo'), $contents); echo $contents; }
/** * @param string $name * * @return string */ public function profileIcon($name) { switch ($name) { case 'gender': switch ($this->gender) { case 1: $gender = 'male'; break; case 2: $gender = 'female'; break; default: $gender = 'unknown'; } $title = JText::_('COM_KUNENA_MYPROFILE_GENDER') . ': ' . JText::_('COM_KUNENA_MYPROFILE_GENDER_' . $gender); return '<span class="kicon-profile kicon-profile-gender-' . $gender . '" title="' . $title . '"></span>'; break; case 'birthdate': if ($this->birthdate) { $date = new KunenaDate($this->birthdate); if ($date->format('%Y') < 1902) { break; } return '<span class="kicon-profile kicon-profile-birthdate" title="' . JText::_('COM_KUNENA_MYPROFILE_BIRTHDATE') . ': ' . $this->birthdate->toKunena('date', 'GMT') . '"></span>'; } break; case 'location': if ($this->location) { return '<span class="kicon-profile kicon-profile-location" title="' . JText::_('COM_KUNENA_MYPROFILE_LOCATION') . ': ' . $this->escape($this->location) . '"></span>'; } break; case 'website': $url = $this->websiteurl; if (!preg_match("~^(?:f|ht)tps?://~i", $this->websiteurl)) { $url = 'http://' . $this->websiteurl; } if (!$this->websitename) { $websitename = $this->websiteurl; } else { $websitename = $this->websitename; } if ($this->websiteurl) { return '<a href="' . $this->escape($url) . '" target="_blank"><span class="kicon-profile kicon-profile-website" title="' . JText::_('COM_KUNENA_MYPROFILE_WEBSITE') . ': ' . $this->escape($websitename) . '"></span></a>'; } break; case 'private': $pms = KunenaFactory::getPrivateMessaging(); return $pms->showIcon($this->userid); break; case 'email': // TODO: show email return; // '<span class="email" title="'. JText::_('COM_KUNENA_MYPROFILE_EMAIL').'"></span>'; break; case 'profile': if (!$this->userid) { return; } return $this->getLink('<span class="profile" title="' . JText::_('COM_KUNENA_VIEW_PROFILE') . '"></span>'); break; } }
<?php /** * Kunena Component * @package Kunena.Template.Blue_Eagle * @subpackage User * * @copyright (C) 2008 - 2012 Kunena Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link http://www.kunena.org **/ defined('_JEXEC') or die; $private = KunenaFactory::getPrivateMessaging(); if ($this->me->userid == $this->user->id) { $PMCount = $private->getUnreadCount($this->me->userid); $PMlink = $private->getInboxLink($PMCount ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $PMCount) : JText::_('COM_KUNENA_PMS_INBOX')); } else { $PMlink = $this->profile->profileIcon('private'); } if ($this->avatarlink) { ?> <div class="kavatar-lg"><?php echo $this->avatarlink; ?> </div> <?php } ?> <div id="kprofile-stats"> <ul> <?php
/** * */ function displaySummary() { $private = KunenaFactory::getPrivateMessaging(); if ($this->me->userid == $this->user->id) { $PMCount = $private->getUnreadCount($this->me->userid); $this->PMlink = $private->getInboxLink($PMCount ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $PMCount) : JText::_('COM_KUNENA_PMS_INBOX')); } else { $this->PMlink = $this->profile->profileIcon('private'); } echo $this->loadTemplateFile('summary'); }
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').' »', 'nofollow', 'edit', 'kheader-link' ); else $this->editLink = CKunenaLink::GetMyProfileLink ( $this->profile->userid, JText::_('COM_KUNENA_BACK').' »', '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(); }
function getPrivateMessageLink() { // Private messages $private = KunenaFactory::getPrivateMessaging(); if ($private) { $count = $private->getUnreadCount($this->me->userid); $this->privateMessagesLink = $private->getInboxLink($count ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $count) : JText::_('COM_KUNENA_PMS_INBOX')); } }
public function profileIcon($name) { switch ($name) { case 'gender': switch ($this->gender) { case 1: $gender = 'male'; break; case 2: $gender = 'female'; break; default: $gender = 'unknown'; } $title = JText::_('COM_KUNENA_MYPROFILE_GENDER') . ': ' . JText::_('COM_KUNENA_MYPROFILE_GENDER_' . $gender); return '<span class="kicon-profile kicon-profile-gender-' . $gender . '" title="' . $title . '"></span>'; break; case 'birthdate': if ($this->birthdate) { jimport('joomla.utilities.date'); $date = new JDate($this->birthdate, 0); if ($date->toFormat('%Y') < 1902) { break; } return '<span class="kicon-profile kicon-profile-birthdate" title="' . JText::_('COM_KUNENA_MYPROFILE_BIRTHDATE') . ': ' . CKunenaTimeformat::showDate($this->birthdate, 'date', 'utc', 0) . '"></span>'; } break; case 'location': if ($this->location) { return '<span class="kicon-profile kicon-profile-location" title="' . JText::_('COM_KUNENA_MYPROFILE_LOCATION') . ': ' . kunena_htmlspecialchars($this->location) . '"></span>'; } break; case 'website': $url = 'http://' . $this->websiteurl; if (!$this->websitename) { $websitename = $this->websiteurl; } else { $websitename = $this->websitename; } if ($this->websiteurl) { return '<a href="' . kunena_htmlspecialchars($url) . '" target="_blank"><span class="kicon-profile kicon-profile-website" title="' . JText::_('COM_KUNENA_MYPROFILE_WEBSITE') . ': ' . kunena_htmlspecialchars($websitename) . '"></span></a>'; } break; case 'private': $pms = KunenaFactory::getPrivateMessaging(); return $pms->showIcon($this->userid); break; case 'email': // TODO: show email return; // '<span class="email" title="'. JText::_('COM_KUNENA_MYPROFILE_EMAIL').'"></span>'; break; case 'profile': if (!$this->userid) { return; } return CKunenaLink::GetProfileLink($this->userid, '<span class="profile" title="' . JText::_('COM_KUNENA_VIEW_PROFILE') . '"></span>'); break; } }