Version 3.2.3

This commit is contained in:
Neo committed 2025-12-19 00:34:03 -08:00
1 parent ae5c01cc78
commit 78706903a2
2641 files changed
+228363 -201264

No files matched your search

@@ -2,19 +2,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Posting
* Last Updated: $Date: 2010-10-20 09:03:17 -0400 (Wed, 20 Oct 2010) $
* Last Updated: $Date: 2011-09-16 07:16:26 -0400 (Fri, 16 Sep 2011) $
* </pre>
* File Created By: Matt Mecham
*
* @author $Author: ips_terabyte $
* @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 7003 $
* @link http://hatynka.in
* @version $Rev: 9496 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -43,7 +43,7 @@ class public_forums_post_post extends ipsCommand
* Controller run function
*
* @param object Registry
* @return void
* @return @e void
*/
public function doExecute( ipsRegistry $registry )
{
@@ -75,16 +75,16 @@ class public_forums_post_post extends ipsCommand
// Check the input
//-----------------------------------------
$this->request[ 't' ] = intval($this->request['t'] );
$this->request[ 'p' ] = intval($this->request['p'] );
$this->request[ 'f' ] = intval($this->request['f'] );
$this->request[ 'st'] = intval($this->request['st'] );
$this->request[ 't' ] = intval($this->request['t']);
$this->request[ 'p' ] = intval($this->request['p']);
$this->request[ 'f' ] = intval($this->request['f']);
$this->request[ 'st'] = intval($this->request['st']);
//-----------------------------------------
// Grab the post class
//-----------------------------------------
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php' );
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php' );/*noLibHook*/
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPostForms.php', 'classPostForms', 'forums' );
$this->_postClass = new $classToLoad( $registry );
@@ -97,13 +97,12 @@ class public_forums_post_post extends ipsCommand
$this->_postClass->setPostID( $this->request['p'] );
$this->_postClass->setForumID( $this->request['f'] );
# Topic Title and description - use _POST as it is cleaned in the function.
# Topic Title use _POST as it is cleaned in the function.
# We wrap this because the title may not be set when showing a form and would
# throw a length error
if ( $_POST['TopicTitle'] )
{
$this->_postClass->setTopicTitle( $_POST['TopicTitle'] );
$this->_postClass->setTopicDescription( $_POST['TopicDesc'] );
}
# Is Preview Mode
@@ -128,7 +127,7 @@ class public_forums_post_post extends ipsCommand
# Published
$this->_postClass->setPublished( $this->_checkPostModeration( $doCodes[ $do ][1] ) === TRUE ? TRUE : FALSE );
$this->_postClass->setPublished( $doCodes[ $do ][1] );
# Post Content
$this->_postClass->setPostContent( isset( $_POST['Post'] ) ? $_POST['Post'] : '' );
@@ -200,7 +199,7 @@ class public_forums_post_post extends ipsCommand
{
if ( $this->memberData['g_avoid_flood'] != 1 )
{
if ( time() - $this->memberData['last_post'] < $this->settings['flood_control'] )
if ( ( time() - $this->memberData['last_post'] < $this->settings['flood_control'] ) OR time() < $this->memberData['last_post'] )
{
$this->registry->getClass('output')->showError( array( 'flood_control', $this->settings['flood_control'] ), 103128, null, null, 403 );
}
@@ -246,7 +245,7 @@ class public_forums_post_post extends ipsCommand
// Make sure we have a "Guest" Name..
//-----------------------------------------
$this->_check_guest_name();
$this->_fixGuestName();
$this->checkDoublePost();
$this->saveForm( $doCodes[ $do ][1] );
@@ -261,7 +260,7 @@ class public_forums_post_post extends ipsCommand
* Save the form
*
* @param string Type of form to show
* @return void
* @return @e void
*/
public function saveForm( $type )
{
@@ -328,7 +327,7 @@ class public_forums_post_post extends ipsCommand
$this->showForm( $type );
}
$this->registry->getClass('output')->showError( $error->getMessage(), 103130 );
$this->registry->getClass('output')->showError( $error->getMessage(), 103130, null, null, 403 );
}
break;
case 'new':
@@ -350,7 +349,7 @@ class public_forums_post_post extends ipsCommand
catch( Exception $error )
{
$language = $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage();
$this->registry->getClass('output')->showError( $language, 103131 );
$this->registry->getClass('output')->showError( $language, 103131, null, null, 403 );
}
break;
case 'edit':
@@ -366,13 +365,23 @@ class public_forums_post_post extends ipsCommand
$topic = $this->_postClass->getTopicData();
$post = $this->_postClass->getPostData();
if( $this->request['return'] )
{
$_bits = explode( ':', $this->request['return'] );
if( count($_bits) AND $_bits[0] == 'modcp' )
{
$this->registry->output->redirectScreen( $this->lang->words['post_edited'], $this->settings['base_url'] . "app=core&amp;module=modcp&amp;fromapp=forums&amp;tab=" . $_bits[1] . 'posts' );
}
}
# Redirect
ipsRegistry::getClass('output')->redirectScreen( $this->lang->words['post_edited'], $this->settings['base_url'] . "showtopic={$topic['tid']}&st=" . $this->request['st'] . "#entry{$post['pid']}", $topic['title_seo'] );
}
catch( Exception $error )
{
$this->registry->getClass('output')->showError( $error->getMessage(), 103132 );
$this->registry->getClass('output')->showError( $error->getMessage(), 103132, null, null, 403 );
}
break;
}
@@ -404,7 +413,7 @@ class public_forums_post_post extends ipsCommand
}
else
{
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103133 );
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103133, null, null, 403 );
}
}
break;
@@ -427,7 +436,7 @@ class public_forums_post_post extends ipsCommand
}
else
{
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103134 );
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103134, null, null, 403 );
}
}
break;
@@ -446,7 +455,7 @@ class public_forums_post_post extends ipsCommand
}
else
{
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103135 );
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103135, null, null, 403 );
}
}
break;
@@ -460,34 +469,38 @@ class public_forums_post_post extends ipsCommand
*/
public function checkDoublePost()
{
if( ! $this->_postClass->getIsPreview() )
if ( ! $this->_postClass->getIsPreview() )
{
if( time() - $this->memberData['last_post'] <= 5 )
if ( time() - $this->memberData['last_post'] <= 4 )
{
if( $this->request['do'] == '01' or $this->request['do'] == '11' )
if ( $this->request['do'] == 'new_post_do' )
{
/* Redirect to the newest topic in the forum */
$forum = $this->_postClass->getForumData();
$this->DB->build( array(
'select' => 'tid',
'from' => 'topics',
'where' => "forum_id='" . $forum['id'] . "' AND approved=1",
'order' => 'last_post DESC',
'limit' => array( 0, 1 )
) );
$this->DB->execute();
$topic = $this->DB->fetch();
$topic = $this->DB->buildAndFetch( array(
'select' => 'tid',
'from' => 'topics',
'where' => "forum_id='" . $forum['id'] . "' AND " . $this->registry->getClass('class_forums')->fetchTopicHiddenQuery( array( 'visible' ), '' ),
'order' => 'last_post DESC',
'limit' => array( 0, 1 )
) );
$this->registry->getClass('output')->silentRedirect( "{$this->settings['base_url']}showtopic={$topic['tid']}" );
exit();
}
else
{
/* It's a reply, so simply show the topic... */
$this->registry->getClass('output')->silentRedirect( "{$this->settings['base_url']}showtopic={$this->request['t']}&amp;view=getlastpost" );
exit();
/* Verify if last post was made to this same topic
@link http://community.invisionpower.com/tracker/issue-25712-replying-to-two-topics-at-same-time-causing-only-one-post-to-actually-make-it-into-the-database */
$_lastPost = $this->DB->buildAndFetch( array( 'select' => 'topic_id', 'from' => 'posts', 'where' => 'author_id=' . $this->memberData['member_id'], 'order' => 'post_date DESC', 'limit' => array( 0, 1 ) ) );
/* We made a reply within the last 4 seconds to this topic.. */
if( $_lastPost['topic_id'] == $this->request['t'] )
{
$this->registry->getClass('output')->silentRedirect( "{$this->settings['base_url']}showtopic={$this->request['t']}&amp;view=getlastpost" );
exit();
}
}
}
}
@@ -496,15 +509,10 @@ class public_forums_post_post extends ipsCommand
/**
* Check for guest's name being in use
*
* @return void
* @deprecated As far as I can see this function is not used anywhere, we should remove it for 3.2
* @return @e void
*/
private function _check_guest_name()
protected function _fixGuestName()
{
/* is this even used anymore?
I disabled it 'cos it was adding the prefix and suffix twice when using a 'found' name
-- Matt */
if ( ! $this->memberData['member_id'] )
{
$this->request['UserName'] = trim( $this->request['UserName'] );
@@ -514,103 +522,6 @@ class public_forums_post_post extends ipsCommand
$this->request['UserName'] = IPSText::mbstrlen( $this->request['UserName'] ) > $this->settings['max_user_name_length'] ? $this->lang->words['global_guestname'] : $this->request['UserName'];
}
return;
/*if( ! $this->memberData['member_id'] )
{
$this->request['UserName'] = trim( $this->request['UserName'] );
$this->request['UserName'] = str_replace( '<br />', '', $this->request['UserName'] );
$this->request['UserName'] = $this->request['UserName'] ? $this->request['UserName'] : $this->lang->words['global_guestname'] ;
$this->request['UserName'] = IPSText::mbstrlen( $this->request['UserName'] ) > $this->settings['max_user_name_length'] ? $this->lang->words['global_guestname'] : $this->request['UserName'];
if ($this->request['UserName'] != $this->lang->words['global_guestname'])
{
$this->DB->build( array(
'select' => 'member_id, name, members_display_name, members_created_remote, email, member_group_id, member_login_key, ip_address, login_anonymous',
'from' => 'members',
'where' => 'members_l_username=\'' . trim( strtolower( $this->request['UserName'] ) ) . '\''
) );
$this->DB->execute();
if ( $this->DB->getTotalRows() )
{
$this->request['UserName'] = $this->settings['guest_name_pre'] . $this->request['UserName'] . $this->settings['guest_name_suf'] ;
}
}
}*/
}
/**
* Checks to see if this member is forced to have their posts
* moderated
*
* @param string Type of post (new, reply, edit, poll)
* @return boolean Whether to PUBLISH this topic or not
*/
private function _checkPostModeration( $type )
{
/* Does this member have mod_posts enabled? */
if ( $this->memberData['mod_posts'] )
{
/* Mod Queue Forever */
if ( $this->memberData['mod_posts'] == 1 )
{
return FALSE;
}
else
{
/* Do we need to remove the mod queue for this user? */
$mod_arr = IPSMember::processBanEntry( $this->memberData['mod_posts'] );
/* Yes, they are ok now */
if ( time() >= $mod_arr['date_end'] )
{
IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'mod_posts' => 0 ) ) );
}
/* Nope, still don't want to see them */
else
{
return FALSE;
}
}
}
/* Group can bypass mod queue */
if( $this->memberData['g_avoid_q'] )
{
return TRUE;
}
/* Is the member's group moderated? */
if ( $this->_postClass->checkGroupIsPostModerated( $this->memberData ) === TRUE )
{
return FALSE;
}
/* Check to see if this forum has moderation enabled */
$forum = $this->_postClass->getForumData();
switch( intval( $forum['preview_posts'] ) )
{
default:
case 0:
return TRUE;
break;
case 1:
return FALSE;
break;
case 2:
return ( $type == 'new' ) ? FALSE : TRUE;
break;
case 3:
return ( $type == 'reply' ) ? FALSE : TRUE;
break;
}
/* Our post can be seen! */
return TRUE;
}
/**
@@ -618,7 +529,7 @@ class public_forums_post_post extends ipsCommand
*
* @return string
*/
private function _fetchPpdError()
protected function _fetchPpdError()
{
$_g = $this->caches['group_cache'][ $this->memberData['member_group_id'] ];
$_l = sprintf( $this->lang->words['NO_POSTING_PPD'], $_g['g_ppd_limit'] );