本文整理汇总了PHP中CKunenaLink::GetThreadPageURL方法的典型用法代码示例。如果您正苦于以下问题:PHP CKunenaLink::GetThreadPageURL方法的具体用法?PHP CKunenaLink::GetThreadPageURL怎么用?PHP CKunenaLink::GetThreadPageURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKunenaLink
的用法示例。
在下文中一共展示了CKunenaLink::GetThreadPageURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayDefault
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);
}
}
示例2: onAfterThankyou
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 );
}
}
示例3: unset
unset($rt[$key]);
$readtopics = implode(",", $rt);
$kunena_db->setQuery("UPDATE #__fb_sessions SET readtopics='{$readtopics}' WHERE userid={$userid}");
$kunena_db->query();
check_dberror("Unable to update sessions.");
}
}
unset($result);
$kunena_db->setQuery("SELECT COUNT(*) AS totalmessages FROM #__fb_messages WHERE thread='{$querythread}'");
$result = $kunena_db->loadObject();
check_dberror("Unable to load messages.");
$threadPages = ceil($result->totalmessages / $fbConfig->messages_per_page);
//construct a useable URL (for plaintext - so no & encoding!)
jimport('joomla.environment.uri');
$uri =& JURI::getInstance(JURI::base());
$LastPostUrl = $uri->toString(array('scheme', 'host', 'port')) . str_replace('&', '&', CKunenaLink::GetThreadPageURL($fbConfig, 'view', $catid, $querythread, $threadPages, $fbConfig->messages_per_page, $pid));
//Now manage the subscriptions (only if subscriptions are allowed)
if ($fbConfig->allowsubscriptions == 1 && $holdPost == 0) {
//they're allowed
//get the proper user credentials for each subscription to this topic
//clean up the message
$mailmessage = smile::purify($message);
$kunena_db->setQuery("SELECT * FROM #__fb_subscriptions AS a" . " LEFT JOIN #__users AS u ON a.userid=u.id " . " WHERE u.block='0' AND a.thread='{$querythread}'");
$subsList = $kunena_db->loadObjectList();
check_dberror("Unable to load subscriptions.");
if (count($subsList) > 0) {
//we got more than 0 subscriptions
require_once KUNENA_PATH_LIB . DS . 'kunena.mail.php';
// include fbMail class for mailing
$_catobj = new jbCategory($kunena_db, $catid);
foreach ($subsList as $subs) {
示例4: buildFeed
/**
* Pulls together data and options and outputs the build feed.
* Header and mime is automaticly set.
*
* @access private
* @param array $items
*/
private function buildFeed($items = array())
{
// Build items for feed
foreach ($items as $data) {
$item = new JFeedItem();
// Calcution to define the last page of the topic
$threadPages = ceil($data->msgcount / $this->config->messages_per_page);
// Build unique direct linking url for each item (htmlspecialchars_decode because FeedCreator uses htmlspecialchars on input)
$url = CKunenaLink::GetThreadPageURL('view', $data->catid, $data->thread, $threadPages, $this->config->messages_per_page, $data->id);
// Extract the data, we want to present and store it in $tmp
$tmp = array();
$tmp['title'] = $data->subject;
// Remove confidential information from message
$data->message = preg_replace('/\\[confidential\\](.*?)\\[\\/confidential\\]/s', '', $data->message);
$data->message = preg_replace('/\\[hide\\](.*?)\\[\\/hide\\]/s', '', $data->message);
$data->message = preg_replace('/\\[spoiler\\]/s', '[spoilerlight]', $data->message);
$data->message = preg_replace('/\\[\\/spoiler\\]/s', '[/spoilerlight]', $data->message);
$data->message = preg_replace('/\\[code\\](.*?)\\[\\/code]/s', '', $data->message);
$tmp['text'] = $data->message;
$tmp['date'] = $data->time;
$tmp['email'] = $data->email;
$tmp['name'] = $data->name;
$tmp['cat_name'] = $data->catname;
// Link and source is always the same
$tmp['link'] = $this->uri->toString(array('scheme', 'host', 'port')) . $url;
$tmp['source'] = $this->uri->toString(array('scheme', 'host', 'port')) . $url;
// Determine title format
if ($this->old_titles) {
$tmp['title'] = JText::_('COM_KUNENA_GEN_SUBJECT') . ': ' . $tmp['title'];
}
// Determine author format
switch ($this->author_format) {
case 'both':
$tmp['author'] = $tmp['email'] . ' (' . $tmp['name'] . ')';
break;
case 'email':
$tmp['author'] = $tmp['email'];
break;
case 'name':
default:
$tmp['author'] = $tmp['name'];
}
// Do we want author in item titles?
if ($this->author_in_title) {
$tmp['title'] .= ' - ' . JText::_('COM_KUNENA_GEN_BY') . ': ' . $tmp['name'];
}
// Limit number of words
if ($this->word_count) {
$Newmessage = '';
$t_newString = explode(" ", $tmp['text']);
foreach ($t_newString as $key => $word) {
if ($key < $this->word_count) {
$Newmessage .= $word . ' ';
}
}
// Append userfriendly '...' string
if (strlen($tmp['text']) != strlen($Newmessage)) {
$Newmessage .= ' ...';
}
$tmp['text'] = $Newmessage;
}
if ($this->allow_html) {
// Not nessecary to convert specialchars or use parsetext.
// ParseBBCode does it for us
$tmp['text'] = KunenaParser::parseBBCode($tmp['text']);
} else {
// Not nessecary to convert specialchars.
// FeedCreator does it for us
$tmp['text'] = KunenaParser::parseText($tmp['text']);
}
// Assign values to feed item
$item->title = $tmp['title'];
$item->link = $tmp['link'];
$item->description = $tmp['text'];
$item->date = $tmp['date'];
$item->source = $tmp['source'];
$item->author = $tmp['author'];
$item->category = $tmp['cat_name'];
// Finally add item to feed
$this->document->addItem($item);
}
}
示例5: _sendReportToMail
protected function _sendReportToMail($message, $subject, $emailToList)
{
jimport('joomla.mail.helper');
$sender = JMailHelper::cleanAddress($this->config->board_title . ' ' . JText::_('COM_KUNENA_GEN_FORUM') . ': ' . $this->_getSenderName());
$subject = JMailHelper::cleanSubject($subject);
$message = JMailHelper::cleanBody($message);
foreach ($emailToList as $emailTo) {
if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) {
continue;
}
JUtility::sendMail($this->config->email, $sender, $emailTo->email, $subject, $message);
}
$this->app->enqueueMessage(JText::_('COM_KUNENA_REPORT_SUCCESS'));
while (@ob_end_clean()) {
}
$this->app->redirect(CKunenaLink::GetThreadPageURL('view', $this->catid, $this->id, NULL, NULL, $this->id, false));
}
示例6: COUNT
if (count($this_message) < 1) {
echo '<p align="center">' . _MODERATION_INVALID_ID . '</p>';
} else {
$thread = $this_message->parent == 0 ? $this_message->id : $this_message->thread;
// Test if this is a valid SEO URL if not we should redirect using a 301 - permanent redirect
if ($thread != $this_message->id || $catid != $this_message->catid) {
// Invalid SEO URL detected!
// Create permanent re-direct and quit
// This query to calculate the page this reply is sitting on within this thread
$query = "SELECT COUNT(*) FROM #__fb_messages AS a WHERE a.thread='{$thread}' AND hold='0' AND a.id<='{$id}'";
$kunena_db->setQuery($query);
$replyCount = $kunena_db->loadResult();
check_dberror('Unable to calculate location of current message.');
$replyPage = $replyCount > $fbConfig->messages_per_page ? ceil($replyCount / $fbConfig->messages_per_page) : 1;
header("HTTP/1.1 301 Moved Permanently");
header("Location: " . htmlspecialchars_decode(CKunenaLink::GetThreadPageURL($fbConfig, 'view', $this_message->catid, $thread, $replyPage, $fbConfig->messages_per_page, $this_message->id)));
$app->close();
}
if ($kunena_my->id) {
//mark this topic as read
$kunena_db->setQuery("SELECT readtopics FROM #__fb_sessions WHERE userid='{$kunena_my->id}'");
$readTopics = $kunena_db->loadResult();
if ($readTopics == "") {
$readTopics = $thread;
} else {
//get all readTopics in an array
$_read_topics = @explode(',', $readTopics);
if (!@in_array($thread, $_read_topics)) {
$readTopics .= "," . $thread;
}
}
示例7: approve
protected function approve()
{
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;
}
require_once KUNENA_PATH_LIB . '/kunena.posting.class.php';
$message = new CKunenaPosting();
$message->action($this->id);
if ($message->canApprove()) {
$success_msg = JText::_('COM_KUNENA_MODERATE_1APPROVE_FAIL');
$this->_db->setQuery("UPDATE #__kunena_messages SET hold=0 WHERE id={$this->_db->Quote($this->id)}");
if ($this->id && $this->_db->query() && $this->_db->getAffectedRows() == 1) {
$success_msg = JText::_('COM_KUNENA_MODERATE_APPROVE_SUCCESS');
$this->_db->setQuery("SELECT COUNT(*) AS totalmessages FROM #__kunena_messages WHERE thread={$this->_db->Quote($this->msg_cat->thread)}");
$result = $this->_db->loadObject();
KunenaError::checkDatabaseError();
$threadPages = ceil($result->totalmessages / $this->config->messages_per_page);
//construct a useable URL (for plaintext - so no & encoding!)
jimport('joomla.environment.uri');
$uri =& JURI::getInstance(JURI::base());
$LastPostUrl = $uri->toString(array('scheme', 'host', 'port')) . str_replace('&', '&', CKunenaLink::GetThreadPageURL('view', $this->catid, $this->msg_cat->thread, $threadPages, $this->config->messages_per_page, $this->id));
$message->emailToSubscribers($LastPostUrl, $this->config->allowsubscriptions, $this->config->mailmod, $this->config->mailadmin);
CKunenaTools::modifyCategoryStats($this->id, $this->msg_cat->parent, $this->msg_cat->time, $this->msg_cat->catid);
}
}
while (@ob_end_clean()) {
}
$this->_app->redirect(CKunenaLink::GetMessageURL($this->id, $this->catid, 0, false), $success_msg);
}
示例8: displayPostRows
function displayPostRows() {
require_once KPATH_SITE.'/lib/kunena.link.class.php';
foreach ( $this->messages as $message ) {
if (!isset($this->topics[$message->thread])) {
// TODO: INTERNAL ERROR
return;
}
$topic = $this->topics[$message->thread];
$title = $message->subject;
// TODO: link must point into right page
$url = CKunenaLink::GetThreadPageURL('view', $message->catid, $message->thread, 0, $this->config->messages_per_page, 0, true );
$description = $message->message;
$category = $topic->getCategory()->name;
$date = new JDate($message->time);
$userid = $message->userid;
$username = KunenaFactory::getUser($userid)->getName($message->name);
$this->createItem($title, $url, $description, $category, $date, $userid, $username);
}
}
示例9: polldo
public function polldo()
{
$vote = JRequest::getInt('kpollradio', '');
$id = JRequest::getInt('kpoll-id', 0);
$catid = JRequest::getInt('catid', 0);
switch ($this->do) {
case 'vote':
case 'pollvote':
$result = $this->save_results($id, $this->my->id, $vote);
if ($result['results'] == '1') {
$message = JText::_('COM_KUNENA_POLL_SAVE_ALERT_OK');
} elseif ($result['results'] == '2') {
$message = JText::_('COM_KUNENA_POLL_SAVE_VOTE_ALREADY');
} elseif ($result['results'] == '3') {
$message = JText::_('COM_KUNENA_POLL_WAIT_BEFORE_VOTE');
} elseif ($result['results'] == '4') {
$message = JText::_('COM_KUNENA_POLL_SAVE_ALERT_ERROR_NOT_CHECK');
} elseif ($result['results'] == '5') {
$message = JText::sprintf('COM_KUNENA_POLL_MAXIMUM_VOTES_ALLOWED_REACH', $result['user_votes']);
}
$this->_app->enqueueMessage($message);
while (@ob_end_clean()) {
}
$this->_app->redirect(CKunenaLink::GetThreadPageURL('view', $catid, $id, 1, $this->config->messages_per_page, '', false));
break;
case 'pollchangevote':
$result = $this->save_changevote($id, $this->my->id, $vote);
if ($result['results'] == 1) {
$message = JText::_('COM_KUNENA_POLL_SAVE_ALERT_OK');
} elseif ($result['results'] == 3) {
$message = JText::_('COM_KUNENA_POLL_WAIT_BEFORE_VOTE');
}
$this->_app->enqueueMessage($message);
while (@ob_end_clean()) {
}
$this->_app->redirect(CKunenaLink::GetThreadPageURL('view', $catid, $id, 1, $this->config->messages_per_page, '', false));
break;
}
}
示例10: onAfterThankyou
public function onAfterThankyou($thankyoutargetid, $username, $message)
{
CFactory::load('libraries', 'userpoints');
CUserPoints::assignPoint('com_kunena.thread.thankyou', $thankyoutargetid);
if (!empty($message->parent)) {
//activity stream - reply post
require_once KPATH_SITE . '/lib/kunena.link.class.php';
$JSPostLink = CKunenaLink::GetThreadPageURL('view', $message->get('catid'), $message->get('thread'), 1);
$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->get('subject') . '</a> ');
$act->content = NULL;
$act->app = 'kunena.thankyou';
$act->cid = $thankyoutargetid;
$act->access = $this->getAccess($message);
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
}
}
示例11: getView
function getView()
{
// Is user allowed to read category from the URL?
if ($this->catid && !$this->session->canRead($this->catid)) {
return;
}
$this->allow = 1;
$where[] = "a.hold IN ({$this->hold})";
$where = implode(' AND ', $where);
$query = "SELECT a.*, b.*, p.id AS poll_id, modified.name AS modified_name, modified.username AS modified_username\n\t\t\tFROM #__kunena_messages AS a\n\t\t\tLEFT JOIN #__kunena_messages_text AS b ON a.id=b.mesid\n\t\t\tLEFT JOIN #__users AS modified ON a.modified_by = modified.id\n\t\t\tLEFT JOIN #__kunena_polls AS p ON a.id=p.threadid\n\t\t\tWHERE a.id={$this->db->Quote($this->id)} AND {$where}";
$this->db->setQuery($query);
$this->first_message = $this->db->loadObject();
// Invalid message id (deleted, on hold?)
if (KunenaError::checkDatabaseError() || !$this->first_message) {
return;
}
// Is user allowed to see the forum specified in the message?
if (!$this->session->canRead($this->first_message->catid)) {
$this->allow = 0;
return;
}
$this->thread = $this->first_message->thread;
// Test if this is a valid URL. If not, redirect browser to the right location
if ($this->first_message->moved || $this->thread != $this->id || $this->catid != $this->first_message->catid) {
$this->catid = $this->first_message->catid;
if ($this->first_message->moved) {
$newurl = array();
parse_str($this->first_message->message, $newloc);
$this->id = $newloc['id'];
$query = "SELECT catid, thread FROM #__kunena_messages AS a WHERE a.id='{$this->id}'";
$this->db->setQuery($query);
$newpos = $this->db->loadObject();
if (!$newpos) {
$this->allow = 0;
return;
}
if (KunenaError::checkDatabaseError()) {
return;
}
$this->thread = $newpos->thread;
$this->catid = $newpos->catid;
}
// This query to calculate the page this reply is sitting on within this thread
$query = "SELECT COUNT(*) FROM #__kunena_messages AS a WHERE a.thread={$this->db->Quote($this->thread)} AND {$where} AND a.id<={$this->db->Quote($this->id)}";
$this->db->setQuery($query);
$replyCount = $this->db->loadResult();
if (KunenaError::checkDatabaseError()) {
return;
}
$replyPage = $replyCount > $this->config->messages_per_page ? ceil($replyCount / $this->config->messages_per_page) : 1;
$this->redirect = CKunenaLink::GetThreadPageURL('view', $this->catid, $this->thread, $replyPage, $this->config->messages_per_page, $this->first_message->id, false);
}
//Get the category name for breadcrumb
$this->db->setQuery("SELECT * FROM #__kunena_categories WHERE id={$this->db->Quote($this->catid)}");
$this->catinfo = $this->db->loadObject();
if (KunenaError::checkDatabaseError()) {
return;
}
//Get Parent's cat.name for breadcrumb
$this->db->setQuery("SELECT id, name FROM #__kunena_categories WHERE id={$this->db->Quote($this->catinfo->parent)}");
$objCatParentInfo = $this->db->loadObject();
if (KunenaError::checkDatabaseError()) {
return;
}
// START
$this->emoticons = smile::getEmoticons(0);
$this->prevCheck = $this->session->lasttime;
$this->read_topics = explode(',', $this->session->readtopics);
$showedEdit = 0;
$this->kunena_forum_locked = $this->catinfo->locked;
//check if topic is locked
$this->topicLocked = $this->first_message->locked;
if (!$this->topicLocked) {
//topic not locked; check if forum is locked
$this->topicLocked = $this->catinfo->locked;
}
$this->topicSticky = $this->first_message->ordering;
CKunenaTools::markTopicRead($this->thread, $this->my->id);
//update the hits counter for this topic & exclude the owner
if ($this->my->id == 0 || $this->first_message->userid != $this->my->id) {
$this->db->setQuery("UPDATE #__kunena_messages SET hits=hits+1 WHERE id={$this->db->Quote($this->thread)} AND parent='0'");
$this->db->query();
KunenaError::checkDatabaseError();
}
$query = "SELECT COUNT(*) FROM #__kunena_messages AS a WHERE a.thread={$this->db->Quote($this->thread)} AND {$where}";
$this->db->setQuery($query);
$this->total_messages = $this->db->loadResult();
KunenaError::checkDatabaseError();
// If page does not exist, redirect to the last page
if ($this->total_messages <= $this->limitstart) {
$page = ceil($this->total_messages / $this->limit);
$this->redirect = CKunenaLink::GetThreadPageURL('view', $this->catid, $this->id, $page, $this->limit, '', false);
}
$maxpages = 7 - 2;
// odd number here (show - 2)
$totalpages = ceil($this->total_messages / $this->limit);
$page = floor($this->limitstart / $this->limit) + 1;
$firstpage = 1;
if ($this->ordering == 'desc') {
$firstpage = $totalpages;
//.........这里部分代码省略.........
示例12: GetLatestPageAutoRedirectURL
function GetLatestPageAutoRedirectURL($fbConfig, $pid, $limit, $catid = 0)
{
$kunena_db =& JFactory::getDBO();
// First determine the thread, latest post and number of posts for the post supplied
$where = '';
if ($catid > 0) {
$where .= " AND a.catid = {$catid} ";
}
$kunena_db->setQuery("SELECT a.thread AS thread, MAX(a.id) AS latest_id, MAX(a.catid) AS catid, COUNT(*) AS totalmessages\n FROM #__fb_messages AS a,\n (SELECT MAX(thread) AS thread FROM #__fb_messages WHERE id='{$pid}') AS b\n WHERE a.thread = b.thread AND a.hold='0' {$where}\n GROUP BY a.thread");
$result = $kunena_db->loadObject();
check_dberror("Unable to retrieve latest post.");
if (!is_object($result)) {
return htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL . '&func=showcat&catid=' . $catid));
}
// Now Calculate the number of pages for this particular thread
$catid = $result->catid;
$threadPages = ceil($result->totalmessages / $limit);
// Finally build output block
return htmlspecialchars_decode(CKunenaLink::GetThreadPageURL($fbConfig, 'view', $catid, $result->thread, $threadPages, $limit));
}
示例13: foreach
<image>
<url><?php
echo KUNENA_URLEMOTIONSPATH;
?>
rss.gif</url>
<title>Powered by Kunena</title>
<link><?php
echo JURI::root();
?>
</link>
<description>Kunena Site Syndication</description>
</image>
<?php
foreach ($rows as $row) {
echo " <item>\n";
echo " <title>" . _GEN_SUBJECT . ": " . stripslashes(kunena_htmlspecialchars($row->subject)) . " - " . _GEN_BY . ": " . stripslashes(kunena_htmlspecialchars($row->lastpostname)) . "</title>" . "\n";
echo " <link>";
$uri =& JURI::getInstance(JURI::base());
$itemlink = $uri->toString(array('scheme', 'host', 'port')) . CKunenaLink::GetThreadPageURL($fbConfig, 'view', $row->catid, $row->thread, ceil($row->numberposts / $fbConfig->messages_per_page), $fbConfig->messages_per_page, $row->lastpostid);
echo $itemlink;
echo "</link>\n";
$words = $row->lastpostmessage;
$words = smile::purify($words);
echo " <description>" . kunena_htmlspecialchars($words) . "</description>" . "\n";
echo " <pubDate>" . date('r', $row->lastposttime) . "</pubDate>" . "\n";
echo " </item>\n";
}
?>
</channel>
</rss>
示例14: GetAutoRedirectThreadPageHTML
function GetAutoRedirectThreadPageHTML($func, $catid, $threadid, $page, $limit = '', $anker = '', $timeout)
{
$p_url = CKunenaLink::GetThreadPageURL($func, $catid, $threadid, $page, $limit, $anker);
return CKunenaLink::GetAutoRedirectHTML($p_url, $timeout);
}
示例15: displayDefault
function displayDefault($tpl = null) {
$this->me = KunenaFactory::getUser();
$this->layout = $this->state->get('layout');
if ($this->layout == 'flat') $this->layout = 'default';
$this->setLayout($this->layout);
$this->assignRef ( 'category', $this->get ( 'Category' ) );
$this->assignRef ( 'topic', $this->get ( 'Topic' ) );
$channels = $this->category->getChannels();
if ($this->category->id && ! $this->category->authorise('read')) {
// User is not allowed to see the category
$this->setError($this->category->getError());
} elseif (! $this->topic) {
// Moved topic loop detected (1 -> 2 -> 3 -> 2)
$this->setError(JText::_('COM_KUNENA_VIEW_TOPIC_ERROR_LOOP'));
} elseif (! $this->topic->authorise('read')) {
// User is not allowed to see the topic
$this->setError($this->topic->getError());
} elseif ($this->state->get('item.id') != $this->topic->id || ($this->category->id != $this->topic->category_id && !isset($channels[$this->topic->category_id]))) {
// Topic has been moved or it doesn't belong to the current category
$db = JFactory::getDBO();
$query = "SELECT COUNT(*) FROM #__kunena_messages WHERE thread={$db->Quote($this->topic->id)} AND hold IN ({$this->state->get('hold')}) AND id<={$db->Quote($this->state->get('item.id'))}";
$db->setQuery ( $query );
$replyCount = $db->loadResult ();
if (KunenaError::checkDatabaseError()) return;
$app = JFactory::getApplication();
$app->redirect(CKunenaLink::GetThreadPageURL ( 'view', $this->topic->category_id, $this->topic->id, $replyCount, $this->state->get('list.limit'), $this->state->get('item.id'), false ));
}
$errors = $this->getErrors();
if ($errors) {
return $this->displayNoAccess($errors);
}
$this->assignRef ( 'messages', $this->get ( 'Messages' ) );
$this->assignRef ( 'total', $this->get ( 'Total' ) );
// If page does not exist, redirect to the last page
/* if ($this->total <= $this->state->get('list.start')) {
$app = JFactory::getApplication();
$app->redirect(CKunenaLink::GetThreadPageURL('view', $this->topic->category_id, $this->topic->id, $this->total, $this->state->get('list.start'), '', false));
}
*/
$this->assignRef ( 'moderators', $this->get ( 'Moderators' ) );
$this->assignRef ( 'usertopic',$this->topic->getUserTopic());
$this->headerText = JText::_('COM_KUNENA_MENU_LATEST_DESC');
$this->title = JText::_('COM_KUNENA_ALL_DISCUSSIONS');
$this->pagination = $this->getPagination ( 5 );
$this->me = KunenaFactory::getUser();
$this->config = KunenaFactory::getConfig();
// Mark topic read
$this->topic->markRead ();
$this->topic->hits++;
$this->topic->save();
// Check is subscriptions were sent and reset the value
if ($this->topic->authorise('subscribe')) {
$usertopic = $this->topic->getUserTopic();
if ($usertopic->subscribed == 2) {
$usertopic->subscribed = 1;
$usertopic->save();
}
}
$this->keywords = $this->topic->getKeywords(false, ', ');
$this->buttons();
//meta description and keywords
// TODO: use real keywords, too
$metaKeys = $this->escape ( "{$this->topic->subject}, {$this->category->getParent()->name}, {$this->config->board_title}, " . JText::_('COM_KUNENA_GEN_FORUM') . ', ' . JFactory::getapplication()->getCfg ( 'sitename' ) );
// Create Meta Description form the content of the first message
// better for search results display but NOT for search ranking!
$metaDesc = KunenaHtmlParser::stripBBCode($this->topic->first_post_message);
$metaDesc = preg_replace('/\s+/', ' ', $metaDesc); // remove newlines
$metaDesc = preg_replace('/^[^\w0-9]+/', '', $metaDesc); // remove characters at the beginning that are not letters or numbers
$metaDesc = trim($metaDesc); // Remove trailing spaces and beginning
// remove multiple spaces
while (strpos($metaDesc, ' ') !== false){
$metaDesc = str_replace(' ', ' ', $metaDesc);
}
// limit to 185 characters - google will cut off at ~150
if (strlen($metaDesc) > 185){
$metaDesc = rtrim(JString::substr($metaDesc, 0, 182)).'...';
}
$this->document->setMetadata ( 'keywords', $metaKeys );
$this->document->setDescription ( $this->escape($metaDesc) );
$this->setTitle(JText::sprintf('COM_KUNENA_VIEW_TOPICS_DEFAULT', $this->topic->subject));
$this->display($tpl);
}