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; }
function logout() { $app = JFactory::getApplication(); if(!JRequest::checkToken()) { $app->redirect ( JRequest::getVar ( 'HTTP_REFERER', JURI::base ( true ), 'server' ), COM_KUNENA_ERROR_TOKEN, 'error' ); } $return = JRequest::getString ( 'return', '', 'POST' ); $login = KunenaFactory::getLogin(); $result = $login->logoutUser($return); if ($result) $app->enqueueMessage ( $result, 'notice' ); $app->redirect ( JRequest::getVar ( 'HTTP_REFERER', JURI::base ( true ), 'server' ) ); }
function logout() { $return = JRequest::getString('return', '', 'POST'); if (!JRequest::checkToken()) { while (@ob_end_clean()) { } $this->_app->redirect(JRequest::getVar('HTTP_REFERER', JURI::base(true), 'server'), COM_KUNENA_ERROR_TOKEN, 'error'); } if (!$this->my->guest) { $login = KunenaFactory::getLogin(); $result = $login->logoutUser($return); if ($result) { $this->_app->enqueueMessage($result, 'notice'); } } while (@ob_end_clean()) { } $this->_app->redirect(JRequest::getVar('HTTP_REFERER', JURI::base(true), 'server')); }
protected function showForm($row, $catid, $thread, $subject ) { $canPost = $this->canPost ( $catid, $thread ); if (! $canPost) { if (! $this->_my->id) { $this->debug ( "showForm: Public posting is not permitted, show login instead" ); $login = KunenaFactory::getLogin (); $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' ); } } $myprofile = KunenaFactory::getUser(); $this->open = $this->params->get ( 'quickpost_open', false ); $this->name = $myprofile->getName(); ob_start (); $this->debug ( "showForm: Rendering form" ); include (JPATH_ROOT . "/{$this->basepath}/kunenadiscuss/form.php"); $str = ob_get_contents (); ob_end_clean (); return $str; }
function getLostUserLink() { $login = KunenaFactory::getLogin(); if (!$login) { return ''; } $url = $login->getRemindURL(); if (!$url) { return ''; } return CKunenaLink::GetHrefLink($url, JText::_('COM_KUNENA_PROFILEBOX_FORGOT_USERNAME')); }