Version 2.2.0 RC-1

This commit is contained in:
Neo committed 2025-12-19 00:22:37 -08:00
1 parent f73f8bff6d
commit 22f1b963ee
1034 files changed
+178610 -70897

No files matched your search

+140 -67
View File
@@ -2,28 +2,18 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2006-01-11 22:47:48 +0000 (Wed, 11 Jan 2006) $
| > $Revision: 122 $
| > $Author: bfarber $
| > $Date: 2006-10-11 13:55:47 +0100 (Wed, 11 Oct 2006) $
| > $Revision: 624 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
| > Post Sub-Class
@@ -33,6 +23,12 @@
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class post_functions extends class_post
{
var $nav = array();
@@ -62,15 +58,22 @@ class post_functions extends class_post
// Set up post key
//-----------------------------------------
$this->post_key = $this->ipsclass->input['post_key'] ? $this->ipsclass->input['post_key'] : md5( microtime() );
$this->post_key = ( isset($this->ipsclass->input['attach_post_key']) AND $this->ipsclass->input['attach_post_key'] != "" ) ? $this->ipsclass->input['attach_post_key'] : md5( microtime() );
//-----------------------------------------
// Lets load the topic from the database
// before we do anything else.
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "forum_id=".intval($this->forum['id'])." AND tid=".intval($this->ipsclass->input['t']) ) );
$this->ipsclass->DB->simple_exec();
$this->ipsclass->DB->build_query( array( 'select' => 't.*, p.poll_only',
'from' => array( 'topics' => 't' ),
'where' => "t.forum_id=".intval($this->forum['id'])." AND t.tid=".intval($this->ipsclass->input['t']),
'add_join' => array( 1 => array( 'type' => 'left',
'from' => array( 'polls' => 'p' ),
'where' => 'p.tid=t.tid'
) )
) );
$this->ipsclass->DB->exec_query();
$this->topic = $this->ipsclass->DB->fetch_row();
@@ -131,30 +134,6 @@ class post_functions extends class_post
$this->convert_open_close_times();
//-----------------------------------------
// Did we remove an attachment?
//-----------------------------------------
if ( $this->ipsclass->input['removeattachid'] )
{
if ( $this->ipsclass->input[ 'removeattach_'. $this->ipsclass->input['removeattachid'] ] )
{
$this->pf_remove_attachment( intval($this->ipsclass->input['removeattachid']), $this->post_key );
$this->show_form();
}
}
//-----------------------------------------
// Did we add an attachment?
//-----------------------------------------
if ( $this->ipsclass->input['attachgo'] )
{
$this->obj['post_errors'] = "";
$this->upload_id = $this->process_upload();
$this->show_form();
}
//-----------------------------------------
// Parse the post, and check for any errors.
//-----------------------------------------
@@ -167,22 +146,65 @@ class post_functions extends class_post
$this->poll_questions = $this->compile_poll();
if ($this->obj['post_errors'] == "")
{
$this->upload = $this->process_upload();
}
if ( ($this->obj['post_errors'] != "") or ($this->obj['preview_post'] != "") )
{
//-----------------------------------------
// Show the form again
//-----------------------------------------
$this->show_form($class);
$this->show_form();
}
else
{
$this->save_post($class);
//-----------------------------------------
// Guest w/ CAPTCHA?
//-----------------------------------------
if( $this->ipsclass->member['id'] == 0 AND $this->ipsclass->vars['guest_captcha'] )
{
//-----------------------------------------
// Security code stuff
//-----------------------------------------
if( isset($this->ipsclass->input['fast_reply_used']) AND $this->ipsclass->input['fast_reply_used'] == 1 )
{
$this->obj['post_errors'] = 'reg_code_enter';
$this->show_form();
return;
}
if ($this->ipsclass->input['imgid'] == "")
{
$this->obj['post_errors'] = 'err_reg_code';
$this->show_form();
return;
}
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
'from' => 'reg_antispam',
'where' => "regid='".trim($this->ipsclass->txt_alphanumerical_clean($this->ipsclass->input['imgid']))."'"
) );
$this->ipsclass->DB->simple_exec();
if ( ! $row = $this->ipsclass->DB->fetch_row() )
{
$this->obj['post_errors'] = 'err_reg_code';
$this->show_form();
return;
}
if ( trim( $this->ipsclass->txt_alphanumerical_clean($this->ipsclass->input['captcha']) ) != $row['regcode'] )
{
$this->obj['post_errors'] = 'err_reg_code';
$this->show_form();
return;
}
$this->ipsclass->DB->do_delete( 'reg_antispam', "regid='".trim($this->ipsclass->txt_alphanumerical_clean($this->ipsclass->input['imgid']))."'" );
}
$this->save_post();
}
}
@@ -212,6 +234,8 @@ class post_functions extends class_post
$return_to_move = 0;
$this->ipsclass->input['mod_options'] = isset($this->ipsclass->input['mod_options']) ? $this->ipsclass->input['mod_options'] : '';
if ( ($this->ipsclass->input['mod_options'] != "") or ($this->ipsclass->input['mod_options'] != 'nowt') )
{
if ($this->ipsclass->input['mod_options'] == 'pin')
@@ -304,6 +328,20 @@ class post_functions extends class_post
{
$new_post = $last_post['post'].'<br /><br />'.$this->post['post'];
//-----------------------------------------
// Make sure we don't have too many images
//-----------------------------------------
$new_post = $this->parser->pre_edit_parse( $new_post );
$new_post = $this->parser->pre_db_parse( $new_post );
if( $this->parser->error )
{
$this->obj['post_errors'] = 'merge_'.$this->parser->error;
$this->show_form($class);
return;
}
//-----------------------------------------
// Update post row
//-----------------------------------------
@@ -332,7 +370,7 @@ class post_functions extends class_post
//-----------------------------------------
$this->post['post_key'] = $this->post_key;
$this->post['post_parent'] = intval($this->ipsclass->input['parent_id']);
$this->post['post_parent'] = isset($this->ipsclass->input['parent_id']) ? intval($this->ipsclass->input['parent_id']) : 0;
//-----------------------------------------
// Typecast
@@ -413,6 +451,13 @@ class post_functions extends class_post
if ( count( $this->poll_questions ) AND $this->can_add_poll )
{
$poll_only = 0;
if( $this->ipsclass->vars['ipb_poll_only'] AND $this->ipsclass->input['poll_only'] == 1 )
{
$poll_only = 1;
}
$this->ipsclass->DB->do_insert( 'polls',
array (
'tid' => $this->topic['tid'],
@@ -422,6 +467,7 @@ class post_functions extends class_post
'starter_id' => $this->ipsclass->member['id'],
'votes' => 0,
'poll_question' => $this->ipsclass->input['poll_question'],
'poll_only' => $poll_only,
) );
}
@@ -438,8 +484,8 @@ class post_functions extends class_post
//-----------------------------------------
// Make attachments "permanent"
//-----------------------------------------
$this->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->post['pid']);
$this->pf_make_attachments_permanent( $this->post_key, $this->post['pid'], 'post', array( 'topic_id' => $this->topic['tid'] ) );
//-----------------------------------------
// MAKE SURE ATTACHMENTS FOR MERGED POSTS
@@ -452,7 +498,7 @@ class post_functions extends class_post
// Update attachments
//-----------------------------------------
$this->ipsclass->DB->do_update( 'attachments', array( 'attach_post_key' => $this->post['post_key'] ), 'attach_pid='.$this->post['pid'] );
$this->ipsclass->DB->do_update( 'attachments', array( 'attach_post_key' => $this->post['post_key'] ), "attach_rel_module='post' AND attach_rel_id=".$this->post['pid'] );
}
//-----------------------------------------
@@ -536,20 +582,20 @@ class post_functions extends class_post
// Do we have any posting errors?
//-----------------------------------------
if ( $this->obj['post_errors'] )
if ( isset($this->obj['post_errors']) AND $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'] )
if ( isset($this->obj['preview_post']) AND $this->obj['preview_post'] )
{
$this->output .= $this->ipsclass->compiled_templates['skin_post']->preview( $this->show_post_preview( $this->post['post'] ) );
$this->output .= $this->ipsclass->compiled_templates['skin_post']->preview( $this->show_post_preview( $this->post['post'], $this->post_key ) );
}
$this->output .= $this->html_start_form( array( 1 => array( 'CODE' , '03' ),
2 => array( 't' , $this->topic['tid'] ),
3 => array( 'post_key' , $this->post_key ),
4 => array( 'parent_id', $this->ipsclass->input['parent_id'] ),
$this->output .= $this->html_start_form( array( 1 => array( 'CODE' , '03' ),
2 => array( 't' , $this->topic['tid'] ),
3 => array( 'attach_post_key' , $this->post_key ),
4 => array( 'parent_id' , isset($this->ipsclass->input['parent_id']) ? intval($this->ipsclass->input['parent_id']) : 0 ),
) );
//-----------------------------------------
@@ -574,6 +620,9 @@ class post_functions extends class_post
// Still here?
//-----------------------------------------
$poll_box = "";
$upload_field = "";
if ( $this->can_add_poll )
{
//-----------------------------------------
@@ -582,10 +631,14 @@ class post_functions extends class_post
//-----------------------------------------
$poll_questions = "";
$poll_question = "";
$poll_choices = "";
$show_open = 0;
$poll_votes = "";
$poll_only = "";
$poll_multi = "";
if ( is_array( $_POST['question'] ) and count( $_POST['question'] ) )
if ( isset($_POST['question']) AND is_array( $_POST['question'] ) and count( $_POST['question'] ) )
{
foreach( $_POST['question'] as $id => $question )
{
@@ -596,7 +649,15 @@ class post_functions extends class_post
$show_open = 1;
}
if ( is_array( $_POST['choice'] ) and count( $_POST['choice'] ) )
if ( isset($_POST['multi']) AND is_array( $_POST['multi'] ) and count( $_POST['multi'] ) )
{
foreach( $_POST['multi'] as $id => $checked )
{
$poll_multi .= "\t{$id} : '{$checked}',\n";
}
}
if ( isset($_POST['choice']) AND is_array( $_POST['choice'] ) and count( $_POST['choice'] ) )
{
foreach( $_POST['choice'] as $id => $choice )
{
@@ -604,19 +665,27 @@ class post_functions extends class_post
}
}
$poll_only = 0;
if( $this->ipsclass->vars['ipb_poll_only'] AND isset($this->ipsclass->input['poll_only']) AND $this->ipsclass->input['poll_only'] == 1 )
{
$poll_only = "checked='checked'";
}
//-----------------------------------------
// Trim off trailing commas (Safari hates it)
//-----------------------------------------
$poll_questions = preg_replace( "#,(\n)?$#", "\\1", $poll_questions );
$poll_choices = preg_replace( "#,(\n)?$#", "\\1", $poll_choices );
$poll_multi = preg_replace( "#,(\n)?$#", "\\1", $poll_multi );
$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 );
$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, 0, $poll_multi, $poll_only );
}
if ( $this->can_upload )
{
$upload_field = $this->html_build_uploads($this->post_key,'reply');
$upload_field = $this->html_build_uploads( $this->post_key,'reply' );
}
$this->output = str_replace( "<!--START TABLE-->" , $start_table , $this->output );
@@ -629,8 +698,6 @@ class post_functions extends class_post
$this->output = str_replace( "<!--END TABLE-->" , $end_form , $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
//-----------------------------------------
@@ -643,6 +710,12 @@ class post_functions extends class_post
$this->title = $this->ipsclass->lang['replying_in'].' '.$this->topic['title'];
//-----------------------------------------
// Reset multi-quote cookie
//-----------------------------------------
$this->ipsclass->my_setcookie('mqtids', ',', 0);
$this->ipsclass->print->add_output( $this->output );
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->vars['board_name']." -> ".$this->title,