class_post.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 2,030 行 · 第 1/5 页
PHP
2,030 行
{ $this->ipsclass->Error( array( LEVEL => 1, MSG => 'post_too_long') ); } //----------------------------------------- // Remove board tags //----------------------------------------- $this->ipsclass->input['Post'] = $this->ipsclass->remove_tags( $this->ipsclass->input['Post'] ); //----------------------------------------- // Post process the editor // Now we have safe HTML and bbcode //----------------------------------------- if ( $_POST['fast_reply_used'] ) { if ( $this->han_editor->method == 'rte' ) { //----------------------------------------- // Fast reply used.. and we've chosen the RTE // Convert STD to RTE first... //----------------------------------------- $_POST['Post'] = $this->parser->convert_std_to_rte( $_POST['Post'] ); } } $this->ipsclass->input['Post'] = $this->han_editor->process_raw_post( 'Post' ); //----------------------------------------- // Parse post //----------------------------------------- $this->parser->parse_smilies = $this->ipsclass->input['enableemo']; $this->parser->parse_html = $this->forum['use_html']; $this->parser->parse_bbcode = $this->forum['use_ibc']; $post = array( 'author_id' => $this->ipsclass->member['id'] ? $this->ipsclass->member['id'] : 0, 'use_sig' => $this->ipsclass->input['enablesig'], 'use_emo' => $this->ipsclass->input['enableemo'], 'ip_address' => $this->ipsclass->ip_address, 'post_date' => time(), 'icon_id' => $this->ipsclass->input['iconid'], 'post' => $this->parser->pre_db_parse( $this->ipsclass->input['Post'] ), 'author_name' => $this->ipsclass->member['id'] ? $this->ipsclass->member['members_display_name'] : $this->ipsclass->input['UserName'], 'topic_id' => "", 'queued' => ( $this->obj['moderate'] == 1 || $this->obj['moderate'] == 3 ) ? 1 : 0, 'post_htmlstate' => intval($this->ipsclass->input['post_htmlstatus']), ); //----------------------------------------- // If we had any errors, parse them back to this class // so we can track them later. //----------------------------------------- $this->obj['post_errors'] = $this->parser->error; return $post; } /*-------------------------------------------------------------------------*/ // HTML: mod_options. // ------------------ // Returns the HTML for the mod options drop down box /*-------------------------------------------------------------------------*/ function mod_options($type='new') { $can_close = 0; $can_pin = 0; $can_move = 0; $html = ""; //----------------------------------------- // Mod options //----------------------------------------- if ( $type != 'edit' ) { $html = "<select id='forminput' name='mod_options' class='forminput'>\n<option value='nowt'>".$this->ipsclass->lang['mod_nowt']."</option>\n"; if ( $this->ipsclass->member['g_is_supmod'] ) { $can_close = 1; $can_pin = 1; $can_move = 1; } else if ( $this->ipsclass->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 and $can_close == 0 and $can_move == 0) { return ""; } if ($can_pin) { $html .= "<option value='pin'>".$this->ipsclass->lang['mod_pin']."</option>"; } if ($can_close) { $html .= "<option value='close'>".$this->ipsclass->lang['mod_close']."</option>"; } if ($can_close and $can_pin) { $html .= "<option value='pinclose'>".$this->ipsclass->lang['mod_pinclose']."</option>"; } if ($can_move and $type != 'new' ) { $html .= "<option value='move'>".$this->ipsclass->lang['mod_move']."</option>"; } } //----------------------------------------- // If we're replying, kill off time boxes //----------------------------------------- if ( $type == 'reply' ) { $this->can_set_open_time = 0; $this->can_set_close_time = 0; } else { //----------------------------------------- // Check dates... //----------------------------------------- $mytimes['open_time'] = $_POST['open_time_time']; $mytimes['open_date'] = $_POST['open_time_date']; $mytimes['close_time'] = $_POST['close_time_time']; $mytimes['close_date'] = $_POST['close_time_date']; if ( ! $open_date ) { if ( $this->topic['topic_open_time'] ) { $date = $this->ipsclass->unixstamp_to_human($this->topic['topic_open_time']); $mytimes['open_date'] = sprintf("%02d/%02d/%04d", $date['month'], $date['day'], $date['year'] ); $mytimes['open_time'] = sprintf("%02d:%02d" , $date['hour'] , $date['minute'] ); } } if ( ! $close_date ) { if ( $this->topic['topic_close_time'] ) { $date = $this->ipsclass->unixstamp_to_human($this->topic['topic_close_time']); $mytimes['close_date'] = sprintf("%02d/%02d/%04d", $date['month'], $date['day'], $date['year'] ); $mytimes['close_time'] = sprintf("%02d:%02d" , $date['hour'] , $date['minute'] ); } } } return $this->ipsclass->compiled_templates['skin_post']->mod_options($html, $this->can_set_open_time, $this->can_set_close_time, $mytimes); } /*-------------------------------------------------------------------------*/ // HTML: start form. // ------------------ // Returns the HTML for the <FORM> opening tag /*-------------------------------------------------------------------------*/ function html_start_form($additional_tags=array()) { $form .= "<form id='postingform' action='{$this->ipsclass->base_url}' method='post' name='REPLIER' onsubmit='return ValidateForm()'".$this->obj['form_extra'].">". "<input type='hidden' name='st' value='".$this->ipsclass->input[st]."' />\n". "<input type='hidden' name='act' value='Post' />\n". "<input type='hidden' name='s' value='".$this->ipsclass->session_id."' />\n". "<input type='hidden' name='f' value='".$this->forum['id']."' />\n". "<input type='hidden' name='auth_key' value='".$this->md5_check."' />\n". "<input type='hidden' name='removeattachid' value='0' />\n". $this->obj['hidden_field']; // Any other tags to add? if (isset($additional_tags)) { foreach($additional_tags as $k => $v) { $form .= "\n<input type='hidden' name='{$v[0]}' value='{$v[1]}' />"; } } return $form; } /*-------------------------------------------------------------------------*/ // HTML: name fields. // ------------------ // Returns the HTML for either text inputs or membername // depending if the member is a guest. /*-------------------------------------------------------------------------*/ function html_name_field() { return $this->ipsclass->member['id'] ? $this->ipsclass->compiled_templates['skin_post']->nameField_reg() : $this->ipsclass->compiled_templates['skin_post']->nameField_unreg( $this->ipsclass->input[UserName] ); } /*-------------------------------------------------------------------------*/ // HTML: Post body. // ------------------ // Returns the HTML for post area, code buttons and // post icons /*-------------------------------------------------------------------------*/ function html_post_body($raw_post="") { $this->ipsclass->lang['the_max_length'] = $this->ipsclass->vars['max_post_length'] * 1024; return $this->ipsclass->compiled_templates['skin_post']->postbox_wrap( $this->han_editor->show_editor( $raw_post, 'Post' ) ); } /*-------------------------------------------------------------------------*/ // HTML: Post Icons // ------------------ // Returns the HTML for post area, code buttons and // post icons /*-------------------------------------------------------------------------*/ function html_post_icons($post_icon="") { if ($this->ipsclass->input['iconid']) { $post_icon = $this->ipsclass->input['iconid']; } $this->ipsclass->lang['the_max_length'] = $this->ipsclass->vars['max_post_length'] * 1024; $html = $this->ipsclass->compiled_templates['skin_post']->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=['\"]checked['\"]/i" , "name='iconid' value='0'", $html ); } return $html; } /*-------------------------------------------------------------------------*/ // HTML: checkboxes // ------------------ // Returns the HTML for sig/emo/track boxes /*-------------------------------------------------------------------------*/ function html_checkboxes($type="", $tid="", $fid="") { $default_checked = array( 'sig' => 'checked="checked"', 'emo' => 'checked="checked"', 'tra' => $this->ipsclass->member['auto_track'] ? 'checked="checked"' : '' ); // Make sure we're not previewing them and they've been unchecked! if ( isset( $this->ipsclass->input['enablesig'] ) AND ( ! $this->ipsclass->input['enablesig'] ) ) { $default_checked['sig'] = ""; } if ( isset( $this->ipsclass->input['enableemo'] ) AND ( ! $this->ipsclass->input['enableemo'] ) ) { $default_checked['emo'] = ""; } if ( isset( $this->ipsclass->input['enabletrack'] ) AND ( ! $this->ipsclass->input['enabletrack'] ) ) { $default_checked['tra'] = ""; } else if ( isset( $this->ipsclass->input['enabletrack'] ) AND ( $this->ipsclass->input['enabletrack'] == 1 ) ) { $default_checked['tra'] = 'checked="checked"'; } $this->output = str_replace( '<!--IBF.EMO-->' , $this->ipsclass->compiled_templates['skin_post']->get_box_enableemo( $default_checked['emo'] ) , $this->output ); if ( $this->ipsclass->member['id'] ) { $this->output = str_replace( '<!--IBF.SIG-->' , $this->ipsclass->compiled_templates['skin_post']->get_box_enablesig( $default_checked['sig'] ) , $this->output ); } if ( $this->ipsclass->cache['forum_cache'][$fid]['use_html'] and $this->ipsclass->cache['group_cache'][ $this->ipsclass->member['mgroup'] ]['g_dohtml'] ) { $this->output = str_replace( '<!--IBF.HTML-->' , $this->ipsclass->compiled_templates['skin_post']->get_box_html( array( intval($this->ipsclass->input['post_htmlstatus']) => ' selected="selected"' ) ), $this->output ); } if ( $type == 'reply' ) { if ( $tid and $this->ipsclass->member['id'] ) { $this->ipsclass->DB->simple_construct( array( 'select' => 'trid', 'from' => 'tracker', 'where' => "topic_id=$tid AND member_id=".$this->ipsclass->member['id'] ) ); $this->ipsclass->DB->simple_exec(); if ( $this->ipsclass->DB->get_num_rows() ) { $this->output = str_replace( '<!--IBF.TRACK-->',$this->ipsclass->compiled_templates['skin_post']->get_box_alreadytrack(), $this->output ); } else { $this->output = str_replace( '<!--IBF.TRACK-->', $this->ipsclass->compiled_templates['skin_post']->get_box_enabletrack( $default_checked['tra'] ), $this->output ); } } } else if ( $type != 'edit' ) { if ( $this->ipsclass->member['id'] ) { $this->output = str_replace( '<!--IBF.TRACK-->', $this->ipsclass->compiled_templates['skin_post']->get_box_enabletrack( $default_checked['tra'] ), $this->output ); } } } /*-------------------------------------------------------------------------*/ // HTML: add smilie box. // ------------------ // Inserts the clickable smilies box /*-------------------------------------------------------------------------*/ function html_add_smilie_box($in_html="") { $show_table = 0; $count = 0; $smilies = "<tr align='center'>\n"; $smilie_id = 0; $total = 0; //----------------------------------------- // Get the smilies from the DB //----------------------------------------- if ( ! is_array( $this->ipsclass->cache['emoticons'] ) ) { $this->ipsclass->cache['emoticons'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => 'typed,image,clickable,emo_set', 'from' => 'emoticons' ) ); $this->ipsclass->DB->simple_exec(); while ( $r = $this->ipsclass->DB->fetch_row() ) { $this->ipsclass->cache['emoticons'][] = $r; } } usort( $this->ipsclass->cache['emoticons'] , array( 'class_post', 'smilie_alpha_sort' ) ); foreach( $this->ipsclass->cache['emoticons'] as $get => $clickable ) { if( $clickable['clickable'] ) { $total++; } } foreach( $this->ipsclass->cache['emoticons'] as $a_id => $elmo ) { if ( $elmo['emo_set'] != $this->ipsclass->skin['_emodir'] ) { continue; } if ( ! $elmo['clickable'] ) { continue; } $show_table++; $count++; $smilie_id++; //----------------------------------------- // Make single quotes as URL's with html entites in them // are parsed by the browser, so ' causes JS error :o //----------------------------------------- if (strstr( $elmo['typed'], "'" ) ) { $in_delim = '"'; $out_delim = "'";
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?