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

+173 -106
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
@@ -32,6 +22,11 @@
+--------------------------------------------------------------------------
*/
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
{
@@ -94,7 +89,7 @@ class post_functions extends class_post
{
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-----------------------------------------
// Generate post key (do we have one?)
//-----------------------------------------
@@ -110,7 +105,7 @@ class post_functions extends class_post
$this->ipsclass->DB->do_update( 'posts', array( 'post_key' => $this->post_key ), 'pid='.$this->orig_post['pid'] );
$this->ipsclass->DB->do_update( 'attachments', array( 'attach_post_key' => $this->post_key ), 'attach_pid='.$this->orig_post['pid'] );
$this->ipsclass->DB->do_update( 'attachments', array( 'attach_post_key' => $this->post_key ), "attach_rel_module='post' AND attach_rel_id=".$this->orig_post['pid'] );
}
else
{
@@ -121,11 +116,22 @@ class post_functions extends class_post
// Load the moderator
//-----------------------------------------
if ($this->ipsclass->member['id'])
if ( $this->ipsclass->member['id'] )
{
$other_mgroups = array();
if( $this->ipsclass->member['mgroup_others'] )
{
$other_mgroups = explode( ",", $this->ipsclass->clean_perm_string( $this->ipsclass->member['mgroup_others'] ) );
}
$other_mgroups[] = $this->ipsclass->member['mgroup'];
$mgroups = implode( ",", $other_mgroups );
$this->ipsclass->DB->simple_construct( array( 'select' => 'member_id, member_name, mid, edit_post, edit_topic',
'from' => 'moderators',
'where' => "forum_id=".$this->forum['id']." AND (member_id='".$this->ipsclass->member['id']."' OR (is_group=1 AND group_id='".$this->ipsclass->member['mgroup']."'))" ) );
'where' => "forum_id=".$this->forum['id']." AND (member_id='".$this->ipsclass->member['id']."' OR (is_group=1 AND group_id IN(".$mgroups.")))" ) );
$this->ipsclass->DB->simple_exec();
@@ -144,7 +150,7 @@ class post_functions extends class_post
$can_edit = 1;
}
if ($this->moderator['edit_post'])
if ( $this->moderator['edit_post'] )
{
$can_edit = 1;
}
@@ -155,7 +161,7 @@ class post_functions extends class_post
// Have we set a time limit?
//-----------------------------------------
if ($this->ipsclass->member['g_edit_cutoff'] > 0)
if ( $this->ipsclass->member['g_edit_cutoff'] > 0 )
{
if ( $this->orig_post['post_date'] > ( time() - ( intval($this->ipsclass->member['g_edit_cutoff']) * 60 ) ) )
{
@@ -184,33 +190,40 @@ class post_functions extends class_post
//-----------------------------------------
# For edit, this means there is a poll and we have perm to edit
$this->can_add_poll = 0;
$this->can_add_poll = 0;
$this->can_add_poll_mod = 0;
if ( $this->orig_post['new_topic'] == 1 )
{
if ( $this->ipsclass->member['g_is_supmod'] == 1 )
{
$this->edit_title = 1;
$this->edit_title = 1;
$this->can_add_poll_mod = 1;
if ( $this->topic['poll_state'] )
{
//if ( $this->topic['poll_state'] )
//{
$this->can_add_poll = 1;
}
//}
}
else if ( $this->moderator['edit_topic'] == 1 )
{
$this->edit_title = 1;
$this->edit_title = 1;
$this->can_add_poll_mod = 1;
if ( $this->topic['poll_state'] )
{
//if ( $this->topic['poll_state'] )
//{
$this->can_add_poll = 1;
}
//}
}
else if ( $this->ipsclass->member['g_edit_topic'] == 1 )
{
$this->edit_title = 1;
}
else if ( $can_edit )
{
$this->can_add_poll = 1;
}
}
}
@@ -239,17 +252,6 @@ class post_functions extends class_post
}
}
//-----------------------------------------
// 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.
// overwrites saved post intentionally
@@ -267,22 +269,17 @@ class post_functions extends class_post
// Check for errors
//-----------------------------------------
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);
$this->save_post( );
}
}
@@ -311,7 +308,7 @@ class post_functions extends class_post
// If the post icon has changed, update the topic post icon
//-----------------------------------------
if ($this->orig_post['new_topic'] == 1)
if ( $this->orig_post['new_topic'] == 1 )
{
if ($this->post['icon_id'] != $this->orig_post['icon_id'])
{
@@ -375,38 +372,64 @@ class post_functions extends class_post
}
}
//-----------------------------------------
// Update poll
//-----------------------------------------
if ( $this->can_add_poll )
{
if ( is_array( $this->poll_questions ) AND count( $this->poll_questions ) )
{
$poll_only = 0;
if ( $this->ipsclass->vars['ipb_poll_only'] AND $this->ipsclass->input['poll_only'] == 1 )
{
$poll_only = 1;
}
if ( $this->topic['poll_state'] )
{
$this->ipsclass->DB->do_update( 'polls', array( 'votes' => intval($this->poll_total_votes),
'choices' => addslashes(serialize( $this->poll_questions )),
'poll_question' => $this->ipsclass->input['poll_question'],
'poll_only' => $poll_only,
), 'tid='.$this->topic['tid'] );
}
else
{
$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'],
'poll_only' => $poll_only,
) );
$this->ipsclass->DB->do_update( 'topics', array( 'poll_state' => 1, 'last_vote' => 0, 'total_votes' => 0 ), 'tid='.$this->topic['tid'] );
}
}
else
{
//-----------------------------------------
// Remove the poll
//-----------------------------------------
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'polls' , 'where' => "tid=".$this->topic['tid'] ) );
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'voters', 'where' => "tid=".$this->topic['tid'] ) );
$this->ipsclass->DB->do_update( 'topics', array( 'poll_state' => '', 'last_vote' => '', 'total_votes' => '' ), 'tid='.$this->topic['tid'] );
}
}
//-----------------------------------------
// Update topic title?
//-----------------------------------------
if ( $this->edit_title == 1 )
{
//-----------------------------------------
// Update poll
//-----------------------------------------
if ( $this->can_add_poll )
{
if ( is_array( $this->poll_questions ) AND count( $this->poll_questions ) )
{
$this->ipsclass->DB->do_update( 'polls', array( 'votes' => intval($this->poll_total_votes),
'choices' => addslashes(serialize( $this->poll_questions )),
'poll_question' => $this->ipsclass->input['poll_question'],
), 'tid='.$this->topic['tid'] );
}
else
{
//-----------------------------------------
// Remove the poll
//-----------------------------------------
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'polls' , 'where' => "tid=".$this->topic['tid'] ) );
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'voters', 'where' => "tid=".$this->topic['tid'] ) );
$this->ipsclass->DB->do_update( 'topics', array( 'poll_state' => '', 'last_vote' => '', 'total_votes' => '' ), 'tid='.$this->topic['tid'] );
}
}
//-----------------------------------------
// Update topic title
//-----------------------------------------
@@ -438,17 +461,26 @@ class post_functions extends class_post
'member_id' => $this->ipsclass->member['id'],
'member_name' => $this->ipsclass->member['members_display_name'],
'ip_address' => $this->ip_address,
'http_referer'=> $_SERVER['HTTP_REFERER'],
'http_referer'=> $this->ipsclass->my_getenv('HTTP_REFERER'),
'ctime' => time(),
'topic_title' => $this->topic['title'],
'action' => "Edited topic title or description '{$this->topic['title']}' to '{$this->ipsclass->input['TopicTitle']}' via post form",
'query_string'=> $_SERVER['QUERY_STRING'],
'query_string'=> $this->ipsclass->my_getenv('QUERY_STRING'),
) );
}
}
}
}
//-----------------------------------------
// Reason for edit?
//-----------------------------------------
if ( $this->moderator['edit_post'] OR $this->ipsclass->member['g_is_supmod'] )
{
$this->post['post_edit_reason'] = trim( $this->ipsclass->input['post_edit_reason'] );
}
//-----------------------------------------
// Update the database (ib_forum_post)
//-----------------------------------------
@@ -469,7 +501,7 @@ class post_functions extends class_post
// Make attachments "permanent"
//-----------------------------------------
$this->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->orig_post['pid']);
$this->pf_make_attachments_permanent( $this->post_key, $this->orig_post['pid'], 'post', array( 'topic_id' => $this->topic['tid'] ) );
//-----------------------------------------
// Make sure paperclip symbol is OK
@@ -487,7 +519,7 @@ class post_functions extends class_post
}
else
{
$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['post_edited'], "act=ST&f={$this->forum['id']}&t={$this->topic['tid']}&st={$this->ipsclass->input['st']}#entry{$this->orig_post['pid']}");
$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['post_edited'], "showtopic={$this->topic['tid']}&st={$this->ipsclass->input['st']}#entry{$this->orig_post['pid']}");
}
}
@@ -519,8 +551,9 @@ class post_functions extends class_post
}
else
{
$this->orig_post['post_htmlstatus'] = isset($this->orig_post['post_htmlstatus']) ? $this->orig_post['post_htmlstatus'] : 0;
$this->parser->parse_html = intval($this->orig_post['post_htmlstatus']) AND $this->forum['use_html'] AND $this->ipsclass->member['g_dohtml'] ? 1 : 0;
$this->parser->parse_nl2br = $this->ipsclass->input['post_htmlstatus'] == 2 ? 1 : 0;
$this->parser->parse_nl2br = (isset($this->ipsclass->input['post_htmlstatus']) AND $this->ipsclass->input['post_htmlstatus'] == 2) ? 1 : 0;
$this->parser->parse_smilies = intval($this->orig_post['use_emo']);
$this->parser->parse_bbcode = $this->forum['use_ibc'];
$raw_post = $this->parser->pre_edit_parse( $this->orig_post['post'] );
@@ -535,6 +568,9 @@ class post_functions extends class_post
// Is this the first post in the topic?
//-----------------------------------------
$topic_title = "";
$topic_desc = "";
if ( $this->edit_title == 1 )
{
$topic_title = isset($_POST['TopicTitle']) ? $this->ipsclass->input['TopicTitle'] : $this->topic['title'];
@@ -547,21 +583,21 @@ 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->html_start_form( array( 1 => array( 'CODE', '09' ),
2 => array( 't' , $this->topic['tid']),
3 => array( 'p' , $this->ipsclass->input['p'] ),
4 => array( 'st' , $this->ipsclass->input['st'] ),
5 => array( 'post_key', $this->post_key )
$this->output .= $this->html_start_form( array( 1 => array( 'CODE' , '09' ),
2 => array( 't' , $this->topic['tid']),
3 => array( 'p' , $this->ipsclass->input['p'] ),
4 => array( 'st' , $this->ipsclass->input['st'] ),
5 => array( 'attach_post_key', $this->post_key )
) );
//-----------------------------------------
@@ -575,25 +611,21 @@ class post_functions extends class_post
$name_fields = $this->html_name_field();
$post_box = $this->html_post_body( $raw_post );
if ( $this->edit_title == 1 )
{
$mod_options = $this->mod_options('edit');
}
$mod_options = $this->edit_title == 1 ? $this->mod_options('edit') : '';
$end_form = $this->ipsclass->compiled_templates['skin_post']->EndForm( $this->ipsclass->lang['submit_edit'] );
$post_icons = $this->html_post_icons($this->orig_post['icon_id']);
if ( $this->can_upload )
{
$upload_field = $this->html_build_uploads($this->post_key,'edit',$this->orig_post['pid']);
}
$upload_field = $this->can_upload ? $this->html_build_uploads($this->post_key,'edit',$this->orig_post['pid']) : '';
//-----------------------------------------
// Still here?
//-----------------------------------------
$poll_box = "";
if ( $this->can_add_poll )
{
//-----------------------------------------
@@ -606,8 +638,10 @@ class post_functions extends class_post
$poll_votes = "";
$show_open = 0;
$is_mod = 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 )
{
@@ -625,6 +659,14 @@ class post_functions extends class_post
}
}
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 ( is_array( $_POST['votes'] ) and count( $_POST['votes'] ) )
{
foreach( $_POST['votes'] as $id => $vote )
@@ -633,8 +675,16 @@ class post_functions extends class_post
}
}
$poll_only = 0;
if( $this->ipsclass->vars['ipb_poll_only'] AND $this->ipsclass->input['poll_only'] == 1 )
{
$poll_only = "checked='checked'";
}
$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_votes = preg_replace( "#,(\n)?$#", "\\1", $poll_votes );
}
@@ -649,7 +699,7 @@ class post_functions extends class_post
$poll_data = $this->ipsclass->DB->fetch_row();
$poll_answers = unserialize(stripslashes($poll_data['choices']));
$poll_answers = $poll_data['choices'] ? unserialize(stripslashes($poll_data['choices'])) : array();
//-----------------------------------------
// Lezz go
@@ -659,6 +709,9 @@ class post_functions extends class_post
{
$poll_questions .= "\t{$question_id} : '".str_replace( "'", '&#39;', $data['question'] )."',\n";
$data['multi'] = isset($data['multi']) ? intval($data['multi']) : 0;
$poll_multi .= "\t{$question_id} : '".$data['multi']."',\n";
foreach( $data['choice'] as $choice_id => $text )
{
$choice = $text;
@@ -669,36 +722,52 @@ class post_functions extends class_post
}
}
$poll_only = 0;
if ( $this->ipsclass->vars['ipb_poll_only'] AND $poll_data['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_votes = preg_replace( "#,(\n)?$#", "\\1", $poll_votes );
$poll_question = $poll_data['poll_question'];
$show_open = 1;
$is_mod = 1;
$show_open = $poll_data['choices'] ? 1 : 0;
$is_mod = $this->can_add_poll_mod;
}
//-----------------------------------------
// Print poll box
//-----------------------------------------
$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, $is_mod );
$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, $is_mod, $poll_multi, $poll_only );
}
$edit_option = "";
if ($this->ipsclass->member['g_append_edit'])
{
$checked = "";
$checked = "";
$show_reason = 0;
if ($this->orig_post['append_edit'])
{
$checked = "checked";
}
$edit_option = $this->ipsclass->compiled_templates['skin_post']->add_edit_box($checked);
if ( $this->moderator['edit_post'] OR $this->ipsclass->member['g_is_supmod'] )
{
$show_reason = 1;
}
$edit_option = $this->ipsclass->compiled_templates['skin_post']->add_edit_box( $checked, $show_reason, $this->orig_post['post_edit_reason'] );
}
$this->output = str_replace( "<!--START TABLE-->" , $start_table , $this->output );
@@ -712,8 +781,6 @@ class post_functions extends class_post
$this->output = str_replace( "<!--FORUM RULES-->" , $this->ipsclass->print_forum_rules($this->forum), $this->output );
$this->output = str_replace( "<!--TOPIC TITLE-->" , $topic_title , $this->output );
$this->output = $this->html_add_smilie_box( $this->output );
//-----------------------------------------
// Add in siggy buttons and such
//-----------------------------------------
@@ -724,7 +791,7 @@ class post_functions extends class_post
$this->html_checkboxes('edit', $this->topic['tid'], $this->forum['id']);
$this->html_topic_summary($this->topic['tid']);
$this->html_topic_summary( $this->topic['tid'] );
$this->show_post_navigation();