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

More forum work

This commit is contained in:
mcfly
2008-11-27 03:02:26 +00:00
parent b88bbcd5d2
commit 1ce8adbab7
4 changed files with 195 additions and 143 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_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $
| $Revision: 1.9 $ | $Revision: 1.10 $
| $Date: 2008-11-26 19:59:06 $ | $Date: 2008-11-27 03:02:26 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -85,19 +85,60 @@ class e107forum
} }
} }
} }
// print_a($this->permList);
// LEFT JOIN #forum_t AS ft ON ft.thread_parent = t.thread_parent AND ft.thread_id <= ".intval($thread_id)."
// LEFT JOIN #forum_t as fp ON fp.thread_id = t.thread_parent
// WHERE t.thread_id = ".intval($thread_id)." AND t.thread_parent != 0
// ORDER BY ft.thread_datestamp ASC
// ";
} }
function checkPerm($forumId, $type='view')
{
return (in_array($forumId, $this->permList[$type]));
}
/*
* Add a post to the db.
*
* If threadinfo is given, then we're adding a new thread.
* We must get thread_id to provide to postInfo after insertion
*/
function postAdd($postInfo, $updateThread = true)
{
$e107 = e107::getInstance();
$result = $e107->sql->db_Insert('forum_post', $postInfo, true);
if($result && $updateThread)
{
$threadInfo = array();
if(varset($postInfo['post_user']))
{
$threadInfo['thread_lastuser'] = $postInfo['post_user'];
$threadInfo['thread_lastuser_anon'] = '';
}
else
{
$threadInfo['thread_lastuser'] = array('int', 0);
$threadInfo['thread_lastuser_anon'] = $postInfo['post_anon_name'];
}
$threadInfo['thread_lastpost'] = array('int', $postInfo['post_datestamp']);
$threadInfo['thread_total_replies'] = array('cmd', 'thread-total_replies + 1');
$threadInfo['WHERE'] = 'thread_id = '.$postInfo['post_thread'];
$result = $e107->sql->db_Update('forum_thread', $threadInfo, true);
}
}
function threadAdd($threadInfo, $postInfo)
{
$e107 = e107::getInstance();
if($result = $e107->sql->db_Insert('forum_thread', $threadInfo, true))
{
$postInfo['post_thread'] = $result;
$result = $this->postAdd($postInfo, false);
}
}
function threadUpdate($threadInfo, $inc)
{
$e107 = e107::getInstance();
}
function thread_postnum($thread_id) function thread_postnum($thread_id)
{ {
global $sql; global $sql;
@@ -400,7 +441,7 @@ class e107forum
function forum_get($forum_id) function forum_get($forum_id)
{ {
$forum_id = intval($forum_id); $forum_id = (int)$forum_id;
$qry = " $qry = "
SELECT f.*, fp.forum_class as parent_class, fp.forum_name as parent_name, fp.forum_id as parent_id, fp.forum_postclass as parent_postclass, sp.forum_name AS sub_parent FROM #forum AS f SELECT f.*, fp.forum_class as parent_class, fp.forum_name as parent_name, fp.forum_id as parent_id, fp.forum_postclass as parent_postclass, sp.forum_name AS sub_parent FROM #forum AS f
LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent
@@ -451,23 +492,22 @@ class e107forum
function forum_get_topics($forum_id, $from, $view) function forum_get_topics($forum_id, $from, $view)
{ {
$forum_id = intval($forum_id); $e107 = e107::getInstance();
global $sql; $forum_id = (int)$forum_id;
$qry = " $qry = "
SELECT t.*, u.user_name, lpu.user_name AS lastpost_username from #forum_t as t SELECT t.*, u.user_name, lpu.user_name AS lastpost_username 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 t.thread_user = u.user_id
LEFT JOIN #user AS lpu ON SUBSTRING_INDEX(t.thread_lastuser,'.',1) = lpu.user_id LEFT JOIN `#user` AS lpu ON t.thread_lastuser = lpu.user_id
WHERE t.thread_forum_id = $forum_id AND t.thread_parent = 0 WHERE t.thread_forum_id = {$forum_id}
ORDER BY ORDER BY
t.thread_s DESC, t.thread_s DESC,
t.thread_lastpost DESC, t.thread_lastpost DESC
t.thread_datestamp DESC LIMIT ".(int)$from.','.(int)$view;
LIMIT ".intval($from).",".intval($view)."
";
$ret = array(); $ret = array();
if ($sql->db_Select_gen($qry)) if ($e107->sql->db_Select_gen($qry))
{ {
while ($row = $sql->db_Fetch(MYSQL_ASSOC)) while ($row = $e107->sql->db_Fetch(MYSQL_ASSOC))
{ {
$ret[] = $row; $ret[] = $row;
} }
@@ -502,8 +542,8 @@ class e107forum
function forum_get_topic_count($forum_id) function forum_get_topic_count($forum_id)
{ {
global $sql; $e107 = e107::getInstance();
return $sql->db_Count("forum_t", "(*)", " WHERE thread_forum_id=".intval($forum_id)." AND thread_parent=0 "); return $e107->sql->db_Count('forum_thread', '(*)', 'WHERE thread_forum_id='.(int)$forum_id);
} }
function thread_getnext($thread_id, $forum_id, $from = 0, $limit = 100) function thread_getnext($thread_id, $forum_id, $from = 0, $limit = 100)

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.17 $ | $Revision: 1.18 $
| $Date: 2008-11-26 19:59:06 $ | $Date: 2008-11-27 03:02:26 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -37,19 +37,12 @@ if (!e_QUERY || !isset($_REQUEST['id']))
header("Location:".$e107->url->getUrl('forum', 'forum', array('func' => 'main'))); header("Location:".$e107->url->getUrl('forum', 'forum', array('func' => 'main')));
exit; exit;
} }
//else
//{
// $tmp = explode(".", e_QUERY);
// $action = preg_replace('#\W#', '', $tmp[0]);
// $id = intval($tmp[1]);
// $from = intval($tmp[2]);
//}
$action = $_REQUEST['f']; $action = $_REQUEST['f'];
$id = (int)$_REQUEST['id']; $id = (int)$_REQUEST['id'];
// check if user can post to this forum ... // check if user can post to this forum ...
if (!in_array($id, $forum->permList['post'])) if (!$forum->checkPerm($id, 'post'))
{ {
require_once(HEADERF); require_once(HEADERF);
$ns->tablerender(LAN_20, "<div style='text-align:center'>".LAN_399."</div>"); $ns->tablerender(LAN_20, "<div style='text-align:center'>".LAN_399."</div>");
@@ -69,10 +62,12 @@ switch($action)
{ {
$forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']); $forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']);
} }
$forum_id = $forum_info['forum_id'];
break; break;
case 'nt': case 'nt':
$forum_info = $forum->forum_get($id); $forum_info = $forum->forum_get($id);
$forum_id = $id;
break; break;
case 'quote': case 'quote':
@@ -83,6 +78,7 @@ switch($action)
{ {
$id = $thread_info['head']['thread_id']; $id = $thread_info['head']['thread_id'];
} }
$forum_id = $forum_info['forum_id'];
break; break;
} }
@@ -93,17 +89,8 @@ require_once(e_PLUGIN."forum/forum_shortcodes.php");
require_once(e_HANDLER."ren_help.php"); require_once(e_HANDLER."ren_help.php");
$gen = new convert; $gen = new convert;
$fp = new floodprotect; $fp = new floodprotect;
global $tp; $e107 = e107::getInstance();
if ($sql->db_Select("tmp", "*", "tmp_ip='$ip' ")) {
$row = $sql->db_Fetch();
$tmp = explode("^", $row['tmp_info']);
$action = $tmp[0];
$anonname = $tmp[1];
$subject = $tmp[2];
$post = $tmp[3];
$sql->db_Delete("tmp", "tmp_ip='$ip' ");
}
//if thread is not active and not new thread, show warning //if thread is not active and not new thread, show warning
if ($action != "nt" && !$thread_info['head']['thread_active'] && !MODERATOR) if ($action != "nt" && !$thread_info['head']['thread_active'] && !MODERATOR)
@@ -220,64 +207,68 @@ if (isset($_POST['fpreview']))
if (isset($_POST['newthread']) || isset($_POST['reply'])) if (isset($_POST['newthread']) || isset($_POST['reply']))
{ {
$poster = array(); $postInfo = array();
if ((isset($_POST['newthread']) && trim($_POST['subject']) == "") || trim($_POST['post']) == "") $threadInfo = array();
if ((isset($_POST['newthread']) && trim($_POST['subject']) == '') || trim($_POST['post']) == '')
{ {
message_handler("ALERT", 5); message_handler("ALERT", 5);
} }
else else
{ {
if ($fp->flood("forum_t", "thread_datestamp") == FALSE && !ADMIN) if ($fp->flood('forum_t', 'thread_datestamp') == false && !ADMIN)
{ {
echo "<script type='text/javascript'>document.location.href='".e_BASE."index.php'</script>\n"; echo "<script type='text/javascript'>document.location.href='".e_BASE."index.php'</script>\n";
} exit;
if (USER)
{
$poster['post_userid'] = USERID;
$poster['post_user_name'] = USERNAME;
}
else
{
$poster = getuser($_POST['anonname']);
if ($poster == -1)
{
require_once(HEADERF);
$ns->tablerender(LAN_20, LAN_310);
if (isset($_POST['reply']))
{
$tmpdata = "reply.".$tp -> toDB($_POST['anonname']).".".$tp -> toDB($_POST['subject']).".".$tp -> toDB($_POST['post']);
}
else
{
$tmpdata = "newthread^".$tp -> toDB($_POST['anonname'])."^".$tp -> toDB($_POST['subject'])."^".$tp -> toDB($_POST['post']);
}
$sql->db_Insert("tmp", "'$ip', '".time()."', '$tmpdata' ");
loginf();
require_once(FOOTERF);
exit;
}
} }
process_upload(); process_upload();
$postInfo['post_ip'] = $e107->getip();
$post = $tp->toDB($_POST['post']); if (USER)
$subject = $tp->toDB($_POST['subject']);
$email_notify = ($_POST['email_notify'] ? 99 : 1);
if ($_POST['poll_title'] != "" && $_POST['poll_option'][0] != "" && $_POST['poll_option'][1] != "")
{ {
$subject = "[".LAN_402."] ".$subject; $postInfo['post_user'] = USERID;
} $threadInfo['thread_lastuser'] = USERID;
$threadInfo['thread_user'] = USERID;
$threadtype = (MODERATOR ? intval($_POST['threadtype']) : 0);
if (isset($_POST['reply']))
{
$parent = $id;
$forum_id = $thread_info['head']['thread_forum_id'];
} }
else else
{ {
$parent = 0; $postInfo['post_anon_name'] = $e107->tp->toDB($_POST['anonname']);
$forum_id = $id; $threadInfo['thread_lastuser'] = $postInfo['post_anon_name'];
$threadInfo['thread_user_anon'] = $postInfo['post_anon_name'];
} }
$time = time();
$postInfo['post_entry'] = $e107->tp->toDB($_POST['post']);
$postInfo['post_forum'] = $forum_id;
$postInfo['post_datestamp'] = $time;
$threadInfo['thread_lastpost'] = $time;
switch($action)
{
case 'rp':
$postInfo['post_thread'] = $id;
$result = $forum->postAdd($postInfo);
break;
case 'nt':
$threadInfo['thread_s'] = (MODERATOR ? (int)$_POST['threadtype'] : 0);
$threadInfo['thread_name'] = $e107->tp->toDB($_POST['subject']);
$threadInfo['thread_forum_id'] = $forum_id;
$threadInfo['thread_active'] = 1;
$threadInfo['thread_datestamp'] = $time;
$result = $forum->threadAdd($threadInfo, $postInfo);
break;
}
// $email_notify = ($_POST['email_notify'] ? 99 : 1);
// if ($_POST['poll_title'] != "" && $_POST['poll_option'][0] != "" && $_POST['poll_option'][1] != "")
// {
// $subject = "[".LAN_402."] ".$subject;
// }
print_a($threadInfo);
print_a($postInfo);
exit;
$result = $forum->postAdd($postInfo, $threadInfo);
$iid = $forum->thread_insert($subject, $post, $forum_id, $parent, $poster, $email_notify, $threadtype, $forum_info['forum_sub']); $iid = $forum->thread_insert($subject, $post, $forum_id, $parent, $poster, $email_notify, $threadtype, $forum_info['forum_sub']);
if($iid === -1) if($iid === -1)

View File

@@ -23,13 +23,15 @@ CREATE TABLE forum (
CREATE TABLE forum_thread ( CREATE TABLE forum_thread (
`thread_id` int(10) unsigned NOT NULL auto_increment, `thread_id` int(10) unsigned NOT NULL auto_increment,
`thread_name` varchar(250) NOT NULL default '', `thread_name` varchar(250) NOT NULL default '',
`thread_thread` text NOT NULL,
`thread_forum_id` int(10) unsigned NOT NULL default '0', `thread_forum_id` int(10) unsigned NOT NULL default '0',
`thread_views` int(10) unsigned NOT NULL default '0', `thread_views` int(10) unsigned NOT NULL default '0',
`thread_active` tinyint(3) unsigned NOT NULL default '0', `thread_active` tinyint(3) unsigned NOT NULL default '0',
`thread_lastpost` int(10) unsigned NOT NULL default '0', `thread_lastpost` int(10) unsigned NOT NULL default '0',
`thread_s` tinyint(1) unsigned NOT NULL default '0', `thread_s` tinyint(1) unsigned NOT NULL default '0',
`thread_user` int(10) unsigned default NULL,
`thread_user_anon` varchar(30) NULL,
`thread_lastuser` int(10) unsigned default NULL, `thread_lastuser` int(10) unsigned default NULL,
`thread_lastuser_anon` varchar(30) NULL,
`thread_total_replies` int(10) unsigned NOT NULL default '0', `thread_total_replies` int(10) unsigned NOT NULL default '0',
`thread_options` text, `thread_options` text,
PRIMARY KEY (`thread_id`), PRIMARY KEY (`thread_id`),

View File

@@ -9,37 +9,45 @@
* View specific forums * View specific forums
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/viewforum.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/forum/viewforum.php,v $
* $Revision: 1.2 $ * $Revision: 1.3 $
* $Date: 2008-11-26 19:59:06 $ * $Date: 2008-11-27 03:02:26 $
* $Author: mcfly_e107 $ * $Author: mcfly_e107 $
* *
*/ */
require_once("../../class2.php"); require_once('../../class2.php');
$lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php'; $lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php';
include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_viewforum.php'); include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_viewforum.php');
if (isset($_POST['fjsubmit'])) { if (isset($_POST['fjsubmit']))
{
header("location:".e_SELF.'?'.$_POST['forumjump']); header("location:".e_SELF.'?'.$_POST['forumjump']);
exit; exit;
} }
if (!e_QUERY) if (!e_QUERY)
{ {
js_location(e_PLUGIN."forum/forum.php"); js_location(e_PLUGIN.'forum/forum.php');
exit;
} }
$view = 25;
$thread_from = (isset($_REQUEST['p']) ? $_REQUEST['p'] * $view : 0);
/*
else else
{ {
$tmp = explode(".", e_QUERY); $tmp = explode('.', e_QUERY);
$forum_id = (int)$tmp[0]; $forum_id = (int)$tmp[0];
$thread_from = (isset($tmp[1]) ? (int)$tmp[1] : 0); $thread_from = (isset($tmp[1]) ? (int)$tmp[1] : 0);
} }
$view = 25;
if(is_numeric(e_MENU)) if(is_numeric(e_MENU))
{ {
$thread_from = (intval(e_MENU)-1)*$view; $thread_from = (intval(e_MENU)-1)*$view;
} }
*/
require_once(e_PLUGIN.'forum/forum_class.php'); require_once(e_PLUGIN.'forum/forum_class.php');
$forum = new e107forum; $forum = new e107forum;
@@ -50,69 +58,74 @@ $LASTPOSTITLE = LAN_57;
$VIEWTITLE = LAN_56; $VIEWTITLE = LAN_56;
global $forum_info, $FORUM_CRUMB; global $forum_info, $FORUM_CRUMB;
$forum_info = $forum->forum_get($forum_id);
if (!check_class($forum_info['forum_class']) || !check_class($forum_info['parent_class']) || !$forum_info['forum_parent']) $forum_id = (int)$_REQUEST['id'];
if (!$forum->checkPerm($forum_id, 'view'))
{ {
header("Location:".e_PLUGIN."forum/forum.php"); header("Location:".$e107->url->getUrl('forum', 'forum', array('func' => 'main')));
exit; exit;
} }
$forum_info = $forum->forum_get($forum_id);
if (!$FORUM_VIEW_START) { if (!$FORUM_VIEW_START) {
if (file_exists(THEME."forum_viewforum_template.php")) if (file_exists(THEME.'forum_viewforum_template.php'))
{ {
require_once(THEME."forum_viewforum_template.php"); require_once(THEME.'forum_viewforum_template.php');
} }
else if (file_exists(THEME."forum_template.php")) else if (file_exists(THEME.'forum_template.php'))
{ {
require_once(THEME."forum_template.php"); require_once(THEME.'forum_template.php');
} }
else else
{ {
require_once(e_PLUGIN."forum/templates/forum_viewforum_template.php"); require_once(e_PLUGIN.'forum/templates/forum_viewforum_template.php');
} }
} }
$forum_info['forum_name'] = $e107->tp->toHTML($forum_info['forum_name'], true, 'no_hook, emotes_off');
$forum_info['forum_description'] = $e107->tp->toHTML($forum_info['forum_description'], true, 'no_hook');
$forum_info['forum_name'] = $tp->toHTML($forum_info['forum_name'], TRUE, 'no_hook, emotes_off'); $_forum_name = (substr($forum_info['forum_name'], 0, 1) == '*' ? substr($forum_info['forum_name'], 1) : $forum_info['forum_name']);
$forum_info['forum_description'] = $tp->toHTML($forum_info['forum_description'], TRUE, 'no_hook'); define('e_PAGETITLE', LAN_01.' / '.$_forum_name);
define('MODERATOR', $forum_info['forum_moderators'] != '' && check_class($forum_info['forum_moderators']));
$_forum_name = (substr($forum_info['forum_name'], 0, 1) == "*" ? substr($forum_info['forum_name'], 1) : $forum_info['forum_name']);
define("e_PAGETITLE", LAN_01." / ".$_forum_name);
define("MODERATOR", $forum_info['forum_moderators'] != "" && check_class($forum_info['forum_moderators']));
$modArray = $forum->forum_getmods($forum_info['forum_moderators']); $modArray = $forum->forum_getmods($forum_info['forum_moderators']);
$message = ""; $message = '';
if (MODERATOR) if (MODERATOR)
{ {
if ($_POST) if ($_POST)
{ {
require_once(e_PLUGIN."forum/forum_mod.php"); require_once(e_PLUGIN.'forum/forum_mod.php');
$message = forum_thread_moderate($_POST); $message = forum_thread_moderate($_POST);
} }
} }
$member_users = $sql->db_Select("online", "*", "online_location REGEXP('forum_viewforum.php.$forum_id') AND online_user_id!='0' "); if(varset($pref['track_online']))
$guest_users = $sql->db_Select("online", "*", "online_location REGEXP('forum_viewforum.php.$forum_id') AND online_user_id='0' "); {
$users = $member_users+$guest_users; $member_users = $sql->db_Count('online', '(*)', "WHERE online_location REGEXP('viewforum.php.id=$forum_id\$') AND online_user_id != 0");
$guest_users = $sql->db_Count('online', '(*)', "WHERE online_location REGEXP('viewforum.php.id=$forum_id\$') AND online_user_id = 0");
$users = $member_users+$guest_users;
}
require_once(HEADERF); require_once(HEADERF);
$text=''; $text='';
if ($message) if ($message)
{ {
$ns->tablerender("", $message, array('forum_viewforum', 'msg')); $ns->tablerender('', $message, array('forum_viewforum', 'msg'));
} }
$topics = $forum->forum_get_topic_count($forum_id); $topics = $forum->forum_get_topic_count($forum_id);
if ($topics > $view) if ($topics > $view)
{ {
$pages = ceil($topics/$view); $pages = ceil($topics/$view);
} }
else else
{ {
$pages = FALSE; $pages = false;
} }
if ($pages) if ($pages)
{ {
if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== FALSE || strpos($FORUM_VIEW_END, 'THREADPAGES') !== FALSE) if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== FALSE || strpos($FORUM_VIEW_END, 'THREADPAGES') !== FALSE)
@@ -122,13 +135,12 @@ if ($pages)
} }
} }
if (check_class($forum_info['forum_postclass']) && check_class($forum_info['parent_postclass'])) if($forum->checkPerm($forum_id, 'post'))
{ {
// $NEWTHREADBUTTON = "<a href='".e_PLUGIN."forum/forum_post.php?nt.".$forum_id."'>".IMAGE_newthread."</a>";
$NEWTHREADBUTTON = "<a href='".$e107->url->getUrl('forum', 'thread', array('func' => 'nt', 'id' => $forum_id))."'>".IMAGE_newthread.'</a>'; $NEWTHREADBUTTON = "<a href='".$e107->url->getUrl('forum', 'thread', array('func' => 'nt', 'id' => $forum_id))."'>".IMAGE_newthread.'</a>';
} }
if(substr($forum_info['forum_name'], 0, 1) == "*") if(substr($forum_info['forum_name'], 0, 1) == '*')
{ {
$forum_info['forum_name'] = substr($forum_info['forum_name'], 1); $forum_info['forum_name'] = substr($forum_info['forum_name'], 1);
$container_only = true; $container_only = true;
@@ -138,7 +150,7 @@ else
$container_only = false; $container_only = false;
} }
if(substr($forum_info['sub_parent'], 0, 1) == "*") if(substr($forum_info['sub_parent'], 0, 1) == '*')
{ {
$forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1); $forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1);
} }
@@ -147,8 +159,13 @@ $forum->set_crumb(); // set $BREADCRUMB (and $BACKLINK)
$FORUMTITLE = $forum_info['forum_name']; $FORUMTITLE = $forum_info['forum_name'];
//$MODERATORS = LAN_404.": ".$forum_info['forum_moderators']; //$MODERATORS = LAN_404.": ".$forum_info['forum_moderators'];
$MODERATORS = LAN_404.": ".implode(", ", $modArray); $MODERATORS = LAN_404.': '.implode(', ', $modArray);
$BROWSERS = $users." ".($users == 1 ? LAN_405 : LAN_406)." (".$member_users." ".($member_users == 1 ? LAN_407 : LAN_409).", ".$guest_users." ".($guest_users == 1 ? LAN_408 : LAN_410).")"; $BROWSERS = '';
if(varset($pref['track_online']))
{
$BROWSERS = $users.' '.($users == 1 ? LAN_405 : LAN_406).' ('.$member_users.' '.($member_users == 1 ? LAN_407 : LAN_409).", ".$guest_users." ".($guest_users == 1 ? LAN_408 : LAN_410).')';
}
$ICONKEY = " $ICONKEY = "
<table style='width:100%'> <table style='width:100%'>
@@ -184,30 +201,30 @@ $SEARCH = "
</p> </p>
</form>"; </form>";
if(check_class($forum_info['forum_postclass'])) if($forum->checkPerm($forum_id, 'post'))
{ {
$PERMS = LAN_204." - ".LAN_206." - ".LAN_208; $PERMS = LAN_204.' - '.LAN_206.' - '.LAN_208;
} }
else else
{ {
$PERMS = LAN_205." - ".LAN_207." - ".LAN_209; $PERMS = LAN_205.' - '.LAN_207.' - '.LAN_209;
} }
$sticky_threads = 0; $sticky_threads = 0;
$stuck = FALSE; $stuck = false;
$reg_threads = 0; $reg_threads = 0;
$unstuck = FALSE; $unstuck = false;
$thread_list = $forum->forum_get_topics($forum_id, $thread_from, $view); $thread_list = $forum->forum_get_topics($forum_id, $thread_from, $view);
$sub_list = $forum->forum_getsubs($forum_id); $sub_list = $forum->forum_getsubs($forum_id);
//print_a($sub_list); //print_a($sub_list);
$gen = new convert; $gen = new convert;
$SUBFORUMS = ""; $SUBFORUMS = '';
if(is_array($sub_list)) if(is_array($sub_list))
{ {
$newflag_list = $forum->forum_newflag_list(); $newflag_list = $forum->forum_newflag_list();
$sub_info = ""; $sub_info = '';
foreach($sub_list as $sub) foreach($sub_list as $sub)
{ {
$sub_info .= parse_sub($sub); $sub_info .= parse_sub($sub);
@@ -215,15 +232,17 @@ if(is_array($sub_list))
$SUBFORUMS = $FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END; $SUBFORUMS = $FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END;
} }
if (count($thread_list) ) if (count($thread_list) )
{ {
foreach($thread_list as $thread_info) { foreach($thread_list as $thread_info)
{
$idArray[] = $thread_info['thread_id']; $idArray[] = $thread_info['thread_id'];
} }
$inList = '('.implode(',', $idArray).')'; $inList = '('.implode(',', $idArray).')';
foreach($thread_list as $thread_info) { foreach($thread_list as $thread_info)
if ($thread_info['thread_s']) { {
if ($thread_info['thread_s'])
{
$sticky_threads ++; $sticky_threads ++;
} }
if ($sticky_threads > 0 && !$stuck && $pref['forum_hilightsticky']) if ($sticky_threads > 0 && !$stuck && $pref['forum_hilightsticky'])
@@ -236,13 +255,13 @@ if (count($thread_list) )
{ {
$forum_view_forum .= "<tr><td class='forumheader'>&nbsp;</td><td colspan='5' class='forumheader'><span class='mediumtext'><b>".LAN_411."</b></span></td></tr>"; $forum_view_forum .= "<tr><td class='forumheader'>&nbsp;</td><td colspan='5' class='forumheader'><span class='mediumtext'><b>".LAN_411."</b></span></td></tr>";
} }
$stuck = TRUE; $stuck = true;
} }
if (!$thread_info['thread_s']) if (!$thread_info['thread_s'])
{ {
$reg_threads ++; $reg_threads ++;
} }
if ($reg_threads == "1" && !$unstuck && $stuck) if ($reg_threads == '1' && !$unstuck && $stuck)
{ {
if($FORUM_NORMAL_ROW) if($FORUM_NORMAL_ROW)
{ {
@@ -252,7 +271,7 @@ if (count($thread_list) )
{ {
$forum_view_forum .= "<tr><td class='forumheader'>&nbsp;</td><td colspan='5' class='forumheader'><span class='mediumtext'><b>".LAN_412."</b></span></td></tr>"; $forum_view_forum .= "<tr><td class='forumheader'>&nbsp;</td><td colspan='5' class='forumheader'><span class='mediumtext'><b>".LAN_412."</b></span></td></tr>";
} }
$unstuck = TRUE; $unstuck = true;
} }
$forum_view_forum .= parse_thread($thread_info); $forum_view_forum .= parse_thread($thread_info);
} }
@@ -262,15 +281,15 @@ else
$forum_view_forum .= "<tr><td class='forumheader' colspan='6'>".LAN_58."</td></tr>"; $forum_view_forum .= "<tr><td class='forumheader' colspan='6'>".LAN_58."</td></tr>";
} }
$sql->db_Select("forum", "*", "forum_parent !=0 AND forum_class!='255' "); //$sql->db_Select('forum', '*', "forum_parent !=0 AND forum_class != '255' ");
$FORUMJUMP = forumjump(); $FORUMJUMP = forumjump();
$TOPLINK = "<a href='".e_SELF."?".e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_02."</a>"; $TOPLINK = "<a href='".e_SELF.'?'.e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_02.'</a>';
if($container_only) if($container_only)
{ {
$FORUM_VIEW_START = ($FORUM_VIEW_START_CONTAINER ? $FORUM_VIEW_START_CONTAINER : $FORUM_VIEW_START); $FORUM_VIEW_START = ($FORUM_VIEW_START_CONTAINER ? $FORUM_VIEW_START_CONTAINER : $FORUM_VIEW_START);
$FORUM_VIEW_END = ($FORUM_VIEW_END_CONTAINER ? $FORUM_VIEW_END_CONTAINER : $FORUM_VIEW_END); $FORUM_VIEW_END = ($FORUM_VIEW_END_CONTAINER ? $FORUM_VIEW_END_CONTAINER : $FORUM_VIEW_END);
$forum_view_forum = ""; $forum_view_forum = '';
} }
$forum_view_start = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_START); $forum_view_start = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_START);