Version 1.3.0
This commit is contained in:
1 parent
7ef3d1712a
commit
f87d29ba65
290 files changed
+50206
-17930
No files matched your search
+296
-160
@@ -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
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Board index module
|
||||
@@ -29,7 +31,6 @@ class Boards {
|
||||
var $output = "";
|
||||
var $base_url = "";
|
||||
var $html = "";
|
||||
var $output = "";
|
||||
var $forums = array();
|
||||
var $mods = array();
|
||||
var $cats = array();
|
||||
@@ -39,17 +40,22 @@ class Boards {
|
||||
var $news_topic_id = "";
|
||||
var $news_forum_id = "";
|
||||
var $news_title = "";
|
||||
var $sep_char = "";
|
||||
|
||||
function Boards() {
|
||||
function Boards()
|
||||
{
|
||||
global $ibforums, $DB, $std, $print, $skin_universal;
|
||||
|
||||
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
|
||||
$this->base_url = $ibforums->base_url;
|
||||
|
||||
// Get more words for this invocation!
|
||||
|
||||
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_boards', $ibforums->lang_id);
|
||||
|
||||
$this->html = $std->load_template('skin_boards');
|
||||
|
||||
$this->sep_char = trim( $this->html->active_list_sep() );
|
||||
|
||||
if (! $ibforums->member['id'] )
|
||||
{
|
||||
$ibforums->input['last_visit'] = time();
|
||||
@@ -60,12 +66,13 @@ class Boards {
|
||||
// Get the forums and category info from the DB
|
||||
|
||||
$last_c_id = -1;
|
||||
|
||||
|
||||
$DB->query("SELECT f.*, c.id as cat_id, c.position as cat_position, c.state as cat_state, c.name as cat_name, c.description as cat_desc,
|
||||
c.image, c.url, 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, ibf_categories c
|
||||
LEFT JOIN ibf_moderators m ON (f.id=m.forum_id)
|
||||
order by c.position, f.position");
|
||||
FROM ibf_forums f, ibf_categories c
|
||||
LEFT JOIN ibf_moderators m ON (f.id=m.forum_id)
|
||||
WHERE c.id=f.category
|
||||
ORDER BY c.position, f.position");
|
||||
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
@@ -113,11 +120,6 @@ class Boards {
|
||||
$this->show_single_cat();
|
||||
$this->nav[] = $this->cats[ $ibforums->input['c'] ]['name'];
|
||||
}
|
||||
else if ($ibforums->input['sub'] == 1)
|
||||
{
|
||||
$this->show_subforum();
|
||||
$this->nav[] = $this->forums[ $ibforums->input['f'] ]['name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->process_all_cats();
|
||||
@@ -147,108 +149,136 @@ class Boards {
|
||||
// Get the users from the DB
|
||||
|
||||
$cut_off = $ibforums->vars['au_cutoff'] * 60;
|
||||
$time = time() - $cut_off;
|
||||
|
||||
$time = time() - $cut_off;
|
||||
|
||||
$DB->query("SELECT s.member_id, s.member_name, s.login_type, g.suffix, g.prefix
|
||||
$DB->query("SELECT s.id, s.member_id, s.member_name, s.login_type, g.suffix, g.prefix
|
||||
FROM ibf_sessions s
|
||||
LEFT JOIN ibf_groups g ON (g.g_id=s.member_group)
|
||||
WHERE running_time > '$time'
|
||||
WHERE running_time > $time
|
||||
ORDER BY s.running_time DESC");
|
||||
|
||||
// cache all printed members so we don't double print them
|
||||
|
||||
$cached = array();
|
||||
|
||||
while ($result = $DB->fetch_row() )
|
||||
{
|
||||
if ($result['member_id'] == 0)
|
||||
if ( strstr( $result['id'], '_session' ) )
|
||||
{
|
||||
if ( $ibforums->vars['spider_anon'] )
|
||||
{
|
||||
if ( $ibforums->member['mgroup'] == $ibforums->vars['admin_group'] )
|
||||
{
|
||||
$active['NAMES'] .= "{$result['member_name']}*{$this->sep_char} \n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$active['NAMES'] .= "{$result['member_name']}{$this->sep_char} \n";
|
||||
}
|
||||
}
|
||||
else if ($result['member_id'] == 0 )
|
||||
{
|
||||
$active['GUESTS']++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty( $cached[ $result['member_id'] ] ) )
|
||||
if ( empty( $cached[ $result['member_id'] ] ) )
|
||||
{
|
||||
$cached[ $result['member_id'] ] = 1;
|
||||
if ($result['login_type'] == 1)
|
||||
{
|
||||
if ( ($ibforums->member['mgroup'] == $ibforums->vars['admin_group']) and ($ibforums->vars['disable_admin_anon'] != 1) )
|
||||
{
|
||||
$active['NAMES'] .= " <span class='highlight'>></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>*{$this->sep_char} \n";
|
||||
$active['ANON']++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$active['anon']++;
|
||||
$active['ANON']++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$active['MEMBERS']++;
|
||||
$active['NAMES'] .= " <span class='highlight'>></span><a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}&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>{$this->sep_char} \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$active['NAMES'] = preg_replace( "/".preg_quote($this->sep_char)."$/", "", trim($active['NAMES']) );
|
||||
|
||||
$active['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON'];
|
||||
|
||||
// Show a link?
|
||||
|
||||
if ($ibforums->vars['allow_online_list'])
|
||||
{
|
||||
$active['LINK'] = '[ '."<a href='".$this->base_url."&act=Online&CODE=listall'>".$ibforums->lang['browser_user_list']."</a>".' ]';
|
||||
$active['links'] = $this->html->active_user_links();
|
||||
}
|
||||
|
||||
$ibforums->lang['active_users'] = sprintf( $ibforums->lang['active_users'], $ibforums->vars['au_cutoff'] );
|
||||
|
||||
$stats_html .= $this->html->ActiveUsers($active, $ibforums->vars['au_cutoff']);
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// Are we viewing the calendar?
|
||||
//-----------------------------------------------
|
||||
//-----------------------------------------------
|
||||
// Are we viewing the calendar?
|
||||
//-----------------------------------------------
|
||||
|
||||
if ($ibforums->vars['show_birthdays'])
|
||||
{
|
||||
|
||||
if ($ibforums->vars['show_birthdays'])
|
||||
$a = explode( ',', gmdate( 'Y,n,j,G,i,s', time() + $std->get_time_offset() ) );
|
||||
|
||||
$day = $a[2];
|
||||
$month = $a[1];
|
||||
$year = $a[0];
|
||||
|
||||
$birthstring = "";
|
||||
$count = 0;
|
||||
|
||||
$DB->query("SELECT id, name, bday_day as DAY, bday_month as MONTH, bday_year as YEAR
|
||||
FROM ibf_members WHERE bday_day=$day and bday_month=$month");
|
||||
|
||||
while ( $user = $DB->fetch_row() )
|
||||
{
|
||||
$birthstring .= "<a href='{$this->base_url}showuser={$user['id']}'>{$user['name']}</a>";
|
||||
|
||||
if ($user['YEAR'])
|
||||
{
|
||||
$pyear = $year - $user['YEAR']; // $year = 2002 and $user['YEAR'] = 1976
|
||||
$birthstring .= "(<b>$pyear</b>)";
|
||||
}
|
||||
|
||||
$birthstring .= $this->sep_char."\n";
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
$user_time = time() + ($ibforums->member['time_offset'] * 3600 );
|
||||
|
||||
$date = getdate($user_time);
|
||||
|
||||
$day = $date['mday'];
|
||||
$month = $date['mon'];
|
||||
$year = $date['year'];
|
||||
|
||||
$birthstring = "";
|
||||
$count = 0;
|
||||
|
||||
$DB->query("SELECT id, name, bday_day as DAY, bday_month as MONTH, bday_year as YEAR from ibf_members WHERE bday_day='$day' and bday_month='$month'");
|
||||
|
||||
while ($user = $DB->fetch_row())
|
||||
{
|
||||
$birthstring .= "<span class='highlight'>></span><a href='{$this->base_url}&act=Profile&CODE=03&MID={$user['id']}'>{$user['name']}</a> ";
|
||||
if ($user['YEAR'])
|
||||
{
|
||||
$pyear = $year - $user['YEAR']; // $year = 2002 and $user['YEAR'] = 1976
|
||||
$birthstring .= "(<b>$pyear</b>) ";
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
|
||||
$lang = $ibforums->lang['no_birth_users'];
|
||||
|
||||
if ($count > 0) {
|
||||
$lang = ($count > 1) ? $ibforums->lang['birth_users'] : $ibforums->lang['birth_user'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$count = "";
|
||||
}
|
||||
|
||||
$birthstring = preg_replace( "/".$this->sep_char."$/", "", trim($birthstring) );
|
||||
|
||||
$lang = $ibforums->lang['no_birth_users'];
|
||||
|
||||
if ($count > 0)
|
||||
{
|
||||
$lang = ($count > 1) ? $ibforums->lang['birth_users'] : $ibforums->lang['birth_user'];
|
||||
$stats_html .= $this->html->birthdays( $birthstring, $count, $lang );
|
||||
}
|
||||
else
|
||||
{
|
||||
$count = "";
|
||||
|
||||
if ( ! $ibforums->vars['autohide_bday'] )
|
||||
{
|
||||
$stats_html .= $this->html->birthdays( $birthstring, $count, $lang );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------
|
||||
// Are we viewing the calendar?
|
||||
//-----------------------------------------------
|
||||
@@ -261,10 +291,11 @@ class Boards {
|
||||
$ibforums->vars['calendar_limit'] = 2;
|
||||
}
|
||||
|
||||
$our_unix = time() + ($ibforums->member['time_offset'] * 3600 );
|
||||
$our_unix = time() + $std->get_time_offset();
|
||||
$max_date = $our_unix + ($ibforums->vars['calendar_limit'] * 86400);
|
||||
|
||||
$DB->query("SELECT eventid, title, read_perms, priv_event, userid FROM ibf_calendar_events WHERE unix_stamp > '$our_unix' and unix_stamp < '$max_date' ORDER BY unix_stamp ASC");
|
||||
$DB->query("SELECT eventid, title, read_perms, priv_event, userid, unix_stamp
|
||||
FROM ibf_calendar_events WHERE unix_stamp > $our_unix and unix_stamp < $max_date ORDER BY unix_stamp ASC");
|
||||
|
||||
$show_events = array();
|
||||
|
||||
@@ -287,21 +318,26 @@ class Boards {
|
||||
}
|
||||
}
|
||||
|
||||
$show_events[] = "<a href='{$ibforums->base_url}&act=calendar&code=showevent&eventid={$event['eventid']}'>".$event['title']."</a>";
|
||||
}
|
||||
|
||||
if ( count($show_events) > 0 )
|
||||
{
|
||||
$event_string = implode( ", ", $show_events );
|
||||
}
|
||||
else
|
||||
{
|
||||
$event_string = $ibforums->lang['no_calendar_events'];
|
||||
$c_time = date( 'j-F-y', $event['unix_stamp']);
|
||||
|
||||
$show_events[] = "<a href='{$ibforums->base_url}act=calendar&code=showevent&eventid={$event['eventid']}' title='$c_time'>".$event['title']."</a>";
|
||||
}
|
||||
|
||||
$ibforums->lang['calender_f_title'] = sprintf( $ibforums->lang['calender_f_title'], $ibforums->vars['calendar_limit'] );
|
||||
|
||||
$stats_html .= $this->html->calendar_events( $event_string );
|
||||
if ( count($show_events) > 0 )
|
||||
{
|
||||
$event_string = implode( $this->sep_char.' ', $show_events );
|
||||
$stats_html .= $this->html->calendar_events( $event_string );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! $ibforums->vars['autohide_calendar'] )
|
||||
{
|
||||
$event_string = $ibforums->lang['no_calendar_events'];
|
||||
$stats_html .= $this->html->calendar_events( $event_string );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************/
|
||||
@@ -326,12 +362,15 @@ class Boards {
|
||||
|
||||
$most_time = $std->get_date( $stats['MOST_DATE'], 'LONG' );
|
||||
|
||||
$ibforums->lang['most_online'] = str_replace( "<#NUM#>" , $stats['MOST_COUNT'] , $ibforums->lang['most_online'] );
|
||||
$ibforums->lang['most_online'] = str_replace( "<#DATE#>", $most_time , $ibforums->lang['most_online'] );
|
||||
$ibforums->lang['most_online'] = str_replace( "<#NUM#>" , $std->do_number_format($stats['MOST_COUNT']) , $ibforums->lang['most_online'] );
|
||||
$ibforums->lang['most_online'] = str_replace( "<#DATE#>", $most_time , $ibforums->lang['most_online'] );
|
||||
|
||||
$total_posts = $stats['TOTAL_REPLIES']+$stats['TOTAL_TOPICS'];
|
||||
$total_posts = $stats['TOTAL_REPLIES'] + $stats['TOTAL_TOPICS'];
|
||||
|
||||
$link = $ibforums->base_url."&act=Profile&MID=".$stats['LAST_MEM_ID'];
|
||||
$total_posts = $std->do_number_format($total_posts);
|
||||
$stats['MEM_COUNT'] = $std->do_number_format($stats['MEM_COUNT']);
|
||||
|
||||
$link = $ibforums->base_url."showuser=".$stats['LAST_MEM_ID'];
|
||||
|
||||
$ibforums->lang['total_word_string'] = str_replace( "<#posts#>" , "$total_posts" , $ibforums->lang['total_word_string'] );
|
||||
$ibforums->lang['total_word_string'] = str_replace( "<#reg#>" , $stats['MEM_COUNT'] , $ibforums->lang['total_word_string'] );
|
||||
@@ -349,11 +388,15 @@ class Boards {
|
||||
$this->output .= $this->html->stats_footer();
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------
|
||||
// Add in board info footer
|
||||
$this->output .= $this->html->BoardInformation();
|
||||
//---------------------------------------
|
||||
|
||||
$this->output .= $this->html->bottom_links();
|
||||
|
||||
//---------------------------------------
|
||||
// Check for news forum.
|
||||
//---------------------------------------
|
||||
|
||||
if ($this->news_title and $this->news_topic_id and $this->news_forum_id)
|
||||
{
|
||||
@@ -361,16 +404,39 @@ class Boards {
|
||||
$this->output = str_replace( "<!-- IBF.NEWSLINK -->" , "$t_html" , $this->output );
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
// Display quick log in if we're not a member
|
||||
//---------------------------------------
|
||||
|
||||
if ($ibforums->member['id'] < 1)
|
||||
{
|
||||
$this->output = str_replace( "<!--IBF.QUICK_LOG_IN-->" , $this->html->quick_log_in() , $this->output );
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
// Showing who's chatting?
|
||||
//---------------------------------------
|
||||
|
||||
if ( $ibforums->vars['chat_account_no'] and $ibforums->vars['chat_who_on'] )
|
||||
{
|
||||
require_once( ROOT_PATH.'sources/lib/chat_functions.php' );
|
||||
|
||||
$chat = new chat_functions();
|
||||
|
||||
$chat->register_class( &$this );
|
||||
|
||||
$chat_html = $chat->get_online_list();
|
||||
|
||||
$this->output = str_replace( "<!--IBF.WHOSCHATTING-->", $chat_html, $this->output );
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
// Print as normal
|
||||
//---------------------------------------
|
||||
|
||||
$print->add_output("$this->output");
|
||||
|
||||
$cp = " (Powered by Invision Board)";
|
||||
$cp = " (Powered by Invision Power Board)";
|
||||
|
||||
if ($ibforums->vars['ips_cp_purchase'])
|
||||
{
|
||||
@@ -380,14 +446,8 @@ class Boards {
|
||||
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name'].$cp, 'JS' => 0, 'NAV' => $this->nav ) );
|
||||
|
||||
}
|
||||
|
||||
//*********************************************/
|
||||
//
|
||||
// SHOW A SUB FORUM
|
||||
//
|
||||
//*********************************************/
|
||||
|
||||
|
||||
|
||||
//*********************************************/
|
||||
//
|
||||
// PROCESS ALL CATEGORIES
|
||||
@@ -405,7 +465,7 @@ class Boards {
|
||||
// Is this category turned on?
|
||||
//----------------------------
|
||||
|
||||
if (! $cat_data['state'] )
|
||||
if ( $cat_data['state'] != 1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -464,7 +524,7 @@ class Boards {
|
||||
// Is this category turned on?
|
||||
//----------------------------
|
||||
|
||||
if (! $cat_data['state'] )
|
||||
if ( $cat_data['state'] == 0 )
|
||||
{
|
||||
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
|
||||
}
|
||||
@@ -515,6 +575,7 @@ class Boards {
|
||||
{
|
||||
|
||||
$printed_children = 0;
|
||||
$can_see_root = FALSE;
|
||||
|
||||
//--------------------------------------
|
||||
// This is a sub cat forum...
|
||||
@@ -527,17 +588,25 @@ class Boards {
|
||||
|
||||
// Are we allowed to see the postable forum stuff?
|
||||
|
||||
if ($forum_data['sub_can_post'] == 1)
|
||||
if ($forum_data['sub_can_post'] == 1 and $forum_data['redirect_on'] != 1)
|
||||
{
|
||||
if ($forum_data['read_perms'] == '*')
|
||||
{
|
||||
$forum_data['fid'] = $forum_data['id'];
|
||||
$newest = $forum_data;
|
||||
}
|
||||
else if ( preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|$)/", $forum_data['read_perms'] ) )
|
||||
if ( $std->check_perms($forum_data['read_perms']) )
|
||||
{
|
||||
$forum_data['fid'] = $forum_data['id'];
|
||||
$newest = $forum_data;
|
||||
$can_see_root = TRUE;
|
||||
|
||||
if (isset($forum_data['last_title']) and $forum_data['last_id'] != "")
|
||||
{
|
||||
if ( ( $ibforums->vars['index_news_link'] == 1 ) and (! empty($ibforums->vars['news_forum_id']) ) and ($ibforums->vars['news_forum_id'] == $forum_data['id']) )
|
||||
{
|
||||
|
||||
$this->news_topic_id = $forum_data['last_id'];
|
||||
$this->news_forum_id = $forum_data['id'];
|
||||
$this->news_title = $forum_data['last_title'];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -550,20 +619,16 @@ class Boards {
|
||||
//--------------------------------------
|
||||
// Check permissions...
|
||||
//--------------------------------------
|
||||
|
||||
if ($data['read_perms'] != '*')
|
||||
|
||||
if ( $std->check_perms($data['read_perms']) != TRUE )
|
||||
{
|
||||
if ( ! preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|$)/", $data['read_perms'] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Do the news stuff first
|
||||
|
||||
if (isset($data['last_title']) and $data['last_id'] != "")
|
||||
{
|
||||
|
||||
if ( ( $ibforums->vars['index_news_link'] == 1 ) and (! empty($ibforums->vars['news_forum_id']) ) and ($ibforums->vars['news_forum_id'] == $data['id']) )
|
||||
{
|
||||
|
||||
@@ -572,7 +637,6 @@ class Boards {
|
||||
$this->news_title = $data['last_title'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($data['last_post'] > $newest['last_post'])
|
||||
@@ -596,10 +660,12 @@ class Boards {
|
||||
|
||||
}
|
||||
|
||||
if ($printed_children < 1)
|
||||
if ( ($printed_children < 1) && ($can_see_root != TRUE) )
|
||||
{
|
||||
// If we don't have permission to view any forums
|
||||
// and we can't post in this root forum
|
||||
// then simply return and the row won't be printed
|
||||
//
|
||||
|
||||
return "";
|
||||
|
||||
@@ -607,12 +673,14 @@ class Boards {
|
||||
|
||||
// Fix up the last of the data
|
||||
|
||||
$newest['last_title'] = strip_tags($newest['last_title']);
|
||||
$newest['last_title'] = str_replace( "!" , "!" , $newest['last_title'] );
|
||||
$newest['last_title'] = str_replace( """, "\"", $newest['last_title'] );
|
||||
|
||||
if (strlen($newest['last_title']) > 30)
|
||||
{
|
||||
$newest['last_title'] = str_replace( "!" , "!" , $newest['last_title'] );
|
||||
$newest['last_title'] = str_replace( """, "\"", $newest['last_title'] );
|
||||
$newest['last_title'] = substr($newest['last_title'],0,27) . "...";
|
||||
$newest['last_title'] = preg_replace( '/&(#(\d+;?)?)?\.\.\.$/', '...', $newest['last_title'] );
|
||||
$newest['last_title'] = preg_replace( '/&(#(\d+;?)?)?(\.\.\.)?$/', '...', $newest['last_title'] );
|
||||
}
|
||||
if ($newest['password'] != "")
|
||||
{
|
||||
@@ -620,7 +688,8 @@ class Boards {
|
||||
}
|
||||
else if($newest['last_title'] != "")
|
||||
{
|
||||
$newest['last_topic'] = "<a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}&act=ST&f={$newest['fid']}&t={$newest['last_id']}&view=getlastpost'>{$newest['last_title']}</a>";
|
||||
$newest['last_unread'] = $this->html->forumrow_lastunread_link($newest['fid'], $newest['last_id']);
|
||||
$newest['last_topic'] = "<a href='{$ibforums->base_url}showtopic={$newest['last_id']}&view=getnewpost' title='{$ibforums->lang['tt_gounread']}'>{$newest['last_title']}</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -629,7 +698,7 @@ class Boards {
|
||||
|
||||
if ( isset($newest['last_poster_name']))
|
||||
{
|
||||
$newest['last_poster'] = $newest['last_poster_id'] ? "<a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}&act=Profile&CODE=03&MID={$newest['last_poster_id']}'>{$newest['last_poster_name']}</a>"
|
||||
$newest['last_poster'] = $newest['last_poster_id'] ? "<a href='{$ibforums->base_url}showuser={$newest['last_poster_id']}'>{$newest['last_poster_name']}</a>"
|
||||
: $newest['last_poster_name'];
|
||||
}
|
||||
else
|
||||
@@ -637,10 +706,18 @@ class Boards {
|
||||
$newest['last_poster'] = $ibforums->lang['f_none'];
|
||||
}
|
||||
|
||||
$newest['img_new_post'] = $std->forum_new_posts($newest, 1);
|
||||
$newest['img_new_post'] = $std->forum_new_posts($newest, $printed_children > 0 ? 1: 0);
|
||||
|
||||
if ( $newest['img_new_post'] == '<{C_ON_CAT}>' )
|
||||
{
|
||||
$newest['img_new_post'] = $this->html->subforum_img_with_link($newest['img_new_post'], $forum_data['id']);
|
||||
}
|
||||
|
||||
$newest['last_post'] = $std->get_date($newest['last_post'], 'LONG');
|
||||
|
||||
$newest['posts'] = $std->do_number_format($newest['posts']);
|
||||
$newest['topics'] = $std->do_number_format($newest['topics']);
|
||||
|
||||
foreach($newest as $k => $v)
|
||||
{
|
||||
if ($k == 'id')
|
||||
@@ -650,6 +727,7 @@ class Boards {
|
||||
$forum_data[$k] = $v;
|
||||
}
|
||||
|
||||
$forum_data['moderator'] = $this->get_moderators($forum_id);
|
||||
|
||||
return $this->html->ForumRow($forum_data);
|
||||
|
||||
@@ -667,21 +745,46 @@ class Boards {
|
||||
// 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 "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
// Redirect only forum?
|
||||
//--------------------------------------
|
||||
|
||||
if ( $forum_data['redirect_on'] )
|
||||
{
|
||||
// Simply return with the redirect information
|
||||
|
||||
if ( $forum_data['redirect_loc'] != "" )
|
||||
{
|
||||
$forum_data['redirect_target'] = " target='".$forum_data['redirect_loc']."' ";
|
||||
}
|
||||
|
||||
$forum_data['redirect_hits'] = $std->do_number_format($forum_data['redirect_hits']);
|
||||
|
||||
return $this->html->forum_redirect_row($forum_data);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
// No - normal forum..
|
||||
//--------------------------------------
|
||||
|
||||
$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->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'])
|
||||
{
|
||||
|
||||
if ( ( $ibforums->vars['index_news_link'] == 1 ) and (! empty($ibforums->vars['news_forum_id']) ) and ($ibforums->vars['news_forum_id'] == $forum_data['id']) )
|
||||
@@ -693,13 +796,18 @@ class Boards {
|
||||
|
||||
}
|
||||
|
||||
$forum_data['last_title'] = strip_tags($forum_data['last_title']);
|
||||
$forum_data['last_title'] = str_replace( "!" , "!", $forum_data['last_title'] );
|
||||
$forum_data['last_title'] = str_replace( """, "\"", $forum_data['last_title'] );
|
||||
|
||||
if (strlen($forum_data['last_title']) > 30)
|
||||
{
|
||||
$forum_data['last_title'] = substr($forum_data['last_title'],0,27) . "...";
|
||||
$forum_data['last_title'] = preg_replace( '/&(#(\d+;?)?)?\.\.\.$/', '...', $forum_data['last_title'] );
|
||||
$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'] != "")
|
||||
@@ -708,13 +816,15 @@ class Boards {
|
||||
}
|
||||
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->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']}&view=getnewpost' 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
|
||||
@@ -726,48 +836,74 @@ class Boards {
|
||||
// Moderators
|
||||
//---------------------------------
|
||||
|
||||
$forum_data['moderator'] = "";
|
||||
$forum_data['moderator'] = $this->get_moderators($forum_data['id']);
|
||||
|
||||
if (isset($this->mods[ $forum_data['id'] ] ) )
|
||||
{
|
||||
$forum_data['moderator'] = $ibforums->lang['forum_leader'].' ';
|
||||
|
||||
if (is_array($this->mods[ $forum_data['id'] ]) )
|
||||
{
|
||||
foreach ($this->mods[ $forum_data['id'] ] as $moderator)
|
||||
{
|
||||
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>, ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$forum_data['moderator'] .= "<a href='{$ibforums->base_url}&act=Profile&CODE=03&MID={$moderator['id']}'>{$moderator['name']}</a>, ";
|
||||
}
|
||||
}
|
||||
|
||||
$forum_data['moderator'] = preg_replace( "!,\s+$!", "", $forum_data['moderator'] );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
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>, ";
|
||||
}
|
||||
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['posts'] = $std->do_number_format($forum_data['posts']);
|
||||
$forum_data['topics'] = $std->do_number_format($forum_data['topics']);
|
||||
|
||||
$forum_data['description'] = str_replace( "<br>", "<br />", $forum_data['description'] );
|
||||
|
||||
return $this->html->ForumRow($forum_data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
//
|
||||
// Return mods for this forum in a
|
||||
// HTML formatted string
|
||||
//
|
||||
//-------------------------------------
|
||||
|
||||
function get_moderators($forum_id="")
|
||||
{
|
||||
global $ibforums, $std, $DB;
|
||||
|
||||
$mod_string = "";
|
||||
|
||||
if ($forum_id == "")
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
if (isset($this->mods[ $forum_id ] ) )
|
||||
{
|
||||
$mod_string = $ibforums->lang['forum_leader'].' ';
|
||||
|
||||
if (is_array($this->mods[ $forum_id ]) )
|
||||
{
|
||||
foreach ($this->mods[ $forum_id ] as $moderator)
|
||||
{
|
||||
if ($moderator['isg'] == 1)
|
||||
{
|
||||
$mod_string .= "<a href='{$ibforums->base_url}act=Members&max_results=30&filter={$moderator['gid']}&sort_order=asc&sort_key=name&st=0&b=1'>{$moderator['gname']}</a>, ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$mod_string .= "<a href='{$ibforums->base_url}showuser={$moderator['id']}'>{$moderator['name']}</a>, ";
|
||||
}
|
||||
}
|
||||
|
||||
$mod_string = preg_replace( "!,\s+$!", "", $mod_string );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($moderator['isg'] == 1)
|
||||
{
|
||||
$mod_string .= "<a href='{$ibforums->base_url}act=Members&max_results=30&filter={$this->mods[$forum_id]['gid']}&sort_order=asc&sort_key=name&st=0&b=1'>{$this->mods[$forum_id]['gname']}</a>, ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$mod_string .= "<a href='{$ibforums->base_url}showuser={$this->mods[$forum_id]['id']}'>{$this->mods[$forum_id]['name']}</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $mod_string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user