本文整理汇总了PHP中KunenaFactory::getActivityIntegration方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaFactory::getActivityIntegration方法的具体用法?PHP KunenaFactory::getActivityIntegration怎么用?PHP KunenaFactory::getActivityIntegration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaFactory
的用法示例。
在下文中一共展示了KunenaFactory::getActivityIntegration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: permdel
function permdel()
{
if (!JSession::checkToken('post')) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
$this->setRedirectBack();
return;
}
$message = '';
$ids = array_keys(JRequest::getVar('topics', array(), 'post', 'array'));
// Array of integer keys
JArrayHelper::toInteger($ids);
$topics = KunenaForumTopicHelper::getTopics($ids);
if (!$topics) {
$message = JText::_('COM_KUNENA_NO_TOPICS_SELECTED');
} else {
foreach ($topics as $topic) {
if ($topic->authorise('permdelete') && $topic->delete()) {
// Activity integration
$activity = KunenaFactory::getActivityIntegration();
$activity->onAfterDeleteTopic($topic);
$message = JText::_('COM_KUNENA_BULKMSG_DELETED');
} else {
$this->app->enqueueMessage($topic->getError(), 'notice');
}
}
}
if ($message) {
$this->app->enqueueMessage($message);
}
$this->setRedirectBack();
}
示例2: setThankyou
/**
* Store ThankYou into the table
*
* @since 1.6
*/
function setThankyou()
{
if (JRequest::checkToken('get') == false) {
$this->_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
while (@ob_end_clean()) {
}
$this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
return;
}
if (!$this->my->id) {
$this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_LOGIN'));
while (@ob_end_clean()) {
}
$this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
}
if (!$this->config->showthankyou) {
$this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_DISABLED'));
$this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
while (@ob_end_clean()) {
}
}
require_once KPATH_SITE . '/lib/kunena.posting.class.php';
$post = new CKunenaPosting();
if (!$post->action($this->pid)) {
$errors = $post->getErrors();
$this->_app->enqueueMessage(reset($post->getErrors()));
while (@ob_end_clean()) {
}
$this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
}
$this->targetuserid = $post->get('userid');
//Check if the user already said thank you to this post
if ($this->my->id == $this->targetuserid) {
$this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_NOT_YOURSELF'));
while (@ob_end_clean()) {
}
$this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
return;
}
$saidit = KunenaThankYou::checkIfThankYouAllready($this->pid, $this->my->id);
if (!empty($saidit)) {
$this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_ALLREADY'));
while (@ob_end_clean()) {
}
$this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
return;
}
//Perform the insert
if (KunenaThankYou::storeThankYou($this->pid, $this->my->id, $this->targetuserid) !== true) {
KunenaError::checkDatabaseError();
}
$activityIntegration = KunenaFactory::getActivityIntegration();
$activityIntegration->onAfterThankyou($this->targetuserid, $this->my->id, $post);
$this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_SUCCESS'));
while (@ob_end_clean()) {
}
$this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
}
示例3: karma
protected function karma($karmaDelta) {
$app = JFactory::getApplication ();
if (! JRequest::checkToken ('get')) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
$this->redirectBack ();
}
$karma_delay = '14400'; // 14400 seconds = 6 hours
$userid = JRequest::getInt ( 'userid', 0 );
$catid = JRequest::getInt ( 'catid', 0 );
$config = KunenaFactory::getConfig();
$me = KunenaFactory::getUser();
$target = KunenaFactory::getUser($userid);
if (!$config->showkarma || !$me->exists() || !$target->exists() || $karmaDelta == 0) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_USER_ERROR_KARMA' ), 'error' );
$this->redirectBack ();
}
$now = JFactory::getDate()->toUnix();
if (!$me->isModerator($catid) && $now - $me->karma_time < $karma_delay) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_KARMA_WAIT' ), 'notice' );
$this->redirectBack ();
}
if ($karmaDelta > 0) {
if ($me->userid == $target->userid) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_KARMA_SELF_INCREASE' ), 'notice' );
$karmaDelta = -10;
} else {
$app->enqueueMessage ( JText::_('COM_KUNENA_KARMA_INCREASED' ) );
}
} else {
if ($me->userid == $target->userid) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_KARMA_SELF_DECREASE' ), 'notice' );
} else {
$app->enqueueMessage ( JText::_('COM_KUNENA_KARMA_DECREASED' ) );
}
}
$me->karma_time = $now;
if ($me->userid != $target->userid && !$me->save()) {
$app->enqueueMessage($me->getError(), 'notice');
$this->redirectBack ();
}
$target->karma += $karmaDelta;
if (!$target->save()) {
$app->enqueueMessage($target->getError(), 'notice');
$this->redirectBack ();
}
// Activity integration
$activity = KunenaFactory::getActivityIntegration();
$activity->onAfterKarma($target->userid, $me->userid, $karmaDelta);
$this->redirectBack ();
}
示例4: while
$kunena_app->enqueueMessage(JText::_('COM_KUNENA_KARMA_WAIT'));
while (@ob_end_clean()) {
}
$kunena_app->redirect(CKunenaLink::GetMyProfileURL($userid));
}
}
} else {
if ($kunena_my->id == $userid) {
if ($do == "increase") {
$kunena_db->setQuery("UPDATE #__kunena_users SET karma=karma-10, karma_time={$kunena_db->Quote($time)} WHERE userid='{$kunena_db->Quote($kunena_my->id)}");
$kunena_db->query();
if (KunenaError::checkDatabaseError()) {
return;
}
// Activity integration
$activity = KunenaFactory::getActivityIntegration();
$activity->onAfterKarma($userid, $kunena_my->id, -10);
if ($pid) {
$kunena_app->enqueueMessage(JText::_('COM_KUNENA_KARMA_SELF_INCREASE'));
while (@ob_end_clean()) {
}
$kunena_app->redirect(CKunenaLink::GetMessageURL($pid, $catid, 0, false));
} else {
$kunena_app->enqueueMessage(JText::_('COM_KUNENA_KARMA_SELF_INCREASE'));
while (@ob_end_clean()) {
}
$kunena_app->redirect(CKunenaLink::GetMyProfileURL($userid));
}
}
if ($do == "decrease") {
$kunena_db->setQuery("UPDATE #__kunena_users SET karma_time={$kunena_db->Quote($time)} WHERE userid={$kunena_db->Quote($kunena_my->id)}");
示例5: displayCommon
/**
* @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) {
//.........这里部分代码省略.........
示例6: getMessageProfileBox
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];
}
示例7: __construct
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();
//.........这里部分代码省略.........
示例8: update
protected function update($newTopic = false)
{
// If post was published and then moved, we need to update old topic
if (!$this->_hold && $this->_thread && $this->_thread != $this->thread) {
$topic = KunenaForumTopicHelper::get($this->_thread);
if (!$topic->update($this, -1)) {
$this->setError($topic->getError());
}
}
$postDelta = $this->delta(true);
$topic = $this->getTopic();
// New topic
if ($newTopic) {
$topic->hold = 0;
}
// Update topic
if (!$this->hold && $topic->hold && $topic->exists()) {
// We published message -> publish and recount topic
$topic->hold = 0;
$topic->recount();
} elseif (!$topic->update($this, $postDelta)) {
$this->setError($topic->getError());
}
// Activity integration
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('finder');
$activity = KunenaFactory::getActivityIntegration();
if ($postDelta < 0) {
$dispatcher->trigger('onDeleteKunenaPost', array(array($this->id)));
$activity->onAfterDelete($this);
} elseif ($postDelta > 0) {
$topic->markRead();
if ($this->parent == 0) {
$activity->onAfterPost($this);
} else {
$activity->onAfterReply($this);
}
}
}
示例9: undelete
public function undelete($mesid)
{
if (!$this->parent || $this->parent->id != $mesid) {
$this->loadMessage($mesid);
}
if (!$this->canUndelete()) {
return false;
}
// Execute undelete
$query = "UPDATE #__kunena_messages SET `hold`=0 WHERE `id`={$this->_db->quote($this->parent->id)};";
$this->_db->setQuery($query);
$this->_db->query();
$dberror = $this->checkDatabaseError();
if ($dberror) {
return $this->setError('-undelete-', JText::_('COM_KUNENA_POST_ERROR_UNDELETE'));
}
// Last but not least update forum stats
CKunenaTools::reCountBoards();
$this->set('id', $this->parent->id);
// Activity integration
$activity = KunenaFactory::getActivityIntegration();
$activity->onAfterUndelete($this);
return empty($this->errors);
}
示例10: KUndelete
function KUndelete()
{
$kunena_app = JFactory::getApplication();
$kunena_db = JFactory::getDBO();
$backUrl = $kunena_app->getUserState("com_kunena.ActionBulk");
if (!JRequest::checkToken()) {
$kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
while (@ob_end_clean()) {
}
$kunena_app->redirect($backUrl);
}
require_once KUNENA_PATH_LIB . '/kunena.moderation.class.php';
$kunena_mod = CKunenaModeration::getInstance();
$items = KGetArrayInts("cb");
// start iterating here
foreach ($items as $id => $value) {
// Need to get hold value to check if the message is right deleted
$query = "SELECT MAX(IF(`hold`=2 OR `hold`=3, 1, 0)) FROM #__kunena_messages WHERE `thread`={$kunena_db->quote($id)} GROUP BY `thread`;";
$kunena_db->setQuery($query);
$messageHold = $kunena_db->loadResult();
KunenaError::checkDatabaseError();
if ($messageHold) {
$delete = $kunena_mod->UndeleteThread($id, true);
if (!$delete) {
$kunena_app->enqueueMessage($kunena_mod->getErrorMessage(), 'notice');
} else {
$kunena_app->enqueueMessage(JText::_('COM_KUNENA_POST_SUCCESS_UNDELETE'));
}
// Last but not least update forum stats
CKunenaTools::reCountBoards();
// Activity integration
$activity = KunenaFactory::getActivityIntegration();
$activity->onAfterUndelete($this);
}
}
//end foreach
while (@ob_end_clean()) {
}
$kunena_app->redirect($backUrl);
}
示例11: unlock
protected function unlock()
{
if ($this->tokenProtection('get')) {
return false;
}
if (!$this->load()) {
return false;
}
if ($this->moderatorProtection()) {
return false;
}
if ($this->isUserBanned()) {
return false;
}
if ($this->isIPBanned()) {
return false;
}
$success_msg = JText::_('COM_KUNENA_POST_LOCK_NOT_UNSET');
$this->_db->setQuery("update #__kunena_messages set locked=0 where id={$this->_db->Quote($this->id)}");
if ($this->id && $this->_db->query() && $this->_db->getAffectedRows() == 1) {
$success_msg = JText::_('COM_KUNENA_POST_LOCK_UNSET');
// Activity integration
$activity = KunenaFactory::getActivityIntegration();
$activity->onAfterLock($this->id, 0);
}
while (@ob_end_clean()) {
}
$this->_app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($this->id, $this->config->messages_per_page), $success_msg);
}
示例12: displayCommon
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();
}
//.........这里部分代码省略.........
示例13: unlock
public function unlock()
{
if (!JRequest::checkToken('get')) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
$this->redirectBack();
}
$topic = KunenaForumTopicHelper::get($this->id);
if (!$topic->authorise('lock')) {
$this->app->enqueueMessage($topic->getError(), 'notice');
} elseif ($topic->lock(0)) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_POST_LOCK_UNSET'));
// Activity integration
$activity = KunenaFactory::getActivityIntegration();
$activity->onAfterLock($topic, 0);
} else {
$this->app->enqueueMessage(JText::_('COM_KUNENA_POST_LOCK_NOT_UNSET'));
}
$this->redirectBack();
}
示例14: display
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);
//.........这里部分代码省略.........
示例15: getMessageProfileBox
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];
}