📄 post_q_reply_post.php
字号:
<?php
class post_functions extends post
{
var $nav = array( );
var $title = "";
var $post = array( );
var $topic = array( );
var $upload = array( );
var $mod_topic = array( );
var $quoted_post = array( );
var $quoted_post_author = array( );
var $m_group = "";
function post_functions( $class )
{
global $ibforums;
global $std;
global $DB;
$DB->query( "SELECT * FROM ibf_topics WHERE forum_id='".$class->forum['id']."' AND tid='".$ibforums->input['t']."'" );
$this->topic = $DB->fetch_row( );
if ( !$this->topic['tid'] )
{
$std->error( array( 1, "missing_files" ) );
}
if ( $this->topic['poll_state'] == "closed" && $ibforums->member['g_is_supadmin'] != 1 )
{
$std->error( array( 1, "no_replies" ) );
}
if ( $this->topic['starter_id'] == $ibforums->member['id'] && !$ibforums->member['g_reply_own_topics'] )
{
$std->error( array( 1, "no_replies" ) );
}
if ( $this->topic['starter_id'] != $ibforums->member['id'] && !$ibforums->member['g_reply_own_topics'] )
{
$std->error( array( 1, "no_replies" ) );
}
$this->m_group = $ibforums->member['mgroup'];
if ( $class->forum['reply_perms'] != "*" && !preg_match( "/(^|,){$this->m_group}(,|\$)/", $class->forum['reply_perms'] ) )
{
$std->error( array( 1, "no_replies" ) );
}
if ( $this->topic['state'] != "open" && $ibforums->member['g_post_closed'] != 1 )
{
$std->error( array( 1, "locked_topic" ) );
}
}
function process( $class )
{
global $ibforums;
global $std;
global $DB;
global $print;
$this->post = $class->compile_post( );
if ( $ibforums->input['QPost'] )
{
$this->quoted_post['post'] = $class->parser->convert( array(
"TEXT" => $ibforums->input['QPost'],
"SMILIES" => $ibforums->input['enableemo'],
"CODE" => 1,
"HTML" => 0
) );
$this->quoted_post['AUTHOR']['name'] = $ibforums->input['QAuthorN'];
$this->quoted_post['DATE'] = $std->get_date( $ibforums->input['QDate'], "LONG" );
$html = $class->parser->wrap_style( array(
"STYLE" => "QUOTE",
"EXTRA" => "(".$this->quoted_post['AUTHOR']['name']." @ ".$this->quoted_post['DATE'].")"
) );
if ( $class->obj['preview_post'] == "" )
{
$this->post['post'] = "<!--QuoteBegin--{$this->quoted_post['AUTHOR']['name']}+{$this->quoted_post['DATE']}-->"."{$html['START']}<!--QuoteEBegin--> ".trim( $this->quoted_post['post'] )." <!--QuoteEnd--> "."{$html['END']} <!--QuoteEEnd--><br>".$this->post['post'];
}
else
{
$class->dump_quote = "[QUOTE=".$this->quoted_post['AUTHOR']['name'].",".$this->quoted_post['DATE']."]".$ibforums->input['QPost']."[/QUOTE]"."\n";
}
}
if ( $class->obj['post_errors'] == "" )
{
$this->upload = $class->process_upload( );
}
if ( $class->obj['post_errors'] != "" || $class->obj['preview_post'] != "" )
{
$this->show_form( $class );
}
else
{
$this->add_reply( $class );
}
}
function add_reply( $class )
{
global $ibforums;
global $std;
global $DB;
global $print;
$this->post['attach_id'] = $this->upload['attach_id'];
$this->post['attach_type'] = $this->upload['attach_type'];
$this->post['attach_hits'] = $this->upload['attach_hits'];
$this->post['attach_file'] = $this->upload['attach_file'];
$this->post['topic_id'] = $this->topic['tid'];
$return_to_move = 0;
if ( $ibforums->input['mod_options'] != "" || $ibforums->input['mod_options'] != "nowt" )
{
if ( $ibforums->input['mod_options'] == "pin" )
{
if ( $ibforums->member['g_is_supmod'] == 1 || $class->moderator['pin_topic'] == 1 )
{
$this->topic['pinned'] = 1;
$class->moderate_log( "Pinned topic from post form", $this->topic['title'] );
}
}
else if ( $ibforums->input['mod_options'] == "close" )
{
if ( $ibforums->member['g_is_supmod'] == 1 || $class->moderator['close_topic'] == 1 )
{
$this->topic['state'] = "closed";
$class->moderate_log( "Closed topic from post form", $this->topic['title'] );
}
}
else if ( $ibforums->input['mod_options'] == "move" && ( $ibforums->member['g_is_supmod'] == 1 || $class->moderator['move_topic'] == 1 ) )
{
$return_to_move = 1;
}
}
$db_string = $std->compile_db_string( $this->post );
$DB->query( "INSERT INTO ibf_posts (".$db_string['FIELD_NAMES'].") VALUES (".$db_string['FIELD_VALUES'].")" );
$this->post['pid'] = $DB->get_insert_id( );
if ( $class->obj['moderate'] )
{
$print->redirect_screen( $ibforums->lang['moderate_post'], "act=ST&f={$class->forum['id']}&t={$this->topic['tid']}" );
}
if ( $this->upload['attach_id'] )
{
$attached = $this->topic['attached'] + 1;
}
else if ( 1 <= $this->topic['attached'] )
{
$attached = $this->topic['attached'];
}
else
{
$attached = "0";
}
$DB->query( "UPDATE ibf_topics SET attached='".$attached."' WHERE tid='".$this->topic['tid']."'" );
$class->forum['last_title'] = $this->topic['title'];
$class->forum['last_id'] = $this->topic['tid'];
$class->forum['last_post'] = time( );
$class->forum['last_poster_name'] = $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'];
$class->forum['last_poster_id'] = $ibforums->member['id'];
++$class->forum['posts'];
if ( 30 < strlen( $class->forum['last_title'] ) )
{
$class->forum['last_title'] = substr( $class->forum['last_title'], 0, 27 )."...";
}
$DB->query( "UPDATE ibf_forums SET last_title='".$class->forum['last_title']."', "."last_id='".$class->forum['last_id']."', "."last_post='".$class->forum['last_post']."', "."last_poster_name='".$class->forum['last_poster_name']."', "."last_poster_id='".$class->forum['last_poster_id']."', "."posts='".$class->forum['posts']."' "."WHERE id='".$class->forum['id']."'" );
$DB->query( "UPDATE ibf_topics SET last_poster_id='".$class->forum['last_poster_id']."', "."last_poster_name='".$class->forum['last_poster_name']."', "."last_post='".$class->forum['last_post']."', "."pinned='".$this->topic['pinned']."', "."state='".$this->topic['state']."', "."posts=posts+1 "."WHERE tid='".$this->topic['tid']."'" );
$DB->query( "UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1" );
$pcount = "";
if ( $ibforums->member['id'] )
{
if ( $class->forum['inc_postcount'] )
{
$val = 10;
$money = "money=money+{$val}, ";
$pcount = "posts=posts+1, ";
}
if ( $ibforums->member['g_promotion'] != "-1&-1" )
{
list( $gid, $gposts ) = explode( "&", $ibforums->member['g_promotion'] );
if ( 0 < $gid && 0 < $gposts && $gposts <= $ibforums->member['posts'] + 1 )
{
$mgroup = "mgroup='{$gid}', ";
}
}
$ibforums->member['last_post'] = time( );
$DB->query( "UPDATE ibf_members SET ".$pcount.$money.$mgroup."last_post='".$ibforums->member['last_post']."'"."WHERE id='".$ibforums->member['id']."'" );
}
if ( $ibforums->member['auto_track'] == 1 )
{
$DB->query( "SELECT trid FROM ibf_tracker WHERE topic_id='".$this->topic['tid']."' AND member_id='".$ibforums->member['id']."'" );
if ( !$DB->get_num_rows( ) )
{
$db_string = $DB->compile_db_insert_string( array(
"member_id" => $ibforums->member['id'],
"topic_id" => $this->topic['tid'],
"start_date" => time( )
) );
$DB->query( "INSERT INTO ibf_tracker ({$db_string['FIELD_NAMES']}) VALUES ({$db_string['FIELD_VALUES']})" );
}
}
$class->topic_tracker( $this->topic['tid'], $this->post['post'], $class->forum['last_poster_name'], $this->topic['last_post'] );
if ( $return_to_move == 1 )
{
$std->boink_it( $class->base_url."&act=Mod&CODE=02&f={$class->forum['id']}&t={$this->topic['tid']}" );
}
else
{
$page = floor( ( $this->topic['posts'] + 1 ) / $ibforums->vars['display_max_posts'] );
$page = $page * $ibforums->vars['display_max_posts'];
$std->boink_it( $class->base_url."&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}&st={$page}&#entry{$this->post['pid']}" );
}
}
function show_form( $class )
{
global $ibforums;
global $std;
global $DB;
global $print;
global $HTTP_POST_VARS;
$raw_post = isset( $HTTP_POST_VARS['Post'] ) ? $HTTP_POST_VARS['Post'] : "";
if ( isset( $raw_post ) )
{
$raw_post = str_replace( "\$", "$", htmlspecialchars( $raw_post ) );
$raw_post = stripslashes( $raw_post );
if ( $class->dump_quote != "" )
{
$raw_post = str_replace( "<br>", "\n", $class->dump_quote ).$raw_post;
}
}
$DB->query( "SELECT post, author_id, author_name, post_date, pid FROM ibf_posts WHERE pid='".$ibforums->input['p']."'" );
$this->quoted_post = $DB->fetch_row( );
$this->quoted_post['post'] = trim( $class->parser->unconvert( $this->quoted_post['post'] ) );
if ( $ibforums->vars['strip_quotes'] )
{
$this->quoted_post['post'] = preg_replace( "#\\[QUOTE(=.+?,.+?)?\\].+?\\[/QUOTE\\]#i", "", $this->quoted_post['post'] );
}
if ( $class->obj['post_errors'] )
{
$class->output .= $class->html->errors( $ibforums->lang[$class->obj['post_errors']] );
}
if ( $class->obj['preview_post'] )
{
$class->output .= $class->html->preview( $class->parser->convert( array(
"TEXT" => $class->dump_quote.$this->post['post'],
"CODE" => $class->forum['use_ibc'],
"SMILIES" => $ibforums->input['enableemo'],
"HTML" => $class->forum['use_html']
) ) );
}
$class->check_upload_ability( );
$class->output .= $class->html_start_form( array(
1 => array( "CODE", "07" ),
2 => array(
"t",
$this->topic['tid']
),
3 => array(
"p",
$ibforums->input['p']
)
) );
$class->output .= $class->html->table_structure( );
$start_table = $class->html->table_top( "{$ibforums->lang['top_txt_reply']} {$this->topic['title']}" );
$name_fields = $class->html_name_field( );
if ( !$class->obj['preview_post'] )
{
$quote_box = $class->html->quote_box( $this->quoted_post );
}
$post_box = $class->html_post_body( $raw_post );
$mod_options = $class->mod_options( 1 );
$end_form = $class->html->endform( $ibforums->lang['submit_reply'] );
$post_icons = $class->html_post_icons( );
if ( $class->obj['can_upload'] )
{
$upload_field = $class->html->upload_field( $ibforums->member['g_attach_max'] * 1024 );
}
$class->output = preg_replace( "/<!--START TABLE-->/", "{$start_table}", $class->output );
$class->output = preg_replace( "/<!--NAME FIELDS-->/", "{$name_fields}", $class->output );
$class->output = preg_replace( "/<!--POST BOX-->/", "{$post_box}", $class->output );
$class->output = preg_replace( "/<!--POST ICONS-->/", "{$post_icons}", $class->output );
$class->output = preg_replace( "/<!--UPLOAD FIELD-->/", "{$upload_field}", $class->output );
$class->output = preg_replace( "/<!--MOD OPTIONS-->/", "{$mod_options}", $class->output );
$class->output = preg_replace( "/<!--END TABLE-->/", "{$end_form}", $class->output );
$class->output = preg_replace( "/<!--QUOTE BOX-->/", "{$quote_box}", $class->output );
$class->html_add_smilie_box( );
$class->html_topic_summary( $this->topic['tid'] );
$this->nav = array(
"<a href='{$class->base_url}&act=SC&c={$class->forum[cat_id]}'>{$class->forum['cat_name']}</a>",
"<a href='{$class->base_url}&act=SF&f={$class->forum['id']}'>{$class->forum['name']}</a>",
"<a href='{$class->base_url}&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>"
);
$this->title = $ibforums->lang['quoting_post']." ".$this->topic['title'];
$print->add_output( "{$class->output}" );
$print->do_output( array(
"TITLE" => $ibforums->vars['board_name']." -> ".$this->title,
"JS" => 1,
"NAV" => $this->nav
) );
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -