/** * Delete a user * * @access protected * @param unknown_type $UserID * @return boolean */ protected function _deleteUser($UserID) { // Sanitize parameters! $UserID = intval($UserID); if (!CKunenaTools::isAdmin($this->_my->id)) { $this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_NOT_ADMIN'); return false; } if ($UserID == $this->_my->id) { $this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_USER_DELETE_YOURSELF'); return false; } if (!$UserID) { $this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_USER_DELETE_ANONYMOUS'); return false; } $user = JUser::getInstance($UserID); if (!$user->id) { $this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_USER_DELETE_NO_USER', $UserID); return false; } // Nobody can delete admins if (CKunenaTools::isAdmin($UserID)) { $this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_USER_DELETE_ADMIN', $user->username); return false; } $user->delete(); $this->_db->setQuery("DELETE FROM #__kunena_users WHERE `userid`={$this->_db->Quote($UserID)};"); $this->_db->query(); if (KunenaError::checkDatabaseError()) { return false; } return true; }
function __construct() { $this->my = JFactory::getUser(); $this->db = JFactory::getDBO(); $this->config = KunenaFactory::getConfig(); $this->app = JFactory::getApplication(); $annmods = @explode(',', $this->config->annmodid); if (in_array($this->my->id, $annmods) || CKunenaTools::isAdmin()) { $this->canEdit = true; } else { $this->canEdit = false; } $this->announcement = new stdClass(); $this->announcement->id = 0; $this->announcement->title = ''; $this->announcement->description = ''; $this->announcement->sdescription = ''; $this->announcement->created = ''; $this->announcement->published = 1; $this->announcement->showdate = 1; }
protected function _removeAttachment($data) { $result = array(); // only registered users when the board is online will endup here // $data has already been escaped as part of this class // TODO: Get attachment details $query = "SELECT a.*, m.*\n\t\t\tFROM #__kunena_attachments AS a\n\t\t\tJOIN #__kunena_messages AS m ON a.mesid = m.id\n\t\t\tWHERE a.id = '" . $data . "'"; $this->_db->setQuery($query); $attachment = $this->_db->loadObject(); if ($this->_db->getErrorNum()) { $result = array('status' => '-1', 'error' => KunenaError::getDatabaseError()); return $result; } // Verify permissions, user must be author of the message this // attachment is attached to or be a moderator or admin of the site if ($attachment->userid != $this->_my->id && !CKunenaTools::isModerator($this->_my->id, $attachment->catid) && !CKunenaTools::isAdmin()) { // not the author, not a moderator, not an admin // nothing todo here - end with permission error $result = array('status' => '-1', 'error' => JText::_('COM_KUNENA_AJAX_PERMISSION_DENIED')); return $result; } // Request coming form valid user, moderator or admin... // First remove files from filsystem - check for thumbs and raw in case this is an image if (file_exists(JPATH_ROOT . $attachment->folder . $attachment->filename)) { JFile::delete(JPATH_ROOT . $attachment->folder . $attachment->filename); } if (file_exists(JPATH_ROOT . $attachment->folder . '/raw/' . $attachment->filename)) { JFile::delete(JPATH_ROOT . $attachment->folder . '/raw/' . $attachment->filename); } if (file_exists(JPATH_ROOT . $attachment->folder . '/thumb/' . $attachment->filename)) { JFile::delete(JPATH_ROOT . $attachment->folder . '/thumb/' . $attachment->filename); } // Finally delete attachment record from db $query = "DELETE FROM #__kunena_attachments AS a\n\t\t\t\t\tWHERE a.id = {$this->_db->Quote($data)}"; $this->_db->setQuery($query); $this->_db->query(); if ($this->_db->getErrorNum()) { $result = array('status' => '-1', 'error' => KunenaError::getDatabaseError()); } else { $result = array('status' => '1', 'error' => JText::_('COM_KUNENA_AJAX_ATTACHMENT_DELETED')); } return $result; }
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(); if ($this->config->showbannedreason) { $this->banReason = $this->banInfo->reason_public; } }
public function canRead($action = '-read-') { // Load must have been performed successfully! if (!$this->parent) { return false; // Error has already been set, either in construct() or load() } // Do not perform rest of the checks to administrators if (CKunenaTools::isAdmin()) { return true; // ACCEPT! } // Category must be visible if (!$this->_session->canRead($this->parent->catid)) { return $this->setError($action, JText::_('COM_KUNENA_NO_ACCESS')); } // Check unapproved, deleted etc messages $access = KunenaFactory::getAccessControl(); $hold = $access->getAllowedHold($this->_my->id, $this->parent->catid, false); if ($this->parent->hold == 1 && $this->_my->id == $this->parent->userid) { // User can see his own post before it gets approved } else { if (!in_array($this->parent->hold, $hold) || !in_array($this->parent->topichold, $hold)) { // User is not allowed to see this post return $this->setError($action, JText::_('COM_KUNENA_POST_INVALID')); } } return true; }
function displayFlat() { if (!$this->allow) { echo JText::_('COM_KUNENA_NO_ACCESS'); return; } if (CKunenaTools::isModerator($this->my->id, $this->catid)) { $this->actionMove = true; $this->actionDropdown[] = JHTML::_('select.option', 'bulkDel', JText::_('COM_KUNENA_DELETE_SELECTED')); $this->actionDropdown[] = JHTML::_('select.option', 'bulkMove', JText::_('COM_KUNENA_MOVE_SELECTED')); if ($this->config->mod_see_deleted == '1' && CKunenaTools::isModerator() || $this->config->mod_see_deleted == '0' && CKunenaTools::isAdmin()) { $this->actionDropdown[] = JHTML::_('select.option', 'bulkDelPerm', JText::_('COM_KUNENA_BUTTON_PERMDELETE_LONG')); $this->actionDropdown[] = JHTML::_('select.option', 'bulkRestore', JText::_('COM_KUNENA_BUTTON_UNDELETE_LONG')); } } if ($this->myprofile->ordering != '0') { $this->topic_ordering = $this->myprofile->ordering == '1' ? 'DESC' : 'ASC'; } else { $this->topic_ordering = $this->config->default_sort == 'asc' ? 'ASC' : 'DESC'; // Just to make sure only valid options make it } CKunenaTools::loadTemplate('/threads/flat.php'); }
protected function load() { if ($this->msg_cat) { return true; } if ($this->id) { // Check that message and category exists and fill some information for later use $query = "SELECT m.*, (mm.locked OR c.locked) AS locked, c.locked AS catlocked, t.message,\n\t\t\t\t\tc.name AS catname, c.parent AS catparent, c.pub_access,\n\t\t\t\t\tc.review, c.class_sfx, p.id AS poll_id, c.allow_anonymous,\n\t\t\t\t\tc.post_anonymous, c.allow_polls\n\t\t\t\tFROM #__kunena_messages AS m\n\t\t\t\tINNER JOIN #__kunena_messages AS mm ON mm.id=m.thread\n\t\t\t\tINNER JOIN #__kunena_messages_text AS t ON t.mesid=m.id\n\t\t\t\tINNER JOIN #__kunena_categories AS c ON c.id=m.catid\n\t\t\t\tLEFT JOIN #__kunena_polls AS p ON m.id=p.threadid\n\t\t\t\tWHERE m.id={$this->_db->Quote($this->id)}"; $this->_db->setQuery($query); $this->msg_cat = $this->_db->loadObject(); if (!$this->msg_cat) { KunenaError::checkDatabaseError(); echo JText::_('COM_KUNENA_POST_INVALID'); return false; } // Make sure that category id is from the message (post may have been moved) if ($this->do != 'domovepostnow' && $this->do != 'domergepostnow' && $this->do != 'dosplit') { $this->catid = $this->msg_cat->catid; } $this->cat_default_allow = $this->msg_cat->allow_anonymous; } else { if ($this->catid) { // Check that category exists and fill some information for later use $this->_db->setQuery("SELECT 0 AS id, 0 AS thread, id AS catid, name AS catname, parent AS catparent, pub_access, locked, locked AS catlocked, review, class_sfx, allow_anonymous, post_anonymous, allow_polls FROM #__kunena_categories WHERE id={$this->_db->Quote($this->catid)}"); $this->msg_cat = $this->_db->loadObject(); if (!$this->msg_cat) { KunenaError::checkDatabaseError(); echo JText::_('COM_KUNENA_NO_ACCESS'); return false; } $this->cat_default_allow = $this->msg_cat->allow_anonymous; } else { //get default category $this->_db->setQuery("SELECT c.allow_anonymous FROM `#__kunena_categories` AS c\n\t\t\t\tINNER JOIN `#__kunena_categories` AS p ON c.parent=p.id AND p.parent=0\n\t\t\t\tWHERE c.id IN ({$this->_session->allowed}) ORDER BY p.ordering, p.name, c.ordering, c.name LIMIT 1"); $this->cat_default_allow = $this->_db->loadResult(); KunenaError::checkDatabaseError(); } } // Special check to verify if topic icons are allowed when do new post and when catid is true if (isset($this->msg_cat->id)) { if ($this->msg_cat->id == 0) { $this->allow_topic_icons = 1; } } // Check if anonymous user needs to log in if ($this->my->id == 0 && (!$this->config->pubwrite || $this->catid && !$this->_session->canRead($this->catid))) { $this->header = JText::_('COM_KUNENA_LOGIN_NOTIFICATION'); $this->body = JText::_('COM_KUNENA_LOGIN_FORUM'); CKunenaTools::loadTemplate('/login.php'); return false; } // Check user access rights if (!empty($this->msg_cat->catparent) && !$this->_session->canRead($this->catid) && !CKunenaTools::isAdmin()) { echo JText::_('COM_KUNENA_NO_ACCESS'); return false; } return true; }
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); $this->message_edit = CKunenaLink::GetTopicPostReplyLink('edit', $this->catid, $this->id, CKunenaTools::showButton('edit', JText::_('COM_KUNENA_BUTTON_EDIT')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_EDIT_LONG')); $this->message_moderate = CKunenaLink::GetTopicPostReplyLink('moderate', $this->catid, $this->id, CKunenaTools::showButton('moderate', JText::_('COM_KUNENA_BUTTON_MODERATE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_MODERATE_LONG')); if ($message->hold == 1) { $this->message_publish = CKunenaLink::GetTopicPostLink('approve', $this->catid, $this->id, CKunenaTools::showButton('approve', JText::_('COM_KUNENA_BUTTON_APPROVE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_APPROVE_LONG')); $this->msgclass .= ' kunapproved'; } if ($message->hold == 2 || $message->hold == 3) { $this->msgclass .= ' kunapproved kdeleted'; $this->message_undelete = CKunenaLink::GetTopicPostLink('undelete', $this->catid, $this->id, CKunenaTools::showButton('undelete', JText::_('COM_KUNENA_BUTTON_UNDELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_UNDELETE_LONG')); $this->message_permdelete = CKunenaLink::GetTopicPostLink('permdelete', $this->catid, $this->id, CKunenaTools::showButton('permdelete', JText::_('COM_KUNENA_BUTTON_PERMDELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_PERMDELETE_LONG')); } else { $this->message_delete = CKunenaLink::GetTopicPostLink('delete', $this->catid, $this->id, CKunenaTools::showButton('delete', JText::_('COM_KUNENA_BUTTON_DELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_DELETE_LONG')); } } else { if ($this->config->useredit && $this->my->id && $this->my->id == $this->profile->userid) { //Now, if the viewer==author and the viewer is allowed to edit his/her own post then offer an 'edit' link if ($message->hold != 2 && CKunenaTools::editTimeCheck($message->modified_time, $message->time)) { $this->message_edit = CKunenaLink::GetTopicPostReplyLink('edit', $this->catid, $this->id, CKunenaTools::showButton('edit', JText::_('COM_KUNENA_BUTTON_EDIT')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_EDIT_LONG')); if ($this->config->userdeletetmessage == '1') { if ($this->replynum == $this->replycnt) { $this->message_delete = CKunenaLink::GetTopicPostLink('delete', $this->catid, $this->id, CKunenaTools::showButton('delete', JText::_('COM_KUNENA_BUTTON_DELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_DELETE_LONG')); } } else { if ($this->config->userdeletetmessage == '2') { $this->message_delete = CKunenaLink::GetTopicPostLink('delete', $this->catid, $this->id, CKunenaTools::showButton('delete', JText::_('COM_KUNENA_BUTTON_DELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_DELETE_LONG')); } } } } } $this->class = 'class="' . $this->msgclass . '"'; if (!$mode) { $templatefile = '/view/message.php'; } else { $templatefile = "/view/message.{$mode}.php"; } CKunenaTools::loadTemplate($templatefile, false, $this->templatepath); }
function GetProfileLink($userid, $name = null, $title = '', $rel = 'nofollow', $class = '') { if (!$name) { $profile = KunenaFactory::getUser($userid); $name = htmlspecialchars($profile->getName(), ENT_COMPAT, 'UTF-8'); } if ($userid == 0) { $uclass = 'kwho-guest'; } else { if (CKunenaTools::isAdmin($userid)) { $uclass = 'kwho-admin'; } else { if (CKunenaTools::isModerator($userid, false)) { $uclass = 'kwho-globalmoderator'; } else { if (CKunenaTools::isModerator($userid)) { $uclass = 'kwho-moderator'; } else { $uclass = 'kwho-user'; } } } } if ($userid > 0) { $link = CKunenaLink::GetProfileURL($userid); if (!empty($link)) { return CKunenaLink::GetHrefLink($link, $name, $title, $rel, $uclass); } } return "<span class=\"{$uclass}\">{$name}</span>"; }
echo $this->escape($tabclass[$k]); ?> "> <td class = "td-1"> <div style = "float: right; width: 14ex;"></div> <span> <?php if ($user->userid == 0) { echo JText::_('COM_KUNENA_GUEST'); } else { echo CKunenaLink::GetProfileLink(intval($user->userid)); } ?> </span> <?php if (CKunenaTools::isAdmin($this->my->id) && $this->config->hide_ip) { echo '(' . $this->escape($user->userip) . ')'; } elseif (CKunenaTools::isModerator($this->my->id) && !$this->config->hide_ip) { echo '(' . $this->escape($user->userip) . ')'; } ?> </td> <td class = "td-2" nowrap = "nowrap"> <span title="<?php echo CKunenaTimeformat::showDate($user->time, 'config_post_dateformat_hover'); ?> "> <?php echo CKunenaTimeformat::showDate($user->time, 'config_post_dateformat'); ?> </span>
function __construct() { ob_start(); // Display time it took to create the entire page in the footer jimport('joomla.error.profiler'); $__kstarttime = JProfiler::getmicrotime(); $kunena_config = KunenaFactory::getConfig(); kimport('error'); KunenaError::initialize(); // First of all take a profiling information snapshot for JFirePHP if (JDEBUG) { require_once JPATH_COMPONENT . '/lib/kunena.profiler.php'; $__profiler = KProfiler::GetInstance(); $__profiler->mark('Start'); } $func = JString::strtolower(JRequest::getCmd('func', JRequest::getCmd('view', ''))); $do = JRequest::getCmd('do', ''); $task = JRequest::getCmd('task', ''); $format = JRequest::getCmd('format', 'html'); JRequest::setVar('func', $func); // Workaround for Joomla 1.7.3 login bug, see: https://github.com/joomla/joomla-platform/pull/740 if ($func == 'profile' && ($task == 'login' || $task == 'logout')) { require_once KUNENA_PATH_FUNCS . '/profile.php'; $page = new CKunenaProfile(JFactory::getUser()->id, $task); } require_once KUNENA_PATH . '/router.php'; if ($func && !isset(KunenaRouter::$functions[$func])) { // If func is not legal, raise joomla error return JError::raiseError(404, 'Kunena function "' . $func . '" not found'); } $kunena_app = JFactory::getApplication(); if (empty($_POST) && $format == 'html') { $me = KunenaFactory::getUser(); $menu = JSite::getMenu(); $active = $menu->getActive(); // Joomla 1.6+ multi-language support if (isset($active->language) && $active->language != '*') { $language = JFactory::getDocument()->getLanguage(); if (strtolower($active->language) != strtolower($language)) { $this->redirect(KunenaRoute::_(null, false)); } } // Legacy menu item and Itemid=0 support with redirect and notice if (empty($active->query['view'])) { $new = $menu->getItem(KunenaRoute::getItemID()); if ($new) { if ($active) { if ($active->route == $new->route) { KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_CONFLICT', $active->route, $active->id, $new->id), 'menu'); $menu->setActive($new->id); $active = $new; } else { KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_LEGACY', $active->route, $active->id, $new->route, $new->id), 'menu'); $this->redirect(KunenaRoute::_(null, false)); } } else { KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NO_ITEM_REDIRECT', $new->route, $new->id)); $this->redirect(KunenaRoute::_(null, false)); } } elseif (!$active) { KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NO_ITEM')); } } if (!$func || $func == 'entrypage') { // If we are currently in entry page, we need to show and highlight default menu item if (!empty($active->query['defaultmenu'])) { $defaultitem = $active->query['defaultmenu']; if ($defaultitem > 0) { $newitem = $menu->getItem($defaultitem); if (!$newitem) { KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NOT_EXISTS'), 'menu'); } elseif (empty($newitem->component) || $newitem->component != 'com_kunena') { KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NOT_KUNENA'), 'menu'); } elseif ($active->route == $newitem->route) { // Special case: we are using Entry Page instead of menu alias and we have identical menu alias if ($active->id != $newitem->id) { $defaultitem = !empty($newitem->query['defaultmenu']) ? $newitem->query['defaultmenu'] : $newitem->id; $newitem2 = $menu->getItem($defaultitem); if (empty($newitem2->component) || $newitem2->component != 'com_kunena') { $defaultitem = $newitem->id; } if ($defaultitem) { $menu->setActive($defaultitem); $active = $menu->getActive(); } } } else { $oldlocation = KunenaRoute::getCurrentMenu(); $menu->setActive($defaultitem); $active = $menu->getActive(); $newlocation = KunenaRoute::getCurrentMenu(); if (!$oldlocation || $oldlocation->id != $newlocation->id) { // Follow Default Menu Item if it's not in the same menu $this->redirect(KunenaRoute::_($defaultitem, false)); } } if (is_object($active)) { foreach ($active->query as $var => $value) { if ($var == 'view') { $var = 'func'; } if ($var == 'func' && $value == 'entrypage') { $value = $func; } JRequest::setVar($var, $value); } $func = JRequest::getCmd('func'); } } } } $newItemid = KunenaRoute::getItemid(); if ($active && $newItemid && !KunenaRoute::getCurrentMenu() && $active->id != $newItemid) { $newroute = KunenaRoute::_($newItemid, false); if (strpos('/' . $active->route, $newroute) === 0) { $menu->setActive($newItemid); $active = $menu->getActive(); } else { $this->redirect(KunenaRoute::_(null, false)); } } } global $message; global $kunena_this_cat; // Get all the variables we need and strip them in case $action = JRequest::getCmd('action', ''); $catid = JRequest::getInt('catid', 0); $contentURL = JRequest::getVar('contentURL', ''); $email = JRequest::getVar('email', ''); $favoriteMe = JRequest::getVar('favoriteMe', ''); $fb_authorname = JRequest::getVar('fb_authorname', ''); $fb_thread = JRequest::getInt('fb_thread', 0); $id = JRequest::getInt('id', 0); $mesid = JRequest::getInt('mesid', 0); $limit = JRequest::getInt('limit', 0); $limitstart = JRequest::getInt('limitstart', 0); $markaction = JRequest::getVar('markaction', ''); $message = JRequest::getVar('message', ''); $page = JRequest::getInt('page', 0); $parentid = JRequest::getInt('parentid', 0); $pid = JRequest::getInt('pid', 0); $replyto = JRequest::getInt('replyto', 0); $resubject = JRequest::getVar('resubject', ''); $rowid = JRequest::getInt('rowid', 0); $rowItemid = JRequest::getInt('rowItemid', 0); $subject = JRequest::getVar('subject', ''); $subscribeMe = JRequest::getVar('subscribeMe', ''); $thread = JRequest::getInt('thread', 0); $topic_emoticon = JRequest::getVar('topic_emoticon', ''); $userid = JRequest::getInt('userid', 0); $no_html = JRequest::getBool('no_html', 0); // If JFirePHP is installed and enabled, leave a trace of the Kunena startup if (JDEBUG == 1 && defined('JFIREPHP')) { // FB::trace("Kunena Startup"); } // Redirect Forum Jump if (isset($_POST['func']) && $func == "showcat") { header("HTTP/1.1 303 See Other"); header("Location: " . KunenaRoute::_('index.php?option=com_kunena&func=showcat&catid=' . $catid, false)); $kunena_app->close(); } $kunena_my =& JFactory::getUser(); $kunena_db =& JFactory::getDBO(); $document = JFactory::getDocument(); $document->addScriptDeclaration('// <![CDATA[ var kunena_toggler_close = "' . JText::_('COM_KUNENA_TOGGLER_COLLAPSE') . '"; var kunena_toggler_open = "' . JText::_('COM_KUNENA_TOGGLER_EXPAND') . '"; // ]]>'); global $lang, $topic_emoticons; // Class structure should be used after this and all the common task should be moved to this class require_once JPATH_COMPONENT . '/class.kunena.php'; // Central Location for all internal links require_once JPATH_COMPONENT . '/lib/kunena.link.class.php'; require_once JPATH_COMPONENT . '/lib/kunena.smile.class.php'; // Redirect profile (menu item) to the right component if ($func == 'profile' && !$do && empty($_POST)) { $redirect = 1; if (!empty($active)) { $params = new JParameter($active->params); $redirect = $params->get('integration', 1); } if ($redirect) { $profileIntegration = KunenaFactory::getProfile(); if (!$profileIntegration instanceof KunenaProfileKunena) { $url = CKunenaLink::GetProfileURL($kunena_my->id, false); if ($url) { $this->redirect($url); } } } } // Check for JSON request if ($func == "json") { if (JDEBUG == 1 && defined('JFIREPHP')) { FB::log('Kunena JSON request'); } // URL format for JSON requests: e.g: index.php?option=com_kunena&func=json&action=autocomplete&do=getcat require_once JPATH_COMPONENT . '/lib/kunena.ajax.helper.php'; $ajaxHelper =& CKunenaAjaxHelper::getInstance(); // Get the document object. $document =& JFactory::getDocument(); // Set the MIME type for JSON output. $document->setMimeEncoding('application/json'); // Change the suggested filename. if ($action != 'uploadfile') { JResponse::setHeader('Content-Disposition', 'attachment; filename="kunena.json"'); } $value = JRequest::getVar('value', ''); JResponse::sendHeaders(); if ($kunena_config->board_offline && !CKunenaTools::isAdmin()) { // when the forum is offline, we don't entertain json requests json_encode(array('status' => '0', 'error' => @sprintf(_KUNENA_FORUM_OFFLINE))); } else { // Generate reponse echo $ajaxHelper->generateJsonResponse($action, $do, $value); } $kunena_app->close(); } if ($kunena_config->board_offline && !CKunenaTools::isAdmin()) { // if the board is offline echo $kunena_config->offline_message; } else { if ($kunena_config->regonly && !$kunena_my->id) { // if we only allow registered users if (file_exists(KUNENA_JTEMPLATEPATH . '/css/kunena.forum-min.css')) { CKunenaTools::addStyleSheet(KUNENA_JTEMPLATEURL . '/css/kunena.forum-min.css'); } else { CKunenaTools::addStyleSheet(KUNENA_TMPLTCSSURL); } echo '<div id="Kunena">'; $this->header = JText::_('COM_KUNENA_LOGIN_NOTIFICATION'); $this->body = JText::_('COM_KUNENA_LOGIN_FORUM'); CKunenaTools::loadTemplate('/login.php'); echo '</div>'; } else { // ======================================================================================= // Forum is online: //intercept the RSS request; we should stop afterwards if ($func == 'rss') { require_once JPATH_COMPONENT . '/funcs/rss.php'; $feed = new CKunenaRSSView($catid); $feed->display(); $kunena_app->close(); } if ($func == 'fb_pdf' || $func == 'pdf') { $httpReferer = JRequest::getVar('HTTP_REFERER', JURI::base(true), 'server'); if (KUNENA_JOOMLA_COMPAT == '1.5') { include JPATH_COMPONENT . '/lib/kunena.pdf.php'; $kunena_app->close(); } } $format = JRequest::getCmd('format', 'html'); if ($format != 'html') { echo "Kunena: Unsupported output format {$format}, please use only format=html or .html"; $kunena_app->close(); } $integration = KunenaFactory::getProfile(); $integration->open(); //time format include_once JPATH_COMPONENT . '/lib/kunena.timeformat.class.php'; $document =& JFactory::getDocument(); if (file_exists(KUNENA_ABSTMPLTPATH . '/initialize.php')) { require_once KUNENA_ABSTMPLTPATH . '/initialize.php'; } else { require_once KPATH_SITE . '/template/default/initialize.php'; } // Insert WhoIsOnlineDatas require_once KUNENA_PATH_LIB . '/kunena.who.class.php'; $who =& CKunenaWhoIsOnline::getInstance(); $who->insertOnlineDatas(); // include required libraries jimport('joomla.template.template'); // Kunena Current Template Icons Pack if (file_exists(KUNENA_ABSTMPLTPATH . '/icons.php')) { include KUNENA_ABSTMPLTPATH . '/icons.php'; } else { include KUNENA_PATH_TEMPLATE_DEFAULT . '/icons.php'; } if (JDEBUG) { $__profiler->mark('Session Start'); } // We only save session for registered users $kunena_session = KunenaFactory::getSession(true); if ($kunena_my->id > 0) { // new indicator handling if ($markaction == "allread") { if (!JRequest::checkToken()) { $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetCategoryURL('listcat', $catid, false)); } $kunena_session->markAllCategoriesRead(); } if (!$kunena_session->save()) { $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_SESSION_SAVE_FAILED'), 'error'); } if ($markaction == "allread") { while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetCategoryURL('listcat', $catid, false), JText::_('COM_KUNENA_GEN_ALL_MARKED')); } $userprofile = KunenaFactory::getUser(); if (!$userprofile->exists()) { $userprofile->save(); } // Assign previous visit without user offset to variable for templates to decide $this->prevCheck = $kunena_session->lasttime; } else { // For guests we don't show new posts $this->prevCheck = CKunenaTimeformat::internalTime() + 60; } if (JDEBUG) { $__profiler->mark('Session End'); } //Get the topics this user has already read this session from #__kunena_sessions $this->read_topics = explode(',', $kunena_session->readtopics); /* _\|/_ (o o) +----oOO-{_}-OOo--------------------------------+ | Until this section we have included the | | necessary files and gathered the required | | variables. Now let's start processing | | them | +----------------------------------------------*/ //Check if the catid requested is a parent category, because if it is //the only thing we can do with it is 'listcat' and nothing else if ($func == "showcat") { if ($catid != 0) { $kunena_db->setQuery("SELECT parent FROM #__kunena_categories WHERE id='{$catid}'"); $catParent = intval($kunena_db->loadResult()); if (KunenaError::checkDatabaseError()) { return; } } if ($catid == 0 || $catParent == 0) { $this->redirect(CKunenaLink::GetCategoryURL('listcat', $catid, false)); } } $kunena_app->setUserState('com_kunena.redirect', null); ?> <div id="Kunena"><?php if ($kunena_config->board_offline) { ?> <span id="fbOffline"><?php echo JText::_('COM_KUNENA_FORUM_IS_OFFLINE'); ?> </span> <?php } ?> <?php if (JDEBUG) { $__profiler->mark('Profilebox Start'); } CKunenaTools::loadTemplate('/menu.php'); CKunenaTools::displayLoginBox(); if (JDEBUG) { $__profiler->mark('Profilebox End'); } // Handle help / rules menuitems if ($func == 'article') { $func = $do; } if (JDEBUG) { $__profiler->mark('$func Start'); } switch ($func) { case 'who': require_once KUNENA_PATH_LIB . '/kunena.who.class.php'; $online =& CKunenaWhoIsOnline::getInstance(); $online->displayWho(); break; case 'announcement': require_once KUNENA_PATH_LIB . '/kunena.announcement.class.php'; $ann = CKunenaAnnouncement::getInstance(); $ann->display(); break; case 'poll': require_once KUNENA_PATH_LIB . '/kunena.poll.class.php'; $kunena_polls =& CKunenaPolls::getInstance(); $kunena_polls->display(); break; case 'polls': require_once KUNENA_PATH_LIB . '/kunena.poll.class.php'; $kunena_polls =& CKunenaPolls::getInstance(); $kunena_polls->polldo(); break; case 'stats': require_once KUNENA_PATH_LIB . '/kunena.stats.class.php'; $kunena_stats = new CKunenaStats(); $kunena_stats->showStats(); break; case 'myprofile': case 'userprofile': case 'fbprofile': case 'profile': case 'moderateuser': require_once KUNENA_PATH_FUNCS . '/profile.php'; $page = new CKunenaProfile($userid, $task ? $task : $do); $page->display(); break; case 'userlist': require_once KUNENA_PATH_FUNCS . '/userlist.php'; $page = new CKunenaUserlist(); $page->display(); break; case 'post': require_once KUNENA_PATH_FUNCS . '/post.php'; $page = new CKunenaPost(); $page->display(); break; case 'view': require_once KUNENA_PATH_FUNCS . '/view.php'; $layout = $kunena_app->getUserStateFromRequest("com_kunena.view_layout", 'layout', 'view'); $page = new CKunenaView($layout, $catid, $id, $limitstart, $limit, $mesid); $page->display(true, true); break; case 'showcat': require_once KUNENA_PATH_FUNCS . '/showcat.php'; $page = new CKunenaShowcat($catid, $page); $page->display(); break; case 'listcat': require_once KUNENA_PATH_FUNCS . '/listcat.php'; $page = new CKunenaListcat($catid); $page->display(); break; case 'review': require_once KUNENA_PATH_LIB . '/kunena.review.php'; $review = new CKunenaReview($catid); $review->display(); break; case 'rules': case 'help': CKunenaTools::loadTemplate('/' . $func . '.php'); break; case 'report': require_once KUNENA_PATH_LIB . '/kunena.report.class.php'; $report = new CKunenaReport(); $report->display(); break; case 'latest': case 'mylatest': case 'noreplies': case 'subscriptions': case 'favorites': case 'userposts': case 'unapproved': case 'deleted': require_once KUNENA_PATH_FUNCS . '/latestx.php'; if ($do) { $func = $do; } $page = new CKunenaLatestX($func, $page); $page->display(); break; case 'search': case 'advsearch': require_once JPATH_COMPONENT . '/lib/kunena.search.class.php'; $kunenaSearch = new CKunenaSearch(); $kunenaSearch->show(); break; case 'markthisread': if (!JRequest::checkToken('get')) { $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), JText::_('COM_KUNENA_GEN_FORUM_MARKED')); } // Mark all unread topics in the category to read $readTopics = $kunena_session->readtopics; $kunena_db->setQuery("SELECT thread FROM #__kunena_messages WHERE catid='{$catid}' AND parent=0 AND thread NOT IN ({$readTopics})"); $readForum = $kunena_db->loadResultArray(); if (KunenaError::checkDatabaseError()) { return; } $readTopics = implode(',', array_merge(explode(',', $readTopics), $readForum)); $kunena_db->setQuery("UPDATE #__kunena_sessions set readtopics='{$readTopics}' WHERE userid={$kunena_my->id}"); $kunena_db->query(); if (KunenaError::checkDatabaseError()) { return; } while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), JText::_('COM_KUNENA_GEN_FORUM_MARKED')); break; case 'subscribecat': if (!JRequest::checkToken('get')) { $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); if ($userid == 0) { while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false)); } else { while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetProfileURL($userid, false)); } } $success_msg = ''; if ($catid && $kunena_my->id) { $query = "INSERT INTO #__kunena_subscriptions_categories (catid, userid) VALUES ('{$catid}','{$kunena_my->id}')"; $kunena_db->setQuery($query); if (@$kunena_db->query() && $kunena_db->getAffectedRows() == 1) { $success_msg = JText::_('COM_KUNENA_GEN_CATEGORY_SUBCRIBED'); } KunenaError::checkDatabaseError(); } while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), $success_msg); break; case 'unsubscribecat': if (!JRequest::checkToken('get')) { $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); if ($userid == 0) { while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), $success_msg); } else { while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetProfileURL($userid, false), $success_msg); } } $success_msg = ''; if ($catid && $kunena_my->id) { $query = "DELETE FROM #__kunena_subscriptions_categories WHERE catid={$catid} AND userid={$kunena_my->id}"; $kunena_db->setQuery($query); if ($kunena_db->query() && $kunena_db->getAffectedRows() == 1) { $success_msg = JText::_('COM_KUNENA_GEN_CATEGORY_UNSUBCRIBED'); } KunenaError::checkDatabaseError(); } if ($userid == 0) { while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), $success_msg); } else { while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetProfileURL($userid, false), $success_msg); } break; case 'karma': include JPATH_COMPONENT . '/lib/kunena.karma.php'; break; case 'thankyou': require_once JPATH_COMPONENT . '/lib/kunena.thankyou.php'; $thankyou = new CKunenaThankyou(); $thankyou->setThankyou(); break; case 'bulkactions': switch ($do) { case "bulkDel": CKunenaTools::KDeletePosts(); break; case "bulkMove": CKunenaTools::KMovePosts($catid); break; case "bulkFavorite": if (!JRequest::checkToken()) { $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetProfileURL($kunena_my->id, false)); } require_once JPATH_ROOT . '/administrator/components/com_kunena/libraries/api.php'; $KunenaUserAPI = new KunenaUserAPI(); $cb = KGetArrayReverseInts("cb"); $result = $KunenaUserAPI->unfavoriteThreads($kunena_my->id, $cb); if ($result) { $message = JText::_('COM_KUNENA_USER_UNFAVORITE_YES'); } else { $message = JText::_('COM_KUNENA_POST_UNFAVORITED_TOPIC'); } while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetProfileURL($kunena_my->id, false), $message); break; case "bulkSub": if (!JRequest::checkToken()) { $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetProfileURL($kunena_my->id, false)); } require_once JPATH_ROOT . '/administrator/components/com_kunena/libraries/api.php'; $KunenaUserAPI = new KunenaUserAPI(); $cb = KGetArrayReverseInts("cb"); $result = $KunenaUserAPI->unsubscribeThreads($kunena_my->id, $cb); if ($result) { $message = JText::_('COM_KUNENA_USER_UNSUBSCRIBE_YES'); } else { $message = JText::_('COM_KUNENA_POST_NO_UNSUBSCRIBED_TOPIC'); } while (@ob_end_clean()) { } $kunena_app->redirect(CKunenaLink::GetProfileURL($kunena_my->id, false), $message); break; case "bulkDelPerm": CKunenaTools::KDeletePerm(); break; case "bulkRestore": CKunenaTools::KUndelete(); break; } break; case 'template': jimport('joomla.filesystem.path'); $name = JRequest::getString('name', JRequest::getString('kunena_template', '', 'COOKIE')); while (@ob_end_clean()) { } if ($name) { $name = JPath::clean($name); if (!is_readable(KPATH_SITE . "/template/{$name}/template.xml")) { $name = 'default'; } setcookie('kunena_template', $name, 0, JURI::root(true) . '/'); } else { setcookie('kunena_template', null, time() - 3600, JURI::root(true) . '/'); } $kunena_app->redirect(CKunenaLink::GetKunenaURL(false)); break; case 'credits': include JPATH_COMPONENT . '/lib/kunena.credits.php'; break; default: require_once KUNENA_PATH_FUNCS . '/listcat.php'; $page = new CKunenaListcat($catid); $page->display(); break; } if (JDEBUG) { $__profiler->mark('$func End'); } // Bottom Module CKunenaTools::showModulePosition('kunena_bottom'); // PDF and RSS if ($kunena_config->enablerss || $kunena_config->enablepdf) { if ($catid > 0) { kimport('category'); $category = KunenaCategory::getInstance($catid); if ($category->pub_access == 0 && $category->parent) { $rss_params = '&catid=' . (int) $catid; } } else { $rss_params = ''; } if (isset($rss_params) || $kunena_config->enablepdf) { echo '<div class="krss-block">'; if ($kunena_config->enablepdf && $func == 'view' && KUNENA_JOOMLA_COMPAT == '1.5') { // FIXME: add better translation: echo CKunenaLink::GetPDFLink($catid, $limit, $limitstart, $id, CKunenaTools::showIcon('kpdf', JText::_('PDF')), 'nofollow', '', JText::_('PDF')); } if ($kunena_config->enablerss && isset($rss_params)) { if ($kunena_config->rss_specification == 'atom1.0') { $rss_specification = 'application/atom+xml'; } else { $rss_specification = 'application/rss+xml'; } $document->addCustomTag('<link rel="alternate" type="' . $rss_specification . '" title="' . JText::_('COM_KUNENA_LISTCAT_RSS') . '" href="' . CKunenaLink::GetRSSURL($rss_params) . '" />'); echo CKunenaLink::GetRSSLink(CKunenaTools::showIcon('krss', JText::_('COM_KUNENA_LISTCAT_RSS')), 'follow', $rss_params); } echo '</div>'; } } $template = KunenaFactory::getTemplate(); $this->params = $template->params; // Credits echo '<div class="kcredits kms"> ' . CKunenaLink::GetTeamCreditsLink($catid, JText::_('COM_KUNENA_POWEREDBY')) . ' ' . CKunenaLink::GetCreditsLink(); if ($this->params->get('templatebyText') != '') { echo ' :: <a href ="' . $this->params->get('templatebyLink') . '" rel="follow">' . $this->params->get('templatebyText'); if ($this->params->get('templatebyName')) { echo ' ' . $this->params->get('templatebyName') . '</a>'; } else { echo '</a>'; } } echo '</div>'; // display footer // Show total time it took to create the page $__ktime = JProfiler::getmicrotime() - $__kstarttime; ?> <div class="kfooter"> <span class="kfooter-time"><?php echo JText::_('COM_KUNENA_FOOTER_TIME_TO_CREATE') . ' ' . sprintf('%0.2f', $__ktime) . ' ' . JText::_('COM_KUNENA_FOOTER_TIME_SECONDS'); ?> </span> </div> </div> <!-- closes Kunena div --> <?php $document->addHeadLink(KunenaRoute::_(), 'canonical', 'rel', ''); $integration = KunenaFactory::getProfile(); $integration->close(); //$params = JComponentHelper::getParams( 'com_kunena' ); //if ($params->get( 'show_page_title' )) $document->setTitle ( $params->get( 'page_title' ) ); if (empty($_POST) && $format == 'html') { $default = KunenaRoute::getDefault(); if ($default) { $menu->setActive($default->id); } } } } // end of online if (JDEBUG == 1) { $__profiler->mark('Done'); $__queries = $__profiler->getQueryCount(); if (defined('JFIREPHP')) { FB::log($__profiler->getBuffer(), 'Kunena Profiler'); if ($__queries > 50) { FB::error($__queries, 'Kunena Queries'); } else { if ($__queries > 35) { FB::warn($__queries, 'Kunena Queries'); } else { FB::log($__queries, 'Kunena Queries'); } } } } ob_end_flush(); }