1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-29 19:00:26 +02:00

new thread listing now working

This commit is contained in:
mcfly
2008-12-18 14:08:33 +00:00
parent 9edf4c18b2
commit 78b398f015
5 changed files with 49 additions and 62 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum.php,v $
| $Revision: 1.12 $ | $Revision: 1.13 $
| $Date: 2008-12-17 04:22:37 $ | $Date: 2008-12-18 14:08:33 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -417,33 +417,26 @@ if (e_QUERY == 'track')
if (e_QUERY == 'new') if (e_QUERY == 'new')
{ {
$newpostList = $forum->post_getnew(10); $newThreadList = $forum->threadGetNew(10);
foreach($newpostList as $post) foreach($newThreadList as $thread)
{ {
list($author_id, $author_info) = explode('.', $post['thread_user'], 2); $author_name = ($thread['user_name'] ? $thread['user_name'] : $thread['lastuser_anon']);
list($author_name, $tmp) = explode(chr(1), $author_info);
$datestamp = $gen->convert_date($post['thread_datestamp'], "forum"); $datestamp = $gen->convert_date($thread['thread_lastpost'], 'forum');
if($author_id == 0) if(!$thread['user_name'])
{ {
$STARTERTITLE = $author_name."<br />".$datestamp; $STARTERTITLE = $author_name.'<br />'.$datestamp;
} }
else else
{ {
$STARTERTITLE = "<a href='".e_BASE."user.php?id.$author_id'>$author_name</a><br />".$datestamp; $STARTERTITLE = "<a href='".$e107->url->getUrl('core:user', 'main', 'func=profile&id='.$thread['thread_lastuser'])."'>{$author_name}</a><br />".$datestamp;
}
if($post['post_subject'])
{
$NEWSPOSTNAME = "<a href='".e_PLUGIN."forum/forum_viewtopic.php?{$post['thread_id']}.post'>".LAN_425.$tp->toHTML($post['post_subject'], TRUE, 'no_make_clickable, no_hook')."</a>";
}
else
{
$NEWSPOSTNAME = "<a href='".e_PLUGIN."forum/forum_viewtopic.php?{$post['thread_id']}'>".$tp->toHTML($post['thread_name'], TRUE, 'no_make_clickable, no_hook')."</a>";
} }
$NEWSPOSTNAME = "<a href='".$e107->url->getUrl('forum', 'thread', 'func=last&id='.$thread['thread_id'])."'>".$e107->tp->toHTML($thread['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>';
$forum_newstring .= preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_NEWPOSTS_MAIN); $forum_newstring .= preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_NEWPOSTS_MAIN);
} }
if (!$newpostList) if (!$newThreadList)
{ {
$NEWSPOSTNAME = LAN_198; $NEWSPOSTNAME = LAN_198;
$forum_newstring = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_NEWPOSTS_MAIN); $forum_newstring = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_NEWPOSTS_MAIN);

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $
| $Revision: 1.28 $ | $Revision: 1.29 $
| $Date: 2008-12-17 04:22:37 $ | $Date: 2008-12-18 14:08:33 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -794,16 +794,6 @@ class e107forum
return $result; return $result;
} }
/*
function track($uid, $thread_id)
{
$thread_id = (int)$thread_id;
$uid = (int)$uid;
global $sql;
return $sql->db_Update("user", "user_realm='".USERREALM."-".$thread_id."-' WHERE user_id=".USERID);
}
*/
function forum_get($forum_id) function forum_get($forum_id)
{ {
$forum_id = (int)$forum_id; $forum_id = (int)$forum_id;
@@ -821,15 +811,13 @@ class e107forum
return FALSE; return FALSE;
} }
function forum_get_allowed() function forumGetAllowed($type='view')
{ {
global $sql; global $sql;
$forumList = implode(',', $this->permList[$type]);
$qry = " $qry = "
SELECT f.forum_id, f.forum_name FROM #forum AS f SELECT forum_id, forum_name FROM `#forum`
LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent WHERE forum_id IN ({$forumList})
WHERE f.forum_parent != 0
AND fp.forum_class IN (".USERCLASS_LIST.")
AND f.forum_class IN (".USERCLASS_LIST.")
"; ";
if ($sql->db_Select_gen($qry)) if ($sql->db_Select_gen($qry))
{ {
@@ -945,20 +933,17 @@ class e107forum
} }
function post_getnew($count = 50, $userviewed = USERVIEWED) function threadGetNew($count = 50, $unread = true, $uid = USERID)
{ {
global $sql; $e107 = e107::getInstance();
$viewed = ""; $viewed = '';
if($userviewed) if($unread)
{ {
$viewed = preg_replace("#\.+#", ".", $userviewed); $viewed = implode(',', $this->threadGetUserViewed($uid));
$viewed = preg_replace("#^\.#", "", $viewed); if($viewed != '')
$viewed = preg_replace("#\.$#", "", $viewed); {
$viewed = str_replace(".", ",", $viewed); $viewed = ' AND p.post_forum NOT IN ('.$viewed.')';
} }
if($viewed != "")
{
$viewed = " AND ft.thread_id NOT IN (".$viewed.")";
} }
$qry = " $qry = "
@@ -971,9 +956,18 @@ class e107forum
AND f.forum_class IN (".USERCLASS_LIST.") AND f.forum_class IN (".USERCLASS_LIST.")
{$viewed} {$viewed}
ORDER BY ft.thread_datestamp DESC LIMIT 0, ".intval($count); ORDER BY ft.thread_datestamp DESC LIMIT 0, ".intval($count);
if($sql->db_Select_gen($qry))
$qry = "
SELECT t.*, u.user_name FROM `#forum_thread` AS t
LEFT JOIN `#user` AS u ON u.user_id = t.thread_lastuser
WHERE t.thread_lastpost > ".USERLV. "
{$viewed}
ORDER BY t.thread_lastpost DESC LIMIT 0, ".(int)$count;
if($e107->sql->db_Select_gen($qry))
{ {
$ret = $sql->db_getList(); $ret = $e107->sql->db_getList();
} }
return $ret; return $ret;
} }

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $
| $Revision: 1.33 $ | $Revision: 1.34 $
| $Date: 2008-12-17 18:48:02 $ | $Date: 2008-12-18 14:08:33 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -543,7 +543,7 @@ function isAuthor()
function forumjump() function forumjump()
{ {
global $forum; global $forum;
$jumpList = $forum->forum_get_allowed(); $jumpList = $forum->forumGetAllowed('view');
$text = "<form method='post' action='".e_SELF."'><p>".LAN_401.": <select name='forumjump' class='tbox'>"; $text = "<form method='post' action='".e_SELF."'><p>".LAN_401.": <select name='forumjump' class='tbox'>";
foreach($jumpList as $key => $val) foreach($jumpList as $key => $val)
{ {

View File

@@ -9,8 +9,8 @@
* View specific forums * View specific forums
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewforum.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewforum.php,v $
* $Revision: 1.11 $ * $Revision: 1.12 $
* $Date: 2008-12-17 04:22:37 $ * $Date: 2008-12-18 14:08:33 $
* $Author: mcfly_e107 $ * $Author: mcfly_e107 $
* *
*/ */
@@ -530,7 +530,7 @@ function parse_sub($subInfo)
function forumjump() function forumjump()
{ {
global $forum; global $forum;
$jumpList = $forum->forum_get_allowed(); $jumpList = $forum->forumGetAllowed('view');
$text = "<form method='post' action='".e_SELF."'><p>".LAN_403.": <select name='forumjump' class='tbox'>"; $text = "<form method='post' action='".e_SELF."'><p>".LAN_403.": <select name='forumjump' class='tbox'>";
foreach($jumpList as $key => $val) foreach($jumpList as $key => $val)
{ {

View File

@@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewtopic.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewtopic.php,v $
| $Revision: 1.17 $ | $Revision: 1.18 $
| $Date: 2008-12-17 04:22:37 $ | $Date: 2008-12-18 14:08:33 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -325,7 +325,7 @@ function showmodoptions()
function forumjump() function forumjump()
{ {
global $forum; global $forum;
$jumpList = $forum->forum_get_allowed(); $jumpList = $forum->forumGetAllowed();
$text = "<form method='post' action='" . e_SELF . "'><p>" . LAN_65 . ": <select name='forumjump' class='tbox'>"; $text = "<form method='post' action='" . e_SELF . "'><p>" . LAN_65 . ": <select name='forumjump' class='tbox'>";
foreach ($jumpList as $key => $val) foreach ($jumpList as $key => $val)
{ {
@@ -338,7 +338,7 @@ function forumjump()
function rpg($user_join, $user_forums) function rpg($user_join, $user_forums)
{ {
global $FORUMTHREADSTYLE; global $FORUMTHREADSTYLE;
if (strpos($FORUMTHREADSTYLE, '{RPG}') == false) if (strpos($FORUMTHREADSTYLE, '{RPG}') === false)
{ {
return ''; return '';
} }