1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-25 17:01:43 +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).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum.php,v $
| $Revision: 1.12 $
| $Date: 2008-12-17 04:22:37 $
| $Revision: 1.13 $
| $Date: 2008-12-18 14:08:33 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
@@ -417,33 +417,26 @@ if (e_QUERY == 'track')
if (e_QUERY == 'new')
{
$newpostList = $forum->post_getnew(10);
foreach($newpostList as $post)
$newThreadList = $forum->threadGetNew(10);
foreach($newThreadList as $thread)
{
list($author_id, $author_info) = explode('.', $post['thread_user'], 2);
list($author_name, $tmp) = explode(chr(1), $author_info);
$datestamp = $gen->convert_date($post['thread_datestamp'], "forum");
if($author_id == 0)
$author_name = ($thread['user_name'] ? $thread['user_name'] : $thread['lastuser_anon']);
$datestamp = $gen->convert_date($thread['thread_lastpost'], 'forum');
if(!$thread['user_name'])
{
$STARTERTITLE = $author_name."<br />".$datestamp;
$STARTERTITLE = $author_name.'<br />'.$datestamp;
}
else
{
$STARTERTITLE = "<a href='".e_BASE."user.php?id.$author_id'>$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>";
$STARTERTITLE = "<a href='".$e107->url->getUrl('core:user', 'main', 'func=profile&id='.$thread['thread_lastuser'])."'>{$author_name}</a><br />".$datestamp;
}
$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);
}
if (!$newpostList)
if (!$newThreadList)
{
$NEWSPOSTNAME = LAN_198;
$forum_newstring = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_NEWPOSTS_MAIN);

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $
| $Revision: 1.28 $
| $Date: 2008-12-17 04:22:37 $
| $Revision: 1.29 $
| $Date: 2008-12-18 14:08:33 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
@@ -748,7 +748,7 @@ class e107forum
return false;
}
}
function thread_user($post_info)
{
if($post_info['user_name'])
@@ -794,16 +794,6 @@ class e107forum
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)
{
$forum_id = (int)$forum_id;
@@ -821,15 +811,13 @@ class e107forum
return FALSE;
}
function forum_get_allowed()
function forumGetAllowed($type='view')
{
global $sql;
$forumList = implode(',', $this->permList[$type]);
$qry = "
SELECT f.forum_id, f.forum_name FROM #forum AS f
LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent
WHERE f.forum_parent != 0
AND fp.forum_class IN (".USERCLASS_LIST.")
AND f.forum_class IN (".USERCLASS_LIST.")
SELECT forum_id, forum_name FROM `#forum`
WHERE forum_id IN ({$forumList})
";
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;
$viewed = "";
if($userviewed)
$e107 = e107::getInstance();
$viewed = '';
if($unread)
{
$viewed = preg_replace("#\.+#", ".", $userviewed);
$viewed = preg_replace("#^\.#", "", $viewed);
$viewed = preg_replace("#\.$#", "", $viewed);
$viewed = str_replace(".", ",", $viewed);
}
if($viewed != "")
{
$viewed = " AND ft.thread_id NOT IN (".$viewed.")";
$viewed = implode(',', $this->threadGetUserViewed($uid));
if($viewed != '')
{
$viewed = ' AND p.post_forum NOT IN ('.$viewed.')';
}
}
$qry = "
@@ -971,9 +956,18 @@ class e107forum
AND f.forum_class IN (".USERCLASS_LIST.")
{$viewed}
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;
}

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $
| $Revision: 1.33 $
| $Date: 2008-12-17 18:48:02 $
| $Revision: 1.34 $
| $Date: 2008-12-18 14:08:33 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
@@ -543,7 +543,7 @@ function isAuthor()
function forumjump()
{
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'>";
foreach($jumpList as $key => $val)
{

View File

@@ -9,8 +9,8 @@
* View specific forums
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewforum.php,v $
* $Revision: 1.11 $
* $Date: 2008-12-17 04:22:37 $
* $Revision: 1.12 $
* $Date: 2008-12-18 14:08:33 $
* $Author: mcfly_e107 $
*
*/
@@ -530,7 +530,7 @@ function parse_sub($subInfo)
function forumjump()
{
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'>";
foreach($jumpList as $key => $val)
{

View File

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