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

📄 mod_cp.php

📁 极限网络智能办公系统—MYOA26—100%—源程序。
💻 PHP
📖 第 1 页 / 共 4 页
字号:
		global $print;
		$pass = 0;
		if ( $ibforums->member['g_is_supmod'] == 1 )
		{
			$pass = 1;
		}
		else if ( $this->moderator['edit_user'] == 1 )
		{
			$pass = 1;
		}
		else
		{
			$pass = 0;
		}
		if ( $pass == 0 )
		{
			$this->mod_error( "cp_no_perms" );
		}
		else
		{
			$this->output .= $this->html->find_user( );
		}
	}

	function find_user_two( )
	{
		global $std;
		global $ibforums;
		global $DB;
		global $print;
		if ( $ibforums->input['name'] == "" )
		{
			$this->mod_error( "cp_no_matches" );
		}
		else
		{
			$DB->query( "SELECT id, name FROM ibf_members WHERE name LIKE '".$ibforums->input['name']."%' LIMIT 0,100" );
			if ( $DB->get_num_rows( ) )
			{
				$select = "<select name='memberid' class='forminput'>";
				while ( $member = $DB->fetch_row( ) )
				{
					$select .= "\n<option value='".$member['id']."'>".$member['name']."</option>";
				}
				$select .= "</select>";
				$this->output .= $this->html->find_two( $select );
			}
			else
			{
				$this->mod_error( "cp_no_matches" );
				return;
			}
		}
	}

	function edit_user( )
	{
		global $std;
		global $ibforums;
		global $DB;
		global $print;
		global $root_path;
		$pass = 0;
		if ( $ibforums->member['g_is_supmod'] == 1 )
		{
			$pass = 1;
		}
		else if ( $this->moderator['edit_user'] == 1 )
		{
			$pass = 1;
		}
		else
		{
			$pass = 0;
		}
		if ( $pass == 0 )
		{
			$this->mod_error( "cp_no_perms" );
		}
		else if ( $ibforums->input['memberid'] == "" )
		{
			$this->mod_error( "cp_no_matches" );
		}
		else
		{
			$DB->query( "SELECT m.*, g.* FROM ibf_members m, ibf_groups g WHERE m.id='".$ibforums->input['memberid']."' AND m.mgroup=g.g_id" );
			if ( !( $member = $DB->fetch_row( ) ) )
			{
				$this->mod_error( "cp_no_matches" );
			}
			else
			{
				if ( $ibforums->member['g_access_cp'] != 1 && $member['g_access_cp'] == 1 )
				{
					$this->mod_error( "cp_admin_user" );
					return;
				}
				require( $root_path."sources/lib/post_parser.php" );
				$parser = new post_parser( );
				$editable['signature'] = $parser->unconvert( $member['signature'] );
				$editable['location'] = $member['location'];
				$editable['interests'] = $member['interests'];
				$editable['website'] = $member['website'];
				$editable['id'] = $member['id'];
				$editable['name'] = $member['name'];
				$this->output .= $this->html->edit_user_form( $editable );
			}
		}
	}

	function complete_user_edit( )
	{
		global $std;
		global $ibforums;
		global $DB;
		global $print;
		global $root_path;
		$pass = 0;
		if ( $ibforums->member['g_is_supmod'] == 1 )
		{
			$pass = 1;
		}
		else if ( $this->moderator['edit_user'] == 1 )
		{
			$pass = 1;
		}
		else
		{
			$pass = 0;
		}
		if ( $pass == 0 )
		{
			$this->mod_error( "cp_no_perms" );
		}
		else if ( $ibforums->input['memberid'] == "" )
		{
			$this->mod_error( "cp_no_matches" );
		}
		else
		{
			$DB->query( "SELECT m.*, g.* FROM ibf_members m, ibf_groups g WHERE m.id='".$ibforums->input['memberid']."' AND m.mgroup=g.g_id" );
			if ( !( $member = $DB->fetch_row( ) ) )
			{
				$this->mod_error( "cp_no_matches" );
			}
			else
			{
				if ( $ibforums->member['g_access_cp'] != 1 && $member['g_access_cp'] == 1 )
				{
					$this->mod_error( "cp_admin_user" );
					return;
				}
				require( $root_path."sources/lib/post_parser.php" );
				$parser = new post_parser( );
				$ibforums->input['signature'] = $parser->convert( array(
					"TEXT" => $ibforums->input['signature'],
					"SMILIES" => 0,
					"CODE" => $ibforums->vars['sig_allow_ibc'],
					"HTML" => 0,
					"SIGNATURE" => 1
				) );
				if ( $parser->error != "" )
				{
					$std->error( array(
						"LEVEL" => 1,
						"MSG" => $parser->error
					) );
				}
				$profile = array(
					"signature" => $ibforums->input['signature'],
					"location" => $ibforums->input['location'],
					"interests" => $ibforums->input['interests'],
					"website" => $ibforums->input['website']
				);
				if ( $ibforums->input['avatar'] == 1 )
				{
					$profile['avatar'] = "";
					$profile['avatar_size'] = "";
				}
				$db_string = $DB->compile_db_update_string( $profile );
				$DB->query( "UPDATE ibf_members SET {$db_string} WHERE id='".$ibforums->input['memberid']."'" );
				$this->moderate_log( "Edited Profile for: {$member['name']}" );
				$std->boink_it( $ibforums->base_url."&act=modcp&f={$ibforums->input['f']}&CODE=doedituser&memberid={$ibforums->input['memberid']}" );
				exit( );
			}
		}
	}

	function splash( )
	{
		global $std;
		global $ibforums;
		global $DB;
		global $print;
		$DB->query( "SELECT COUNT(tid) as count FROM ibf_topics WHERE approved <> 1 and forum_id='".$this->forum['id']."'" );
		$row = $DB->fetch_row( );
		$tcount = $row['count'] ? $row['count'] : 0;
		$DB->query( "SELECT COUNT(pid) as pcount FROM ibf_posts WHERE queued=1 and new_topic <> 1 and forum_id='".$this->forum['id']."'" );
		$row = $DB->fetch_row( );
		$pcount = $row['pcount'] ? $row['pcount'] : 0;
		$this->output .= $this->html->splash( $tcount, $pcount, $this->forum['name'] );
	}

	function do_move( )
	{
		global $std;
		global $ibforums;
		global $DB;
		global $print;
		$this->load_forum( );
		$pass = 0;
		if ( $ibforums->member['g_is_supmod'] == 1 )
		{
			$pass = 1;
		}
		else if ( $this->moderator['mass_move'] == 1 )
		{
			$pass = 1;
		}
		else
		{
			$pass = 0;
		}
		if ( $pass == 0 )
		{
			$this->mod_error( "cp_no_perms" );
		}
		else
		{
			$db_query = "SELECT tid FROM ibf_topics WHERE approved=1 and forum_id='".$this->forum['id']."'";
			if ( $ibforums->input['dateline'] )
			{
				$db_query .= " AND last_post < {$ibforums->input['dateline']}";
			}
			if ( $ibforums->input['starter'] )
			{
				$db_query .= " AND starter_id='".$ibforums->input['starter']."'";
			}
			if ( $ibforums->input['posts'] )
			{
				$db_query .= " AND posts < '".$ibforums->input['posts']."'";
			}
			if ( $ibforums->input['state'] != "all" && $ibforums->input['state'] )
			{
				$db_query .= " AND state='".$ibforums->input['state']."'";
			}
			$DB->query( $db_query );
			if ( !( $num_rows = $DB->get_num_rows( ) ) )
			{
				$this->mod_error( "cp_error_no_topics" );
			}
			else
			{
				$tid_array = array( );
				while ( $row = $DB->fetch_row( ) )
				{
					$tid_array[] = $row['tid'];
				}
				$tid = implode( ",", $tid_array );
				$source = $this->forum['id'];
				$moveto = $ibforums->input['df'];
				$DB->query( "SELECT subwrap, id, sub_can_post FROM ibf_forums WHERE id='{$moveto}'" );
				$f = $DB->fetch_row( );
				if ( $f['subwrap'] == 1 && $f['sub_can_post'] != 1 )
				{
					$this->mod_error( "cp_error_no_subforum" );
				}
				else
				{
					$DB->query( "UPDATE ibf_topics SET forum_id='{$moveto}' WHERE forum_id='{$source}' AND tid IN({$tid})" );
					$DB->query( "UPDATE ibf_posts SET forum_id='{$moveto}' WHERE forum_id='{$source}' AND topic_id IN({$tid})" );
					$DB->query( "UPDATE ibf_polls SET forum_id='{$moveto}' WHERE forum_id='{$source}' AND tid IN({$tid})" );
					$this->moderate_log( "Mass moved topics" );
					$this->recount( $source );
					$this->recount( $moveto );
					$this->output .= $this->html->mod_simple_page( $ibforums->lang['cp_results'], $ibforums->lang['cp_result_move'].$num_rows );
				}
			}
		}
	}

	function moderate_log( $title = "unknown" )
	{
		global $std;
		global $ibforums;
		global $DB;
		global $HTTP_REFERER;
		global $QUERY_STRING;
		$db_string = $std->compile_db_string( array(
			"forum_id" => $ibforums->input['f'],
			"topic_id" => $ibforums->input['t'],
			"post_id" => $ibforums->input['p'],
			"member_id" => $ibforums->member['id'],
			"member_name" => $ibforums->member['name'],
			"ip_address" => $ibforums->input['IP_ADDRESS'],
			"http_referer" => $HTTP_REFERER,
			"ctime" => time( ),
			"topic_title" => "<i>Via Moderators CP</i>",
			"action" => $title,
			"query_string" => $QUERY_STRING
		) );
		$DB->query( "INSERT INTO ibf_moderator_logs (".$db_string['FIELD_NAMES'].") VALUES (".$db_string['FIELD_VALUES'].")" );
	}

	function recount( $fid = "" )
	{
		global $ibforums;
		global $root_path;
		global $DB;
		global $std;
		if ( $fid != "" )
		{
			$this->forum['id'] = $fid;
		}
		$DB->query( "SELECT COUNT(tid) as tcount from ibf_topics WHERE approved=1" );
		$topics = $DB->fetch_row( );
		$DB->query( "SELECT COUNT(pid) as pcount from ibf_posts WHERE queued <> 1" );
		$posts = $DB->fetch_row( );
		$DB->query( "SELECT COUNT(tid) as tcount from ibf_topics WHERE approved=1 and forum_id='".$this->forum['id']."'" );
		$f_topics = $DB->fetch_row( );
		$f_topics['tcount'] = $f_topics['tcount'] < 1 ? 0 : $f_topics['tcount'];
		$DB->query( "SELECT COUNT(pid) as pcount from ibf_posts WHERE queued <> 1 and forum_id='".$this->forum['id']."'" );
		$f_posts = $DB->fetch_row( );
		$f_posts['pcount'] = $f_posts['pcount'] < 1 ? 0 : $f_posts['pcount'];
		$this->forum['topics'] = $f_topics['tcount'];
		$this->forum['posts'] = $f_posts['pcount'] - $f_topics['tcount'];
		$DB->query( "SELECT tid, title, last_poster_id, last_poster_name, last_post FROM ibf_topics WHERE approved=1 and forum_id='".$this->forum['id']."' ORDER BY last_post DESC LIMIT 0,1" );
		$last_post = $DB->fetch_row( );
		$db_string = $DB->compile_db_update_string( array(
			"last_poster_id" => $last_post['last_poster_id'],
			"last_poster_name" => $last_post['last_poster_name'],
			"last_post" => $last_post['last_post'],
			"last_title" => $last_post['title'],
			"last_id" => $last_post['tid'],
			"topics" => $this->forum['topics'],
			"posts" => $this->forum['posts']
		) );
		$DB->query( "UPDATE ibf_forums SET {$db_string} WHERE id='".$this->forum['id']."'" );
		$replies = $posts['pcount'] - $topics['tcount'];
		$DB->query( "UPDATE ibf_stats SET TOTAL_TOPICS='".$topics['tcount']."', TOTAL_REPLIES='{$replies}'" );
	}

	function load_forum( $fid = "" )
	{
		global $std;
		global $ibforums;
		global $DB;
		if ( $fid == "" )
		{
			$fid = intval( $ibforums->input['f'] );
		}
		$DB->query( "SELECT * FROM ibf_forums WHERE id={$fid}" );
		if ( !( $this->forum = $DB->fetch_row( ) ) )
		{
			$this->mod_error( "cp_err_no_f" );
		}
		else
		{
			return TRUE;
		}
	}

	function get_tids( )
	{
		global $std;
		global $ibforums;
		global $DB;
		$ids = array( );
		foreach ( $ibforums->input as $key => $value )
		{
			if ( !preg_match( "/^TID_(\\d+)\$/", $key, $match ) && !$ibforums->input[$match[0]] )
			{
				$ids[] = $match[1];
			}
		}
		if ( count( $ids ) < 1 )
		{
			$this->mod_error( "cp_err_no_topics" );
		}
		else
		{
			return $ids;
		}
	}

	function mod_error( $error )
	{
		global $std;
		global $ibforums;
		global $DB;
		global $print;
		$error = $ibforums->lang[$error];
		$this->output .= $this->html->mod_simple_page( $ibforums->lang['cp_error'], $error );
		if ( count( $this->nav ) < 1 )
		{
			$this->nav[] = "<a href='{$this->base_url}&act=modcp'>{$ibforums->lang['cp_modcp_home']}</a>";
		}
		if ( !$this->page_title )
		{
			$this->page_title = $ibforums->lang['cp_modcp_ptitle'];
		}
		$print->add_output( "{$this->output}" );
		$print->do_output( array(
			"TITLE" => $this->page_title,
			"JS" => 1,
			NAV => $this->nav
		) );
		exit( );
	}

	function parse_member( $member = array( ) )
	{
		global $ibforums;
		global $std;
		global $DB;
		$member['name'] = "<a href='{$this->base_url}&act=Profile&CODE=03&MID={$member['id']}'>{$member['name']}</a>";
		$member['avatar'] = $std->get_avatar( $member['avatar'], $ibforums->member['view_avs'], $member['avatar_size'] );
		$member['MEMBER_JOINED'] = $ibforums->lang['m_joined']." ".$std->get_date( $member['joined'], "JOINED" );
		$member['MEMBER_GROUP'] = $ibforums->lang['m_group']." ".$member['g_title'];
		$member['MEMBER_POSTS'] = $ibforums->lang['m_posts']." ".$member['member_posts'];
		$member['PROFILE_ICON'] = "<a href='{$this->base_url}&act=Profile&CODE=03&MID={$member['id']}'><{P_PROFILE}></a>&nbsp;";
		$member['MESSAGE_ICON'] = "<a href='{$this->base_url}&act=Msg&CODE=04&MID={$member['id']}'><{P_MSG}></a>&nbsp;";
		if ( !$member['hide_email'] )
		{
			$member['EMAIL_ICON'] = "<a href='{$this->base_url}&act=Mail&CODE=00&MID={$member['id']}'><{P_EMAIL}></a>&nbsp;";
		}
		if ( $member['website'] && ( $member['website'] = preg_match( "/^http:\\/\\/\\S+\$/", $member['WEBSITE'] ) ) )
		{
			$member['WEBSITE_ICON'] = "<a href='{$member['website']}' target='_blank'><{P_WEBSITE}></a>&nbsp;";
		}
		if ( $member['icq_number'] )
		{
			$member['ICQ_ICON'] = "<a href=\"javascript:PopUp('{$this->base_url}&act=ICQ&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_ICQ}></a>&nbsp;";
		}
		if ( $member['aim_name'] )
		{
			$member['AOL_ICON'] = "<a href='http://search.tencent.com/cgi-bin/friend/user_show_info?ln={$member['aim_name']}' target='_blank'><{P_AOL}></a>&nbsp;";
		}
		return $member;
	}

	function print_index( )
	{
		global $ibforums;
		global $std;
		global $DB;
		global $print;
		$this->output .= $this->html->cp_index( );
	}

}

$idx = new moderate( );
?>

⌨️ 快捷键说明

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