Version 1.3.0
This commit is contained in:
1 parent
7ef3d1712a
commit
f87d29ba65
290 files changed
+50206
-17930
No files matched your search
@@ -2,15 +2,17 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Board v1.1
|
||||
| Invision Power Board v1.3 Final
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001,2002 Invision Power Services
|
||||
| http://www.ibforums.com
|
||||
| (c) 2001 - 2003 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
| Web: http://www.invisionboard.com
|
||||
| Time: Sun, 04 Jan 2004 00:30:16 GMT
|
||||
| Release: 28e7bfb25f08ac72a789cb1b172fa185
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Edit post library
|
||||
@@ -32,26 +34,33 @@ class post_functions extends Post {
|
||||
var $upload = array();
|
||||
var $moderator = array( 'member_id' => 0, 'member_name' => "", 'edit_post' => 0 );
|
||||
var $orig_post = array();
|
||||
var $edit_title = 0;
|
||||
|
||||
function post_functions($class) {
|
||||
|
||||
global $ibforums, $std, $DB;
|
||||
|
||||
//-------------------------------------------------
|
||||
// Lets load the topic from the database before we do anything else.
|
||||
//-------------------------------------------------
|
||||
|
||||
$DB->query("SELECT * FROM ibf_topics WHERE tid='".$ibforums->input['t']."'");
|
||||
$DB->query("SELECT * FROM ibf_topics WHERE tid=".intval($ibforums->input['t']));
|
||||
$this->topic = $DB->fetch_row();
|
||||
|
||||
//-------------------------------------------------
|
||||
// Is it legitimate?
|
||||
//-------------------------------------------------
|
||||
|
||||
if (! $this->topic['tid'])
|
||||
{
|
||||
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Load the old post
|
||||
//-------------------------------------------------
|
||||
|
||||
$DB->query("SELECT * FROM ibf_posts WHERE pid='".$ibforums->input['p']."'");
|
||||
$DB->query("SELECT * FROM ibf_posts WHERE pid=".intval($ibforums->input['p']));
|
||||
$this->orig_post = $DB->fetch_row();
|
||||
|
||||
if (! $this->orig_post['pid'])
|
||||
@@ -59,11 +68,13 @@ class post_functions extends Post {
|
||||
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Load the moderator
|
||||
//-------------------------------------------------
|
||||
|
||||
if ($ibforums->member['id'])
|
||||
{
|
||||
$DB->query("SELECT member_id, member_name, mid, edit_post FROM ibf_moderators WHERE forum_id='".$class->forum['id']."' AND (member_id='".$ibforums->member['id']."' OR (is_group=1 AND group_id='".$ibforums->member['mgroup']."'))");
|
||||
$DB->query("SELECT member_id, member_name, mid, edit_post, edit_topic FROM ibf_moderators WHERE forum_id=".$class->forum['id']." AND (member_id=".$ibforums->member['id']." OR (is_group=1 AND group_id='".$ibforums->member['mgroup']."'))");
|
||||
$this->moderator = $DB->fetch_row();
|
||||
}
|
||||
|
||||
@@ -104,11 +115,40 @@ class post_functions extends Post {
|
||||
$std->Error( array( LEVEL => 1, MSG => 'not_op') );
|
||||
}
|
||||
|
||||
//-----------------------------
|
||||
// Is the topic locked?
|
||||
//-----------------------------
|
||||
|
||||
if (($this->topic['state'] != 'open') and (!$ibforums->member['g_is_supmod']))
|
||||
{
|
||||
$std->Error( array( LEVEL => 1, MSG => 'locked_topic') );
|
||||
if ($ibforums->member['g_post_closed'] != 1)
|
||||
{
|
||||
$std->Error( array( LEVEL => 1, MSG => 'locked_topic') );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------
|
||||
// // Do we have edit topic abilities?
|
||||
//-----------------------------
|
||||
|
||||
if ( $this->orig_post['new_topic'] == 1 )
|
||||
{
|
||||
if ($ibforums->member['g_is_supmod'] == 1)
|
||||
{
|
||||
$this->edit_title = 1;
|
||||
}
|
||||
|
||||
else if ($this->moderator['edit_topic'] == 1)
|
||||
{
|
||||
if ( $ibforums->member['id'] == $this->topic['starter_id'] )
|
||||
{
|
||||
$this->edit_title = 1;
|
||||
}
|
||||
}
|
||||
else if ($ibforums->member['g_edit_topic'] == 1 )
|
||||
{
|
||||
$this->edit_title = 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -144,7 +184,7 @@ class post_functions extends Post {
|
||||
global $ibforums, $std, $DB, $print, $HTTP_POST_FILES;
|
||||
|
||||
$time = $std->get_date( time(), 'LONG' );
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// Reset some data
|
||||
//-------------------------------------------------
|
||||
@@ -153,7 +193,7 @@ class post_functions extends Post {
|
||||
|
||||
if ($this->orig_post['attach_id'])
|
||||
{
|
||||
if ($ibforums->input['editupload'] != 'keep')
|
||||
if ( isset($ibforums->input['editupload']) AND ($ibforums->input['editupload'] != 'keep') )
|
||||
{
|
||||
// We're either uploading a new attachment, or deleting one, so lets
|
||||
// remove the old attachment first eh?
|
||||
@@ -192,13 +232,31 @@ class post_functions extends Post {
|
||||
else
|
||||
{
|
||||
// We are keeping the old attachment
|
||||
|
||||
$this->post['attach_id'] = $this->orig_post['attach_id'];
|
||||
$this->post['attach_type'] = $this->orig_post['attach_type'];
|
||||
$this->post['attach_hits'] = $this->orig_post['attach_hits'];
|
||||
$this->post['attach_file'] = $this->orig_post['attach_file'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Is there a new attachment?
|
||||
|
||||
$new_upload = $class->process_upload();
|
||||
|
||||
if ( $class->obj['post_errors'] != "") {
|
||||
|
||||
$this->show_form($class);
|
||||
}
|
||||
|
||||
if ( $new_upload['attach_id'] )
|
||||
{
|
||||
$this->post['attach_id'] = $new_upload['attach_id'];
|
||||
$this->post['attach_type'] = $new_upload['attach_type'];
|
||||
$this->post['attach_hits'] = $new_upload['attach_hits'];
|
||||
$this->post['attach_file'] = $new_upload['attach_file'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->post['ip_address'] = $this->orig_post['ip_address'];
|
||||
$this->post['topic_id'] = $this->orig_post['topic_id'];
|
||||
@@ -206,18 +264,81 @@ class post_functions extends Post {
|
||||
$this->post['pid'] = $this->orig_post['pid'];
|
||||
$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'] = $ibforums->member['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'])
|
||||
{
|
||||
$DB->query("UPDATE ibf_topics SET icon_id='".$this->post['icon_id']."' WHERE tid='".$this->topic['tid']."'");
|
||||
$DB->query("UPDATE ibf_topics SET icon_id='".$this->post['icon_id']."' WHERE tid=".$this->topic['tid']);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Update topic title?
|
||||
//-------------------------------------------------
|
||||
|
||||
if ( $this->edit_title == 1 )
|
||||
{
|
||||
if ($ibforums->vars['etfilter_punct'])
|
||||
{
|
||||
$ibforums->input['TopicTitle'] = preg_replace( "/\?{1,}/" , "?" , $ibforums->input['TopicTitle'] );
|
||||
$ibforums->input['TopicTitle'] = preg_replace( "/(!){1,}/" , "!", $ibforums->input['TopicTitle'] );
|
||||
}
|
||||
|
||||
if ($ibforums->vars['etfilter_shout'])
|
||||
{
|
||||
$ibforums->input['TopicTitle'] = ucwords(strtolower($ibforums->input['TopicTitle']));
|
||||
}
|
||||
|
||||
$ibforums->input['TopicTitle'] = trim( $class->parser->bad_words( $ibforums->input['TopicTitle'] ) );
|
||||
$ibforums->input['TopicDesc'] = trim( $class->parser->bad_words( $ibforums->input['TopicDesc'] ) );
|
||||
|
||||
if ( $ibforums->input['TopicTitle'] != "" )
|
||||
{
|
||||
if ( ($ibforums->input['TopicTitle'] != $this->topic['title']) or ($ibforums->input['TopicDesc'] != $this->topic['description']) )
|
||||
{
|
||||
$dbs = $DB->compile_db_update_string( array(
|
||||
'title' => $ibforums->input['TopicTitle'],
|
||||
'description' => $ibforums->input['TopicDesc']
|
||||
) );
|
||||
|
||||
$DB->query("UPDATE ibf_topics SET $dbs WHERE tid=".$this->topic['tid']);
|
||||
|
||||
if ($this->topic['tid'] == $class->forum['last_id'])
|
||||
{
|
||||
$DB->query("UPDATE ibf_forums SET last_title='{$ibforums->input['TopicTitle']}' WHERE id='".$class->forum['id']."'");
|
||||
}
|
||||
|
||||
if ( ($this->moderator['edit_topic'] == 1) OR ( $ibforums->member['g_is_supmod'] == 1 ) )
|
||||
{
|
||||
$db_string = $std->compile_db_string( array (
|
||||
'forum_id' => $class->forum['id'],
|
||||
'topic_id' => $this->topic['tid'],
|
||||
'post_id' => $this->post['pid'],
|
||||
'member_id' => $ibforums->member['id'],
|
||||
'member_name' => $ibforums->member['name'],
|
||||
'ip_address' => $ibforums->input['IP_ADDRESS'],
|
||||
'http_referer'=> $HTTP_REFERER,
|
||||
'ctime' => time(),
|
||||
'topic_title' => $this->topic['title'],
|
||||
'action' => "Edited topic title or description '{$this->topic['title']}' to '{$ibforums->input['TopicTitle']}' via post form",
|
||||
'query_string'=> $QUERY_STRING,
|
||||
)
|
||||
);
|
||||
|
||||
$DB->query("INSERT INTO ibf_moderator_logs (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Update the database (ib_forum_post)
|
||||
//-------------------------------------------------
|
||||
@@ -260,12 +381,23 @@ class post_functions extends Post {
|
||||
// we have a <textarea> tag in the raw post var.
|
||||
//-------------------------------------------------
|
||||
|
||||
$raw_post = isset($HTTP_POST_VARS['Post']) ? $HTTP_POST_VARS['Post'] : $class->parser->unconvert($this->orig_post['post'], $class->forum['use_ibc'], $class->forum['use_html']);
|
||||
$raw_post = isset($HTTP_POST_VARS['Post']) ? $std->txt_htmlspecialchars($HTTP_POST_VARS['Post']) : $class->parser->unconvert($this->orig_post['post'], $class->forum['use_ibc'], $class->forum['use_html']);
|
||||
|
||||
if (isset($raw_post)) {
|
||||
$raw_post = str_replace( '$' , "$" , $raw_post );
|
||||
$raw_post = str_replace( '<' , "<" , $raw_post );
|
||||
$raw_post = stripslashes($raw_post);
|
||||
if (isset($raw_post))
|
||||
{
|
||||
$raw_post = $std->txt_raw2form($raw_post);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Is this the first post in the topic?
|
||||
//-------------------------------------------------
|
||||
|
||||
if ( $this->edit_title == 1 )
|
||||
{
|
||||
$topic_title = isset($HTTP_POST_VARS['TopicTitle']) ? $ibforums->input['TopicTitle'] : $this->topic['title'];
|
||||
$topic_desc = isset($HTTP_POST_VARS['TopicDesc']) ? $ibforums->input['TopicDesc'] : $this->topic['description'];
|
||||
|
||||
$topic_title = $class->html->topictitle_fields( array( 'TITLE' => $topic_title, 'DESC' => $topic_desc ) );
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@@ -279,7 +411,15 @@ class post_functions extends Post {
|
||||
|
||||
if ($class->obj['preview_post'])
|
||||
{
|
||||
$class->output .= $class->html->preview( $class->parser->convert( array( 'TEXT' => $this->post['post'], 'CODE' => $class->forum['use_ibc'], 'SMILIES' => $ibforums->input['enableemo'], 'HTML' => $class->forum['use_html']) ) );
|
||||
$this->post['post'] = $class->parser->post_db_parse(
|
||||
$class->parser->convert( array(
|
||||
'TEXT' => $this->post['post'],
|
||||
'CODE' => $class->forum['use_ibc'],
|
||||
'SMILIES' => $ibforums->input['enableemo'],
|
||||
'HTML' => $class->forum['use_html']
|
||||
) ) ,
|
||||
$class->forum['use_html'] AND $ibforums->member['g_dohtml'] ? 1 : 0);
|
||||
$class->output .= $class->html->preview( $this->post['post'] );
|
||||
}
|
||||
|
||||
$class->check_upload_ability();
|
||||
@@ -308,9 +448,16 @@ class post_functions extends Post {
|
||||
|
||||
$post_icons = $class->html_post_icons($this->orig_post['icon_id']);
|
||||
|
||||
if (($class->obj['can_upload']) and ($this->orig_post['attach_id'] != ""))
|
||||
if ( $class->obj['can_upload'] )
|
||||
{
|
||||
$upload_field = $class->html->edit_upload_field( $ibforums->member['g_attach_max'] * 1024, $this->orig_post['attach_file'] );
|
||||
if ($this->orig_post['attach_id'] != "")
|
||||
{
|
||||
$upload_field = $class->html->edit_upload_field( $std->size_format( $ibforums->member['g_attach_max'] * 1024 ), $this->orig_post['attach_file'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$upload_field = $class->html->Upload_field( $std->size_format( $ibforums->member['g_attach_max'] * 1024 ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ($ibforums->member['g_append_edit'])
|
||||
@@ -334,11 +481,21 @@ class post_functions extends Post {
|
||||
$class->output = str_replace( "<!--END TABLE-->" , $end_form , $class->output );
|
||||
$class->output = str_replace( "<!--UPLOAD FIELD-->", $upload_field , $class->output );
|
||||
$class->output = str_replace( "<!--MOD OPTIONS-->" , $edit_option , $class->output );
|
||||
$class->output = str_replace( "<!--FORUM RULES-->" , $std->print_forum_rules($class->forum), $class->output );
|
||||
$class->output = str_replace( "<!--TOPIC TITLE-->" , $topic_title , $class->output );
|
||||
|
||||
//---------------------------------------
|
||||
|
||||
$class->html_add_smilie_box();
|
||||
|
||||
//---------------------------------------
|
||||
// Add in siggy buttons and such
|
||||
//---------------------------------------
|
||||
|
||||
$class->html_checkboxes('edit');
|
||||
|
||||
//---------------------------------------
|
||||
|
||||
$class->html_topic_summary($this->topic['tid']);
|
||||
|
||||
$this->nav = array( "<a href='{$class->base_url}&act=SC&c={$class->forum['cat_id']}'>{$class->forum['cat_name']}</a>",
|
||||
|
||||
Reference in new issue
Block a user