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

📄 mod_cp.php

📁 极限网络智能办公系统—MYOA26—100%—源程序。
💻 PHP
📖 第 1 页 / 共 4 页
字号:
				$mems[] = $r['author_id'];
			}
		}
		if ( 0 < count( $mems ) )
		{
			$mstring = implode( ",", $mems );
			$DB->query( "UPDATE ibf_members SET posts=posts+1 WHERE id IN ({$mstring})" );
		}
		$DB->query( "SELECT author_id, author_name, post_date FROM ibf_posts WHERE topic_id='".$ibforums->input['tid']."' AND queued <> 1 ORDER BY pid DESC LIMIT 0,1" );
		if ( $last = $DB->fetch_row( ) )
		{
			$db_string = $DB->compile_db_update_string( array(
				"last_post" => $last['post_date'],
				"last_poster_id" => $last['author_id'],
				"last_poster_name" => $last['author_name']
			) );
			$DB->query( "UPDATE ibf_topics SET {$db_string} WHERE tid='".$ibforums->input['tid']."'" );
		}
		$this->recount( );
		$print->redirect_screen( $ibforums->lang['cp_redirect_mod_topics'], "act=modcp&CODE=modposts&f=".$this->forum['id'] );
	}

	function mod_domodposts( )
	{
		global $std;
		global $ibforums;
		global $DB;
		global $print;
		$this->load_forum( );
		$delete_ids = array( );
		$approve_ids = array( );
		foreach ( $ibforums->input as $key => $value )
		{
			if ( preg_match( "/^PID_(\\d+)\$/", $key, $match ) )
			{
				if ( $ibforums->input[$match[0]] == "approve" )
				{
					$approve_ids[] = $match[1];
				}
				else if ( $ibforums->input[$match[0]] == "remove" )
				{
					$delete_ids[] = $match[1];
				}
			}
		}
		$total = count( $delete_ids ) + count( $approve_ids );
		if ( $total < 1 )
		{
			$this->mod_error( "cp_error_no_topics" );
		}
		else
		{
			if ( 0 < count( $approve_ids ) )
			{
				$pids = implode( ",", $approve_ids );
				$pid_count = count( $approve_ids );
				$DB->query( "UPDATE ibf_topics SET posts=posts+{$pid_count} WHERE tid='".$ibforums->input['tid']."'" );
				$DB->query( "UPDATE ibf_posts SET queued=0 WHERE pid IN ({$pids})" );
				$DB->query( "SELECT author_id FROM ibf_posts WHERE queued <> 1 and pid IN ({$pids})" );
				$mems = array( );
				while ( $r = $DB->fetch_row( ) )
				{
					if ( 0 < $r['author_id'] )
					{
						$mems[] = $r['author_id'];
					}
				}
				if ( 0 < count( $mems ) )
				{
					$mstring = implode( ",", $mems );
					$DB->query( "UPDATE ibf_members SET posts=posts+1 WHERE id IN ({$mstring})" );
				}
				$DB->query( "SELECT author_id, author_name, post_date FROM ibf_posts WHERE topic_id='".$ibforums->input['tid']."' AND queued <> 1 ORDER BY pid DESC LIMIT 0,1" );
				if ( $last = $DB->fetch_row( ) )
				{
					$db_string = $DB->compile_db_update_string( array(
						"last_post" => $last['post_date'],
						"last_poster_id" => $last['author_id'],
						"last_poster_name" => $last['author_name']
					) );
					$DB->query( "UPDATE ibf_topics SET {$db_string} WHERE tid='".$ibforums->input['tid']."'" );
				}
			}
			if ( 0 < count( $delete_ids ) )
			{
				$pids = implode( ",", $delete_ids );
				$DB->query( "DELETE FROM ibf_posts WHERE pid IN ({$pids})" );
			}
			$this->recount( );
			$print->redirect_screen( $ibforums->lang['cp_redirect_mod_topics'], "act=modcp&CODE=modposts&f=".$this->forum['id'] );
		}
	}

	function mod_topicview( )
	{
		global $std;
		global $ibforums;
		global $DB;
		global $print;
		$this->load_forum( );
		$DB->query( "SELECT tid, title FROM ibf_topics WHERE tid='".$ibforums->input['tid']."'" );
		if ( !$DB->get_num_rows( ) )
		{
			$this->mod_error( "cp_error_no_topics" );
		}
		else
		{
			$topic = $DB->fetch_row( );
			$this->output .= $this->html->modtopicview_start( $ibforums->input['tid'], $this->forum['name'], $this->forum['id'], $topic['title'] );
			$DB->query( "SELECT p.*, m.id,m.name,m.mgroup,m.email,m.joined,m.avatar,m.avatar_size,m.posts as member_posts,m.aim_name,m.icq_number,m.signature, m.website,m.yahoo,m.title,m.hide_email,m.msnname, g.g_id, g.g_title, g.g_icon, t.* FROM ibf_posts p, ibf_members m, ibf_groups g, ibf_topics t WHERE t.tid='".$ibforums->input['tid']."' AND t.approved=1 AND p.topic_id=t.tid AND p.queued=1 AND p.author_id=m.id AND g.g_id=m.mgroup "."ORDER BY p.pid ASC" );
			while ( $r = $DB->fetch_row( ) )
			{
				$member = $this->parse_member( $r );
				$r['post_date'] = $std->get_date( $r['post_date'], "LONG" );
				$this->output .= $this->html->mod_postentry_checkbox( $r['pid'] );
				$this->output .= $this->html->mod_postentry( array(
					"msg" => $r,
					"member" => $member
				) );
			}
			$this->output .= $this->html->mod_topic_spacer( );
			$this->output .= $this->html->modtopics_end( );
		}
	}

	function mod_posts( )
	{
		global $std;
		global $ibforums;
		global $DB;
		global $print;
		$this->load_forum( );
		$DB->query( "SELECT t.*, COUNT(p.pid) as reply_count FROM ibf_topics t, ibf_posts p WHERE p.queued=1 AND p.new_topic <> 1 AND t.tid=p.topic_id AND t.forum_id='".$this->forum['id']."' GROUP BY t.tid ORDER BY p.post_date ASC" );
		if ( !$DB->get_num_rows( ) )
		{
			$this->mod_error( "cp_error_no_topics" );
		}
		else
		{
			$this->output .= $this->html->modpost_topicstart( $this->forum['name'], $this->forum['id'] );
			while ( $r = $DB->fetch_row( ) )
			{
				$this->output .= $this->html->modpost_topicentry( $r['title'], $r['tid'], $r['reply_count'], $this->forum['id'] );
			}
			$this->output .= $this->html->modpost_topicend( );
		}
	}

	function domod_topics( )
	{
		global $std;
		global $ibforums;
		global $DB;
		global $print;
		$this->load_forum( );
		$delete_ids = array( );
		$approve_ids = array( );
		foreach ( $ibforums->input as $key => $value )
		{
			if ( preg_match( "/^TID_(\\d+)\$/", $key, $match ) )
			{
				if ( $ibforums->input[$match[0]] == "approve" )
				{
					$approve_ids[] = $match[1];
				}
				else if ( $ibforums->input[$match[0]] == "remove" )
				{
					$delete_ids[] = $match[1];
				}
			}
		}
		$total = count( $delete_ids ) + count( $approve_ids );
		if ( $total < 1 )
		{
			$this->mod_error( "cp_error_no_topics" );
		}
		else
		{
			if ( 0 < count( $approve_ids ) )
			{
				$tids = implode( ",", $approve_ids );
				$DB->query( "UPDATE ibf_topics SET approved=1 WHERE tid IN ({$tids})" );
				$DB->query( "UPDATE ibf_posts SET queued=0 WHERE topic_id IN ({$tids})" );
				$DB->query( "SELECT starter_id FROM ibf_topics WHERE tid IN ({$tids})" );
				$mems = array( );
				while ( $r = $DB->fetch_row( ) )
				{
					if ( 0 < $r['starter_id'] )
					{
						$mems[] = $r['starter_id'];
					}
				}
				if ( 0 < count( $mems ) )
				{
					$mstring = implode( ",", $mems );
					$DB->query( "UPDATE ibf_members SET posts=posts+1 WHERE id IN ({$mstring})" );
				}
			}
			if ( 0 < count( $delete_ids ) )
			{
				$tids = implode( ",", $delete_ids );
				$DB->query( "DELETE FROM ibf_topics WHERE tid IN ({$tids})" );
				$DB->query( "DELETE FROM ibf_posts WHERE topic_id IN ({$tids})" );
			}
			$this->recount( );
			$print->redirect_screen( $ibforums->lang['cp_redirect_mod_topics'], "act=modcp&CODE=modtopics&f=".$this->forum['id'] );
		}
	}

	function mod_topics( )
	{
		global $std;
		global $ibforums;
		global $DB;
		global $print;
		$perpage = 10;
		$start = $ibforums->input['st'] ? $ibforums->input['st'] : 0;
		$this->load_forum( );
		$DB->query( "SELECT COUNT(tid) as tcount FROM ibf_topics WHERE approved=0 and forum_id='".$this->forum['id']."'" );
		$count = $DB->fetch_row( );
		if ( $count['tcount'] < 1 )
		{
			$this->mod_error( "cp_error_no_topics" );
		}
		else
		{
			$pages = $std->build_pagelinks( array(
				"TOTAL_POSS" => $count['tcount'],
				"PER_PAGE" => $perpage,
				"CUR_ST_VAL" => $start,
				"L_SINGLE" => "",
				"L_MULTI" => $ibforums->lang['cp_pages'],
				"BASE_URL" => $this->base_url."&act=modcp&CODE=modtopics&f=".$this->forum['id']
			) );
			$this->output .= $this->html->modtopics_start( $pages, $this->forum['name'], $this->forum['id'] );
			$DB->query( "SELECT p.*, m.id,m.name,m.mgroup,m.email,m.joined,m.avatar,m.avatar_size,m.posts as member_posts,m.aim_name,m.icq_number,m.signature, m.website,m.yahoo,m.title,m.hide_email,m.msnname, g.g_id, g.g_title, g.g_icon, t.* FROM ibf_posts p, ibf_members m, ibf_groups g, ibf_topics t WHERE t.forum_id='".$this->forum['id']."' and t.approved=0 AND p.topic_id=t.tid AND p.new_topic=1 AND p.author_id=m.id AND g.g_id=m.mgroup "."ORDER BY t.tid ASC LIMIT {$start}, {$perpage}" );
			while ( $r = $DB->fetch_row( ) )
			{
				$member = $this->parse_member( $r );
				$r['post_date'] = $std->get_date( $r['post_date'], "LONG" );
				$this->output .= $this->html->mod_topic_title( $r['title'], $r['tid'] );
				$this->output .= $this->html->mod_postentry( array(
					"msg" => $r,
					"member" => $member
				) );
				$this->output .= $this->html->mod_topic_spacer( );
			}
			$this->output .= $this->html->modtopics_end( );
		}
	}

	function drink_prune_juice( )
	{
		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_prune'] == 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']."'";
			}
			$batch = $DB->query( $db_query );
			if ( !( $num_rows = $DB->get_num_rows( ) ) )
			{
				$this->mod_error( "cp_error_no_topics" );
			}
			else
			{
				$tid_array = array( );
				while ( $tid = $DB->fetch_row( ) )
				{
					$tid_array[] = $tid['tid'];
				}
				$this->prune_batch( implode( ",", $tid_array ) );
				$this->recount( );
				$this->moderate_log( "Pruned Forum" );
				$this->output .= $this->html->mod_simple_page( $ibforums->lang['cp_results'], $ibforums->lang['cp_result_del'].$num_rows );
			}
		}
	}

	function prune_batch( $tid_string )
	{
		global $std;
		global $ibforums;
		global $DB;
		$this->load_forum( );
		$DB->query( "SELECT attach_id FROM ibf_posts WHERE topic_id IN ({$tid_string})" );
		while ( $attach = $DB->fetch_row( ) )
		{
			if ( is_file( $this->upload_dir."/".$attach['attach_id'] ) )
			{
				@unlink( $this->upload_dir."/".$attach['attach_id'] );
			}
		}
		$DB->query( "DELETE FROM ibf_polls WHERE tid IN ({$tid_string})" );
		$DB->query( "DELETE FROM ibf_voters WHERE tid IN ({$tid_string})" );
		$DB->query( "DELETE FROM ibf_topics WHERE tid IN ({$tid_string})" );
		$DB->query( "DELETE FROM ibf_posts WHERE topic_id IN ({$tid_string})" );
	}

	function prune_juice( )
	{
		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_prune'] == 1 )
		{
			$pass = 1;
		}
		else
		{
			$pass = 0;
		}
		if ( $pass == 0 )
		{
			$this->mod_error( "cp_no_perms" );
		}
		else
		{
			if ( $ibforums->input['check'] == 1 )
			{
				$link = "";
				$link_text = $ibforums->lang['cp_prune_dorem'];
				$DB->query( "SELECT COUNT(tid) as tcount FROM ibf_topics WHERE approved=1 and forum_id='".$this->forum['id']."'" );
				$tcount = $DB->fetch_row( );
				$db_query = "SELECT COUNT(*) as count FROM ibf_topics WHERE approved=1 and forum_id='".$this->forum['id']."'";
				if ( $ibforums->input['dateline'] )
				{
					$date = time( ) - $ibforums->input['dateline'] * 60 * 60 * 24;
					$db_query .= " AND last_post < {$date}";
					$link .= "&dateline={$date}";
				}
				if ( $ibforums->input['member'] )
				{
					$DB->query( "SELECT id FROM ibf_members WHERE name='".$ibforums->input['member']."'" );
					if ( !( $mem = $DB->fetch_row( ) ) )
					{
						$this->mod_error( "cp_error_no_mem" );
						return;
					}
					else
					{
						$db_query .= " AND starter_id='".$mem['id']."'";
						$link .= "&starter={$mem['id']}";
					}
				}
				if ( $ibforums->input['posts'] )
				{
					$db_query .= " AND posts < '".$ibforums->input['posts']."'";
					$link .= "&posts={$ibforums->input['posts']}";
				}
				if ( $ibforums->input['topic_type'] != "all" )
				{
					$db_query .= " AND state='".$ibforums->input['topic_type']."'";
					$link .= "&state={$ibforums->input['topic_type']}";
				}
				$DB->query( $db_query );
				$count = $DB->fetch_row( );
				if ( $ibforums->input['df'] == "prune" )
				{
					$link = "&act=modcp&f={$this->forum['id']}&CODE=doprune&".$link;
				}
				else
				{
					if ( $ibforums->input['df'] == $this->forum['id'] )
					{
						$this->mod_error( "cp_same_forum" );
						return;
					}
					else
					{
						if ( $ibforums->input['df'] == -1 )
						{
							$this->mod_error( "cp_no_forum" );
						}
					}
					$link = "&act=modcp&f={$this->forum['id']}&CODE=domove&df=".$ibforums->input['df'].$link;
					$link_text = $ibforums->lang['cp_prune_domove'];
				}
				$confirm_html = $this->html->prune_confirm( $tcount['tcount'], $count['count'], $link, $link_text );
			}
			$select = "<select name='topic_type' class='forminput'>";
			foreach ( array( "open", "closed", "link", "all" ) as $type )
			{
				if ( $ibforums->input['topic_type'] == $type )
				{
					$selected = " selected";
				}
				else
				{
					$selected = "";
				}
				$select .= "<option value='{$type}'".$selected.">".$ibforums->lang["cp_pday_".$type]."</option>";
			}
			$select .= "</select>\n";
			$forums = "<option value='prune'>{$ibforums->lang['cp_ac_prune']}</option>";
			$forums .= $std->build_forum_jump( 0 );
			if ( $ibforums->input['df'] )
			{
				$forums = preg_replace( "/<option value=\"".$ibforums->input['df']."\"/", "<option value=\"".$ibforums->input['df']."\" selected", $forums );
			}
			$this->output .= $this->html->prune_splash( $this->forum, $forums, $select, $button, $confirm );
			if ( $confirm_html )
			{
				$this->output = preg_replace( "/<!-- IBF\\.CONFIRM -->/", "{$confirm_html}", $this->output );
			}
		}
	}

	function find_user_one( )
	{
		global $std;
		global $ibforums;
		global $DB;

⌨️ 快捷键说明

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