Version 1.3.0

This commit is contained in:
Neo committed 2025-12-19 00:17:06 -08:00
1 parent 7ef3d1712a
commit f87d29ba65
290 files changed
+50206 -17930

No files matched your search

+241 -122
View File
@@ -2,15 +2,17 @@
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| Invision Power Board v1.3 Final
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| (c) 2001 - 2003 Invision Power Services
| http://www.invisionpower.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
| Web: http://www.invisionboard.com
| Time: Sun, 04 Jan 2004 00:30:16 GMT
| Release: 28e7bfb25f08ac72a789cb1b172fa185
| Email: matt@invisionpower.com
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Forum topic index module
@@ -31,12 +33,14 @@ class Forums {
var $html = "";
var $moderator = array();
var $forum = array();
var $mods = array();
var $show_dots = "";
var $nav_extra = "";
var $read_array = array();
var $board_html = "";
var $sub_output = "";
var $pinned_print = 0;
var $new_posts = 0;
//+----------------------------------------------------------------
//
@@ -44,16 +48,38 @@ class Forums {
//
//+----------------------------------------------------------------
function Forums() {
function Forums()
{
global $ibforums, $DB, $std, $print, $skin_universal;
$ibforums->input['f'] = intval($ibforums->input['f']);
//+------------------------------------------
// Are we doing anything with "site jump?"
//+------------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_forum', $ibforums->lang_id);
switch( $ibforums->input['f'] )
{
case 'sj_home':
$std->boink_it($ibforums->base_url."act=idx");
break;
case 'sj_search':
$std->boink_it($ibforums->base_url."act=Search");
break;
case 'sj_help':
$std->boink_it($ibforums->base_url."act=Help");
break;
default:
$ibforums->input['f'] = intval($ibforums->input['f']);
break;
}
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_forum', $ibforums->lang_id);
$this->html = $std->load_template('skin_forum');
$this->html = $std->load_template('skin_forum');
// Get the forum info based on the forum ID, and get the category name, ID, etc.
//+------------------------------------------
// Get the forum info based on the forum ID,
// and get the category name, ID, etc.
//+------------------------------------------
$DB->query("SELECT f.*, c.id as cat_id, c.name as cat_name
FROM ibf_forums f
@@ -68,7 +94,24 @@ class Forums {
if (!$this->forum['id'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
$std->Error( array( LEVEL => 1, MSG => 'is_broken_link') );
}
//----------------------------------------
// Is it a redirect forum?
//----------------------------------------
if ( $this->forum['redirect_on'] and $this->forum['redirect_url'] )
{
// Update hits:
$DB->query("UPDATE ibf_forums SET redirect_hits=redirect_hits+1 WHERE id=".$this->forum['id']);
// Boink!
$std->boink_it( $this->forum['redirect_url'] );
// Game over man!
}
//----------------------------------------
@@ -86,19 +129,16 @@ class Forums {
$this->forum['cat_id'] = $row['id'];
$this->forum['cat_name'] = $row['name'];
$this->nav_extra = "<a href='".$ibforums->base_url."&act=SF&f={$row['forum_id']}'>{$row['forum_name']}</a>";
$this->nav_extra = "<a href='".$ibforums->base_url."showforum={$row['forum_id']}'>{$row['forum_name']}</a>";
}
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
$this->base_url = $ibforums->base_url;
$this->forum['FORUM_JUMP'] = $std->build_forum_jump();
$this->forum['FORUM_JUMP'] = preg_replace( "!#Forum Jump#!", $ibforums->lang['forum_jump'], $this->forum['FORUM_JUMP']);
// Are we viewing the forum, or viewing the forum rules?
if ($ibforums->input['act'] == 'SR')
@@ -144,13 +184,21 @@ class Forums {
$this->output = str_replace( "<!--IBF.SUB_FORUM_LINK-->", $this->html->show_sub_link($this->forum['id']), $this->output );
}
if ( $ibforums->member['g_is_supmod'] OR $ibforums->member['is_mod'] )
{
if ( $this->forum['has_mod_posts'] )
{
$this->output = str_replace( "<!--IBF.MODLINK-->", $this->html->show_mod_link($this->forum['id']), $this->output );
}
}
$print->add_output($this->output);
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->forum['name'],
'JS' => 0,
'NAV' => array(
"<a href='".$this->base_url."&act=SC&c={$this->forum['cat_id']}'>{$this->forum['cat_name']}</a>",
"<a href='".$this->base_url."act=SC&amp;c={$this->forum['cat_id']}'>{$this->forum['cat_name']}</a>",
$this->nav_extra,
"<a href='".$this->base_url."&act=SF&f={$this->forum['id']}'>{$this->forum['name']}</a>",
"<a href='".$this->base_url."showforum={$this->forum['id']}'>{$this->forum['name']}</a>",
),
) );
@@ -171,14 +219,34 @@ class Forums {
$fid = $ibforums->input['f'];
$DB->query("SELECT * FROM ibf_forums WHERE parent_id='$fid' ORDER BY position");
$DB->query("SELECT f.*, m.member_name as mod_name, m.member_id as mod_id, m.is_group, m.group_id, m.group_name, m.mid
FROM ibf_forums f
LEFT JOIN ibf_moderators m ON (f.id=m.forum_id)
WHERE parent_id='$fid'
ORDER BY position");
if ( ! $DB->get_num_rows() )
{
return "";
}
while ( $data = $DB->fetch_row() )
while ( $r = $DB->fetch_row() )
{
$this->forums[ $r['id'] ] = $r;
if ($r['mod_id'] != "")
{
$this->mods[ $r['id'] ][ $r['mid'] ] = array( 'name' => $r['mod_name'],
'id' => $r['mod_id'],
'isg' => $r['is_group'],
'gname'=> $r['group_name'],
'gid' => $r['group_id'],
);
}
}
foreach( $this->forums as $data )
{
$temp_html .= $this->process_forum($data['id'], $data);
}
@@ -208,23 +276,45 @@ class Forums {
// Check permissions...
//--------------------------------------
if ($forum_data['read_perms'] != '*')
if ( $std->check_perms($forum_data['read_perms']) != TRUE )
{
if ( ! preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|$)/", $forum_data['read_perms'] ) )
return "";
}
//--------------------------------------
// Redirect only forum?
//--------------------------------------
if ( $forum_data['redirect_on'] )
{
// Simply return with the redirect information
if ( $forum_data['redirect_loc'] != "" )
{
return "";
$forum_data['redirect_target'] = " target='".$forum_data['redirect_loc']."' ";
}
$forum_data['redirect_hits'] = $std->do_number_format($forum_data['redirect_hits']);
return $this->board_html->forum_redirect_row($forum_data);
}
$forum_data['img_new_post'] = $std->forum_new_posts($forum_data);
if ( $forum_data['img_new_post'] == '<{C_ON}>' )
{
$forum_data['img_new_post'] = $this->board_html->forum_img_with_link($forum_data['img_new_post'], $forum_data['id']);
}
$forum_data['last_post'] = $std->get_date($forum_data['last_post'], 'LONG');
$forum_data['last_topic'] = $ibforums->lang['f_none'];
if (isset($forum_data['last_title']) and $forum_data['last_id'] != "")
if (isset($forum_data['last_title']) and $forum_data['last_id'])
{
$forum_data['last_title'] = strip_tags($forum_data['last_title']);
$forum_data['last_title'] = str_replace( "&#33;" , "!", $forum_data['last_title'] );
$forum_data['last_title'] = str_replace( "&quot;", "\"", $forum_data['last_title'] );
@@ -233,6 +323,10 @@ class Forums {
$forum_data['last_title'] = substr($forum_data['last_title'],0,27) . "...";
$forum_data['last_title'] = preg_replace( '/&(#(\d+;?)?)?\.\.\.$/', '...', $forum_data['last_title'] );
}
else
{
$forum_data['last_title'] = preg_replace( '/&(#(\d+?)?)?$/', '', $forum_data['last_title'] );
}
if ($forum_data['password'] != "")
{
@@ -240,13 +334,14 @@ class Forums {
}
else
{
$forum_data['last_topic'] = "<a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}&act=ST&f={$forum_data['id']}&t={$forum_data['last_id']}&view=getlastpost'>{$forum_data['last_title']}</a>";
$forum_data['last_unread'] = $this->board_html->forumrow_lastunread_link($forum_data['id'], $forum_data['last_id']);
$forum_data['last_topic'] = "<a href='{$ibforums->base_url}showtopic={$forum_data['last_id']}&amp;view=getlastpost' title='{$ibforums->lang['tt_gounread']}'>{$forum_data['last_title']}</a>";
}
}
if ( isset($forum_data['last_poster_name']))
{
$forum_data['last_poster'] = $forum_data['last_poster_id'] ? "<a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}&act=Profile&CODE=03&MID={$forum_data['last_poster_id']}'>{$forum_data['last_poster_name']}</a>"
$forum_data['last_poster'] = $forum_data['last_poster_id'] ? "<a href='{$ibforums->base_url}showuser={$forum_data['last_poster_id']}'>{$forum_data['last_poster_name']}</a>"
: $forum_data['last_poster_name'];
}
else
@@ -270,11 +365,11 @@ class Forums {
{
if ($moderator['isg'] == 1)
{
$forum_data['moderator'] .= "<a href='{$ibforums->base_url}&act=Members&max_results=30&filter={$moderator['gid']}&sort_order=asc&sort_key=name&st=0'>{$moderator['gname']}</a>, ";
$forum_data['moderator'] .= "<a href='{$ibforums->base_url}act=Members&amp;max_results=30&amp;filter={$moderator['gid']}&amp;sort_order=asc&amp;sort_key=name&amp;st=0'>{$moderator['gname']}</a>, ";
}
else
{
$forum_data['moderator'] .= "<a href='{$ibforums->base_url}&act=Profile&CODE=03&MID={$moderator['id']}'>{$moderator['name']}</a>, ";
$forum_data['moderator'] .= "<a href='{$ibforums->base_url}showuser={$moderator['id']}'>{$moderator['name']}</a>, ";
}
}
@@ -285,25 +380,29 @@ class Forums {
{
if ($moderator['isg'] == 1)
{
$forum_data['moderator'] .= "<a href='{$ibforums->base_url}&act=Members&max_results=30&filter={$this->mods[$forum_data['id']]['gid']}&sort_order=asc&sort_key=name&st=0'>{$this->mods[$forum_data['id']]['gname']}</a>, ";
$forum_data['moderator'] .= "<a href='{$ibforums->base_url}act=Members&amp;max_results=30&amp;filter={$this->mods[$forum_data['id']]['gid']}&amp;sort_order=asc&amp;sort_key=name&amp;st=0'>{$this->mods[$forum_data['id']]['gname']}</a>, ";
}
else
{
$forum_data['moderator'] .= "<a href='{$ibforums->base_url}&act=Profile&CODE=03&MID={$this->mods[$forum_data['id']]['id']}'>{$this->mods[$forum_data['id']]['name']}</a>";
$forum_data['moderator'] .= "<a href='{$ibforums->base_url}showuser={$this->mods[$forum_data['id']]['id']}'>{$this->mods[$forum_data['id']]['name']}</a>";
}
}
}
$forum_data['posts'] = $std->do_number_format($forum_data['posts']);
$forum_data['topics'] = $std->do_number_format($forum_data['topics']);
return $this->board_html->ForumRow($forum_data);
}
//+----------------------------------------------------------------
//
// Show the forum rules on a seperate page
// Show the forum rules on a separate page
//
//+----------------------------------------------------------------
function show_rules() {
function show_rules()
{
global $DB, $ibforums, $std, $print;
//+--------------------------------------------
@@ -317,24 +416,21 @@ class Forums {
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_view_topic') );
}
//+--------------------------------------------
// Get the rules from the DB
//+--------------------------------------------
$DB->query("SELECT * FROM ibf_rules WHERE fid='".$ibforums->input['f']."'");
if ( $rules = $DB->fetch_row() )
if ( $this->forum['rules_title'] )
{
$rules['title'] = stripslashes($rules['title']);
$rules['body'] = stripslashes($rules['body']);
$rules['title'] = $this->forum['rules_title'];
$rules['body'] = $this->forum['rules_text'];
$rules['fid'] = $this->forum['id'];
$this->output .= $this->html->show_rules($rules);
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => "IBForums -> ".$this->forum['name'],
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -&gt; ".$this->forum['name'],
'JS' => 0,
'NAV' => array(
"<a href='".$this->base_url."&act=SC&c={$this->forum['cat_id']}'>{$this->forum['cat_name']}</a>",
"<a href='".$this->base_url."act=SC&amp;c={$this->forum['cat_id']}'>{$this->forum['cat_name']}</a>",
$this->forum['name']
),
) );
}
@@ -350,7 +446,8 @@ class Forums {
//
//+----------------------------------------------------------------
function show_forum() {
function show_forum()
{
global $ibforums;
// are we checking for user authentication via the log in form
// for a private forum w/password protection?
@@ -379,22 +476,18 @@ class Forums {
$std->my_setcookie( "iBForum".$this->forum['id'], $ibforums->input['f_password'] );
$print->redirect_screen( $ibforums->lang['logged_in'] , "act=SF&f=".$this->forum['id'] );
$print->redirect_screen( $ibforums->lang['logged_in'] , "showforum=".$this->forum['id'] );
}
//+----------------------------------------------------------------------------------
function check_access() {
global $ibforums, $HTTP_COOKIE_VARS;
global $ibforums, $std, $HTTP_COOKIE_VARS;
$return = 1;
if ($this->forum['read_perms'] == '*')
{
$return = 0;
}
else if (preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|$)/", $this->forum['read_perms'] ) )
if ( $std->check_perms($this->forum['read_perms']) == TRUE )
{
$return = 0;
}
@@ -437,8 +530,8 @@ class Forums {
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->forum['name'],
'JS' => 0,
'NAV' => array(
"<a href='".$this->base_url."&act=SC&c={$this->forum['cat_id']}'>{$this->forum['cat_name']}</a>",
"<a href='".$this->base_url."&act=SF&f={$this->forum['id']}'>{$this->forum['name']}</a>",
"<a href='".$this->base_url."act=SC&amp;c={$this->forum['cat_id']}'>{$this->forum['cat_name']}</a>",
"<a href='".$this->base_url."showforum={$this->forum['id']}'>{$this->forum['name']}</a>",
),
) );
@@ -450,8 +543,9 @@ class Forums {
//
//+----------------------------------------------------------------
function render_forum() {
global $ibforums, $DB, $std, $print, $HTTP_COOKIE_VARS;
function render_forum()
{
global $ibforums, $DB, $std, $print, $skin_universal,$HTTP_COOKIE_VARS;
$bad_entry = $this->check_access();
@@ -478,12 +572,10 @@ class Forums {
{
$this->read_array = unserialize(stripslashes($read));
}
if ( $forum = $std->my_getcookie('fread_'.$ibforums->input['f']) )
{
$ibforums->input['last_visit'] = $forum > $ibforums->input['last_visit'] ? $forum : $ibforums->input['last_visit'];
}
$ibforums->input['last_visit'] = $ibforums->forum_read[ $ibforums->input['f'] ] > $ibforums->input['last_visit']
? $ibforums->forum_read[ $ibforums->input['f'] ] : $ibforums->input['last_visit'];
$prune_value = $std->select_var( array(
1 => $ibforums->input['prune_day'],
2 => $this->forum['prune'] ,
@@ -541,7 +633,7 @@ class Forums {
// check for any form funny business by wanna-be hackers
//+----------------------------------------------------------------
if ( (!isset($sort_keys[$sort_key])) and (!isset($prune_by_day[$prune_value])) and (!isset($sort_by_keys[$sort_by])) )
if ( (!isset($sort_keys[$sort_key])) or (!isset($prune_by_day[$prune_value])) or (!isset($sort_by_keys[$sort_by])) )
{
$std->Error( array( LEVEL=> 5, MSG =>'incorrect_use') );
}
@@ -552,7 +644,7 @@ class Forums {
// Query the database to see how many topics there are in the forum
//+----------------------------------------------------------------
$DB->query("SELECT COUNT(tid) as max FROM ibf_topics WHERE forum_id='".$this->forum['id']."' and approved='1' and (last_post > $Prune or pinned=1)");
$DB->query("SELECT COUNT(tid) as max FROM ibf_topics WHERE forum_id=".$this->forum['id']." and approved=1 and (pinned=1 or last_post > $Prune)");
$total_possible = $DB->fetch_row();
//+----------------------------------------------------------------
@@ -560,12 +652,11 @@ class Forums {
//+----------------------------------------------------------------
$this->forum['SHOW_PAGES']
= $std->build_pagelinks( array( 'TOTAL_POSS' => $total_possible[max],
= $std->build_pagelinks( array( 'TOTAL_POSS' => $total_possible['max'],
'PER_PAGE' => $ibforums->vars['display_max_topics'],
'CUR_ST_VAL' => $ibforums->input['st'],
'L_SINGLE' => $ibforums->lang['single_page_forum'],
'L_MULTI' => $ibforums->lang['multi_page_forum'],
'BASE_URL' => $this->base_url."&act=SF&f=".$this->forum['id']."&prune_day=$prune_value&sort_by=$sort_by&sort_key=$sort_key",
'BASE_URL' => $this->base_url."showforum=".$this->forum['id']."&amp;prune_day=$prune_value&amp;sort_by=$sort_by&amp;sort_key=$sort_key",
)
);
@@ -574,24 +665,14 @@ class Forums {
// Do we have any rules to show?
//+----------------------------------------------------------------
if ($this->forum['show_rules'])
{
$DB->query("SELECT * from ibf_rules WHERE fid='".$this->forum['id']."'");
if ( $rules = $DB->fetch_row() )
{
$rules['title'] = stripslashes($rules['title']);
$rules['body'] = stripslashes($rules['body']);
$this->output .= $rules['show_all'] ? $this->html->show_rules_full($rules) : $this->html->show_rules_link($rules);
}
}
$this->output .= $std->print_forum_rules($this->forum);
//+----------------------------------------------------------------
// Generate the poll button
//+----------------------------------------------------------------
$this->forum['POLL_BUTTON'] = $this->forum['allow_poll']
? "<a href='".$this->base_url."&act=Post&CODE=10&f=".$this->forum['id']."'><{A_POLL}></a>"
? "<a href='".$this->base_url."act=Post&amp;CODE=10&amp;f=".$this->forum['id']."'><{A_POLL}></a>"
: '';
//+----------------------------------------------------------------
@@ -613,11 +694,16 @@ class Forums {
if ( ($ibforums->vars['show_user_posted'] == 1) and ($ibforums->member['id']) )
{
$query = "SELECT DISTINCT ibf_posts.author_id, ibf_topics.* from ibf_topics LEFT JOIN ibf_posts ON (ibf_topics.tid = ibf_posts.topic_id AND ibf_posts.author_id = '".$ibforums->member['id']."') WHERE ibf_topics.forum_id='".$this->forum['id']."' and (ibf_topics.last_post > '$Prune' OR ibf_topics.pinned='1') and ibf_topics.approved='1'";
$query = "SELECT DISTINCT(ibf_posts.author_id), ibf_topics.* FROM ibf_topics
LEFT JOIN ibf_posts ON
(ibf_topics.tid=ibf_posts.topic_id AND ibf_posts.author_id=".$ibforums->member['id'].")
WHERE ibf_topics.forum_id=".$this->forum['id']."
and ibf_topics.approved=1
and (ibf_topics.pinned=1 or ibf_topics.last_post > $Prune)";
}
else
{
$query = "SELECT * from ibf_topics WHERE forum_id='".$this->forum['id']."' and approved='1' and (last_post > '$Prune' OR pinned='1')";
$query = "SELECT * from ibf_topics WHERE forum_id=".$this->forum['id']." and approved=1 and (last_post > $Prune OR pinned=1)";
}
//+----------------------------------------------------------------
@@ -661,18 +747,21 @@ class Forums {
$sort_by_html = "<select name='sort_by' class='forminput'>\n";
foreach ($sort_by_keys as $k => $v) {
$sort_by_html .= $k == $sort_by ? "<option value='$k' selected>" . $ibforums->lang[ $sort_by_keys[ $k ] ] . "\n"
: "<option value='$k'>" . $ibforums->lang[ $sort_by_keys[ $k ] ] . "\n";
foreach ($sort_by_keys as $k => $v)
{
$sort_by_html .= $k == $sort_by ? "<option value='$k' selected='selected'>" . $ibforums->lang[ $sort_by_keys[ $k ] ] . "</option>\n"
: "<option value='$k'>" . $ibforums->lang[ $sort_by_keys[ $k ] ] . "</option>\n";
}
foreach ($sort_keys as $k => $v) {
$sort_key_html .= $k == $sort_key ? "<option value='$k' selected>" . $ibforums->lang[ $sort_keys[ $k ] ] . "\n"
: "<option value='$k'>" . $ibforums->lang[ $sort_keys[ $k ] ] . "\n";
foreach ($sort_keys as $k => $v)
{
$sort_key_html .= $k == $sort_key ? "<option value='$k' selected='selected'>" . $ibforums->lang[ $sort_keys[ $k ] ] . "</option>\n"
: "<option value='$k'>" . $ibforums->lang[ $sort_keys[ $k ] ] . "</option>\n";
}
foreach ($prune_by_day as $k => $v) {
$prune_day_html .= $k == $prune_value ? "<option value='$k' selected>" . $ibforums->lang[ $prune_by_day[ $k ] ] . "\n"
: "<option value='$k'>" . $ibforums->lang[ $prune_by_day[ $k ] ] . "\n";
foreach ($prune_by_day as $k => $v)
{
$prune_day_html .= $k == $prune_value ? "<option value='$k' selected='selected'>" . $ibforums->lang[ $prune_by_day[ $k ] ] . "</option>\n"
: "<option value='$k'>" . $ibforums->lang[ $prune_by_day[ $k ] ] . "</option>\n";
}
$ibforums->lang['sort_text'] = preg_replace( "!<#SORT_KEY_HTML#>!", "$sort_key_html</select>" , $ibforums->lang['sort_text'] );
@@ -681,21 +770,23 @@ class Forums {
$this->output .= $this->html->TableEnd($this->forum);
//+----------------------------------------------------------------
// If all the new topics have been read in this forum..
//+----------------------------------------------------------------
if ($this->new_posts < 1)
{
$ibforums->forum_read[ $this->forum['id'] ] = time();
$std->hdl_forum_read_cookie('set');
}
//+----------------------------------------------------------------
// Process users active in this forum
//+----------------------------------------------------------------
if ($ibforums->vars['no_au_forum'] != 1)
{
//+-----------------------------------------
// Is this forum restricted, or global?
//+-----------------------------------------
if ($this->forum['read_perms'] != '*')
{
$q_extra = " AND s.member_group IN (-2,".$this->forum['read_perms'].") ";
}
//+-----------------------------------------
// Get the users
//+-----------------------------------------
@@ -704,14 +795,16 @@ class Forums {
$time = time() - $cut_off;
$DB->query("SELECT s.member_id, s.member_name, s.login_type, s.location, g.suffix, g.prefix
$DB->query("SELECT s.member_id, s.member_name, s.login_type, s.location, g.suffix, g.prefix, g.g_perm_id, t.forum_id, m.org_perm_id
FROM ibf_sessions s
LEFT JOIN ibf_groups g ON (g.g_id=s.member_group)
WHERE s.in_forum='{$this->forum['id']}'
AND s.running_time > '$time'"
.$q_extra.
"ORDER BY s.running_time DESC");
LEFT JOIN ibf_topics t ON (t.tid=s.in_topic)
LEFT JOIN ibf_members m on (s.member_id=m.id)
WHERE (s.in_forum={$this->forum['id']} OR t.forum_id={$this->forum['id']})
AND s.running_time > $time
ORDER BY s.running_time DESC");
//+-----------------------------------------
// Cache all printed members so we don't double print them
//+-----------------------------------------
@@ -721,6 +814,23 @@ class Forums {
while ($result = $DB->fetch_row() )
{
$result['g_perm_id'] = $result['org_perm_id'] ? $result['org_perm_id'] : $result['g_perm_id'];
if ( $this->forum['read_perms'] != '*' )
{
if ( $result['g_perm_id'] )
{
if ( ! preg_match("/(^|,)(".str_replace( ",", '|', $result['g_perm_id'] ).")(,|$)/", $this->forum['read_perms'] ) )
{
continue;
}
}
else
{
continue;
}
}
if ($result['member_id'] == 0)
{
$active['guests']++;
@@ -735,18 +845,18 @@ class Forums {
{
if ( ($ibforums->member['mgroup'] == $ibforums->vars['admin_group']) and ($ibforums->vars['disable_admin_anon'] != 1) )
{
$active['names'] .= "</span><a href='{$ibforums->base_url}&act=Profile&MID={$result['member_id']}'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>*, ";
$active['names'] .= "<a href='{$ibforums->base_url}showuser={$result['member_id']}'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>*, ";
$active['anon']++;
}
else
{
$active['anon']++;
$active['anon']++;
}
}
else
{
$active['members']++;
$active['names'] .= "</span><a href='{$ibforums->base_url}&act=Profile&MID={$result['member_id']}'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>, ";
$active['names'] .= "<a href='{$ibforums->base_url}showuser={$result['member_id']}'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>, ";
}
}
}
@@ -778,11 +888,11 @@ class Forums {
$topic['last_text'] = $ibforums->lang['last_post_by'];
$topic['last_poster'] = ($topic['last_poster_id'] != 0)
? "<b><a href='{$this->base_url}&act=Profile&CODE=03&MID={$topic['last_poster_id']}'>{$topic['last_poster_name']}</a></b>"
? "<a href='{$this->base_url}showuser={$topic['last_poster_id']}'>{$topic['last_poster_name']}</a>"
: "-".$topic['last_poster_name']."-";
$topic['starter'] = ($topic['starter_id'] != 0)
? "<a href='{$this->base_url}&act=Profile&CODE=03&MID={$topic['starter_id']}'>{$topic['starter_name']}</a>"
? "<a href='{$this->base_url}showuser={$topic['starter_id']}'>{$topic['starter_name']}</a>"
: "-".$topic['starter_name']."-";
if ($topic['poll_state'])
@@ -797,7 +907,7 @@ class Forums {
$topic['folder_img'] = $std->folder_icon($topic, $show_dots, $this->read_array[$topic['tid']]);
$topic['topic_icon'] = $topic['icon_id'] ? '<img src="'.$ibforums->vars['img_url'] . '/icon' . $topic['icon_id'] . '.gif" border="0" alt="">'
$topic['topic_icon'] = $topic['icon_id'] ? '<img src="'.$ibforums->vars['img_url'] . '/icon' . $topic['icon_id'] . '.gif" border="0" alt="" />'
: '&nbsp;';
$topic['start_date'] = $std->get_date( $topic['start_date'], 'LONG' );
@@ -819,37 +929,46 @@ class Forums {
}
if ($pages > 1) {
if ($pages > 1)
{
$topic['PAGES'] = "<span class='small'>({$ibforums->lang['topic_sp_pages']} ";
for ($i = 0 ; $i < $pages ; ++$i ) {
$real_no = $i * $ibforums->vars['display_max_posts'];
$page_no = $i + 1;
if ($page_no == 4) {
$topic['PAGES'] .= "<a href='{$this->base_url}&act=ST&f={$this->forum['id']}&t={$topic['tid']}&st=" . ($pages - 1) * $ibforums->vars['display_max_posts'] . "'>...$pages </a>";
$topic['PAGES'] .= "<a href='{$this->base_url}showtopic={$topic['tid']}&amp;st=" . ($pages - 1) * $ibforums->vars['display_max_posts'] . "'>...$pages </a>";
break;
} else {
$topic['PAGES'] .= "<a href='{$this->base_url}&act=ST&f={$this->forum['id']}&t={$topic['tid']}&st=$real_no'>$page_no </a>";
$topic['PAGES'] .= "<a href='{$this->base_url}showtopic={$topic['tid']}&amp;st=$real_no'>$page_no </a>";
}
}
$topic['PAGES'] .= ")</span>";
}
//------------------------------------------------
// Format some numbers
//------------------------------------------------
if ($topic['posts'] < 0) $topic['posts'] = 0;
$topic['posts'] = $std->do_number_format($topic['posts']);
$topic['views'] = $std->do_number_format($topic['views']);
//------------------------------------------------
// Last time stuff...
//------------------------------------------------
$last_time = $this->read_array[ $topic['tid'] ] > $ibforums->input['last_visit'] ? $this->read_array[ $topic['tid'] ] : $ibforums->input['last_visit'];
if ($last_time && ($topic['last_post'] > $last_time))
{
$topic['go_last_page'] = "<a href='{$this->base_url}&act=ST&f={$this->forum['id']}&t={$topic['tid']}&view=getlastpost'><{GO_LAST_ON}></a>";
$topic['go_new_post'] = "<a href='{$this->base_url}&act=ST&f={$this->forum['id']}&t={$topic['tid']}&view=getnewpost'><{NEW_POST}></a>";
$this->new_posts++;
$topic['go_new_post'] = "<a href='{$this->base_url}showtopic={$topic['tid']}&amp;view=getnewpost'><{NEW_POST}></a>";
}
else
{
$topic['go_last_page'] = "<a href='{$this->base_url}&act=ST&f={$this->forum['id']}&t={$topic['tid']}&view=getlastpost'><{GO_LAST_OFF}></a>";
$topic['go_new_post'] = "";
}
$topic['last_post'] = $std->get_date( $topic['last_post'], 'SHORT' );