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

+111 -70
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: 2005-12-22 15:20:25 +0000 (Thu, 22 Dec 2005) $
| > $Revision: 105 $
| > $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();
@@ -47,6 +43,8 @@ class post_functions extends class_post
var $has_poll = 0;
var $poll_questions = array();
var $orig_post;
/*-------------------------------------------------------------------------*/
// Sub class init
/*-------------------------------------------------------------------------*/
@@ -64,8 +62,8 @@ class post_functions extends class_post
// Check permissions
//-----------------------------------------
$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() );
$this->check_for_new_topic();
}
@@ -81,30 +79,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.
//-----------------------------------------
@@ -141,15 +115,6 @@ class post_functions extends class_post
$this->poll_questions = $this->compile_poll();
//-----------------------------------------
// If we don't have any errors yet, parse the upload
//-----------------------------------------
if ($this->obj['post_errors'] == "")
{
$this->upload = $this->process_upload();
}
if ( ($this->obj['post_errors'] != "") or ( $this->obj['preview_post'] != "" ) )
{
//-----------------------------------------
@@ -160,6 +125,47 @@ class post_functions extends class_post
}
else
{
//-----------------------------------------
// Guest w/ CAPTCHA?
//-----------------------------------------
if( $this->ipsclass->member['id'] == 0 AND $this->ipsclass->vars['guest_captcha'] )
{
//-----------------------------------------
// Security code stuff
//-----------------------------------------
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();
}
}
@@ -179,9 +185,13 @@ class post_functions extends class_post
$this->ipsclass->input['TopicTitle'] = $this->parser->bad_words( $this->ipsclass->input['TopicTitle'] );
$this->ipsclass->input['TopicDesc'] = $this->parser->bad_words( $this->ipsclass->input['TopicDesc'] );
$this->ipsclass->input['TopicDesc'] = $this->ipsclass->txt_mbsubstr( $this->ipsclass->input['TopicDesc'], 0, 70 );
$pinned = 0;
$state = 'open';
$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')
@@ -190,7 +200,7 @@ class post_functions extends class_post
{
$pinned = 1;
$this->moderate_log('Òåìà áûëà «ïîäíÿòà» ïðè åå ïóáëèêàöèè', $this->ipsclass->input['TopicTitle']);
$this->moderate_log('Pinned topic from post form', $this->ipsclass->input['TopicTitle']);
}
}
else if ($this->ipsclass->input['mod_options'] == 'close')
@@ -199,7 +209,7 @@ class post_functions extends class_post
{
$state = 'closed';
$this->moderate_log('Òåìà áûëà çàêðûòà ïðè åå ïóáëèêàöèè', $this->ipsclass->input['TopicTitle']);
$this->moderate_log('Closed topic from post form', $this->ipsclass->input['TopicTitle']);
}
}
else if ($this->ipsclass->input['mod_options'] == 'pinclose')
@@ -209,7 +219,7 @@ class post_functions extends class_post
$pinned = 1;
$state = 'closed';
$this->moderate_log('Òåìà áûëà «ïîäíÿòà» è çàêðûòà ïðè åå ïóáëèêàöèè', $this->ipsclass->input['TopicTitle']);
$this->moderate_log('Pinned & closed topic from post form', $this->ipsclass->input['TopicTitle']);
}
}
}
@@ -239,7 +249,7 @@ class post_functions extends class_post
'last_poster_id' => $this->ipsclass->member['id'],
'last_poster_name' => $this->ipsclass->member['id'] ? $this->ipsclass->member['members_display_name'] : $this->ipsclass->input['UserName'],
'last_post' => time(),
'icon_id' => $this->ipsclass->input['iconid'],
'icon_id' => intval($this->ipsclass->input['iconid']),
'author_mode' => $this->ipsclass->member['id'] ? 1 : 0,
'poll_state' => ( count( $this->poll_questions ) AND $this->can_add_poll ) ? 1 : 0,
'last_vote' => 0,
@@ -247,8 +257,8 @@ class post_functions extends class_post
'forum_id' => $this->forum['id'],
'approved' => ( $this->obj['moderate'] == 1 || $this->obj['moderate'] == 2 ) ? 0 : 1,
'pinned' => $pinned,
'topic_open_time' => $this->times['open'],
'topic_close_time' => $this->times['close'],
'topic_open_time' => intval( $this->times['open'] ),
'topic_close_time' => intval( $this->times['close'] ),
);
//-----------------------------------------
@@ -305,6 +315,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'],
@@ -314,6 +331,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,
) );
}
@@ -328,7 +346,7 @@ 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'] ) );
//-----------------------------------------
// If we are a member, lets update thier last post
@@ -396,18 +414,18 @@ 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'] )
{
$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' , '01' ),
2 => array( 'post_key', $this->post_key ),
$this->output .= $this->html_start_form( array( 1 => array( 'CODE' , '01' ),
2 => array( 'attach_post_key', $this->post_key ),
) );
//-----------------------------------------
@@ -434,6 +452,8 @@ class post_functions extends class_post
// POLL BOX
//-----------------------------------------
$poll_box = "";
if ( $this->can_add_poll )
{
//-----------------------------------------
@@ -442,10 +462,14 @@ class post_functions extends class_post
//-----------------------------------------
$poll_questions = "";
$poll_question = "";
$poll_votes = "";
$poll_choices = "";
$show_open = 0;
$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 )
{
@@ -456,7 +480,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 )
{
@@ -464,24 +496,29 @@ 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_multi = preg_replace( "#,(\n)?$#", "\\1", $poll_multi );
$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 );
$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 );
}
//-----------------------------------------
// UPLOAD BOX
//-----------------------------------------
if ( $this->can_upload )
{
$upload_field = $this->html_build_uploads( $this->post_key, 'new' );
}
$upload_field = $this->can_upload ? $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 );
@@ -494,8 +531,6 @@ class post_functions extends class_post
$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
//-----------------------------------------
@@ -506,6 +541,12 @@ class post_functions extends class_post
$this->show_post_navigation();
//-----------------------------------------
// 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,
'JS' => 1,