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

📄 post.php

📁 极限网络智能办公系统—MYOA26—100%—源程序。
💻 PHP
📖 第 1 页 / 共 2 页
字号:
			"use_sig" => $ibforums->input['enablesig'],
			"use_emo" => $ibforums->input['enableemo'],
			"ip_address" => $ibforums->input['IP_ADDRESS'],
			"post_date" => time( ),
			"icon_id" => $ibforums->input['iconid'],
			"post" => $this->parser->convert( array(
				TEXT => $ibforums->input['Post'],
				SMILIES => $ibforums->input['enableemo'],
				CODE => $this->forum['use_ibc'],
				HTML => $this->forum['use_html']
			) ),
			"author_name" => $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'],
			"forum_id" => $this->forum['id'],
			"topic_id" => "",
			"queued" => $this->obj['moderate'],
			"attach_id" => "",
			"attach_hits" => "",
			"attach_type" => ""
		);
		$this->obj['post_errors'] = $this->parser->error;
		return $post;
	}

	function process_upload( )
	{
		global $ibforums;
		global $std;
		global $HTTP_POST_FILES;
		global $DB;
		global $FILE_UPLOAD;
		$FILE_NAME = $HTTP_POST_FILES['FILE_UPLOAD']['name'];
		$FILE_SIZE = $HTTP_POST_FILES['FILE_UPLOAD']['size'];
		$FILE_TYPE = $HTTP_POST_FILES['FILE_UPLOAD']['type'];
		$FILE_TYPE = preg_replace( "/^(.+?);.*\$/", "\\1", $FILE_TYPE );
		$attach_data = array( "attach_id" => "", "attach_hits" => "", "attach_type" => "", "attach_file" => "" );
		if ( $HTTP_POST_FILES['FILE_UPLOAD']['name'] == "" || !$HTTP_POST_FILES['FILE_UPLOAD']['name'] || $HTTP_POST_FILES['FILE_UPLOAD']['name'] == "none" )
		{
			return $attach_data;
		}
		if ( $this->can_upload != 1 && $ibforums->member['g_attach_max'] < 1 )
		{
			return $attach_data;
		}
		require( "./conf_mime_types.php" );
		if ( $mime_types[$FILE_TYPE][0] != 1 )
		{
			$this->obj['post_errors'] = "invalid_mime_type";
			return $attach_data;
		}
		if ( $ibforums->member['g_attach_max'] * 1024 < $FILE_SIZE )
		{
			$std->error( array( 1, "upload_to_big" ) );
		}
		$FILE_NAME = preg_replace( "/[^\\w\\.]/", "_", $FILE_NAME );
		$real_file_name = "post-".$this->forum['id']."-".time( );
		if ( preg_match( "/\\.(cgi|pl|js|asp|php|html|htm|jsp|jar)/", $FILE_NAME ) )
		{
			$FILE_TYPE = "text/plain";
		}
		$ext = ".ibf";
		switch ( $FILE_TYPE )
		{
		case "image/gif" :
			$ext = ".gif";
			break;
		case "image/jpeg" :
			$ext = ".jpg";
			break;
		case "image/pjpeg" :
			$ext = ".jpg";
			break;
		case "image/x-png" :
			$ext = ".png";
			break;
		default :
			$ext = ".ibf";
			break;
		}
		$real_file_name .= $ext;
		if ( $this->obj['preview_post'] )
		{
			return array(
				"FILE_NAME" => $FILE_NAME
			);
		}
		if ( !move_uploaded_file( $HTTP_POST_FILES['FILE_UPLOAD']['tmp_name'], $ibforums->vars['upload_dir']."/".$real_file_name ) )
		{
			$this->obj['post_errors'] = "upload_failed";
			return $attach_data;
		}
		else
		{
			@chmod( $ibforums->vars['upload_dir']."/".$real_file_name, 511 );
		}
		$attach_data['attach_id'] = $real_file_name;
		$attach_data['attach_hits'] = 0;
		$attach_data['attach_type'] = $FILE_TYPE;
		$attach_data['attach_file'] = $FILE_NAME;
		return $attach_data;
	}

	function check_upload_ability( )
	{
		global $ibforums;
		if ( $this->can_upload == 1 && 0 < $ibforums->member['g_attach_max'] )
		{
			$this->obj['can_upload'] = 1;
			$this->obj['form_extra'] = " enctype='multipart/form-data'";
			$this->obj['hidden_field'] = ( "<input type='hidden' name='MAX_FILE_SIZE' value='".$ibforums->member['g_attach_max'] * 1024 )."'>";
		}
	}

	function mod_options( $is_reply = 0 )
	{
		global $ibforums;
		global $DB;
		$can_close = 0;
		$can_pin = 0;
		$can_move = 0;
		$html = "<select id='forminput' name='mod_options' class='forminput'>\n<option value='nowt'>".$ibforums->lang['mod_nowt']."</option>\n";
		if ( $ibforums->member['g_is_supmod'] )
		{
			$can_close = 1;
			$can_pin = 1;
			$can_move = 1;
		}
		else if ( $ibforums->member['id'] != 0 )
		{
			if ( $this->moderator['mid'] != "" )
			{
				if ( $this->moderator['close_topic'] )
				{
					$can_close = 1;
				}
				if ( $this->moderator['pin_topic'] )
				{
					$can_pin = 1;
				}
				if ( $this->moderator['move_topic'] )
				{
					$can_move = 1;
				}
			}
		}
		else
		{
			return "";
		}
		if ( $can_pin == 0 && $can_close == 0 && $can_move == 0 )
		{
			return "";
		}
		if ( $can_pin )
		{
			$html .= "<option value='pin'>".$ibforums->lang['mod_pin']."</option>";
		}
		if ( $can_close )
		{
			$html .= "<option value='close'>".$ibforums->lang['mod_close']."</option>";
		}
		if ( $can_move && $is_reply )
		{
			$html .= "<option value='move'>".$ibforums->lang['mod_move']."</option>";
		}
		return $this->html->mod_options( $html );
	}

	function html_start_form( $additional_tags = array( ) )
	{
		global $ibforums;
		$form = "<form action='{$this->base_url}' method='POST' name='REPLIER' onSubmit='return ValidateForm()'".$this->obj['form_extra'].">"."<input type='hidden' name='st' value='".$ibforums->input[st]."'>"."<input type='hidden' name='act' value='Post'>"."<input type='hidden' name='s' value='".$ibforums->session_id."'>"."<input type='hidden' name='f' value='".$this->forum['id']."'>".$this->obj['hidden_field'];
		if ( isset( $additional_tags ) )
		{
			foreach ( $additional_tags as $k => $v )
			{
				$form .= "\n<input type='hidden' name='{$v[0]}' value='{$v[1]}'>";
			}
		}
		return $form;
	}

	function html_name_field( )
	{
		global $ibforums;
		return $ibforums->member['id'] ? $this->html->namefield_reg( ) : $this->html->namefield_unreg( $ibforums->input[UserName] );
	}

	function html_post_body( $raw_post = "" )
	{
		global $ibforums;
		$ibforums->lang['the_max_length'] = $ibforums->vars['max_post_length'] * 1024;
		return $this->html->postbox_buttons( $raw_post );
	}

	function html_post_icons( $post_icon = "" )
	{
		global $ibforums;
		if ( $ibforums->input['iconid'] )
		{
			$post_icon = $ibforums->input['iconid'];
		}
		$ibforums->lang['the_max_length'] = $ibforums->vars['max_post_length'] * 1024;
		$html = $this->html->posticons( );
		if ( $post_icon )
		{
			$html = preg_replace( "/name=[\"']iconid[\"']\\s*value=[\"']{$post_icon}\\s?[\"']/", "name='iconid' value='{$post_icon}' checked", $html );
			$html = preg_replace( "/name=[\"']iconid[\"']\\s*value=[\"']0[\"']\\s*checked/i", "name='iconid' value='0'", $html );
		}
		return $html;
	}

	function html_add_smilie_box( )
	{
		global $ibforums;
		global $DB;
		$show_table = 0;
		$count = 0;
		$smilies = "<tr align='center'>\n";
		$DB->query( "SELECT * FROM ibf_emoticons WHERE clickable='1'" );
		while ( $elmo = $DB->fetch_row( ) )
		{
			++$show_table;
			++$count;
			if ( strstr( $elmo['typed'], "&#39;" ) )
			{
				$in_delim = "\"";
				$out_delim = "'";
			}
			else
			{
				$in_delim = "'";
				$out_delim = "\"";
			}
			$smilies .= "<td><a href={$out_delim}javascript:emoticon({$in_delim}".$elmo['typed']."{$in_delim}){$out_delim}><img src=\"".$ibforums->vars['EMOTICONS_URL']."/".$elmo['image']."\" alt='smilie' border='0'></a>&nbsp;</td>\n";
			if ( $count == $ibforums->vars['emo_per_row'] )
			{
				$smilies .= "</tr>\n\n<tr align='center'>";
				$count = 0;
			}
		}
		if ( $count != $ibforums->vars['emo_per_row'] )
		{
			$i = $count;
			for ( ;	$i < $ibforums->vars['emo_per_row'];	++$i	)
			{
				$smilies .= "<td>&nbsp;</td>\n";
			}
			$smilies .= "</tr>";
		}
		$table = $this->html->smilie_table( );
		if ( $show_table != 0 )
		{
			$table = preg_replace( "/<!--THE SMILIES-->/", $smilies, $table );
			$this->output = preg_replace( "/<!--SMILIE TABLE-->/", $table, $this->output );
		}
	}

	function html_topic_summary( $topic_id )
	{
		global $ibforums;
		global $std;
		global $DB;
		if ( !$topic_id )
		{
			return;
		}
		$cached_members = array( );
		$this->output .= $this->html->topicsummary_top( );
		$post_query = $DB->query( "SELECT post, pid, post_date, author_id, author_name FROM ibf_posts WHERE topic_id='{$topic_id}' and queued <> 1 ORDER BY pid DESC LIMIT 0,10" );
		while ( $row = $DB->fetch_row( $post_query ) )
		{
			$row['author'] = $row['author_name'];
			$row['date'] = $std->get_date( $row['post_date'], "LONG" );
			$this->output .= $this->html->topicsummary_body( $row );
		}
		$this->output .= $this->html->topicsummary_bottom( );
	}

	function moderate_log( $title = "unknown", $topic_title )
	{
		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" => $topic_title,
			"action" => $title,
			"query_string" => $QUERY_STRING
		) );
		$DB->query( "INSERT INTO ibf_moderator_logs (".$db_string['FIELD_NAMES'].") VALUES (".$db_string['FIELD_VALUES'].")" );
	}

}

$idx = new post( );
?>

⌨️ 快捷键说明

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