moderate.php

来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 2,138 行 · 第 1/5 页

PHP
2,138 行
字号
		else if ($this->moderator['mass_prune'] == 1)		{			$pass = 1;		}		else		{			$pass = 0;		}				if ($pass == 0)		{			$this->moderate_error();			return;		}				//-----------------------------------------		// SET UP		//-----------------------------------------				$pergo      = intval( $this->ipsclass->input['pergo'] ) ? intval( $this->ipsclass->input['pergo'] ) : 50;		$max        = intval( $this->ipsclass->input['max'] );		$current    = intval($this->ipsclass->input['current']);		$maxdone    = $pergo + $current;		$tid_array  = array();		$starter    = trim( $this->ipsclass->input['starter'] );		$state      = trim( $this->ipsclass->input['state'] );		$posts      = intval( $this->ipsclass->input['posts'] );		$dateline   = intval( $this->ipsclass->input['dateline'] );		$ignore_pin = intval( $this->ipsclass->input['ignore_pin'] );				//-----------------------------------------		// Carry on...		//-----------------------------------------				$db_query = $this->modfunc->sql_prune_create( $this->forum['id'], $starter, $state, $posts, $dateline, $ignore_pin, $pergo, $current );													  		$batch    = $this->ipsclass->DB->query($db_query);				//-----------------------------------------		// Got anything?		//-----------------------------------------				if ( ! $num_rows = $this->ipsclass->DB->get_num_rows() )		{			if ( ! $current )			{				$this->moderate_error('cp_error_no_topics'); 				return;			}		}				//-----------------------------------------		// Get tiddles		//-----------------------------------------				while ( $tid = $this->ipsclass->DB->fetch_row() )		{			$tid_array[] = $tid['tid'];		}				$this->modfunc->topic_delete($tid_array);				$this->moderate_log("Pruned Forum");				//-----------------------------------------		// Show results or refresh..		//-----------------------------------------				if ( ! $num_rows )		{			//-----------------------------------------			// Done...			//-----------------------------------------						$this->ipsclass->input['check'] = 0;			$this->prune_start( $this->ipsclass->compiled_templates['skin_mod']->mod_simple_page( $this->ipsclass->lang['cp_results'], $this->ipsclass->lang['cp_result_del'].($max)  ) );		}		else		{			$link  = "act=mod&f={$this->forum['id']}&CODE=prune_finish&pergo={$pergo}&current={$maxdone}&max={$max}";			$link .= "&starter={$starter}&state={$state}&posts={$posts}&dateline={$dateline}&ignore_pin={$ignore_pin}";			$link .= "&auth_key=".$this->ipsclass->md5_check;			$done  = $current + $num_rows;			$text  = sprintf( $this->ipsclass->lang['cp_batch_done'], $done, $max - $done );						$this->ipsclass->print->redirect_screen( $text, $link );		}				$this->ipsclass->print->pop_up_window( "", $this->output );	}														  	/*-------------------------------------------------------------------------*/	// Prune / Move Start	/*-------------------------------------------------------------------------*/		function prune_start( $complete_html="" )	{		//-----------------------------------------		// Check permissions		//-----------------------------------------				if ($this->ipsclass->member['g_is_supmod'] == 1)		{			$pass = 1;		}		else if ($this->moderator['mass_prune'] == 1)		{			$pass = 1;		}		else		{			$pass = 0;		}				if ($pass == 0)		{			$this->moderate_error();			return;		}				//-----------------------------------------		// Check per go		//-----------------------------------------				$this->ipsclass->input['pergo'] = $this->ipsclass->input['pergo'] ? $this->ipsclass->input['pergo'] : 50;				//-----------------------------------------		// Are we checking first?		//-----------------------------------------				if ($this->ipsclass->input['check'] == 1)		{			$link      = "&pergo=".$this->ipsclass->input['pergo'];			$link_text = $this->ipsclass->lang['cp_prune_dorem'];						$tcount = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'COUNT(*) as tcount', 'from' => 'topics', 'where' => "approved=1 and forum_id={$this->forum['id']}" ) );						//-----------------------------------------			// date...			//-----------------------------------------					if ($this->ipsclass->input['dateline'])			{				$date      = time() - $this->ipsclass->input['dateline']*60*60*24;				$db_query .= " AND last_post < $date";								$link .= "&dateline=$date";			}						//-----------------------------------------			// Member...			//-----------------------------------------						if ( $this->ipsclass->input['member'] )			{				$this->ipsclass->DB->query("SELECT id FROM ibf_members WHERE name='".$this->ipsclass->input['member']."'");								if (! $mem = $this->ipsclass->DB->fetch_row() )				{					$this->moderate_error('cp_error_no_mem');					return;				}				else				{					$db_query .= " AND starter_id='".$mem['id']."'";					$link     .= "&starter={$mem['id']}";				}			}						//-----------------------------------------			// Posts / Topic type			//-----------------------------------------						if ($this->ipsclass->input['posts'])			{				$db_query .= " AND posts < '".$this->ipsclass->input['posts']."'";				$link     .= "&posts={$this->ipsclass->input['posts']}";			}						if ($this->ipsclass->input['topic_type'] != 'all')			{				$db_query .= " AND state='".$this->ipsclass->input['topic_type']."'";				$link     .= "&state={$this->ipsclass->input['topic_type']}";			}						if ($this->ipsclass->input['ignore_pin'] == 1)			{				$db_query .= " AND pinned <> 1";				$link     .= "&ignore_pin=1";			}						$this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(*) as count',										  				  'from'   => 'topics',										  				  'where'  => "approved=1 and forum_id='".$this->forum['id']."'" . $db_query ) );								$this->ipsclass->DB->simple_exec();						$count = $this->ipsclass->DB->fetch_row();						//-----------------------------------------			// Prune?			//-----------------------------------------						if ($this->ipsclass->input['df'] == 'prune')			{				$link = "act=mod&f={$this->forum['id']}&CODE=prune_finish&".$link;			}			else			{				if ( $this->ipsclass->input['df'] == $this->forum['id'] )				{					$this->moderate_error('cp_same_forum');					return;				}				else if ($this->ipsclass->input['df'] == -1)				{					$this->moderate_error('cp_no_forum');					return;				}								$link      = "act=mod&f={$this->forum['id']}&CODE=prune_move&df=".$this->ipsclass->input['df'].$link;				$link_text = $this->ipsclass->lang['cp_prune_domove'];			}						//-----------------------------------------			// Build data			//-----------------------------------------						$confirm_data = array( 'tcount'    => $tcount['tcount'],								   'count'     => $count['count'],								   'link'      => $link . '&max='.$count['count'],								   'link_text' => $link_text,								   'show'      => 1 );		}				$select = "<select name='topic_type' class='forminput'>";				foreach( array( 'open', 'closed', 'link', 'all' ) as $type )		{			if ($this->ipsclass->input['topic_type'] == $type)			{				$selected = ' selected';			}			else			{				$selected = '';			}						$select .= "<option value='$type'".$selected.">".$this->ipsclass->lang['cp_pday_'.$type]."</option>";		}				$select .= "</select>\n";				$html_forums  = "<option value='prune'>{$this->ipsclass->lang['cp_ac_prune']}</option>";				$tmp_jump_setting = $this->ipsclass->vars['short_forum_jump'];		$this->ipsclass->vars['short_forum_jump'] = 0;		$html_forums .= $this->ipsclass->build_forum_jump(0,0,1);		$this->ipsclass->vars['short_forum_jump'] = $tmp_jump_setting;		unset($tmp_jump_setting);						//-----------------------------------------		// Make current destination forum this one if selected		// before		//-----------------------------------------				if ( $this->ipsclass->input['df'] )		{			$html_forums = preg_replace( "/<option value=\"".$this->ipsclass->input['df']."\"/", "<option value=\"".$this->ipsclass->input['df']."\" selected", $html_forums );		}				$this->output .= $this->ipsclass->compiled_templates['skin_mod']->prune_splash($this->forum, $html_forums, $select, $this->ipsclass->return_md5_check(), $confirm_data, $complete_html );				$this->ipsclass->print->pop_up_window( "", $this->output );	}		/*-------------------------------------------------------------------------*/	// Resynchronise Forum	/*-------------------------------------------------------------------------*/		function resync_forum()	{		$this->ipsclass->forums->forum_by_id[ $this->forum['id'] ]['_update_deletion'] = 1;		$this->modfunc->forum_recount( $this->forum['id'] );		$this->modfunc->stats_recount();				$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['cp_resync'], "showforum=".$this->forum['id'] );	}		/*-------------------------------------------------------------------------*/	// Topic act	/*-------------------------------------------------------------------------*/		function multi_topic_modify()	{		$this->tids  = $this->get_tids();				if ( count( $this->tids ) )		{			switch ( $this->ipsclass->input['tact'] )			{				case 'close':					$this->multi_alter_topics('close_topic', "state='closed'");					break;				case 'open':					$this->multi_alter_topics('open_topic', "state='open'");					break;				case 'pin':					$this->multi_alter_topics('pin_topic', "pinned=1");					break;				case 'unpin':					$this->multi_alter_topics('unpin_topic', "pinned=0");					break;				case 'approve':					$this->multi_alter_topics('topic_q', "approved=1");					break;				case 'unapprove':					$this->multi_alter_topics('topic_q', "approved=0");					break;				case 'delete':					$this->multi_alter_topics('delete_topic');					break;				case 'move':					$this->multi_start_checked_move();					return;					break;				case 'domove':					$this->multi_complete_checked_move();					break;				case 'merge':					$this->multi_topic_merge();					break;				default:					$this->multi_topic_mmod();					break;			}		}				$this->ipsclass->my_setcookie('modtids', '', 0);				if ( $this->forum['id'] )		{			$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['cp_redirect_topics'], "showforum=".$this->forum['id'] );		}	}		/*-------------------------------------------------------------------------*/	// Multi Merge Topics	/*-------------------------------------------------------------------------*/		function multi_topic_merge()	{		global $std, $ibforums, $DB, $print;		$pass = 0;				if ($this->ipsclass->member['g_is_supmod'] == 1)		{			$pass = 1;		}		else if ($this->moderator['delete_topic'] == 1)		{			$pass = 1;		}		else		{			$pass = 0;		}				if ($pass == 0)		{			$this->moderate_error();			return;		}				if ( count($this->tids) < 2 )		{			$this->moderate_error();  ### NEEDS CUSTOM MESSAGE			return;		}				//-----------------------------------------		// Get the topics in ascending date order		//-----------------------------------------				$topics = array();				$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid IN ('.implode( ",",$this->tids ).')', 'order' => 'start_date asc' ) );		$this->ipsclass->DB->simple_exec();				while ( $r = $this->ipsclass->DB->fetch_row() )		{			$topics[] = $r;		}				//-----------------------------------------		// Check...		//-----------------------------------------				if ( count($topics) < 2 )		{			$this->moderate_error();  ### NEEDS CUSTOM MESSAGE			return;		}				//-----------------------------------------		// Get topic ID for first topic 'master'		//-----------------------------------------				$first_topic = array_shift( $topics );				$main_topic_id = $first_topic['tid'];				$merge_ids = array();				foreach( $topics as $t )		{			$merge_ids[] = $t['tid'];		}				//-----------------------------------------		// Update the posts, remove old polls, subs and topic		//-----------------------------------------				$this->ipsclass->DB->do_update( 'posts', array( 'topic_id' => $main_topic_id ), 'to

⌨️ 快捷键说明

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