public function __construct() { $this->integration = KunenaIntegration::getInstance ('communitybuilder'); if (! $this->integration || ! $this->integration->isLoaded()) return; $this->joomlalogin = KunenaLogin::getInstance('joomla'); $this->priority = 50; }
function displayUninstall() { $this->setToolBarUninstall(); $login = KunenaLogin::getInstance(); $this->isTFAEnabled = $login->isTFAEnabled(); $this->display(); }
/** * 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; }
public function __construct() { $this->integration = KunenaIntegration::getInstance('jomsocial'); if (!$this->integration || !$this->integration->isLoaded()) { return; } $this->joomlalogin = KunenaLogin::getInstance('joomla'); $this->priority = 50; }
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(); }
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'); }
/** * Method to completly remove kunena by checking before if the user is a super-administrator * * @return void * * @since K4.0 */ public function uninstall() { if (!JSession::checkToken('post')) { $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); $this->setRedirect(KunenaRoute::_($this->baseurl, false)); return; } // Check if the user has the super-administrator rights $username = $this->app->input->getString('username'); $password = $this->app->input->getString('password'); $code = $this->app->input->getInt('secretkey'); $login = KunenaLogin::getInstance(); if ($login->isTFAEnabled()) { if (empty($code) || $code == 0) { $this->app->enqueueMessage(JText::_('COM_KUNENA_TOOLS_UNINSTALL_LOGIN_SECRETKEY_INVALID')); $this->setRedirect(KunenaRoute::_($this->baseurl, false)); } } $error = $login->loginUser($username, $password, 0, null, $code); $user = JFactory::getUser(JUserHelper::getUserId($username)); $isroot = $user->authorise('core.admin'); if (!$error && $isroot) { $this->app->setUserState('com_kunena.uninstall.allowed', true); $this->setRedirect(KunenaRoute::_('administrator/index.php?option=com_kunena&view=uninstall&' . JSession::getFormToken() . '=1', false)); return; } $this->app->enqueueMessage(JText::_('COM_KUNENA_TOOLS_UNINSTALL_LOGIN_FAILED')); $this->setRedirect(KunenaRoute::_($this->baseurl, false)); }
function logout() { if (!JSession::checkToken('request')) { $this->app->redirect(JRequest::getVar('HTTP_REFERER', JURI::base(true), 'server'), JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); } $login = KunenaLogin::getInstance(); if (!JFactory::getUser()->guest) { $login->logoutUser(); } // Get the return url from the request and validate that it is internal. $return = base64_decode(JRequest::getVar('return', '', 'method', 'base64')); // Internal URI if ($return && JURI::isInternal($return)) { // Redirect the user. $this->app->redirect(JRoute::_($return, false)); } $this->redirectBack(); }
/** * Prepare message actions display. * * @return void */ protected function before() { parent::before(); $mesid = $this->input->getInt('mesid'); $me = KunenaUserHelper::getMyself(); $this->message = KunenaForumMessage::getInstance($mesid); $this->topic = $this->message->getTopic(); $id = $this->message->thread; $catid = $this->message->catid; $token = JSession::getFormToken(); $task = "index.php?option=com_kunena&view=topic&task=%s&catid={$catid}&id={$id}&mesid={$mesid}&{$token}=1"; $layout = "index.php?option=com_kunena&view=topic&layout=%s&catid={$catid}&id={$id}&mesid={$mesid}"; $this->template = KunenaFactory::getTemplate(); $this->messageButtons = new JObject(); $this->message_closed = null; if ($this->message->isAuthorised('reply')) { if (version_compare(JVERSION, '3.4', '<') && $me->canDoCaptcha()) { $this->quickreply = false; } elseif (version_compare(JVERSION, '3.4', '>') && $me->canDoCaptcha()) { $this->quickreply = true; } else { $this->quickreply = true; } } else { $this->quickreply = false; } // Reply / Quote if ($this->message->isAuthorised('reply')) { $this->messageButtons->set('reply', $this->getButton(sprintf($layout, 'reply'), 'reply', 'message', 'communication', null, true)); if ($me->exists() && !KunenaSpamRecaptcha::getInstance()->enabled()) { $this->messageButtons->set('quickreply', $this->getButton(sprintf($layout, 'reply'), 'quickreply', 'message', 'communication', "kreply{$mesid}")); } $this->messageButtons->set('quote', $this->getButton(sprintf($layout, 'reply"e=1'), 'quote', 'message', 'communication')); } elseif (!$me->isModerator($this->topic->getCategory())) { // User is not allowed to write a post. $this->message_closed = $this->topic->locked ? JText::_('COM_KUNENA_POST_LOCK_SET') : ($me->exists() ? JText::_('COM_KUNENA_REPLY_USER_REPLY_DISABLED') : ' '); } $login = KunenaLogin::getInstance(); if (!$this->message->isAuthorised('reply') && !$this->message_closed && $login->enabled() || !$this->message->isAuthorised('reply') && !$this->topic->locked && $login->enabled() && !$me->userid) { $logintext = '<a class="btn-link" href="#klogin" rel="nofollow"> ' . JText::_('JLOGIN') . '</a>'; if ($login->getRegistrationUrl()) { $register = ' ' . JText::_('COM_KUNENA_LOGIN_OR') . ' <a class="btn-link" href="' . $login->getRegistrationUrl() . '">' . JText::_('COM_KUNENA_PROFILEBOX_CREATE_ACCOUNT') . '</a>'; } else { $register = ''; } echo '<p>' . JText::sprintf('COM_KUNENA_LOGIN_PLEASE', $logintext, $register) . '</p>'; } // Thank you. if (isset($this->message->thankyou)) { if ($this->message->isAuthorised('thankyou') && !array_key_exists($me->userid, $this->message->thankyou)) { $this->messageButtons->set('thankyou', $this->getButton(sprintf($task, 'thankyou'), 'thankyou', 'message', 'user', null, false)); } } // Unthank you if ($this->message->isAuthorised('unthankyou') && array_key_exists($me->userid, $this->message->thankyou)) { $this->messageButtons->set('unthankyou', $this->getButton(sprintf($task, 'unthankyou&userid=' . $me->userid), 'unthankyou', 'message', 'user', null, false)); } // Report this. if (KunenaFactory::getConfig()->reportmsg && $me->exists()) { $this->messageButtons->set('report', $this->getButton(sprintf($layout, 'report'), 'report', 'message', 'user')); } // Moderation and own post actions. if ($this->message->isAuthorised('edit')) { $this->messageButtons->set('edit', $this->getButton(sprintf($layout, 'edit'), 'edit', 'message', 'moderation')); } if ($this->message->isAuthorised('move')) { $this->messageButtons->set('moderate', $this->getButton(sprintf($layout, 'moderate'), 'moderate', 'message', 'moderation')); } if ($this->message->hold == 1) { if ($this->message->isAuthorised('approve')) { $this->messageButtons->set('publish', $this->getButton(sprintf($task, 'approve'), 'approve', 'message', 'moderation')); } if ($this->message->isAuthorised('delete')) { $this->messageButtons->set('delete', $this->getButton(sprintf($task, 'delete'), 'delete', 'message', 'moderation')); } } elseif ($this->message->hold == 2 || $this->message->hold == 3) { if ($this->message->isAuthorised('undelete')) { $this->messageButtons->set('undelete', $this->getButton(sprintf($task, 'undelete'), 'undelete', 'message', 'moderation')); } if ($this->message->isAuthorised('permdelete')) { $this->messageButtons->set('permdelete', $this->getButton(sprintf($task, 'permdelete'), 'permdelete', 'message', 'permanent')); } } elseif ($this->message->isAuthorised('delete')) { $this->messageButtons->set('delete', $this->getButton(sprintf($task, 'delete'), 'delete', 'message', 'moderation')); } JPluginHelper::importPlugin('kunena'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onKunenaGetButtons', array('message.action', $this->messageButtons, $this)); }
<a href="#" class="thumbnail"> <i class="glyphicon glyphicon-super glyphicon-user "></i> </a> </div> <input id="login-username" type="text" name="username" class="form-control input-sm" tabindex="1" size="18" placeholder="<?php echo JText::_('JGLOBAL_USERNAME'); ?> " /> <input id="login-passwd" type="password" name="password" class="form-control input-sm" tabindex="2" size="18" placeholder="<?php echo JText::_('JGLOBAL_PASSWORD'); ?> " required/> <?php $login = KunenaLogin::getInstance(); ?> <?php if ($login->getTwoFactorMethods() > 1) { ?> <input id="k-lgn-secretkey" type="text" name="secretkey" class="input-large" tabindex="3" size="18" placeholder="<?php echo JText::_('COM_KUNENA_LOGIN_SECRETKEY'); ?> " /> <?php echo JText::_('COM_KUNENA_LOGIN_SECRETKEY'); ?> <?php } ?>
/** * @param $row * @param KunenaForumCategory $category * @param KunenaForumTopic $topic * @param $subject * * @return string */ protected function showForm($row, KunenaForumCategory $category, KunenaForumTopic $topic, $subject) { $canPost = $this->canPost($category, $topic); if (!$canPost) { if (!$this->user->exists()) { $this->debug("showForm: Public posting is not permitted, show login instead"); $login = KunenaLogin::getInstance(); $loginlink = $login->getLoginURL(); $registerlink = $login->getRegistrationURL(); $this->msg = JText::sprintf('PLG_KUNENADISCUSS_LOGIN_OR_REGISTER', '"' . $loginlink . '"', '"' . $registerlink . '"'); } else { $this->debug("showForm: Unfortunately you cannot discuss this item"); $this->msg = JText::_('PLG_KUNENADISCUSS_NO_PERMISSION_TO_POST'); } } $this->open = $this->params->get('quickpost_open', false); $this->name = JRequest::getString('name', $this->user->getName(), 'POST'); $this->email = JRequest::getString('email', null, 'POST'); $this->message = JRequest::getString('message', null, 'POST'); ob_start(); $this->debug("showForm: Rendering form"); include __DIR__ . "/tmpl/form.php"; $str = ob_get_contents(); ob_end_clean(); return $str; }
function displayLoginBox($tpl = null) { if ($this->offline) { return; } $my = JFactory::getUser(); $cache = JFactory::getCache('com_kunena', 'output'); $cachekey = "{$this->ktemplate->name}.common.loginbox.u{$my->id}"; $cachegroup = 'com_kunena.template'; // FIXME: enable caching after fixing the issues $contents = false; //$cache->get($cachekey, $cachegroup); if (!$contents) { $this->moduleHtml = $this->getModulePosition('kunena_profilebox'); $login = KunenaLogin::getInstance(); if ($my->get('guest')) { $this->setLayout('login'); if ($login) { $this->login = $login; $this->registerUrl = $login->getRegistrationUrl(); $this->lostPasswordUrl = $login->getResetUrl(); $this->lostUsernameUrl = $login->getRemindUrl(); $this->remember = $login->getRememberMe(); } } else { $this->setLayout('logout'); if ($login) { $this->logout = $login; } $this->lastvisitDate = KunenaDate::getInstance($this->me->lastvisitDate); // Private messages $this->getPrivateMessageLink(); // TODO: Edit profile (need to get link to edit page, even with integration) //$this->editProfileLink = '<a href="' . $url.'">'. JText::_('COM_KUNENA_PROFILE_EDIT').'</a>'; // Announcements if ($this->me->isModerator()) { $this->announcementsLink = '<a href="' . KunenaForumAnnouncementHelper::getUrl('list') . '">' . JText::_('COM_KUNENA_ANN_ANNOUNCEMENTS') . '</a>'; } } $contents = $this->loadTemplateFile($tpl); if (JError::isError($contents)) { return $contents; } // FIXME: enable caching after fixing the issues //$cache->store($contents, $cachekey, $cachegroup); } $contents = preg_replace_callback('|\[K=(\w+)(?:\:([\w-_]+))?\]|', array($this, 'fillLoginBoxInfo'), $contents); echo $contents; }
function logout() { if (!JRequest::checkToken('request')) { $this->app->redirect(JRequest::getVar('HTTP_REFERER', JURI::base(true), 'server'), COM_KUNENA_ERROR_TOKEN, 'error'); } $login = KunenaLogin::getInstance(); if (!JFactory::getUser()->guest) { $login->logoutUser(); } $this->redirectBack(); }
/** * Get Kunena login object * * Returns the global {@link KunenaLogin} object, only creating it if it doesn't already exist. * * @return object KunenaLogin */ public static function getLogin() { require_once KPATH_ADMIN . '/libraries/integration/login.php'; return KunenaLogin::getInstance(); }
/** * Get Kunena login object * * Returns the global {@link KunenaLogin} object, only creating it if it doesn't already exist. * * @return object KunenaLogin */ public static function getLogin() { kimport('integration.login'); return KunenaLogin::getInstance(); }
/** * @throws Exception */ public function logout() { if (!JSession::checkToken('request')) { $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); $this->setRedirectBack(); return; } $login = KunenaLogin::getInstance(); if (!JFactory::getUser()->guest) { $login->logoutUser(); } // Get the return url from the request and validate that it is internal. $return = base64_decode(JFactory::getApplication()->input->get('return', '', 'method', 'base64')); // Internal URI if ($return && JURI::isInternal($return)) { // Redirect the user. $this->setRedirect(JRoute::_($return, false)); return; } $this->setRedirectBack(); }