mirror of
https://github.com/e107inc/e107.git
synced 2025-06-08 03:45:03 +02:00
Fix for forum query
Still a deprecated plugin - use newforumposts_menu (included with the forum plugin) instead
This commit is contained in:
parent
87b9489976
commit
71ce71bdb1
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
@ -6,12 +6,6 @@
|
|||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/newforumposts_main/newforumposts_main.php,v $
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!defined('e107_INIT')) { exit();}
|
if(!defined('e107_INIT')) { exit();}
|
||||||
@ -65,14 +59,14 @@ elseif(!isset($NEWFORUMPOSTSTYLE_HEADER))
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$results = $sql->db_Select_gen("
|
$results = $sql->gen("
|
||||||
SELECT t.thread_id, t.thread_name, t.thread_datestamp, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, t.thread_active, t.thread_s, f.forum_id, f.forum_name, f.forum_class, u.user_name, fp.forum_class, lp.user_name AS lp_name
|
SELECT t.thread_id, t.thread_name, t.thread_datestamp, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, t.thread_active, f.forum_id, f.forum_name, f.forum_class, u.user_name, fp.forum_class, lp.user_name AS lp_name
|
||||||
FROM #forum_thread AS t
|
FROM #forum_thread AS t
|
||||||
LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
|
LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
|
||||||
LEFT JOIN #user AS lp ON SUBSTRING_INDEX(t.thread_lastuser,'.',1) = lp.user_id
|
LEFT JOIN #user AS lp ON SUBSTRING_INDEX(t.thread_lastuser,'.',1) = lp.user_id
|
||||||
LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
|
LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
|
||||||
LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
|
LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
|
||||||
WHERE f.forum_id = t.thread_forum_id AND t.thread_parent=0 AND f.forum_class IN (".USERCLASS_LIST.")
|
WHERE f.forum_id = t.thread_forum_id AND f.forum_class IN (".USERCLASS_LIST.")
|
||||||
AND fp.forum_class IN (".USERCLASS_LIST.")
|
AND fp.forum_class IN (".USERCLASS_LIST.")
|
||||||
ORDER BY t.$query DESC LIMIT 0, ".$pref['nfp_amount']);
|
ORDER BY t.$query DESC LIMIT 0, ".$pref['nfp_amount']);
|
||||||
|
|
||||||
@ -93,17 +87,19 @@ else
|
|||||||
$ICON = "<img src='".e_PLUGIN_ABS."forum/images/".IMODE."/new_small.png' alt='' />";
|
$ICON = "<img src='".e_PLUGIN_ABS."forum/images/".IMODE."/new_small.png' alt='' />";
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$TOTAL_TOPICS = $sql->db_Count("forum_thread", "(*)", " WHERE thread_parent='0' ");
|
$TOTAL_TOPICS = $sql->count("forum_thread");
|
||||||
$TOTAL_REPLIES = $sql->db_Count("forum_thread", "(*)", " WHERE thread_parent!='0' ");
|
$TOTAL_REPLIES = $sql->count("forum_post");
|
||||||
$sql->db_Select_gen("SELECT sum(thread_views) FROM #forum_thread");
|
|
||||||
$tmp = $sql->db_Fetch();
|
$sql->gen("SELECT sum(thread_views) FROM #forum_thread");
|
||||||
$TOTAL_VIEWS = $tmp[0];
|
$tmp = $sql->fetch();
|
||||||
|
$TOTAL_VIEWS = $tmp["sum(thread_views)"];
|
||||||
|
|
||||||
$text = preg_replace("/\{(.*?)\}/e", '$\1', $NEWFORUMPOSTSTYLE_HEADER);
|
$text = preg_replace("/\{(.*?)\}/e", '$\1', $NEWFORUMPOSTSTYLE_HEADER);
|
||||||
|
|
||||||
foreach ($forumArray as $forumInfo)
|
foreach ($forumArray as $forumInfo)
|
||||||
{
|
{
|
||||||
extract($forumInfo);
|
extract($forumInfo);
|
||||||
|
|
||||||
$r_datestamp = $gen->convert_date($thread_lastpost, "forum");
|
$r_datestamp = $gen->convert_date($thread_lastpost, "forum");
|
||||||
if($thread_total_replies)
|
if($thread_total_replies)
|
||||||
{
|
{
|
||||||
@ -142,7 +138,7 @@ foreach ($forumArray as $forumInfo)
|
|||||||
$newflag = TRUE;
|
$newflag = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($newflag)
|
if ($newflag)
|
||||||
{
|
{
|
||||||
if ($forumInfo['thread_total_replies'] >= $pref['forum_popular'])
|
if ($forumInfo['thread_total_replies'] >= $pref['forum_popular'])
|
||||||
@ -231,4 +227,4 @@ $text = ($pref['nfp_layer'] ? "<div style='border : 0; padding : 4px; width : au
|
|||||||
if($results)
|
if($results)
|
||||||
{
|
{
|
||||||
$ns->tablerender($pref["nfp_caption"], $text, 'nfp');
|
$ns->tablerender($pref["nfp_caption"], $text, 'nfp');
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user