function KunenaLatestxPagination($func, $sel, $page, $totalpages, $maxpages) { $startpage = $page - floor($maxpages / 2) < 1 ? 1 : $page - floor($maxpages / 2); $endpage = $startpage + $maxpages; if ($endpage > $totalpages) { $startpage = $totalpages - $maxpages < 1 ? 1 : $totalpages - $maxpages; $endpage = $totalpages; } $output = '<span class="fb_pagination">' . _PAGE; if ($startpage > 1) { if ($endpage < $totalpages) { $endpage--; } $output .= CKunenaLink::GetLatestPageLink($func, 1, 'follow', '', $sel); if ($startpage > 2) { $output .= "..."; } } for ($i = $startpage; $i <= $endpage && $i <= $totalpages; $i++) { if ($page == $i) { $output .= "<strong>{$i}</strong>"; } else { $output .= CKunenaLink::GetLatestPageLink($func, $i, 'follow', '', $sel); } } if ($endpage < $totalpages) { if ($endpage < $totalpages - 1) { $output .= "..."; } $output .= CKunenaLink::GetLatestPageLink($func, $totalpages, 'follow', '', $sel); } $output .= '</span>'; return $output; }
function KunenaShowcatPagination($catid, $page, $totalpages, $maxpages) { $startpage = $page - floor($maxpages / 2) < 1 ? 1 : $page - floor($maxpages / 2); $endpage = $startpage + $maxpages; if ($endpage > $totalpages) { $startpage = $totalpages - $maxpages < 1 ? 1 : $totalpages - $maxpages; $endpage = $totalpages; } $output = '<span class="fb_pagination">' . _PAGE; if ($startpage > 1) { if ($endpage < $totalpages) { $endpage--; } $output .= CKunenaLink::GetCategoryPageLink('showcat', $catid, 1, 1, $rel = 'follow'); if ($startpage > 2) { $output .= "..."; } } for ($i = $startpage; $i <= $endpage && $i <= $totalpages; $i++) { if ($page == $i) { $output .= "<strong>{$i}</strong>"; } else { $output .= CKunenaLink::GetCategoryPageLink('showcat', $catid, $i, $i, $rel = 'follow'); } } if ($endpage < $totalpages) { if ($endpage < $totalpages - 1) { $output .= "..."; } $output .= CKunenaLink::GetCategoryPageLink('showcat', $catid, $totalpages, $totalpages, $rel = 'follow'); } $output .= '</span>'; return $output; }
public function results() { require_once KPATH_SITE . '/lib/kunena.link.class.php'; $model = $this->getModel('Search'); $this->app->redirect ( CKunenaLink::GetSearchURL('advsearch', $model->getState('searchwords'), $model->getState('list.start'), $model->getState('list.limit'), $model->getUrlParams(), false) ); }
function KunenaViewPagination($catid, $threadid, $page, $totalpages, $maxpages) { $fbConfig =& CKunenaConfig::getInstance(); $startpage = $page - floor($maxpages / 2) < 1 ? 1 : $page - floor($maxpages / 2); $endpage = $startpage + $maxpages; if ($endpage > $totalpages) { $startpage = $totalpages - $maxpages < 1 ? 1 : $totalpages - $maxpages; $endpage = $totalpages; } $output = '<span class="fb_pagination">' . _PAGE; if ($startpage > 1) { if ($endpage < $totalpages) { $endpage--; } $output .= CKunenaLink::GetThreadPageLink($fbConfig, 'view', $catid, $threadid, 1, $fbConfig->messages_per_page, 1, '', $rel = 'follow'); if ($startpage > 2) { $output .= "..."; } } for ($i = $startpage; $i <= $endpage && $i <= $totalpages; $i++) { if ($page == $i) { $output .= "<strong>{$i}</strong>"; } else { $output .= CKunenaLink::GetThreadPageLink($fbConfig, 'view', $catid, $threadid, $i, $fbConfig->messages_per_page, $i, '', $rel = 'follow'); } } if ($endpage < $totalpages) { if ($endpage < $totalpages - 1) { $output .= "..."; } $output .= CKunenaLink::GetThreadPageLink($fbConfig, 'view', $catid, $threadid, $totalpages, $fbConfig->messages_per_page, $totalpages, '', $rel = 'follow'); } $output .= '</span>'; return $output; }
public function getInboxLink($text) { if (!$text) { $text = JText::_('COM_KUNENA_PMS_INBOX'); } return CKunenaLink::GetHrefLink(CRoute::_('index.php?option=com_community&view=inbox'), $text, '', 'follow'); }
public function getUsersOnlineList($sfunc) { $users = $this->_getOnlineUsers($sfunc); $onlineUsersList = array(); $totalguests = $totalhidden = 0; foreach ($users as $user) { if ($user->userid) { if ($user->showOnline) { $onlineUsersList[] = CKunenaLink::GetProfileLink($user->userid, $user->username); } else { $totalhidden++; } } else { $totalguests++; } } // Show hidden users as quests: $totalguests += $totalhidden; if ($totalguests > 0) { if ($totalguests == 1) { $onlineUsersList[] = '(' . $totalguests . ') ' . JText::_('COM_KUNENA_WHO_ONLINE_GUEST'); } else { $onlineUsersList[] = '(' . $totalguests . ') ' . JText::_('COM_KUNENA_WHO_ONLINE_GUESTS'); } } return implode(', ', $onlineUsersList); }
public function getInboxLink($text) { if (!$text) { $text = JText::_('COM_KUNENA_PMS_INBOX'); } return CKunenaLink::GetSefHrefLink($this->uddeim->getLinkToBox('inbox', false), $text, '', 'follow'); }
function kunenaAvatar($userid) { $kunena_user = KunenaFactory::getUser((int) $userid); $username = $kunena_user->getName(); // Takes care of realname vs username setting $avatarlink = $kunena_user->getAvatarLink('', $this->params->get('avatar_w'), $this->params->get('avatar_h')); return CKunenaLink::GetProfileLink($userid, $avatarlink, $username); }
/** * adds the link for the connect param * @since 1.7.3 * @param $user pass-by-reference * @return void */ private function getUserLink(&$user) { $username = KunenaFactory::getUser($user['userid'])->getName(); if ($user['leapcorrection'] == $this->timeo->format('z', true) + 1) { $subject = getSubject($username); $db = JFactory::getDBO(); $query = "SELECT id,catid,subject,time as year FROM #__kunena_messages WHERE subject='{$subject}'"; $db->setQuery($query, 0, 1); $post = $db->loadAssoc(); if ($db->getErrorMsg()) { KunenaError::checkDatabaseError(); } $catid = $this->params->get('bcatid'); $postyear = new JDate($post['year'], $this->soffset); if (empty($post) && !empty($catid) || !empty($post) && !empty($catid) && $postyear->format('Y', true) < $this->timeo->format('Y', true)) { $botname = $this->params->get('swkbbotname', JText::_('SW_KBIRTHDAY_FORUMPOST_BOTNAME_DEF')); $botid = $this->params->get('swkbotid'); $time = CKunenaTimeformat::internalTime(); //Insert the birthday thread into DB $query = "INSERT INTO #__kunena_messages (catid,name,userid,email,subject,time, ip)\n\t\t \t\tVALUES({$catid},'{$botname}',{$botid}, '','{$subject}', {$time}, '')"; $db->setQuery($query); $db->query(); if ($db->getErrorMsg()) { KunenaError::checkDatabaseError(); } //What ID get our thread? $messid = (int) $db->insertID(); //Insert the thread message into DB $message = getMessage($username); $query = "INSERT INTO #__kunena_messages_text (mesid,message)\n VALUES({$messid},'{$message}')"; $db->setQuery($query); $db->query(); if ($db->getErrorMsg()) { KunenaError::checkDatabaseError(); } //We know the thread ID so we can update the parent thread id with it's own ID because we know it's //the first post $query = "UPDATE #__kunena_messages SET thread={$messid} WHERE id={$messid}"; $db->setQuery($query); $db->query(); if ($db->getErrorMsg()) { KunenaError::checkDatabaseError(); } // now increase the #s in categories CKunenaTools::modifyCategoryStats($messid, 0, $time, $catid); $user['link'] = CKunenaLink::GetViewLink('view', $messid, $catid, '', $username); $uri = JFactory::getURI(); if ($uri->getVar('option') == 'com_kunena') { $app =& JFactory::getApplication(); $app->redirect($uri->toString()); } } elseif (!empty($post)) { $user['link'] = CKunenaLink::GetViewLink('view', $post['id'], $post['catid'], '', $username); } } else { $user['link'] = CKunenaLink::GetProfileLink($user['userid']); } }
function fbSetTimeout($url, $time, $script = 1) { $url = JRoute::_($url); if ($script) { echo CKunenaLink::GetAutoRedirectHTML($url, $time); } else { echo 'setTimeout("location=\'' . $url . '\'",$time)'; } }
function displayDefault($tpl = null) { require_once KPATH_SITE . '/lib/kunena.link.class.php'; $kunena_stats = KunenaForumStatistics::getInstance(); $kunena_stats->loadAll(); $this->assign($kunena_stats); $this->latestMemberLink = KunenaFactory::getUser(intval($this->lastUserId))->getLink(); $this->userlist = CKunenaLink::GetUserlistLink('', intval($this->get('memberCount'))); $this->_prepareDocument(); parent::display(); }
function displayDefault($tpl = null) { $this->config = KunenaFactory::getConfig (); $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_KUNENA_STAT_FORUMSTATS') . ' - ' . $this->config->board_title); require_once(KPATH_SITE.'/lib/kunena.link.class.php'); $kunena_stats = KunenaForumStatistics::getInstance ( ); $kunena_stats->loadAll(); $this->assign($kunena_stats); $this->latestMemberLink = CKunenaLink::GetProfileLink($this->lastUserId); $this->userlist = CKunenaLink::GetUserlistLink('', intval($this->get('memberCount'))); $this->statisticsURL = KunenaRoute::_('index.php?option=com_kunena&view=statistics'); parent::display (); }
public function getInboxLink ($text) { if (!$text) $text = JText::_('COM_KUNENA_PMS_INBOX'); global $_CB_framework; $cbpath = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php'; if (file_exists($cbpath)) require_once($cbpath); else return; $userid = $_CB_framework->myId(); $cbUser =& CBuser::getInstance( (int) $userid ); if($cbUser === null) return; $itemid = getCBprofileItemid(); return CKunenaLink::GetHrefLink ( cbSef ('index.php?option=com_comprofiler&task=userProfile&user='******'', 'follow'); }
public function onAfterReply($message) { // Check for permisions of the current category - activity only if public or registered $category = $message->getCategory(); if ($category->pub_access == 0 || $category->pub_access == - 1) { require_once KPATH_SITE.'/lib/kunena.link.class.php'; $datareference = '<a href="' . CKunenaLink::GetMessageURL ( $message->id, $message->catid ) . '">' . $message->subject . '</a>'; if ($this->_config->alphauserpointsnumchars > 0) { // use if limit chars for a response if (JString::strlen ( $message->message ) > $this->_config->alphauserpointsnumchars) { if ( $this->_getAUPversion() < '1.5.12' ) { $ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( 'plgaup_reply_kunena' ); if ($ruleEnabled) { AlphaUserPointsHelper::newpoints ( 'plgaup_reply_kunena', '', $message->id, $datareference ); } else { return; } } elseif ( $this->_getAUPversion() >= '1.5.12' ) { $ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( 'plgaup_kunena_topic_reply' ); if ($ruleEnabled) { AlphaUserPointsHelper::newpoints ( 'plgaup_kunena_topic_reply', '', $message->id, $datareference ); } else { return; } } } } else { if ( $this->_getAUPversion() < '1.5.12' ) { $ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( 'plgaup_reply_kunena' ); if ($ruleEnabled) { AlphaUserPointsHelper::newpoints ( 'plgaup_reply_kunena', '', $message->id, $datareference ); } else { return; } } elseif ( $this->_getAUPversion() >= '1.5.12' ) { $ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( 'plgaup_kunena_topic_reply' ); if ($ruleEnabled) { AlphaUserPointsHelper::newpoints ( 'plgaup_kunena_topic_reply', '', $message->id, $datareference ); } else { return; } } } } }
function displayDefault($tpl = null) { $this->config = KunenaFactory::getConfig(); if (!$this->config->enablerss) { JError::raiseError ( 404, JText::_ ( 'COM_KUNENA_RSS_DISABLED' ) ); } $this->assignRef ( 'category', $this->get ( 'Category' ) ); if (! $this->category->authorise('read')) { JError::raiseError ( 404, $this->category->getError() ); } $this->template = KunenaTemplate::getInstance(); $this->assignRef ( 'topics', $this->get ( 'Topics' ) ); $title = JText::_('COM_KUNENA_THREADS_IN_FORUM').': '. $this->category->name; $this->setTitle ( $title ); $metaDesc = $this->document->get ( 'description' ) . '. ' . $this->escape ( "{$this->category->name} - {$this->config->board_title}" ); $this->document->setDescription ( $metaDesc ); // Create image for feed $image = new JFeedImage(); $image->title = $this->document->getTitle(); $image->url = $this->template->getImagePath('icons/rss.png'); $image->description = $this->document->getDescription(); $this->document->image = $image; foreach ( $this->topics as $topic ) { $id = $topic->last_post_id; $page = ceil ( $topic->posts / $this->config->messages_per_page ); $description = $topic->last_post_message; $date = new JDate($topic->last_post_time); $userid = $topic->last_post_userid; $username = KunenaFactory::getUser($userid)->getName($topic->last_post_guest_name); $title = $topic->subject; $url = CKunenaLink::GetThreadPageURL('view', $topic->category_id, $topic->id, $page, $this->config->messages_per_page, $id, true ); $category = $topic->getCategory()->name; $this->createItem($title, $url, $description, $category, $date, $userid, $username); } }
function edit() { require_once KPATH_SITE . '/lib/kunena.link.class.php'; $app = JFactory::getApplication (); if (! JRequest::checkToken ()) { $app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' ); $this->redirectBack (); } $model = $this->getModel('announcement'); $this->canEdit = $model->getCanEdit(); if (! $this->canEdit) { $app->enqueueMessage ( JText::_ ( 'COM_KUNENA_POST_NOT_MODERATOR' ), 'error' ); $this->redirectBack (); } $model->edit(); if (1) { $id = JRequest::getInt ( 'id', 0 ); $app->enqueueMessage ( JText::_ ( $id ? 'COM_KUNENA_ANN_SUCCESS_EDIT' : 'COM_KUNENA_ANN_SUCCESS_ADD' ) ); } $this->setRedirect (CKunenaLink::GetAnnouncementURL ( 'show', false, false )); }
$kunena_db->query(); if (KunenaError::checkDatabaseError()) { return; } if ($pid) { $kunena_app->enqueueMessage(JText::_('COM_KUNENA_KARMA_SELF_DECREASE')); while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetMessageURL($pid, $catid, 0, false)); } else { $kunena_app->enqueueMessage(JText::_('COM_KUNENA_KARMA_SELF_DECREASE')); while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetMyProfileURL($userid)); } } } } } else { //get outa here, you fraud! $kunena_app->enqueueMessage(JText::_('COM_KUNENA_USER_ERROR_KARMA')); while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($pid, $kunena_config->messages_per_page)); } ?> </center> </td> </tr> </table>
</td> </tr> <?php } } ?> <?php if ($this->embedded) { ?> <!-- Bulk Actions --> <tr class="krow1"> <td colspan="7" class="kcol-first krowmoderation"> <?php $user = $this->userid ? '&userid=' . $this->userid : ''; echo CKunenaLink::GetShowLatestLink(JText::_('COM_KUNENA_MORE'), $this->func . $user, 'follow'); ?> </td> </tr> <!-- /Bulk Actions --> <?php } ?> </table> </div> </div> </div> <input type="hidden" name="option" value="com_kunena" /> <input type="hidden" name="func" value="bulkactions" /> <?php echo JHTML::_('form.token');
<th class="kbanned-expire" width="32%"><?php echo JText::_('COM_KUNENA_BAN_EXPIRETIME'); ?></th> </tr> </thead> <tbody> <?php if ( $this->bannedusers ) : foreach ($this->bannedusers as $userban) : $bantext = $userban->blocked ? JText::_('COM_KUNENA_BAN_UNBLOCK_USER') : JText::_('COM_KUNENA_BAN_UNBAN_USER'); $j++; ?> <tr class="krow<?php echo ($i^=1)+1;?>"> <td class="kcol-first kid"> <?php echo $j; ?> </td> <td class="kcol-mid kbanned-user"> <a href="#"><?php echo CKunenaLink::GetProfileLink ( intval($userban->userid) ); ?> </a> </td> <td class="kcol-mid kbanned-from"> <span><?php echo $userban->blocked ? JText::_('COM_KUNENA_BAN_BANLEVEL_JOOMLA') : JText::_('COM_KUNENA_BAN_BANLEVEL_KUNENA'); ?></span> </td> <td class="kcol-mid kbanned-start"> <span><?php echo KunenaDate::getInstance($userban->created_time)->toKunena('datetime'); ?></span> </td> <td class="kcol-mid kbanned-expire"> <span><?php echo $userban->isLifetime() ? JText::_('COM_KUNENA_BAN_LIFETIME') : KunenaDate::getInstance($userban->expiration)->toKunena('datetime'); ?></span> </td> </tr> <?php endforeach; ?> <?php else : ?> <tr class="krow2"> <td colspan="5" class="kcol-first">
<!-- /Avatar --> <!-- Latest Post --> <span class="topic_latest_post"> <?php if ($fbConfig->default_sort == 'asc') { if ($leaf->moved == 0) { echo CKunenaLink::GetThreadPageLink($fbConfig, 'view', $leaf->catid, $leaf->thread, $threadPages, $fbConfig->messages_per_page, _GEN_LAST_POST, $last_reply[$leaf->id]->id); } else { echo _KUNENA_MOVED . ' '; } } else { echo CKunenaLink::GetThreadPageLink($fbConfig, 'view', $leaf->catid, $leaf->thread, 1, $fbConfig->messages_per_page, _GEN_LAST_POST, $last_reply[$leaf->id]->id); } if ($leaf->name) { echo ' ' . _GEN_BY . ' ' . CKunenaLink::GetProfileLink($fbConfig, $last_reply[$leaf->id]->userid, stripslashes($last_reply[$leaf->id]->name), 'nofollow', 'topic_latest_post_user'); } ?> </span> <!-- /Latest Post --> <br /> <!-- Latest Post Date --> <span class="topic_date"> <?php echo time_since($last_reply[$leaf->id]->time, time() + $fbConfig->board_ofset * 3600); ?> <?php echo _KUNENA_AGO; ?> </span> <!-- /Latest Post Date -->
<?php //get the Moderator list for display $fb_queryName = $fbConfig->username ? "username" : "name"; $kunena_db->setQuery("select m.userid, u.{$fb_queryName} AS username FROM #__fb_moderation AS m LEFT JOIN #__users AS u ON u.id=m.userid WHERE m.catid='{$catid}'"); $modslist = $kunena_db->loadObjectList(); check_dberror("Unable to load moderators."); ?> <?php if (count($modslist) > 0) { ?> <div class = "jr-bottomarea-modlist fbs"> <?php echo '' . _GEN_MODERATORS . ": "; foreach ($modslist as $mod) { echo ' ' . CKunenaLink::GetProfileLink($fbConfig, $mod->userid, $mod->username) . ' '; } ?> </div> <?php } ?> <!-- /Mod List --> </th> <th class = "th-right fbs" align="right"> <?php //(JJ) FINISH: CAT LIST BOTTOM if ($fbConfig->enableforumjump) { require_once KUNENA_PATH_LIB . DS . 'kunena.forumjump.php';
?> </td> </tr> <tr> <td class="kuadesc"> <?php //FIXME: move to js folder ?> <script type="text/javascript"> <!-- function switch_avatar_category(gallery) { if (gallery == "") return; var url = "<?php echo CKunenaLink::GetMyProfileUrl(intval($this->user->id), 'edit', false, '&gallery=_GALLERY_'); ?> "; var urlreg = new RegExp("_GALLERY_","g"); location.href=url.replace(urlreg,gallery); } // --> </script> <?php $kid = 0; foreach ($this->galleryimg as $avatarimg) { ?> <span> <label for="kavatar<?php echo $kid;
?> </th> </tr> </thead> <tbody> <tr> <td rowspan="2" valign="top" class="kprofile-left kauthor"> <p><?php echo $this->escape($mes->name); ?> </p> <p><?php $profile = KunenaFactory::getUser(intval($mes->userid)); $useravatar = $profile->getAvatarLink('', '', 'profile'); if ($useravatar) { echo CKunenaLink::GetProfileLink(intval($mes->userid), $useravatar); } ?> </p> </td> <td class="kmessage-left khistorymsg"> <div class="kmsgbody"> <div class="kmsgtext"> <?php echo KunenaParser::parseBBCode($mes->message, $this); ?> </div> </div> <?php if (!empty($this->attachmentslist[$mes->id])) { $this->displayAttachments($this->attachmentslist[$mes->id]);
function display() { if (!$this->config->showannouncement) { return; } $do = JRequest::getVar("do", ""); $id = intval(JRequest::getVar("id", "")); switch ($do) { case 'read': $this->getAnnouncement($id, 1); CKunenaTools::loadTemplate('/announcement/read.php'); break; case 'show': $this->getAnnouncements(0, 5); CKunenaTools::loadTemplate('/announcement/show.php'); break; case 'edit': if (!$this->canEdit) { while (@ob_end_clean()) { } $this->app->redirect(CKunenaLink::GetKunenaURL(false), JText::_('COM_KUNENA_POST_NOT_MODERATOR')); return; } $this->getAnnouncement($id, 0); // Continue // Continue case 'add': if (!$this->canEdit) { while (@ob_end_clean()) { } $this->app->redirect(CKunenaLink::GetKunenaURL(false), JText::_('COM_KUNENA_POST_NOT_MODERATOR')); return; } CKunenaTools::loadTemplate('/announcement/edit.php'); break; case 'delete': $this->delete($id); break; case 'doedit': $this->edit($id); break; default: $this->getAnnouncements(0, 5); CKunenaTools::loadTemplate('/announcement/show.php'); } }
<span class="kpost-userposts"><?php echo JText::_('COM_KUNENA_POSTS') . intval($this->userposts); ?></span> <?php endif ?> <?php if ($this->userpoints) : ?> <span class="kpost-userposts"><?php echo JText::_('COM_KUNENA_AUP_POINTS') . intval($this->userpoints); ?></span> <?php endif ?> </div> </li> <?php if (!empty($this->personaltext)) : ?> <li class="kpost-personal"> <?php echo $this->personaltext ?> </li> <?php endif ?> <?php endif; ?> <?php $avatar = $this->profile->getAvatarImage ('kavatar', 'welcome'); if ($avatar) : ?> <li class="kpost-avatar"> <span class="kavatar"><?php echo CKunenaLink::GetProfileLink ( intval($this->profile->userid), $avatar ); ?></span> </li> <?php endif; ?> <li class="kpost-username"> <?php echo $this->profile->getLink() ?> </li> <?php if (!empty($this->usertype)) : ?> <li class="kpost-usertype"> <span class = "kmsgusertype">( <?php echo $this->escape($this->usertype) ?> )</span> </li> <?php endif ?> <?php if ($this->profile->exists()): ?> <?php if (!empty($this->userranktitle)) : ?> <li class="kpost-userrank"> <?php echo $this->escape($this->userranktitle) ?> </li>
public function onAfterThankyou($thankyoutargetid, $username , $message) { CFactory::load ( 'libraries', 'userpoints' ); CUserPoints::assignPoint ( 'com_kunena.thread.thankyou', $thankyoutargetid ); // Check for permisions of the current category - activity only if public or registered if ($message->getCategory()->pub_access <= 0) { //activity stream - reply post require_once KPATH_SITE.'/lib/kunena.link.class.php'; $JSPostLink = CKunenaLink::GetThreadPageURL ( 'view', $message->catid, $message->thread, 0 ); $act = new stdClass (); $act->cmd = 'wall.write'; $act->actor = JFactory::getUser()->id; $act->target = $thankyoutargetid; $act->title = JText::_ ( '{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::_( 'COM_KUNENA_JS_ACTIVITYSTREAM_THANKYOU' ).' <a href="' . $JSPostLink . '">' . $message->subject . '</a> ' . JText::_ ( 'COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG2' ) ); $act->content = NULL; $act->app = 'kunena.thankyou'; $act->cid = $message->id; // jomsocial 0 = public, 20 = registered members if ($message->getCategory()->pub_access == 0) { $act->access = 0; } else { $act->access = 20; } CFactory::load ( 'libraries', 'activities' ); CActivityStream::add ( $act ); } }
protected function saveUser() { $app = JFactory::getApplication(); $user = $this->user; //new JUser ( $this->user->get('id') ); // we don't want users to edit certain fields so we will ignore them $ignore = array('id', 'gid', 'block', 'usertype', 'registerDate', 'activation'); //clean request $post = JRequest::get( 'post' ); $post['password'] = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW); $post['password2'] = JRequest::getVar('password2', '', 'post', 'string', JREQUEST_ALLOWRAW); if (empty($post['password']) || empty($post['password2'])) { unset($post['password'], $post['password2']); } if ($this->config->usernamechange) $post['username'] = JRequest::getVar('username', '', 'post', 'username'); else $ignore[] = 'username'; foreach ($ignore as $field) { if (isset($post[$field])) unset($post[$field]); } jimport ( 'joomla.version' ); $jversion = new JVersion (); if ( $jversion->RELEASE == '1.6' ) { jimport('joomla.user.helper'); $result = JUserHelper::getUserGroups($user->id); $groups = array(); foreach ( $result as $key => $value ) { $groups[]= $key; } $post['groups'] = $groups; } // get the redirect $return = CKunenaLink::GetMyProfileURL($user->id, '', false); $err_return = CKunenaLink::GetMyProfileURL($user->id, 'edit', false); // do a password safety check if ( !empty($post['password']) && !empty($post['password2']) ) { if(strlen($post['password']) < 5 && strlen($post['password2']) < 5 ) { if($post['password'] != $post['password2']) { $msg = JText::_('COM_KUNENA_PROFILE_PASSWORD_MISMATCH'); $app->redirect ( $err_return, $msg, 'error' ); } $msg = JText::_('COM_KUNENA_PROFILE_PASSWORD_NOT_MINIMUM'); $app->redirect ( $err_return, $msg, 'error' ); } } $username = $this->user->username; // Bind the form fields to the user table if (!$user->bind($post)) { $app->enqueueMessage ( $user->getError(), 'error' ); return false; } // Store user to the database if (!$user->save(true)) { $app->enqueueMessage ( $user->getError(), 'error' ); return false; } $session = JFactory::getSession(); $session->set('user', $user); // update session if username has been changed if ( $username && $username != $user->username ) { $table = JTable::getInstance('session', 'JTable' ); $table->load($session->getId()); $table->username = $user->username; $table->store(); } }
<?php $document =& JFactory::getDocument(); $renderer = $document->loadRenderer('modules'); $options = array('style' => 'xhtml'); $position = 'kunena_bottom'; echo $renderer->render($position, $options, null); ?> </div> <?php } // Credits echo '<div class="fb_credits"> ' . CKunenaLink::GetTeamCreditsLink($catid, _KUNENA_POWEREDBY) . ' ' . CKunenaLink::GetCreditsLink(); if ($fbConfig->enablerss) { $document->addCustomTag('<link rel="alternate" type="application/rss+xml" title="' . _LISTCAT_RSS . '" href="' . JRoute::_(KUNENA_LIVEURLREL . '&func=fb_rss&no_html=1') . '" />'); echo CKunenaLink::GetRSSLink('<img class="rsslink" src="' . KUNENA_URLEMOTIONSPATH . 'rss.gif" border="0" alt="' . _LISTCAT_RSS . '" title="' . _LISTCAT_RSS . '" />'); } echo '</div>'; // display footer $KunenaTemplate->displayParsedTemplate('kunena-footer'); } } //else if (is_object($kunenaProfile)) { $kunenaProfile->close(); } // Just for debugging and performance analysis $mtime = explode(" ", microtime()); $tend = $mtime[1] + $mtime[0]; $tpassed = $tend - $tstart; //echo $tpassed;
function displayFooter($tpl = null) { require_once KPATH_SITE . '/lib/kunena.link.class.php'; $catid = 0; if (KunenaFactory::getConfig ()->enablerss) { if ($catid > 0) { kimport ( 'kunena.forum.category.helper' ); $category = KunenaForumCategoryHelper::get ( $catid ); if ($category->pub_access == 0 && $category->parent) $rss_params = '&catid=' . ( int ) $catid; } else { $rss_params = ''; } if (isset ( $rss_params )) { $document = JFactory::getDocument (); $document->addCustomTag ( '<link rel="alternate" type="application/rss+xml" title="' . JText::_ ( 'COM_KUNENA_LISTCAT_RSS' ) . '" href="' . CKunenaLink::GetRSSURL ( $rss_params ) . '" />' ); $this->assign ( 'rss', CKunenaLink::GetRSSLink ( $this->getIcon ( 'krss', JText::_('COM_KUNENA_LISTCAT_RSS') ), 'follow', $rss_params )); } } $template = KunenaFactory::getTemplate (); $credits = CKunenaLink::GetTeamCreditsLink ( $catid, JText::_('COM_KUNENA_POWEREDBY') ) . ' ' . CKunenaLink::GetCreditsLink (); if ($template->params->get('templatebyText') !='') { $credits .= ' :: <a href ="'. $template->params->get('templatebyLink').'" rel="follow">' . $template->params->get('templatebyText') .' '. $template->params->get('templatebyName') .'</a>'; } $this->assign ( 'credits', $credits ); $result = $this->loadTemplate($tpl); if (JError::isError($result)) { return $result; } echo $result; }
protected function showPlugin($catid, $thread, &$row, $linkOnly) { // Show a simple form to allow posting to forum from the plugin $plgShowForm = $this->params->get ( 'form', 1 ); // Default is to put QuickPost at the very bottom. $formLocation = $this->params->get ( 'form_location', 0 ); // Don't repeat the CSS for each instance of this plugin in a page! if (! self::$includedCss) { $doc = JFactory::getDocument (); $doc->addStyleSheet ( KUNENA_JLIVEURL . $this->basepath .'/kunenadiscuss/discuss.css' ); self::$includedCss = true; } $subject = $row->title; $published = JFactory::getDate(isset($row->publish_up) ? $row->publish_up : 'now')->toUnix(); $now = JFactory::getDate()->toUnix(); // Find cross reference and the real topic $query = "SELECT d.content_id, d.thread_id, m.id AS mesid, t.thread, t.time FROM #__kunenadiscuss AS d LEFT JOIN #__kunena_messages AS m ON d.thread_id = m.id LEFT JOIN #__kunena_messages AS t ON t.id = m.thread WHERE d.content_id = {$this->_db->quote($row->id)}"; $this->_db->setQuery ( $query ); $result = $this->_db->loadObject (); CKunenaTools::checkDatabaseError (); if ( is_object($result) ) { if ($thread && $thread != $result->mesid) { // Custom Topic is not the same as cross reference, additional check needed $query = "SELECT t.thread FROM #__kunena_messages AS m LEFT JOIN #__kunena_messages AS t ON t.id = m.thread WHERE m.id = {$this->_db->quote($thread)}"; $this->_db->setQuery ( $query ); $result->thread = $this->_db->loadResult (); CKunenaTools::checkDatabaseError (); if (!$result->thread) { $this->debug ( "showPlugin: Custom Topic does not exist, aborting" ); return ''; } $this->debug ( "showPlugin: Custom Topic points to new location {$result->thread}" ); } if ($result->thread != $result->thread_id) { // Topic has been moved, has been deleted or tag inside message has been changed $this->debug ( "showPlugin: Removing cross reference record pointing to topic {$result->thread_id}" ); $query = "DELETE FROM #__kunenadiscuss WHERE content_id={$this->_db->quote($result->content_id)}"; $this->_db->setQuery ( $query ); $this->_db->query (); CKunenaTools::checkDatabaseError (); // We may need to add new cross reference or create new topic $thread = $result->thread; $result = null; } } if ( !is_object($result) && $thread) { // Find the real topic $query = "SELECT {$this->_db->quote($row->id)} AS content_id, t.id AS thread_id, m.id AS mesid, t.thread, t.time FROM #__kunena_messages AS m LEFT JOIN #__kunena_messages AS t ON t.id = m.thread WHERE m.id = {$this->_db->quote($thread)}"; $this->_db->setQuery ( $query ); $result = $this->_db->loadObject (); CKunenaTools::checkDatabaseError (); if ( !is_object($result) ) { $this->createReference ( $row, $thread ); $this->debug ( "showPlugin: First hit to Custom Topic, created cross reference to topic {$thread}" ); } else { $this->debug ( "showPlugin: First hit to Custom Topic, cross reference not created to topic {$thread} because it exist already" ); } } else if (! is_object($result) ) { $thread = 0; $create = $this->params->get ( 'create', 0 ); $createTime = $this->params->get ( 'create_time', 0 )*604800; // Weeks in seconds if ($createTime && $published+$createTime < $now) { $this->debug ( "showPlugin: Topic creation time expired, cannot start new discussion anymore" ); return ''; } if ($create) { $thread = $this->createTopic ( $row, $catid, $subject ); $this->debug ( "showPlugin: First hit, created new topic {$thread} into forum" ); } } else { $thread = $result->thread_id; $this->debug ( "showPlugin: Topic {$thread} exists in the forum" ); } // Do we allow answers into the topic? $closeTime = $this->params->get ( 'close_time', 0 ) * 604800; // Weeks in seconds or 0 if ($closeTime) { $this->debug ( "showPlugin: Check if topic is closed" ); if ($result) { $closeReason = $this->params->get ( 'close_reason', 0 ); if ($closeReason) { // Close topic by last post time $query = "SELECT MAX(time) FROM #__kunena_messages WHERE thread = {$this->_db->quote($result->thread)}"; $this->_db->setQuery ( $query ); $closeTime = $this->_db->loadResult () + $closeTime; CKunenaTools::checkDatabaseError (); $this->debug ( "showPlugin: Close time by last post" ); } else { // Close topic by cration time $closeTime = $result->time + $closeTime; $this->debug ( "showPlugin: Close time by topic creation" ); } } else { $closeTime = $now; } } if ($linkOnly && $thread) { $this->debug ( "showPlugin: Link only" ); $sql = "SELECT COUNT(*) FROM #__kunena_messages WHERE hold=0 AND parent!=0 AND thread={$this->_db->quote($thread)}"; $this->_db->setQuery ( $sql ); $postCount = $this->_db->loadResult (); CKunenaTools::checkDatabaseError (); $linktitle = JText::sprintf ( 'PLG_KUNENADISCUSS_DISCUSS_ON_FORUMS', $postCount ); require_once (KPATH_SITE . '/lib/kunena.link.class.php'); $link = CKunenaLink::GetThreadLink ( 'view', $catid, $thread, $linktitle, $linktitle ); return '<div class="kunenadiscuss">' . $link . '</div>'; } // ************************************************************************ // Process the QuickPost form $quickPost = ''; if (!$plgShowForm) { $this->debug ( "showPlugin: Form has been disabled" ); } elseif (!$closeTime || $closeTime >= $now) { $canPost = $this->canPost ( $catid, $thread ); if ($canPost && JRequest::getInt ( 'kdiscussContentId', 0, 'POST' ) == $row->id) { $this->debug ( "showPlugin: Reply topic!" ); $quickPost .= $this->replyTopic ( $row, $catid, $thread, $subject ); } else { $quickPost .= $this->showForm ( $row, $catid, $thread, $subject ); } } // This will be used all the way through to tell users how many posts are in the forum. $content = $this->showTopic ( $catid, $thread ); if (!$content && !$quickPost) { return ''; } if ($formLocation) { $content = '<div class="kunenadiscuss">' . $content . '<br />' . $quickPost . '</div>'; } else { $content = '<div class="kunenadiscuss">' . $quickPost . "<br />" . $content . '</div>'; } return $content; }