⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boards.php

📁 泛微协同办公系统标准版E-office V5.5的源代码内含泛微办公系统V5.5自动注册文件。
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php

class boards
{

	var $output = "";
	var $base_url = "";
	var $html = "";
	var $forums = array( );
	var $mods = array( );
	var $cats = array( );
	var $children = array( );
	var $nav;
	var $news_topic_id = "";
	var $news_forum_id = "";
	var $news_title = "";

	function boards( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		global $skin_universal;
		$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
		$ibforums->lang = $std->load_words( $ibforums->lang, "lang_boards", $ibforums->lang_id );
		$this->html = $std->load_template( "skin_boards" );
		if ( !$ibforums->member['id'] )
		{
			$ibforums->input['last_visit'] = time( );
		}
		$this->output .= $this->html->pagetop( $std->get_date( $ibforums->input['last_visit'], "LONG" ) );
		$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,\n        \t\t   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\n        \t\t   from ibf_forums f, ibf_categories c\n        \t\t   LEFT JOIN ibf_moderators m ON (f.id=m.forum_id)\n        \t\t   WHERE f.category=c.id\n        \t\t   order by c.position, f.position" );
		while ( $r = $DB->fetch_row( ) )
		{
			if ( $last_c_id != $r['cat_id'] )
			{
				$this->cats[$r['cat_id']] = array(
					"id" => $r['cat_id'],
					"position" => $r['cat_position'],
					"state" => $r['cat_state'],
					"name" => $r['cat_name'],
					"description" => $r['cat_desc'],
					"image" => $r['image'],
					"url" => $r['url']
				);
				$last_c_id = $r['cat_id'];
			}
			if ( 0 < $r['parent_id'] )
			{
				$this->children[$r['parent_id']][$r['id']] = $r;
			}
			else
			{
				$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']
				);
			}
		}
		if ( $ibforums->input['c'] != "" )
		{
			$this->show_single_cat( );
			$this->nav[] = $this->cats[$ibforums->input['c']]['name'];
		}
		else
		{
			$this->process_all_cats( );
		}
		$active = array(
			"TOTAL" => 0,
			"NAMES" => "",
			"GUESTS" => 0,
			"MEMBERS" => 0,
			"ANON" => 0,
			"LIST" => array( )
		);
		$stats_html = "";
		if ( $ibforums->vars['show_active'] )
		{
			if ( $ibforums->vars['au_cutoff'] == "" )
			{
				$ibforums->vars['au_cutoff'] = 15;
			}
			$cut_off = $ibforums->vars['au_cutoff'] * 60;
			$time = time( ) - $cut_off;
			$DB->query( "SELECT s.member_id, s.member_name, s.ip_address, s.browser, s.login_type, g.suffix, g.prefix\n\t\t\t            FROM ibf_sessions s\n\t\t\t              LEFT JOIN ibf_groups g ON (g.g_id=s.member_group)\n\t\t\t            WHERE running_time > '{$time}'\n\t\t\t            ORDER BY s.running_time DESC" );
			$cached = array( );
			while ( $result = $DB->fetch_row( ) )
			{
				if ( $result['member_id'] == 0 )
				{
					if ( $ibforums->vars['allow_online_guest'] )
					{
						$active['LIST'][] .= "{$result['prefix']}<a href='#'>游客</a>{$result['suffix']} \n";
						++$active['GUESTS'];
					}
					else
					{
						++$active['GUESTS'];
					}
				}
				else if ( empty( $cached[$result['member_id']] ) )
				{
					$cached[$result['member_id']] = 1;
					if ( $result['login_type'] == 1 )
					{
						if ( $ibforums->member['mgroup'] == $ibforums->vars['admin_group'] && $ibforums->vars['disable_admin_anon'] != 1 )
						{
							$active['LIST'][] .= "<a href='{$ibforums->base_url}&act=Profile&MID={$result['member_id']}'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>* \n";
							++$active['ANON'];
						}
						else
						{
							++$active['ANON'];
						}
					}
					else
					{
						++$active['MEMBERS'];
						$active['LIST'][] .= "<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> \n";
					}
				}
			}
			$active['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON'];
			if ( $ibforums->member['g_access_cp'] )
			{
				$active_no = $active['MEMBERS'] + $active['ANON'];
			}
			else
			{
				$active_no = $active['MEMBERS'];
			}
			$active_no = $active_no + $active['GUESTS'];
			$members_per_row = "8";
			$rows_needed = intval( $active_no / $members_per_row + 1 );
			if ( 0 < $active_no )
			{
				$active['NAMES'] = "<table width='100%'>";
				$i = 1;
				for ( ;	$i <= $rows_needed;	++$i	)
				{
					$active['NAMES'] .= "<tr>";
					$j = 0;
					for ( ;	$j <= $members_per_row - 1;	++$j	)
					{
						$k = ( $i - 1 ) * $members_per_row + $j;
						$active['NAMES'] .= "<td width='12%'>".$active['LIST'][$k]."</td>";
					}
					$active['NAMES'] .= "</tr>";
				}
				$active['NAMES'] .= "</table>";
			}
			if ( $ibforums->vars['allow_online_list'] )
			{
				$active['LINK'] = "[ <a href='".$this->base_url."&act=Online&CODE=listall'>".$ibforums->lang['browser_user_list']."</a>"." ]";
			}
			$ibforums->lang['active_users'] = sprintf( $ibforums->lang['active_users'], $ibforums->vars['au_cutoff'] );
			$stats_html .= $this->html->activeusers( $active, $ibforums->vars['au_cutoff'] );
			if ( $ibforums->vars['show_birthdays'] )
			{
				$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'>&gt;</span><a href='{$this->base_url}&act=Profile&CODE=03&MID={$user['id']}'>{$user['name']}</a> ";
					if ( $user['YEAR'] )
					{
						$pyear = $year - $user['YEAR'];
						$birthstring .= "(<b>{$pyear}</b>) ";
					}
					++$count;
				}
				$lang = $ibforums->lang['no_birth_users'];
				if ( 0 < $count )
				{
					$lang = 1 < $count ? $ibforums->lang['birth_users'] : $ibforums->lang['birth_user'];
				}
				else
				{
					$count = "";
				}
				$stats_html .= $this->html->birthdays( $birthstring, $count, $lang );
			}
		}
		if ( $ibforums->vars['show_calendar'] )
		{
			if ( $ibforums->vars['calendar_limit'] < 2 )
			{
				$ibforums->vars['calendar_limit'] = 2;
			}
			$our_unix = time( ) + $ibforums->member['time_offset'] * 3600;
			$max_date = $our_unix + $ibforums->vars['calendar_limit'] * 86400;
			$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( );
			while ( $event = $DB->fetch_row( ) )
			{
				if ( $event['priv_event'] == 1 && $ibforums->member['id'] != $event['userid'] )
				{
				}
				else
				{
					if ( $event['read_perms'] != "*" && !preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|\$)/", $event['read_perms'] ) )
					{
						continue;
					}
					$c_time = $std->get_date( $event['unix_stamp'] - 86000, "JOINED" );
					$show_events[] = "<a href='{$ibforums->base_url}&act=calendar&code=showevent&eventid={$event['eventid']}' title='{$c_time}'>".$event['title']."</a>";
				}
			}
			if ( 0 < count( $show_events ) )
			{
				$event_string = implode( ", ", $show_events );
			}
			else
			{
				$event_string = $ibforums->lang['no_calendar_events'];
			}
			$ibforums->lang['calender_f_title'] = sprintf( $ibforums->lang['calender_f_title'], $ibforums->vars['calendar_limit'] );
			$stats_html .= $this->html->calendar_events( $event_string );
		}
		if ( $ibforums->vars['show_totals'] )
		{
			$DB->query( "SELECT * FROM ibf_stats" );
			$stats = $DB->fetch_row( );
			if ( $stats['MOST_COUNT'] < $active['TOTAL'] )
			{
				$DB->query( "UPDATE ibf_stats SET MOST_DATE='".time( )."', MOST_COUNT='".$active[TOTAL]."'" );
				$stats['MOST_COUNT'] = $active[TOTAL];
				$stats['MOST_DATE'] = time( );
			}
			$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'] );
			$total_posts = $stats['TOTAL_REPLIES'] + $stats['TOTAL_TOPICS'];
			if ( $ibforums->vars['number_format'] != "none" )
			{
				$ibforums->vars['number_format'] = $ibforums->vars['number_format'] == "space" ? " " : $ibforums->vars['number_format'];
				$total_posts = number_format( $total_posts, 0, "", $ibforums->vars['number_format'] );
				$stats['MEM_COUNT'] = number_format( $stats['MEM_COUNT'], 0, "", $ibforums->vars['number_format'] );
			}
			$link = $ibforums->base_url."&act=Profile&MID=".$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'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#mem#>", $stats['LAST_MEM_NAME'], $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#link#>", $link, $ibforums->lang['total_word_string'] );
			$stats_html .= $this->html->showstats( $ibforums->lang['total_word_string'] );
		}
		if ( $stats_html != "" )
		{
			$this->output .= $this->html->stats_header( );
			$this->output .= $stats_html;
			$this->output .= $this->html->stats_footer( );
		}
		$this->output .= $this->html->boardinformation( );
		if ( $this->news_title && $this->news_topic_id && $this->news_forum_id )
		{
			$t_html = $this->html->newslink( $this->news_forum_id, stripslashes( $this->news_title ), $this->news_topic_id );
			$this->output = str_replace( "<!-- IBF.NEWSLINK -->", "{$t_html}", $this->output );
		}
		if ( $ibforums->member['id'] < 1 )
		{
			$this->output = str_replace( "<!--IBF.QUICK_LOG_IN-->", $this->html->quick_log_in( ), $this->output );
		}
		$print->add_output( "{$this->output}" );
		$cp = " (Powered by HuaCooL Network)";
		if ( $ibforums->vars['ips_cp_purchase'] )
		{
			$cp = "";
		}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -