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

📄 online.php

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

class online
{

	var $output = "";
	var $page_title = "";
	var $nav = array( );
	var $html = "";
	var $first = 0;
	var $perpage = 25;
	var $forums = array( );
	var $cats = array( );
	var $sessions = array( );
	var $where = array( );
	var $seen_name = array( );

	function online( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		if ( $ibforums->vars['allow_online_list'] != 1 )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_permission" ) );
		}
		if ( $ibforums->input['CODE'] == "" )
		{
			$ibforums->input['CODE'] = "listall";
		}
		$ibforums->lang = $std->load_words( $ibforums->lang, "lang_online", $ibforums->lang_id );
		$this->html = $std->load_template( "skin_online" );
		$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
		foreach ( $ibforums->lang as $k => $v )
		{
			if ( preg_match( "/^WHERE_(\\w+)\$/", $k, $match ) )
			{
				$this->where[$match[1]] = $ibforums->lang[$k];
			}
		}
		unset( $match );
		switch ( $ibforums->input['CODE'] )
		{
		case "listall" :
			$this->list_all( );
			break;
		case "02" :
			$this->list_forum( );
			break;
		default :
			$this->list_all( );
			break;
		}
		$print->add_output( "{$this->output}" );
		$print->do_output( array(
			"TITLE" => $this->page_title,
			"JS" => 0,
			NAV => $this->nav
		) );
	}

	function list_all( )
	{
		global $ibforums;
		global $DB;
		global $std;
		$this->first = 0;
		if ( !empty( $ibforums->input['st'] ) )
		{
			$this->first = $ibforums->input['st'];
		}
		$last_cat_id = -1;
		$DB->query( "SELECT f.id, f.name, f.read_perms, f.password, c.id as cat_id, c.name as cat_name from ibf_forums f, ibf_categories c where c.id=f.category ORDER BY c.position, f.position" );
		while ( $i = $DB->fetch_row( ) )
		{
			if ( $last_cat_id != $i['cat_id'] )
			{
				$last_cat_id = $i['cat_id'];
				$this->cats[$i['cat_id']] = $this->cats['cat_name'];
			}
			$this->forums[$i['id']] = array(
				"name" => $i['name'],
				"read_perms" => $i['read_perms'],
				"password" => $i['password']
			);
		}
		$DB->free_result( );
		$cut_off = $ibforums->vars['au_cutoff'] != "" ? $ibforums->vars['au_cutoff'] * 60 : 900;
		$t_time = time( ) - $cut_off;
		$DB->query( "SELECT COUNT(id) as total_sessions FROM ibf_sessions WHERE login_type <> 1 AND running_time > {$t_time}" );
		$max = $DB->fetch_row( );
		$DB->free_result( );
		$links = $std->build_pagelinks( array(
			"TOTAL_POSS" => $max['total_sessions'],
			"PER_PAGE" => 25,
			"CUR_ST_VAL" => $this->first,
			"L_SINGLE" => "",
			"L_MULTI" => $ibforums->lang['pages'],
			"BASE_URL" => $this->base_url."&act=Online&CODE=listall"
		) );
		$this->output = $this->html->page_header( $links );
		$final = array( );
		$tid_array = array( );
		$topics = array( );
		$DB->query( "SELECT s.id, s.in_forum, s.in_topic, s.member_name, s.member_id, s.ip_address, s.running_time, s.location, s.login_type, s.member_group, g.prefix, g.suffix FROM ibf_sessions s, ibf_groups g WHERE s.running_time > {$t_time} AND s.member_group=g.g_id ORDER BY !member_id, running_time DESC LIMIT ".$this->first.",25" );
		while ( $r = $DB->fetch_row( ) )
		{
			$final[] = $r;
			if ( $r['in_topic'] != "" )
			{
				$tid_array[] = $r['in_topic'];
			}
		}
		if ( 0 < count( $tid_array ) )
		{
			$tid_string = implode( ",", $tid_array );
			$DB->query( "SELECT tid, title FROM ibf_topics WHERE tid IN ({$tid_string})" );
			while ( $t = $DB->fetch_row( ) )
			{
				$topics[$t['tid']] = $t['title'];
			}
		}
		foreach ( $final as $idx => $sess )
		{
			$inv = "";
			if ( $sess['login_type'] == 1 )
			{
				if ( $ibforums->member['mgroup'] == $ibforums->vars['admin_group'] && $ibforums->vars['disable_admin_anon'] != 1 )
				{
					$inv = "*";
				}
			}
			else
			{
				if ( !empty( $sess['member_name'] ) )
				{
					if ( isset( $this->seen_name[$sess['member_name']] ) )
					{
						continue;
					}
					else
					{
						$this->seen_name[$sess['member_name']] = 1;
					}
				}
				if ( isset( $sess['location'] ) )
				{
					$line = "";
					list( $act, $pid ) = explode( ",", $sess['location'] );
					$fid = $sess['in_forum'];
					$tid = $sess['in_topic'];
					if ( isset( $act ) )
					{
						$line = isset( $this->where[$act] ) ? $this->where[$act] : $ibforums->lang['board_index'];
					}
					if ( $fid != "" && ( $act == "SF" || $act == "ST" || $act == "Post" ) )
					{
						$pass = 0;
						if ( $this->forums[$fid]['read_perms'] == "*" )
						{
							$pass = 1;
						}
						else if ( preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|\$)/", $this->forums[$fid]['read_perms'] ) )
						{
							$pass = 1;
						}
						if ( $pass == 1 )
						{
							if ( $this->forums[$fid]['password'] != "" )
							{
								if ( !( $c_pass = $std->my_getcookie( "iBForum".$fid ) ) )
								{
									$pass = 0;
								}
								if ( $c_pass == $this->forums[$fid]['password'] )
								{
									$pass = 1;
								}
								else
								{
									$pass = 0;
								}
							}
							else
							{
								$pass = 1;
							}
						}
						if ( $pass == 1 )
						{
							if ( 0 < $tid && $act != "Post" )
							{
								$line .= " <a href='{$this->base_url}&act=ST&f={$fid}&t={$tid}'>{$topics[$tid]}</a>";
							}
							else
							{
								$line .= " <a href='{$this->base_url}&act=SF&f={$fid}'>{$this->forums[$fid]['name']}</a>";
							}
						}
						else
						{
							$line = " <a href='{$this->base_url}'>{$ibforums->lang['board_index']}</a>";
						}
					}
				}
				else
				{
					$line .= " <a href='{$this->base_url}'>{$ibforums->lang['board_index']}</a>";
				}
				$sess['where_line'] = $line;
				if ( $ibforums->member['mgroup'] == $ibforums->vars['admin_group'] && $ibforums->vars['disable_online_ip'] != 1 )
				{
					$sess['ip_address'] = " ( ".$sess['ip_address']." )";
				}
				else
				{
					$sess['ip_address'] = "";
				}
				if ( isset( $sess['member_id'] ) )
				{
					$sess['member_name'] = "<a href='{$this->base_url}&act=Profile&CODE=03&MID={$sess['member_id']}'>{$sess['prefix']}{$sess['member_name']}{$sess['suffix']}</a>{$inv} {$sess['ip_address']}";
				}
				$sess['running_time'] = $std->get_date( $sess['running_time'], "LONG" );
				$this->output .= $this->do_html_row( $sess );
			}
		}
		$this->output .= $this->html->page_end( $links );
		$this->page_title = $ibforums->lang['page_title'];
		$this->nav = array(
			$ibforums->lang['page_title']
		);
	}

	function do_html_row( $sess )
	{
		global $ibforums;
		if ( $sess['member_name'] && $sess['member_id'] )
		{
			$sess['msg_icon'] = "<a href='{$this->base_url}&act=Msg&CODE=04&MID={$sess['member_id']}'><{P_MSG}></a>";
		}
		else
		{
			$sess['member_name'] = $sess['prefix'].$ibforums->lang['guest'].$sess['suffix']." ".$sess['ip_address'];
			$sess['msg_icon'] = "&nbsp;";
		}
		return $this->html->show_row( $sess );
	}

	function list_forum( )
	{
	}

}

$idx = new online( );
?>

⌨️ 快捷键说明

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