Version 2.1.7
This commit is contained in:
1 parent
0eecc172d9
commit
f73f8bff6d
941 files changed
+215301
-103093
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,744 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 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 $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Post Sub-Class
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: Wednesday 9th March 2005 (15:23)
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
class post_functions extends class_post
|
||||
{
|
||||
var $nav = array();
|
||||
var $title = "";
|
||||
var $post = array();
|
||||
var $upload = array();
|
||||
var $moderator = array( 'member_id' => 0, 'member_name' => "", 'edit_post' => 0 );
|
||||
var $orig_post = array();
|
||||
var $edit_title = 0;
|
||||
var $post_key = "";
|
||||
var $class = "";
|
||||
|
||||
function main_init()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load classes
|
||||
//-----------------------------------------
|
||||
|
||||
$this->load_classes();
|
||||
$this->build_permissions();
|
||||
|
||||
//-----------------------------------------
|
||||
// Lets load the topic from the database before we do anything else.
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=".intval($this->ipsclass->input['t']) ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
$this->topic = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
//-----------------------------------------
|
||||
// Is it legitimate?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->topic['tid'] )
|
||||
{
|
||||
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load the old post
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'posts', 'where' => "pid=".intval($this->ipsclass->input['p']) ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
$this->orig_post = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
if (! $this->orig_post['pid'])
|
||||
{
|
||||
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Same topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->orig_post['topic_id'] != $this->topic['tid'] )
|
||||
{
|
||||
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate post key (do we have one?)
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->orig_post['post_key'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Generate one and save back to post and attachment
|
||||
// to ensure 1.3 < compatibility
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post_key = md5(microtime());
|
||||
|
||||
$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'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->post_key = $this->orig_post['post_key'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load the moderator
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->ipsclass->member['id'])
|
||||
{
|
||||
$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']."'))" ) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
$this->moderator = $this->ipsclass->DB->fetch_row();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Lets do some tests to make sure that we are
|
||||
// allowed to edit this topic
|
||||
//-----------------------------------------
|
||||
|
||||
$can_edit = 0;
|
||||
|
||||
if ($this->ipsclass->member['g_is_supmod'])
|
||||
{
|
||||
$can_edit = 1;
|
||||
}
|
||||
|
||||
if ($this->moderator['edit_post'])
|
||||
{
|
||||
$can_edit = 1;
|
||||
}
|
||||
|
||||
if ( ($this->orig_post['author_id'] == $this->ipsclass->member['id']) and ($this->ipsclass->member['g_edit_posts']) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Have we set a time limit?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->ipsclass->member['g_edit_cutoff'] > 0)
|
||||
{
|
||||
if ( $this->orig_post['post_date'] > ( time() - ( intval($this->ipsclass->member['g_edit_cutoff']) * 60 ) ) )
|
||||
{
|
||||
$can_edit = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$can_edit = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $can_edit != 1 )
|
||||
{
|
||||
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'not_op') );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check access
|
||||
//-----------------------------------------
|
||||
|
||||
$this->check_for_edit($this->topic);
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have edit topic abilities?
|
||||
//-----------------------------------------
|
||||
|
||||
# For edit, this means there is a poll and we have perm to edit
|
||||
$this->can_add_poll = 0;
|
||||
|
||||
if ( $this->orig_post['new_topic'] == 1 )
|
||||
{
|
||||
if ( $this->ipsclass->member['g_is_supmod'] == 1 )
|
||||
{
|
||||
$this->edit_title = 1;
|
||||
|
||||
if ( $this->topic['poll_state'] )
|
||||
{
|
||||
$this->can_add_poll = 1;
|
||||
}
|
||||
}
|
||||
else if ( $this->moderator['edit_topic'] == 1 )
|
||||
{
|
||||
$this->edit_title = 1;
|
||||
|
||||
if ( $this->topic['poll_state'] )
|
||||
{
|
||||
$this->can_add_poll = 1;
|
||||
}
|
||||
|
||||
}
|
||||
else if ( $this->ipsclass->member['g_edit_topic'] == 1 )
|
||||
{
|
||||
$this->edit_title = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// MAIN PROCESS FUNCTION
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function process_post()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Convert times...
|
||||
//-----------------------------------------
|
||||
|
||||
$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.
|
||||
// overwrites saved post intentionally
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post = $this->compile_post();
|
||||
|
||||
//-----------------------------------------
|
||||
// Compile the poll
|
||||
//-----------------------------------------
|
||||
|
||||
$this->poll_questions = $this->compile_poll();
|
||||
|
||||
//-----------------------------------------
|
||||
// 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);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->save_post($class);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// COMPLETE EDIT THINGY
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function save_post()
|
||||
{
|
||||
$time = $this->ipsclass->get_date( time(), 'LONG' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Reset some data
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post['ip_address'] = $this->orig_post['ip_address'];
|
||||
$this->post['topic_id'] = $this->orig_post['topic_id'];
|
||||
$this->post['author_id'] = $this->orig_post['author_id'];
|
||||
$this->post['post_date'] = $this->orig_post['post_date'];
|
||||
$this->post['author_name'] = $this->orig_post['author_name'];
|
||||
$this->post['queued'] = $this->orig_post['queued'];
|
||||
$this->post['edit_time'] = time();
|
||||
$this->post['edit_name'] = $this->ipsclass->member['members_display_name'];
|
||||
|
||||
//-----------------------------------------
|
||||
// If the post icon has changed, update the topic post icon
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->orig_post['new_topic'] == 1)
|
||||
{
|
||||
if ($this->post['icon_id'] != $this->orig_post['icon_id'])
|
||||
{
|
||||
$this->ipsclass->DB->do_update( 'topics', array( 'icon_id' => $this->post['icon_id'] ), 'tid='.$this->topic['tid'] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update open and close times
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->orig_post['new_topic'] == 1 )
|
||||
{
|
||||
$times = array();
|
||||
|
||||
if ( $this->can_set_open_time )
|
||||
{
|
||||
$times['topic_open_time'] = $this->times['open'];
|
||||
|
||||
if( $this->topic['topic_open_time'] AND $this->times['open'] )
|
||||
{
|
||||
$times['state'] = "closed";
|
||||
|
||||
if( time() > $this->topic['topic_open_time'] )
|
||||
{
|
||||
if( time() < $this->topic['topic_close_time'] )
|
||||
{
|
||||
$times['state'] = "open";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ! $this->times['open'] AND $this->topic['topic_open_time'] )
|
||||
{
|
||||
if ( $this->topic['state'] == 'closed' )
|
||||
{
|
||||
$times['state'] = 'open';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->can_set_close_time )
|
||||
{
|
||||
$times['topic_close_time'] = $this->times['close'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Was a close time, but not now?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->times['close'] AND $this->topic['topic_close_time'] )
|
||||
{
|
||||
if ( $this->topic['state'] == 'closed' )
|
||||
{
|
||||
$times['state'] = 'open';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $times ) )
|
||||
{
|
||||
$this->ipsclass->DB->do_update( 'topics', $times, "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
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->input['TopicTitle'] = $this->pf_clean_topic_title( $this->ipsclass->input['TopicTitle'] );
|
||||
$this->ipsclass->input['TopicTitle'] = trim( $this->parser->bad_words( $this->ipsclass->input['TopicTitle'] ) );
|
||||
$this->ipsclass->input['TopicDesc'] = trim( $this->parser->bad_words( $this->ipsclass->input['TopicDesc'] ) );
|
||||
|
||||
if ( $this->ipsclass->input['TopicTitle'] != "" )
|
||||
{
|
||||
if ( ($this->ipsclass->input['TopicTitle'] != $this->topic['title']) or ($this->ipsclass->input['TopicDesc'] != $this->topic['description']) )
|
||||
{
|
||||
$this->ipsclass->DB->do_update( 'topics', array( 'title' => $this->ipsclass->input['TopicTitle'],
|
||||
'description' => $this->ipsclass->input['TopicDesc']
|
||||
) , "tid=".$this->topic['tid'] );
|
||||
|
||||
if ($this->topic['tid'] == $this->forum['last_id'])
|
||||
{
|
||||
$this->ipsclass->DB->do_update( 'forums', array( 'last_title' => $this->ipsclass->input['TopicTitle'] ), 'id='.$this->forum['id'] );
|
||||
$this->ipsclass->update_forum_cache();
|
||||
}
|
||||
|
||||
if ( ($this->moderator['edit_topic'] == 1) OR ( $this->ipsclass->member['g_is_supmod'] == 1 ) )
|
||||
{
|
||||
$this->ipsclass->DB->do_insert( 'moderator_logs', array (
|
||||
'forum_id' => $this->forum['id'],
|
||||
'topic_id' => $this->topic['tid'],
|
||||
'post_id' => $this->orig_post['pid'],
|
||||
'member_id' => $this->ipsclass->member['id'],
|
||||
'member_name' => $this->ipsclass->member['members_display_name'],
|
||||
'ip_address' => $this->ip_address,
|
||||
'http_referer'=> $_SERVER['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'],
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update the database (ib_forum_post)
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post['append_edit'] = 1;
|
||||
|
||||
if ( $this->ipsclass->member['g_append_edit'] )
|
||||
{
|
||||
if ( $this->ipsclass->input['add_edit'] != 1 )
|
||||
{
|
||||
$this->post['append_edit'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->do_update( 'posts', $this->post, 'pid='.$this->orig_post['pid'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Make attachments "permanent"
|
||||
//-----------------------------------------
|
||||
|
||||
$this->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->orig_post['pid']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Make sure paperclip symbol is OK
|
||||
//-----------------------------------------
|
||||
|
||||
$this->pf_recount_topic_attachments($this->topic['tid']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Not XML? Redirect them back to the topic
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->input['act'] == 'xmlout' )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
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']}");
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// SHOW FORM
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function show_form()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$raw_post = "";
|
||||
|
||||
//-----------------------------------------
|
||||
// Unconvert the saved post if required
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! isset($_POST['Post']) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// If we're using RTE, then just clean up html
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->han_editor->method == 'rte' )
|
||||
{
|
||||
$raw_post = $this->parser->convert_ipb_html_to_html( $this->orig_post['post'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$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_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'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$raw_post = $this->ipsclass->txt_stripslashes( $_POST['Post'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Is this the first post in the topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->edit_title == 1 )
|
||||
{
|
||||
$topic_title = isset($_POST['TopicTitle']) ? $this->ipsclass->input['TopicTitle'] : $this->topic['title'];
|
||||
$topic_desc = isset($_POST['TopicDesc']) ? $this->ipsclass->input['TopicDesc'] : $this->topic['description'];
|
||||
|
||||
$topic_title = $this->ipsclass->compiled_templates['skin_post']->topictitle_fields( array( 'TITLE' => $topic_title, 'DESC' => $topic_desc ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have any posting errors?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($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->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 )
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
// START TABLE
|
||||
//-----------------------------------------
|
||||
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_post']->table_structure();
|
||||
|
||||
$start_table = $this->ipsclass->compiled_templates['skin_post']->table_top( "{$this->ipsclass->lang['top_txt_edit']} {$this->topic['title']}");
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
$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']);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Still here?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->can_add_poll )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Did someone hit preview / do we have
|
||||
// post info?
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_questions = "";
|
||||
$poll_choices = "";
|
||||
$poll_votes = "";
|
||||
$show_open = 0;
|
||||
$is_mod = 0;
|
||||
|
||||
if ( is_array( $_POST['question'] ) and count( $_POST['question'] ) )
|
||||
{
|
||||
foreach( $_POST['question'] as $id => $question )
|
||||
{
|
||||
$poll_questions .= "\t{$id} : '".str_replace( "'", ''', $question )."',\n";
|
||||
}
|
||||
|
||||
$poll_question = $this->ipsclass->input['poll_question'];
|
||||
$show_open = 1;
|
||||
|
||||
if ( is_array( $_POST['choice'] ) and count( $_POST['choice'] ) )
|
||||
{
|
||||
foreach( $_POST['choice'] as $id => $choice )
|
||||
{
|
||||
$poll_choices .= "\t'{$id}' : '".str_replace( "'", ''', $choice )."',\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_array( $_POST['votes'] ) and count( $_POST['votes'] ) )
|
||||
{
|
||||
foreach( $_POST['votes'] as $id => $vote )
|
||||
{
|
||||
$poll_votes .= "\t'{$id}' : '".$vote."',\n";
|
||||
}
|
||||
}
|
||||
|
||||
$poll_questions = preg_replace( "#,(\n)?$#", "\\1", $poll_questions );
|
||||
$poll_choices = preg_replace( "#,(\n)?$#", "\\1", $poll_choices );
|
||||
$poll_votes = preg_replace( "#,(\n)?$#", "\\1", $poll_votes );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load the poll from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'polls', 'where' => "tid=".$this->topic['tid'] ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
$poll_data = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
$poll_answers = unserialize(stripslashes($poll_data['choices']));
|
||||
|
||||
//-----------------------------------------
|
||||
// Lezz go
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $poll_answers as $question_id => $data )
|
||||
{
|
||||
$poll_questions .= "\t{$question_id} : '".str_replace( "'", ''', $data['question'] )."',\n";
|
||||
|
||||
foreach( $data['choice'] as $choice_id => $text )
|
||||
{
|
||||
$choice = $text;
|
||||
$votes = intval($data['votes'][ $choice_id ]);
|
||||
|
||||
$poll_choices .= "\t'{$question_id}_{$choice_id}' : '".str_replace( "'", ''', $choice )."',\n";
|
||||
$poll_votes .= "\t'{$question_id}_{$choice_id}' : '".$votes."',\n";
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Trim off trailing commas (Safari hates it)
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_questions = preg_replace( "#,(\n)?$#", "\\1", $poll_questions );
|
||||
$poll_choices = preg_replace( "#,(\n)?$#", "\\1", $poll_choices );
|
||||
$poll_votes = preg_replace( "#,(\n)?$#", "\\1", $poll_votes );
|
||||
|
||||
$poll_question = $poll_data['poll_question'];
|
||||
$show_open = 1;
|
||||
$is_mod = 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// 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 );
|
||||
}
|
||||
|
||||
if ($this->ipsclass->member['g_append_edit'])
|
||||
{
|
||||
$checked = "";
|
||||
|
||||
if ($this->orig_post['append_edit'])
|
||||
{
|
||||
$checked = "checked";
|
||||
}
|
||||
|
||||
$edit_option = $this->ipsclass->compiled_templates['skin_post']->add_edit_box($checked);
|
||||
}
|
||||
|
||||
$this->output = str_replace( "<!--START TABLE-->" , $start_table , $this->output );
|
||||
$this->output = str_replace( "<!--NAME FIELDS-->" , $name_fields , $this->output );
|
||||
$this->output = str_replace( "<!--POST BOX-->" , $post_box , $this->output );
|
||||
$this->output = str_replace( "<!--POLL BOX-->" , $poll_box , $this->output );
|
||||
$this->output = str_replace( "<!--POST ICONS-->" , $post_icons , $this->output );
|
||||
$this->output = str_replace( "<!--END TABLE-->" , $end_form , $this->output );
|
||||
$this->output = str_replace( "<!--UPLOAD FIELD-->", $upload_field , $this->output );
|
||||
$this->output = str_replace( "<!--MOD OPTIONS-->" , $edit_option . $mod_options , $this->output );
|
||||
$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
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->input['post_htmlstatus'] = $this->orig_post['post_htmlstate'];
|
||||
$this->ipsclass->input['enablesig'] = $this->orig_post['use_sig'];
|
||||
$this->ipsclass->input['enableemo'] = $this->orig_post['use_emo'];
|
||||
|
||||
$this->html_checkboxes('edit', $this->topic['tid'], $this->forum['id']);
|
||||
|
||||
$this->html_topic_summary($this->topic['tid']);
|
||||
|
||||
$this->show_post_navigation();
|
||||
|
||||
$this->title = $this->ipsclass->lang['editing_post'].' '.$this->topic['title'];
|
||||
|
||||
$this->ipsclass->print->add_output( $this->output );
|
||||
|
||||
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->vars['board_name']." -> ".$this->title,
|
||||
'JS' => 1,
|
||||
'NAV' => $this->nav,
|
||||
) );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,517 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 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 $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Post Sub-Class
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: Wednesday 9th March 2005 (15:23)
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
class post_functions extends class_post
|
||||
{
|
||||
var $nav = array();
|
||||
var $title = "";
|
||||
var $post = array();
|
||||
var $upload = array();
|
||||
var $mod_topic = array();
|
||||
var $class = "";
|
||||
var $m_group = "";
|
||||
var $post_key = "";
|
||||
|
||||
var $has_poll = 0;
|
||||
var $poll_questions = array();
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Sub class init
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function main_init()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load classes
|
||||
//-----------------------------------------
|
||||
|
||||
$this->load_classes();
|
||||
$this->build_permissions();
|
||||
|
||||
//-----------------------------------------
|
||||
// Check permissions
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post_key = $this->ipsclass->input['post_key'] ? $this->ipsclass->input['post_key'] : md5(microtime());
|
||||
|
||||
$this->check_for_new_topic();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// MAIN PROCESS FUNCTION
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function process_post()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Convert times...
|
||||
//-----------------------------------------
|
||||
|
||||
$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.
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post = $this->compile_post();
|
||||
|
||||
//-----------------------------------------
|
||||
// check to make sure we have a valid topic title
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->input['TopicTitle'] = str_replace( "<br />", "", $this->ipsclass->input['TopicTitle'] );
|
||||
|
||||
$this->ipsclass->input['TopicTitle'] = trim($this->ipsclass->input['TopicTitle']);
|
||||
|
||||
//-----------------------------------------
|
||||
// More unicode..
|
||||
//-----------------------------------------
|
||||
|
||||
$temp = $this->ipsclass->txt_stripslashes($_POST['TopicTitle']);
|
||||
|
||||
if ( $this->ipsclass->txt_mb_strlen($_POST['TopicTitle']) > $this->ipsclass->vars['topic_title_max_len'] )
|
||||
{
|
||||
$this->obj['post_errors'] = 'topic_title_long';
|
||||
}
|
||||
|
||||
if ( (strlen($temp) < 2) or (!$this->ipsclass->input['TopicTitle']) )
|
||||
{
|
||||
$this->obj['post_errors'] = 'no_topic_title';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Compile the poll
|
||||
//-----------------------------------------
|
||||
|
||||
$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'] != "" ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Show the form again
|
||||
//-----------------------------------------
|
||||
|
||||
$this->show_form();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->save_post();
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// ADD TOPIC FUNCTION
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function save_post()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Fix up the topic title
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->input['TopicTitle'] = $this->pf_clean_topic_title( $this->ipsclass->input['TopicTitle'] );
|
||||
|
||||
$this->ipsclass->input['TopicTitle'] = $this->parser->bad_words( $this->ipsclass->input['TopicTitle'] );
|
||||
$this->ipsclass->input['TopicDesc'] = $this->parser->bad_words( $this->ipsclass->input['TopicDesc'] );
|
||||
|
||||
$pinned = 0;
|
||||
$state = 'open';
|
||||
|
||||
if ( ($this->ipsclass->input['mod_options'] != "") or ($this->ipsclass->input['mod_options'] != 'nowt') )
|
||||
{
|
||||
if ($this->ipsclass->input['mod_options'] == 'pin')
|
||||
{
|
||||
if ($this->ipsclass->member['g_is_supmod'] == 1 or $this->moderator['pin_topic'] == 1)
|
||||
{
|
||||
$pinned = 1;
|
||||
|
||||
$this->moderate_log('Òåìà áûëà «ïîäíÿòà» ïðè åå ïóáëèêàöèè', $this->ipsclass->input['TopicTitle']);
|
||||
}
|
||||
}
|
||||
else if ($this->ipsclass->input['mod_options'] == 'close')
|
||||
{
|
||||
if ($this->ipsclass->member['g_is_supmod'] == 1 or $this->moderator['close_topic'] == 1)
|
||||
{
|
||||
$state = 'closed';
|
||||
|
||||
$this->moderate_log('Òåìà áûëà çàêðûòà ïðè åå ïóáëèêàöèè', $this->ipsclass->input['TopicTitle']);
|
||||
}
|
||||
}
|
||||
else if ($this->ipsclass->input['mod_options'] == 'pinclose')
|
||||
{
|
||||
if ($this->ipsclass->member['g_is_supmod'] == 1 or ( $this->moderator['pin_topic'] == 1 AND $this->moderator['close_topic'] == 1 ) )
|
||||
{
|
||||
$pinned = 1;
|
||||
$state = 'closed';
|
||||
|
||||
$this->moderate_log('Òåìà áûëà «ïîäíÿòà» è çàêðûòà ïðè åå ïóáëèêàöèè', $this->ipsclass->input['TopicTitle']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check close times...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $state == 'open' AND ( $this->times['open'] OR $this->times['close'] )
|
||||
AND ( $this->times['close'] <= time() OR ( $this->times['open'] > time() AND !$this->times['close'] ) ) )
|
||||
{
|
||||
$state = 'closed';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Build the master array
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic = array(
|
||||
'title' => $this->ipsclass->input['TopicTitle'],
|
||||
'description' => $this->ipsclass->input['TopicDesc'] ,
|
||||
'state' => $state,
|
||||
'posts' => 0,
|
||||
'starter_id' => $this->ipsclass->member['id'],
|
||||
'starter_name' => $this->ipsclass->member['id'] ? $this->ipsclass->member['members_display_name'] : $this->ipsclass->input['UserName'],
|
||||
'start_date' => time(),
|
||||
'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'],
|
||||
'author_mode' => $this->ipsclass->member['id'] ? 1 : 0,
|
||||
'poll_state' => ( count( $this->poll_questions ) AND $this->can_add_poll ) ? 1 : 0,
|
||||
'last_vote' => 0,
|
||||
'views' => 0,
|
||||
'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'],
|
||||
);
|
||||
|
||||
//-----------------------------------------
|
||||
// Insert the topic into the database to get the
|
||||
// last inserted value of the auto_increment field
|
||||
// follow suit with the post
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'title' => 'string',
|
||||
'description' => 'string',
|
||||
'starter_name' => 'string',
|
||||
'last_poster_name' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'topics', $this->topic );
|
||||
|
||||
$this->post['topic_id'] = $this->ipsclass->DB->get_insert_id();
|
||||
$this->topic['tid'] = $this->post['topic_id'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Update the post info with the upload array info
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post['post_key'] = $this->post_key;
|
||||
$this->post['new_topic'] = 1;
|
||||
|
||||
//-----------------------------------------
|
||||
// Unqueue the post if we're starting a new topic
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post['queued'] = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Add post to DB
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'posts', $this->post );
|
||||
|
||||
$this->post['pid'] = $this->ipsclass->DB->get_insert_id();
|
||||
|
||||
//-----------------------------------------
|
||||
// Update topic with firstpost ID
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'update' => 'topics',
|
||||
'set' => "topic_firstpost=".$this->post['pid'],
|
||||
'where' => "tid=".$this->topic['tid']
|
||||
) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
//-----------------------------------------
|
||||
// Add the poll to the polls table
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $this->poll_questions ) AND $this->can_add_poll )
|
||||
{
|
||||
$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'],
|
||||
) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// If we are still here, lets update the
|
||||
// board/forum stats
|
||||
//-----------------------------------------
|
||||
|
||||
$this->pf_update_forum_and_stats($this->topic['tid'], $this->topic['title'], 'new');
|
||||
|
||||
//-----------------------------------------
|
||||
// Make attachments "permanent"
|
||||
//-----------------------------------------
|
||||
|
||||
$this->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->post['pid']);
|
||||
|
||||
//-----------------------------------------
|
||||
// If we are a member, lets update thier last post
|
||||
// date and increment their post count.
|
||||
//-----------------------------------------
|
||||
|
||||
$this->pf_increment_user_post_count();
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we tracking new topics we start 'auto_track'?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->pf_add_tracked_topic($this->topic['tid']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Moderating?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->obj['moderate'] == 1 OR $this->obj['moderate'] == 2 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Redirect them with a message telling them the
|
||||
// post has to be previewed first
|
||||
//-----------------------------------------
|
||||
|
||||
$this->notify_new_topic_approval( $this->topic['tid'], $this->topic['title'], $this->topic['starter_name'], $this->post['pid'] );
|
||||
|
||||
$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['moderate_topic'], "act=SF&f={$this->forum['id']}" );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we tracking this forum? If so generate some mailies - yay!
|
||||
//-----------------------------------------
|
||||
|
||||
$this->forum_tracker($this->forum['id'], $this->topic['tid'], $this->topic['title'], $this->forum['name'], $this->post['post'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Redirect them back to the topic
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic={$this->topic['tid']}");
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// SHOW FORM
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function show_form()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Are we quoting posts?
|
||||
//-----------------------------------------
|
||||
|
||||
$raw_post = $this->check_multi_quote();
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out the "raw" textarea input and make it safe incase
|
||||
// we have a <textarea> tag in the raw post var.
|
||||
//-----------------------------------------
|
||||
|
||||
$topic_title = isset($_POST['TopicTitle']) ? $this->ipsclass->input['TopicTitle'] : "";
|
||||
$topic_desc = isset($_POST['TopicDesc']) ? $this->ipsclass->input['TopicDesc'] : "";
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have any posting errors?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($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->html_start_form( array( 1 => array( 'CODE' , '01' ),
|
||||
2 => array( 'post_key', $this->post_key ),
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
// START TABLE
|
||||
//-----------------------------------------
|
||||
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_post']->table_structure();
|
||||
|
||||
$topic_title = $this->ipsclass->compiled_templates['skin_post']->topictitle_fields( array( 'TITLE' => $topic_title, 'DESC' => $topic_desc ) );
|
||||
|
||||
$start_table = $this->ipsclass->compiled_templates['skin_post']->table_top( "{$this->ipsclass->lang['top_txt_new']} {$this->forum['name']}");
|
||||
|
||||
$name_fields = $this->html_name_field();
|
||||
|
||||
$post_box = $this->html_post_body( $raw_post );
|
||||
|
||||
$mod_options = $this->mod_options();
|
||||
|
||||
$end_form = $this->ipsclass->compiled_templates['skin_post']->EndForm( $this->ipsclass->lang['submit_new'] );
|
||||
|
||||
$post_icons = $this->html_post_icons();
|
||||
|
||||
//-----------------------------------------
|
||||
// POLL BOX
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->can_add_poll )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Did someone hit preview / do we have
|
||||
// post info?
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_questions = "";
|
||||
$poll_choices = "";
|
||||
$show_open = 0;
|
||||
|
||||
if ( is_array( $_POST['question'] ) and count( $_POST['question'] ) )
|
||||
{
|
||||
foreach( $_POST['question'] as $id => $question )
|
||||
{
|
||||
$poll_questions .= "\t{$id} : '".str_replace( "'", ''', $question )."',\n";
|
||||
}
|
||||
|
||||
$poll_question = $this->ipsclass->input['poll_question'];
|
||||
$show_open = 1;
|
||||
}
|
||||
|
||||
if ( is_array( $_POST['choice'] ) and count( $_POST['choice'] ) )
|
||||
{
|
||||
foreach( $_POST['choice'] as $id => $choice )
|
||||
{
|
||||
$poll_choices .= "\t'{$id}' : '".str_replace( "'", ''', $choice )."',\n";
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Trim off trailing commas (Safari hates it)
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_questions = preg_replace( "#,(\n)?$#", "\\1", $poll_questions );
|
||||
$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 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// UPLOAD BOX
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->can_upload )
|
||||
{
|
||||
$upload_field = $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 );
|
||||
$this->output = str_replace( "<!--POST BOX-->" , $post_box , $this->output );
|
||||
$this->output = str_replace( "<!--POLL BOX-->" , $poll_box , $this->output );
|
||||
$this->output = str_replace( "<!--POST ICONS-->" , $post_icons , $this->output );
|
||||
$this->output = str_replace( "<!--UPLOAD FIELD-->", $upload_field , $this->output );
|
||||
$this->output = str_replace( "<!--MOD OPTIONS-->" , $mod_options , $this->output );
|
||||
$this->output = str_replace( "<!--END TABLE-->" , $end_form , $this->output );
|
||||
$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
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html_checkboxes('new', 0, $this->forum['id']);
|
||||
|
||||
$this->title = $this->ipsclass->lang['posting_new_topic'];
|
||||
|
||||
$this->show_post_navigation();
|
||||
|
||||
$this->ipsclass->print->add_output( $this->output );
|
||||
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->vars['board_name']." -> ".$this->title,
|
||||
'JS' => 1,
|
||||
'NAV' => $this->nav,
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,657 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 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 $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Post Sub-Class
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: Wednesday 9th March 2005 (15:23)
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
class post_functions extends class_post
|
||||
{
|
||||
var $nav = array();
|
||||
var $title = "";
|
||||
var $post = array();
|
||||
var $upload = array();
|
||||
var $mod_topic = array();
|
||||
var $m_group = "";
|
||||
var $post_key = "";
|
||||
var $quote_pids = array();
|
||||
var $quote_posts = array();
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Sub class init
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function main_init()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load classes
|
||||
//-----------------------------------------
|
||||
|
||||
$this->load_classes();
|
||||
$this->build_permissions();
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up post key
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post_key = $this->ipsclass->input['post_key'] ? $this->ipsclass->input['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->topic = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
//-----------------------------------------
|
||||
// Check permissions, etc
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->topic['tid'] )
|
||||
{
|
||||
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Lets do some tests to make sure that we are
|
||||
// allowed to reply to this topic
|
||||
//-----------------------------------------
|
||||
|
||||
$this->check_for_reply($this->topic);
|
||||
|
||||
//-----------------------------------------
|
||||
// POLL BOX ( Either topic starter or admin)
|
||||
// and without a current poll
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->can_add_poll )
|
||||
{
|
||||
$this->can_add_poll = 0;
|
||||
|
||||
if ( ! $this->topic['poll_state'] )
|
||||
{
|
||||
if ( $this->ipsclass->member['id'] and ! $this->obj['moderate'] )
|
||||
{
|
||||
if ( $this->ipsclass->member['g_is_supmod'] == 1 )
|
||||
{
|
||||
$this->can_add_poll = 1;
|
||||
}
|
||||
else if ( $this->topic['starter_id'] == $this->ipsclass->member['id'] )
|
||||
{
|
||||
if ( ($this->ipsclass->vars['startpoll_cutoff'] > 0) AND ( $this->topic['start_date'] + ($this->ipsclass->vars['startpoll_cutoff'] * 3600) > time() ) )
|
||||
{
|
||||
$this->can_add_poll = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// MAIN PROCESS FUNCTION
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function process_post()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Convert times...
|
||||
//-----------------------------------------
|
||||
|
||||
$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.
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post = $this->compile_post();
|
||||
|
||||
//-----------------------------------------
|
||||
// Compile the poll
|
||||
//-----------------------------------------
|
||||
|
||||
$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);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->save_post($class);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// ADD THE REPLY
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function save_post()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Insert the post into the database to get the
|
||||
// last inserted value of the auto_increment field
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post['topic_id'] = $this->topic['tid'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the last post time of this topic not counting
|
||||
// this new reply
|
||||
//-----------------------------------------
|
||||
|
||||
$this->last_post = $this->topic['last_post'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we a mod, and can we change the topic state?
|
||||
//-----------------------------------------
|
||||
|
||||
$return_to_move = 0;
|
||||
|
||||
if ( ($this->ipsclass->input['mod_options'] != "") or ($this->ipsclass->input['mod_options'] != 'nowt') )
|
||||
{
|
||||
if ($this->ipsclass->input['mod_options'] == 'pin')
|
||||
{
|
||||
if ($this->ipsclass->member['g_is_supmod'] == 1 or $this->moderator['pin_topic'] == 1)
|
||||
{
|
||||
$this->topic['pinned'] = 1;
|
||||
|
||||
$this->moderate_log('Pinned topic from post form', $this->topic['title']);
|
||||
}
|
||||
}
|
||||
else if ($this->ipsclass->input['mod_options'] == 'close')
|
||||
{
|
||||
if ($this->ipsclass->member['g_is_supmod'] == 1 or $this->moderator['close_topic'] == 1)
|
||||
{
|
||||
$this->topic['state'] = 'closed';
|
||||
|
||||
$this->moderate_log('Closed topic from post form', $this->topic['title']);
|
||||
}
|
||||
}
|
||||
else if ($this->ipsclass->input['mod_options'] == 'move')
|
||||
{
|
||||
if ($this->ipsclass->member['g_is_supmod'] == 1 or $this->moderator['move_topic'] == 1)
|
||||
{
|
||||
$return_to_move = 1;
|
||||
}
|
||||
}
|
||||
else if ($this->ipsclass->input['mod_options'] == 'pinclose')
|
||||
{
|
||||
if ($this->ipsclass->member['g_is_supmod'] == 1 or ( $this->moderator['pin_topic'] == 1 AND $this->moderator['close_topic'] == 1 ) )
|
||||
{
|
||||
$this->topic['pinned'] = 1;
|
||||
$this->topic['state'] = 'closed';
|
||||
|
||||
$this->moderate_log('Pinned & closed topic from post form', $this->topic['title']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check close times...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->topic['state'] == 'open' AND ( $this->times['close'] AND $this->times['close'] <= time() ) )
|
||||
{
|
||||
$this->topic['state'] = 'closed';
|
||||
}
|
||||
else if ( $this->topic['state'] == 'closed' AND ( $this->times['open'] AND $this->times['open'] >= time() ) )
|
||||
{
|
||||
$this->topic['state'] = 'open';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Merge concurrent posts?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->member['id'] AND $this->ipsclass->vars['post_merge_conc'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get check time
|
||||
//-----------------------------------------
|
||||
|
||||
$time_check = time() - ( $this->ipsclass->vars['post_merge_conc'] * 60 );
|
||||
|
||||
//-----------------------------------------
|
||||
// Last to post?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ( $this->topic['last_post'] > $time_check ) AND ( $this->topic['last_poster_id'] == $this->ipsclass->member['id'] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get the last post. 2 queries more efficient
|
||||
// than one... trust me
|
||||
//-----------------------------------------
|
||||
|
||||
$last_pid = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'MAX(pid) as maxpid',
|
||||
'from' => 'posts',
|
||||
'where' => 'topic_id='.$this->topic['tid'],
|
||||
'limit' => array( 0, 1 ) ) );
|
||||
|
||||
$last_post = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'posts',
|
||||
'where' => 'pid='.$last_pid['maxpid'] ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Sure we're the last poster?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $last_post['author_id'] == $this->ipsclass->member['id'] )
|
||||
{
|
||||
$new_post = $last_post['post'].'<br /><br />'.$this->post['post'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Update post row
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'pid' => 'int',
|
||||
'post' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_update( 'posts', array( 'post' => $new_post, 'post_date' => time() ), 'pid='.$last_post['pid'] );
|
||||
|
||||
$this->post['pid'] = $last_post['pid'];
|
||||
$this->post['post_key'] = $last_post['post_key'];
|
||||
$post_saved = 1;
|
||||
$this->is_merging_posts = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// No?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->is_merging_posts )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Add post to DB
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post['post_key'] = $this->post_key;
|
||||
$this->post['post_parent'] = intval($this->ipsclass->input['parent_id']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Typecast
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'pid' => 'int',
|
||||
'post' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'posts', $this->post );
|
||||
|
||||
$this->post['pid'] = $this->ipsclass->DB->get_insert_id();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// If we are still here, lets update the
|
||||
// board/forum/topic stats
|
||||
//-----------------------------------------
|
||||
|
||||
$this->pf_update_forum_and_stats($this->topic['tid'], $this->topic['title'], 'reply');
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the correct number of replies
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$this->topic['tid']} and queued != 1" ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
$posts = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
$pcount = intval( $posts['posts'] - 1 );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the correct number of queued replies
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$this->topic['tid']} and queued=1" ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
$qposts = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
$qpcount = intval( $qposts['posts'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// UPDATE TOPIC
|
||||
//-----------------------------------------
|
||||
|
||||
$poster_name = $this->ipsclass->member['id'] ? $this->ipsclass->member['members_display_name'] : $this->ipsclass->input['UserName'];
|
||||
|
||||
$update_array = array(
|
||||
'posts' => $pcount,
|
||||
'topic_queuedposts'=> $qpcount
|
||||
);
|
||||
|
||||
if ( $this->obj['moderate'] != 1 and $this->obj['moderate'] != 3 )
|
||||
{
|
||||
$update_array['last_poster_id'] = $this->ipsclass->member['id'];
|
||||
$update_array['last_poster_name'] = $poster_name;
|
||||
$update_array['last_post'] = time();
|
||||
$update_array['pinned'] = $this->topic['pinned'];
|
||||
$update_array['state'] = $this->topic['state'];
|
||||
|
||||
if ( count( $this->poll_questions ) AND $this->can_add_poll )
|
||||
{
|
||||
$update_array['poll_state'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->force_data_type = array( 'title' => 'string',
|
||||
'description' => 'string',
|
||||
'starter_name' => 'string',
|
||||
'last_poster_name' => 'string' );
|
||||
|
||||
$this->ipsclass->DB->do_update( 'topics', $update_array, "tid={$this->topic['tid']}" );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add the poll to the polls table
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $this->poll_questions ) AND $this->can_add_poll )
|
||||
{
|
||||
$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'],
|
||||
) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// If we are a member, lets update thier last post
|
||||
// date and increment their post count.
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->is_merging_posts )
|
||||
{
|
||||
$this->pf_increment_user_post_count();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Make attachments "permanent"
|
||||
//-----------------------------------------
|
||||
|
||||
$this->pf_make_attachments_permanent($this->post_key, $this->topic['tid'], $this->post['pid']);
|
||||
|
||||
//-----------------------------------------
|
||||
// MAKE SURE ATTACHMENTS FOR MERGED POSTS
|
||||
// ARE UPDATED
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->is_merging_posts )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update attachments
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_update( 'attachments', array( 'attach_post_key' => $this->post['post_key'] ), 'attach_pid='.$this->post['pid'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Moderating?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->is_merging_posts AND ( $this->obj['moderate'] == 1 or $this->obj['moderate'] == 3) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Boing!!!
|
||||
//-----------------------------------------
|
||||
|
||||
$this->notify_new_topic_approval( $this->topic['tid'], $this->topic['title'], $this->topic['starter_name'], $this->post['pid'], 'reply' );
|
||||
|
||||
$page = floor( ($this->topic['posts'] + 1) / $this->ipsclass->vars['display_max_posts']);
|
||||
$page = $page * $this->ipsclass->vars['display_max_posts'];
|
||||
|
||||
$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['moderate_post'], "showtopic={$this->topic['tid']}&st=$page" );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we tracking topics we reply in 'auto_track'?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->pf_add_tracked_topic($this->topic['tid'], 1);
|
||||
|
||||
//-----------------------------------------
|
||||
// Check for subscribed topics
|
||||
// Pass on the previous last post time of the topic
|
||||
// to see if we need to send emails out
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic_tracker( $this->topic['tid'], $this->post['post'], $poster_name, $this->last_post );
|
||||
|
||||
//-----------------------------------------
|
||||
// Redirect them back to the topic
|
||||
//-----------------------------------------
|
||||
|
||||
if ($return_to_move == 1)
|
||||
{
|
||||
$this->ipsclass->boink_it($this->ipsclass->base_url."act=Mod&CODE=02&f={$this->forum['id']}&t={$this->topic['tid']}");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $this->ipsclass->vars['post_order_sort'] == 'desc' )
|
||||
{
|
||||
$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic={$this->topic['tid']}&#entry{$this->post['pid']}");
|
||||
}
|
||||
else
|
||||
{
|
||||
$page = floor( ($this->topic['posts'] + 1) / $this->ipsclass->vars['display_max_posts']);
|
||||
$page = $page * $this->ipsclass->vars['display_max_posts'];
|
||||
$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic={$this->topic['tid']}&st=$page&gopid={$this->post['pid']}&#entry{$this->post['pid']}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// SHOW FORM
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function show_form()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Are we quoting posts?
|
||||
//-----------------------------------------
|
||||
|
||||
$raw_post = $this->check_multi_quote();
|
||||
|
||||
//-----------------------------------------
|
||||
// RTE? Convert RIGHT tags that QUOTE would
|
||||
// have put there
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->han_editor->method == 'rte' )
|
||||
{
|
||||
$raw_post = $this->parser->convert_ipb_html_to_html( $raw_post );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have any posting errors?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $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->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'] ),
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
// START TABLE
|
||||
//-----------------------------------------
|
||||
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_post']->table_structure();
|
||||
|
||||
$start_table = $this->ipsclass->compiled_templates['skin_post']->table_top( "{$this->ipsclass->lang['top_txt_reply']} {$this->topic['title']}");
|
||||
|
||||
$name_fields = $this->html_name_field();
|
||||
|
||||
$post_box = $this->html_post_body( $raw_post );
|
||||
|
||||
$mod_options = $this->mod_options('reply');
|
||||
|
||||
$end_form = $this->ipsclass->compiled_templates['skin_post']->EndForm( $this->ipsclass->lang['submit_reply'] );
|
||||
|
||||
$post_icons = $this->html_post_icons();
|
||||
|
||||
//-----------------------------------------
|
||||
// Still here?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->can_add_poll )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Did someone hit preview / do we have
|
||||
// post info?
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_questions = "";
|
||||
$poll_choices = "";
|
||||
$show_open = 0;
|
||||
|
||||
if ( is_array( $_POST['question'] ) and count( $_POST['question'] ) )
|
||||
{
|
||||
foreach( $_POST['question'] as $id => $question )
|
||||
{
|
||||
$poll_questions .= "\t{$id} : '".str_replace( "'", ''', $question )."',\n";
|
||||
}
|
||||
|
||||
$poll_question = $this->ipsclass->input['poll_question'];
|
||||
$show_open = 1;
|
||||
}
|
||||
|
||||
if ( is_array( $_POST['choice'] ) and count( $_POST['choice'] ) )
|
||||
{
|
||||
foreach( $_POST['choice'] as $id => $choice )
|
||||
{
|
||||
$poll_choices .= "\t'{$id}' : '".str_replace( "'", ''', $choice )."',\n";
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Trim off trailing commas (Safari hates it)
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_questions = preg_replace( "#,(\n)?$#", "\\1", $poll_questions );
|
||||
$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 );
|
||||
}
|
||||
|
||||
if ( $this->can_upload )
|
||||
{
|
||||
$upload_field = $this->html_build_uploads($this->post_key,'reply');
|
||||
}
|
||||
|
||||
$this->output = str_replace( "<!--START TABLE-->" , $start_table , $this->output );
|
||||
$this->output = str_replace( "<!--NAME FIELDS-->" , $name_fields , $this->output );
|
||||
$this->output = str_replace( "<!--POLL BOX-->" , $poll_box , $this->output );
|
||||
$this->output = str_replace( "<!--POST BOX-->" , $post_box , $this->output );
|
||||
$this->output = str_replace( "<!--POST ICONS-->" , $post_icons , $this->output );
|
||||
$this->output = str_replace( "<!--UPLOAD FIELD-->", $upload_field , $this->output );
|
||||
$this->output = str_replace( "<!--MOD OPTIONS-->" , $mod_options , $this->output );
|
||||
$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
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html_checkboxes('reply', $this->topic['tid'], $this->forum['id']);
|
||||
|
||||
$this->html_topic_summary($this->topic['tid']);
|
||||
|
||||
$this->show_post_navigation();
|
||||
|
||||
$this->title = $this->ipsclass->lang['replying_in'].' '.$this->topic['title'];
|
||||
|
||||
$this->ipsclass->print->add_output( $this->output );
|
||||
|
||||
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->vars['board_name']." -> ".$this->title,
|
||||
'JS' => 1,
|
||||
'NAV' => $this->nav,
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,15 @@
|
||||
<html>
|
||||
<head><title>Ошибка < Русская версия Invision Power Board</title></head>
|
||||
<body>
|
||||
<h1>Ошибка < Русская версия Invision Power Board</h1>
|
||||
<hr>
|
||||
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку «<b>Назад</b>»
|
||||
в вашем браузере для возвращения на предыдущую страницу.
|
||||
<hr>
|
||||
<b>Invision Power Board:</b>
|
||||
<ul>
|
||||
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
|
||||
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user