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

📄 contact_member.php

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

class contact
{

	var $output = "";
	var $base_url = "";
	var $html = "";
	var $nav = array( );
	var $page_title = "";
	var $email = "";
	var $forum = "";

	function contact( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		global $skin_universal;
		switch ( $ibforums->input['act'] )
		{
		case "Mail" :
			$this->mail_member( );
			break;
		case "AOL" :
			$this->show_aim( );
			break;
		case "ICQ" :
			$this->show_icq( );
			break;
		case "MSN" :
			$this->show_msn( );
			break;
		case "YAHOO" :
			$this->show_yahoo( );
			break;
		case "Invite" :
			$this->invite_member( );
			break;
		case "chat" :
			$this->chat_display( );
			break;
		case "report" :
			if ( $ibforums->input['send'] != 1 )
			{
				$this->report_form( );
			}
			else
			{
				$this->send_report( );
				break;
			}
		default :
			$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
			break;
		}
		$print->add_output( "{$this->output}" );
		$print->do_output( array(
			"TITLE" => $this->page_title,
			"JS" => 0,
			NAV => $this->nav
		) );
	}

	function chat_display( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		$ibforums->lang = $std->load_words( $ibforums->lang, "lang_emails", $ibforums->lang_id );
		$this->html = $std->load_template( "skin_emails" );
		if ( !$ibforums->vars['chat_account_no'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "missing_files" ) );
		}
		$width = $ibforums->vars['chat_width'] ? $ibforums->vars['chat_width'] : 600;
		$height = $ibforums->vars['chat_height'] ? $ibforums->vars['chat_height'] : 350;
		$lang = $ibforums->vars['chat_language'] ? $ibforums->vars['chat_language'] : "en";
		if ( $ibforums->input['pop'] )
		{
			$html = $this->html->chat_pop( $ibforums->vars['chat_account_no'], $lang, $width, $height );
			$print->pop_up_window( "CHAT", $html );
			exit( );
		}
		else
		{
			$this->output .= $this->html->chat_inline( $ibforums->vars['chat_account_no'], $lang, $width, $height );
		}
		$this->nav[] = $ibforums->lang['live_chat'];
		$this->page_title = $ibforums->lang['live_chat'];
	}

	function report_form( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		$ibforums->lang = $std->load_words( $ibforums->lang, "lang_emails", $ibforums->lang_id );
		$this->html = $std->load_template( "skin_emails" );
		$pid = intval( $ibforums->input['p'] );
		$tid = intval( $ibforums->input['t'] );
		$fid = intval( $ibforums->input['f'] );
		$st = intval( $ibforums->input['st'] );
		if ( !$pid && !$tid && !$fid )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "missing_files" ) );
		}
		$this->check_access( $fid, $tid );
		$this->output .= $this->html->report_form( $fid, $tid, $pid, $st, $this->forum['topic_title'] );
		$this->nav[] = "<a href='".$ibforums->base_url."&act=SC&c={$this->forum['cat_id']}'>{$this->forum['cat_name']}</a>";
		$this->nav[] = "<a href='".$ibforums->base_url."&act=SF&f={$this->forum['id']}'>{$this->forum['name']}</a>";
		$this->nav[] = $ibforums->lang['report_title'];
		$this->page_title = $ibforums->lang['report_title'];
	}

	function send_report( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		global $HTTP_POST_VARS;
		$ibforums->lang = $std->load_words( $ibforums->lang, "lang_emails", $ibforums->lang_id );
		$this->html = $std->load_template( "skin_emails" );
		$pid = intval( $ibforums->input['p'] );
		$tid = intval( $ibforums->input['t'] );
		$fid = intval( $ibforums->input['f'] );
		$st = intval( $ibforums->input['st'] );
		if ( !$pid && !$tid && !$fid )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "missing_files" ) );
		}
		if ( $HTTP_POST_VARS['message'] == "" )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "complete_form" ) );
		}
		$DB->query( "SELECT title FROM ibf_topics WHERE tid='{$tid}'" );
		$topic = $DB->fetch_row( );
		if ( !$topic['title'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "missing_files" ) );
		}
		$this->check_access( $fid, $tid );
		$mods = array( );
		$DB->query( "SELECT m.name, m.email, mod.member_id FROM ibf_moderators mod, ibf_members m WHERE mod.forum_id='{$fid}' and mod.member_id=m.id" );
		if ( $DB->get_num_rows( ) )
		{
			while ( $r = $DB->fetch_row( ) )
			{
				$mods[] = array(
					"name" => $r['name'],
					"email" => $r['email']
				);
			}
		}
		else
		{
			$DB->query( "SELECT m.id, m.name, m.email FROM ibf_members m, ibf_groups g WHERE g.g_access_cp=1 AND m.mgroup=g.g_id" );
			while ( $r = $DB->fetch_row( ) )
			{
				$mods[] = array(
					"name" => $r['name'],
					"email" => $r['email']
				);
			}
		}
		require( "./sources/lib/emailer.php" );
		$this->email = new emailer( );
		$report = trim( stripslashes( $HTTP_POST_VARS['message'] ) );
		$report = str_replace( "<!--", "", $report );
		$report = str_replace( "-->", "", $report );
		$report = str_replace( "<script", "", $report );
		foreach ( $mods as $idx => $data )
		{
			$this->email->get_template( "report_post" );
			$this->email->build_message( array(
				"MOD_NAME" => $data['name'],
				"USERNAME" => $ibforums->member['name'],
				"TOPIC" => $topic['title'],
				"LINK_TO_POST" => "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}"."?act=ST&f={$fid}&t={$tid}&st={$st}&#entry{$pid}",
				"REPORT" => $report
			) );
			$this->email->subject = $ibforums->lang['report_subject']." ".$ibforums->vars['board_name'];
			$this->email->to = $data['email'];
			$this->email->send_mail( );
		}
		$print->redirect_screen( $ibforums->lang['report_redirect'], "act=ST&f={$fid}&t={$tid}&st={$st}&#entry{$pid}" );
	}

	function check_access( $fid, $tid )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $HTTP_COOKIE_VARS;
		if ( !$ibforums->member['id'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_permission" ) );
		}
		$DB->query( "SELECT t.title as topic_title, f.*, c.id as cat_id, c.name as cat_name from ibf_forums f, ibf_categories c, ibf_topics t WHERE f.id=".$fid." and c.id=f.category and t.tid={$tid}" );
		$this->forum = $DB->fetch_row( );
		$return = 1;
		if ( $this->forum['read_perms'] == "*" )
		{
			$return = 0;
		}
		else if ( preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|\$)/", $this->forum['read_perms'] ) )
		{
			$return = 0;
		}
		if ( $this->forum['password'] && $HTTP_COOKIE_VARS[$ibforums->vars['cookie_id']."iBForum".$this->forum['id']] == $this->forum['password'] )
		{
			$return = 0;
		}
		if ( $return == 1 )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_permission" ) );
		}
	}

	function show_msn( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		$this->html = $std->load_template( "skin_emails" );
		$ibforums->lang = $std->load_words( $ibforums->lang, "lang_emails", $ibforums->lang_id );
		if ( empty( $ibforums->member['id'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_guests" ) );
		}
		if ( empty( $ibforums->input['MID'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
		}
		if ( !preg_match( "/^(\\d+)\$/", $ibforums->input['MID'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
		}
		$DB->query( "SELECT name, id, msnname from ibf_members WHERE id='".$ibforums->input['MID']."'" );
		$member = $DB->fetch_row( );
		if ( !$member['id'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_such_user" ) );
		}
		if ( !$member['msnname'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_msn" ) );
		}
		$html = $this->html->pager_header( array( "TITLE" => "MSN" ) );
		$html .= $this->html->msn_body( $member['msnname'] );
		$html .= $this->html->end_table( );
		$print->pop_up_window( "MSN CONSOLE", $html );
	}

	function show_yahoo( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		$this->html = $std->load_template( "skin_emails" );
		$ibforums->lang = $std->load_words( $ibforums->lang, "lang_emails", $ibforums->lang_id );
		if ( empty( $ibforums->member['id'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_guests" ) );
		}
		if ( empty( $ibforums->input['MID'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
		}
		if ( !preg_match( "/^(\\d+)\$/", $ibforums->input['MID'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
		}
		$DB->query( "SELECT name, id, yahoo from ibf_members WHERE id='".$ibforums->input['MID']."'" );
		$member = $DB->fetch_row( );
		if ( !$member['id'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_such_user" ) );
		}
		if ( !$member['yahoo'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_yahoo" ) );
		}
		$html = $this->html->pager_header( array( "TITLE" => "Yahoo!" ) );
		$html .= $this->html->yahoo_body( $member['yahoo'] );
		$html .= $this->html->end_table( );
		$print->pop_up_window( "YAHOO! CONSOLE", $html );
	}

	function show_aim( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		$ibforums->lang = $std->load_words( $ibforums->lang, "lang_emails", $ibforums->lang_id );
		$this->html = $std->load_template( "skin_emails" );
		if ( empty( $ibforums->member['id'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_guests" ) );
		}
		if ( empty( $ibforums->input['MID'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
		}
		if ( !preg_match( "/^(\\d+)\$/", $ibforums->input['MID'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
		}
		$DB->query( "SELECT name, id, aim_name from ibf_members WHERE id='".$ibforums->input['MID']."'" );
		$member = $DB->fetch_row( );
		if ( !$member['id'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_such_user" ) );
		}
		if ( !$member['aim_name'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_aol" ) );
		}
		$member['aim_name'] = str_replace( " ", "", $member['aim_name'] );
		$print->pop_up_window( "AOL CONSOLE", $this->html->aol_body( array(
			"AOLNAME" => $member['aim_name']
		) ) );
	}

	function show_icq( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		$ibforums->lang = $std->load_words( $ibforums->lang, "lang_emails", $ibforums->lang_id );
		$this->html = $std->load_template( "skin_emails" );
		if ( empty( $ibforums->member['id'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_guests" ) );
		}
		if ( empty( $ibforums->input['MID'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
		}
		if ( !preg_match( "/^(\\d+)\$/", $ibforums->input['MID'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
		}
		$DB->query( "SELECT name, id, icq_number from ibf_members WHERE id='".$ibforums->input['MID']."'" );
		$member = $DB->fetch_row( );
		if ( !$member['id'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_such_user" ) );
		}
		if ( !$member['icq_number'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_icq" ) );
		}
		$html = $this->html->pager_header( array(
			$ibforums->lang['icq_title']
		) );
		$html .= $this->html->icq_body( array(
			"UIN" => $member['icq_number']
		) );
		$html .= $this->html->end_table( );
		$print->pop_up_window( "ICQ CONSOLE", $html );
	}

	function mail_member( )
	{
		global $ibforums;
		global $DB;
		global $std;
		global $print;
		require( "./sources/lib/emailer.php" );
		$this->email = new emailer( );
		$ibforums->lang = $std->load_words( $ibforums->lang, "lang_emails", $ibforums->lang_id );
		$this->html = $std->load_template( "skin_emails" );
		if ( empty( $ibforums->member['id'] ) )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_guests" ) );
		}
		if ( !$ibforums->member['g_email_friend'] )
		{
			$std->error( array( "LEVEL" => 1, "MSG" => "no_member_mail" ) );
		}
		if ( $ibforums->input['CODE'] == "01" )
		{
			if ( empty( $ibforums->input['to'] ) )
			{
				$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
			}
			if ( !preg_match( "/^(\\d+)\$/", $ibforums->input['to'] ) )
			{
				$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
			}
			$DB->query( "SELECT name, id, email, hide_email from ibf_members WHERE id='".$ibforums->input['to']."'" );
			$member = $DB->fetch_row( );
			if ( !$member['id'] )
			{
				$std->error( array( "LEVEL" => 1, "MSG" => "no_such_user" ) );
			}
			$check_array = array( "message" => "no_message", "subject" => "no_subject" );
			foreach ( $check_array as $input => $msg )
			{
				if ( empty( $ibforums->input[$input] ) )
				{
					$std->error( array(
						1,
						MSG => $msg
					) );
				}
			}
			$this->email->get_template( "email_member" );
			$this->email->build_message( array(
				"MESSAGE" => str_replace( "<br>", "\n", str_replace( "\r", "", $ibforums->input['message'] ) ),
				"MEMBER_NAME" => $member['name'],
				"FROM_NAME" => $ibforums->member['name']
			) );
			$this->email->subject = $ibforums->input['subject'];
			$this->email->to = $member['email'];
			$this->email->from = $ibforums->member['email'];
			$this->email->send_mail( );
			$forum_jump = $std->build_forum_jump( );
			$forum_jump = preg_replace( "!#Forum Jump#!", $ibforums->lang['forum_jump'], $forum_jump );
			$this->output = $this->html->sent_screen( $member['name'] );
			$this->output .= $this->html->forum_jump( $forum_jump );
			$this->page_title = $ibforums->lang['email_sent'];
			$this->nav = array(
				$ibforums->lang['email_sent']
			);
		}
		else
		{
			if ( empty( $ibforums->input['MID'] ) )
			{
				$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
			}
			if ( !preg_match( "/^(\\d+)\$/", $ibforums->input['MID'] ) )
			{
				$std->error( array( "LEVEL" => 1, "MSG" => "invalid_use" ) );
			}
			$DB->query( "SELECT name, id, email, hide_email from ibf_members WHERE id='".$ibforums->input['MID']."'" );
			$member = $DB->fetch_row( );
			if ( !$member['id'] )
			{
				$std->error( array( "LEVEL" => 1, "MSG" => "no_such_user" ) );
			}
			if ( $member['hide_email'] == 1 )
			{
				$std->error( array( "LEVEL" => 1, "MSG" => "private_email" ) );
			}
			$this->output = $ibforums->vars['use_mail_form'] ? $this->html->send_form( array(
				"NAME" => $member['name'],
				"TO" => $member['id']
			) ) : $this->html->show_address( array(
				"NAME" => $member['name'],
				"ADDRESS" => $member['email']
			) );
			$this->page_title = $ibforums->lang['member_address_title'];
			$this->nav = array(
				$ibforums->lang['member_address_title']
			);
		}
	}

}

$idx = new contact( );
?>

⌨️ 快捷键说明

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