class_post_new.php

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

PHP
509
字号
				$this->ipsclass->DB->do_insert( 'topics', $this->topic );				$this->post['topic_id']  = $this->ipsclass->DB->get_insert_id();		$this->topic['tid']      = $this->post['topic_id'];				//-----------------------------------------		// Update the post info with the upload array info		//-----------------------------------------				$this->post['post_key']  = $this->post_key;		$this->post['new_topic'] = 1;				//-----------------------------------------		// Unqueue the post if we're starting a new topic		//-----------------------------------------				$this->post['queued'] = 0;				//-----------------------------------------		// Add post to DB		//-----------------------------------------				$this->ipsclass->DB->do_insert( 'posts', $this->post );			$this->post['pid'] = $this->ipsclass->DB->get_insert_id();				//-----------------------------------------		// Update topic with firstpost ID		//-----------------------------------------				$this->ipsclass->DB->simple_construct( array( 'update' => 'topics',													  'set'    => "topic_firstpost=".$this->post['pid'],													  'where'  => "tid=".$this->topic['tid']											 )      );							 		$this->ipsclass->DB->simple_exec();				//-----------------------------------------		// Add the poll to the polls table		//-----------------------------------------				if ( count( $this->poll_questions ) AND $this->can_add_poll )		{			$this->ipsclass->DB->do_insert( 'polls', 											array (													  'tid'           => $this->topic['tid'],													  'forum_id'      => $this->forum['id'],													  'start_date'    => time(),													  'choices'       => addslashes(serialize( $this->poll_questions )),													  'starter_id'    => $this->ipsclass->member['id'],													  'votes'         => 0,													  'poll_question' => $this->ipsclass->input['poll_question'],											)     );		}						 		//-----------------------------------------		// If we are still here, lets update the		// board/forum stats		//----------------------------------------- 				$this->pf_update_forum_and_stats($this->topic['tid'], $this->topic['title'], 'new');				//-----------------------------------------		// Make attachments "permanent"		//-----------------------------------------				$this->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->post['pid']);				//-----------------------------------------		// If we are a member, lets update thier last post		// date and increment their post count.		//-----------------------------------------				$this->pf_increment_user_post_count();				//-----------------------------------------		// Are we tracking new topics we start 'auto_track'?		//-----------------------------------------				$this->pf_add_tracked_topic($this->topic['tid']);						//-----------------------------------------		// Moderating?		//-----------------------------------------				if ( $this->obj['moderate'] == 1 OR $this->obj['moderate'] == 2 )		{			//-----------------------------------------			// Redirect them with a message telling them the			// post has to be previewed first			//-----------------------------------------						$this->notify_new_topic_approval( $this->topic['tid'], $this->topic['title'], $this->topic['starter_name'], $this->post['pid'] );						$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['moderate_topic'], "act=SF&f={$this->forum['id']}" );		}				//-----------------------------------------		// Are we tracking this forum? If so generate some mailies - yay!		//-----------------------------------------				$this->forum_tracker($this->forum['id'], $this->topic['tid'], $this->topic['title'], $this->forum['name'], $this->post['post'] );				//-----------------------------------------		// Redirect them back to the topic		//-----------------------------------------				$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic={$this->topic['tid']}");	}	/*-------------------------------------------------------------------------*/	// SHOW FORM	/*-------------------------------------------------------------------------*/	function show_form()	{		//-----------------------------------------		// Are we quoting posts?		//-----------------------------------------				$raw_post = $this->check_multi_quote();				//-----------------------------------------		// Sort out the "raw" textarea input and make it safe incase		// we have a <textarea> tag in the raw post var.		//-----------------------------------------				$topic_title = isset($_POST['TopicTitle']) ? $this->ipsclass->input['TopicTitle'] : "";		$topic_desc  = isset($_POST['TopicDesc'])  ? $this->ipsclass->input['TopicDesc']  : "";				//-----------------------------------------		// Do we have any posting errors?		//-----------------------------------------				if ($this->obj['post_errors'])		{			$this->output .= $this->ipsclass->compiled_templates['skin_post']->errors( $this->ipsclass->lang[ $this->obj['post_errors'] ]);		}				if ( $this->obj['preview_post'] )		{			$this->output .= $this->ipsclass->compiled_templates['skin_post']->preview( $this->show_post_preview( $this->post['post'] ) );		}				$this->output .= $this->html_start_form( array( 1 => array( 'CODE'    , '01' ),														2 => array( 'post_key', $this->post_key ),											   )      );				//-----------------------------------------		// START TABLE		//-----------------------------------------				$this->output .= $this->ipsclass->compiled_templates['skin_post']->table_structure();				$topic_title = $this->ipsclass->compiled_templates['skin_post']->topictitle_fields( array( 'TITLE' => $topic_title, 'DESC' => $topic_desc ) );				$start_table = $this->ipsclass->compiled_templates['skin_post']->table_top( "{$this->ipsclass->lang['top_txt_new']} {$this->forum['name']}");				$name_fields = $this->html_name_field();				$post_box    = $this->html_post_body( $raw_post );				$mod_options = $this->mod_options();				$end_form    = $this->ipsclass->compiled_templates['skin_post']->EndForm( $this->ipsclass->lang['submit_new'] );				$post_icons  = $this->html_post_icons();				//-----------------------------------------		// POLL BOX		//-----------------------------------------				if ( $this->can_add_poll )		{			//-----------------------------------------			// Did someone hit preview / do we have			// post info?			//-----------------------------------------						$poll_questions = "";			$poll_choices   = "";			$show_open      = 0;						if ( is_array( $_POST['question'] ) and count( $_POST['question'] ) )			{				foreach( $_POST['question'] as $id => $question )				{					$poll_questions .= "\t{$id} : '".str_replace( "'", '&#39;', $question )."',\n";				}								$poll_question = $this->ipsclass->input['poll_question'];				$show_open     = 1;			}						if ( is_array( $_POST['choice'] ) and count( $_POST['choice'] ) )			{				foreach( $_POST['choice'] as $id => $choice )				{					$poll_choices .= "\t'{$id}' : '".str_replace( "'", '&#39;', $choice )."',\n";				}			}						//-----------------------------------------			// Trim off trailing commas (Safari hates it)			//-----------------------------------------						$poll_questions = preg_replace( "#,(\n)?$#", "\\1", $poll_questions );			$poll_choices   = preg_replace( "#,(\n)?$#", "\\1", $poll_choices );						$poll_box = $this->ipsclass->compiled_templates['skin_post']->poll_box( $this->max_poll_questions, $this->max_poll_choices_per_question, $poll_questions, $poll_choices, $poll_votes, $show_open, $poll_question );		}				//-----------------------------------------		// UPLOAD BOX		//-----------------------------------------				if ( $this->can_upload )		{			$upload_field = $this->html_build_uploads( $this->post_key, 'new' );		}				$this->output = str_replace( "<!--START TABLE-->" , $start_table  , $this->output );		$this->output = str_replace( "<!--NAME FIELDS-->" , $name_fields  , $this->output );		$this->output = str_replace( "<!--POST BOX-->"    , $post_box     , $this->output );		$this->output = str_replace( "<!--POLL BOX-->"    , $poll_box     , $this->output );		$this->output = str_replace( "<!--POST ICONS-->"  , $post_icons   , $this->output );		$this->output = str_replace( "<!--UPLOAD FIELD-->", $upload_field , $this->output );		$this->output = str_replace( "<!--MOD OPTIONS-->" , $mod_options  , $this->output );		$this->output = str_replace( "<!--END TABLE-->"   , $end_form     , $this->output );		$this->output = str_replace( "<!--TOPIC TITLE-->" , $topic_title  , $this->output );		$this->output = str_replace( "<!--FORUM RULES-->" , $this->ipsclass->print_forum_rules($this->forum), $this->output );				$this->output = $this->html_add_smilie_box( $this->output );				//-----------------------------------------		// Add in siggy buttons and such		//-----------------------------------------				$this->html_checkboxes('new', 0, $this->forum['id']);				$this->title = $this->ipsclass->lang['posting_new_topic'];				$this->show_post_navigation();				$this->ipsclass->print->add_output( $this->output );        $this->ipsclass->print->do_output( array( 'TITLE'    => $this->ipsclass->vars['board_name']." -> ".$this->title,												  'JS'       => 1,												  'NAV'      => $this->nav,										 )     );	}}?>

⌨️ 快捷键说明

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