Version 3.4.5

This commit is contained in:
Neo committed 2025-12-19 00:38:12 -08:00
1 parent fb6b5baabc
commit e4478369d8
1360 files changed
+228921 -179445

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -2,19 +2,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Posting display formatting methods
* Last Updated: $Date: 2012-07-09 12:56:26 -0400 (Mon, 09 Jul 2012) $
* Last Updated: $Date: 2013-03-20 10:14:51 -0400 (Wed, 20 Mar 2013) $
* </pre>
* File Created By: Matt Mecham
*
* @author $Author: AndyMillne $
* @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 11047 $
* @version $Revision: 12094 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -128,6 +128,9 @@ class classPostForms extends classPost
$extraData['reasonForEdit'] = $this->request['post_edit_reason'] ? $this->request['post_edit_reason'] : $this->_originalPost['post_edit_reason'];
$extraData['append_edit'] = $this->request['append_edit'] ? $this->request['append_edit'] : $this->_originalPost['append_edit'];
/* HTML set? */
$this->setSettings( array( 'post_htmlstatus' => $this->_originalPost['post_htmlstate'] ) );
$extraData['checkBoxes'] = $this->_generateCheckBoxes( 'edit', isset( $topic['tid'] ) ? $topic['tid'] : 0, $this->getForumData('id') );
//-----------------------------------------
@@ -138,7 +141,6 @@ class classPostForms extends classPost
$postContent = $this->getPostContentPreFormatted() ? $this->getPostContentPreFormatted() : $this->getPostContent();
$postContent = $this->_afterPostCompile( $postContent, 'edit' );
//-----------------------------------------
// Do we have any posting errors?
//-----------------------------------------
@@ -312,25 +314,35 @@ class classPostForms extends classPost
//-----------------------------------------
// Appending a reason for the edit?
//-----------------------------------------
if ( $this->getAuthor('g_append_edit') )
{
$extraData['showEditOptions'] = 1;
if ( !empty( $this->_originalPost['append_edit'] ) )
$extraData['showAppendEdit'] = 0;
if ( $this->getAuthor('g_append_edit') )
{
$extraData['showEditOptions'] = 1;
$extraData['showAppendEdit'] = 1;
if ( $this->_originalPost['append_edit'] )
{
$extraData['checked'] = "checked";
}
$extraData['checked'] = 'checked';
}
else
{
$extraData['checked'] = '';
}
}
if ( !empty( $this->moderator['edit_post'] ) OR $this->getAuthor('g_is_supmod') )
if ( isset( $this->moderator['edit_post'] ) && $this->moderator['edit_post'] OR $this->getAuthor('g_is_supmod') )
{
$extraData['showEditOptions'] = 1;
$extraData['showReason'] = 1;
}
/* Reset reason for edit */
$extraData['reasonForEdit'] = $this->request['post_edit_reason'] ? $this->request['post_edit_reason'] : $this->_originalPost['post_edit_reason'];
$extraData['reasonForEdit'] = $this->request['post_edit_reason'] ? $this->request['post_edit_reason'] : $this->_originalPost['post_edit_reason'];
$extraData['append_edit'] = $this->request['append_edit'] ? $this->request['append_edit'] : $this->_originalPost['append_edit'];
/* Reset check boxes and such */
$this->setSettings( array( 'enableSignature' => $this->_originalPost['use_sig'],
'enableEmoticons' => $this->_originalPost['use_emo'],
@@ -386,7 +398,7 @@ class classPostForms extends classPost
{
$output .= $this->registry->getClass('output')->getTemplate('post')->preview( $this->_generatePostPreview( $this->getPostContentPreFormatted() ? $this->getPostContentPreFormatted() : $this->getPostContent(), $this->post_key ) );
}
/* Defaults */
if( ! isset( $extraData['checked'] ) )
{
@@ -564,6 +576,13 @@ class classPostForms extends classPost
$postContent = IPSText::stripslashes( $_POST['Post'] );
}
}
else if ( $this->getIsPreview() )
{
if ( isset($_POST['Post']) )
{
$postContent = $_POST['Post'];
}
}
return $postContent;
}
@@ -620,10 +639,12 @@ class classPostForms extends classPost
$_queued = $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible' ), 'p.' );
$sort_field = ($this->settings['post_order_column'] == 'pid') ? 'p.pid' : 'p.post_date';
$this->DB->build( array( 'select' => 'p.*',
'from' => array( 'posts' => 'p' ),
'where' => 'p.topic_id=' . $topicID . ' AND ' . $_queued,
'order' => 'p.pid DESC',
'order' => $sort_field . ' DESC',
'limit' => array( 0, 10 ),
'add_join' => array(
array( 'select' => 'm.members_display_name, m.member_group_id, m.mgroup_others, m.member_id, m.members_seo_name',
@@ -646,25 +667,25 @@ class classPostForms extends classPost
$post_query = $this->DB->execute();
/* Load parser */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser' );
$parser = new $classToLoad();
while ( $row = $this->DB->fetch($post_query) )
{
$row['author'] = $row['members_display_name'] ? $row['members_display_name'] : $row['author_name'];
$row['date'] = $this->registry->getClass('class_localization')->getDate( $row['post_date'], 'LONG' );
//-----------------------------------------
// Parse the post
//-----------------------------------------
IPSText::getTextClass( 'bbcode' )->parse_smilies = $row['use_emo'];
IPSText::getTextClass( 'bbcode' )->parse_html = $row['post_htmlstate'];
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = $row['use_ibc'];
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others'];
$row['post'] = IPSText::getTextClass('bbcode')->preDisplayParse( $row['post'] );
# Config
$parser->set( array( 'memberData' => $this->memberData,
'parseBBCode' => $this->getForumData('use_ibc'),
'parseArea' => 'topics',
'parseHtml' => (intval($row['post_htmlstate']) AND $this->getForumData('use_html') AND $this->getAuthor('g_dohtml')) ? 1 : 0,
'parseEmoticons' => $row['use_emo'] ) );
# Make sure we have the display look
$row['post'] = $parser->display( $row['post'] );
//-----------------------------------------
// Are we giving this bloke a good ignoring?
@@ -754,7 +775,7 @@ class classPostForms extends classPost
{
$return['emo'] = "";
}
if ( $this->_canHtml( $forumID ) )
{
$return['html'] = ( $this->getSettings('post_htmlstatus') ) ? ' checked="checked"' : '';
@@ -861,7 +882,7 @@ class classPostForms extends classPost
{
$selected = ($this->getModOptions() == 'nowt') ? " selected='selected'" : '';
$html = "<select id='forminput' name='mod_options' class='forminput'>\n<option value='nowt'{$selected}>".$this->lang->words['mod_nowt']."</option>\n";
$html = "<select id='forminput' name='mod_options' class='forminput' tabindex='61'>\n<option value='nowt'{$selected}>".$this->lang->words['mod_nowt']."</option>\n";
}
if ($can_pin AND !$topic['pinned'] )
@@ -938,10 +959,10 @@ class classPostForms extends classPost
// Check dates...
//-----------------------------------------
$mytimes['open_time'] = isset($_POST['open_time_time']) ? $_POST['open_time_time'] : '';
$mytimes['open_date'] = isset($_POST['open_time_date']) ? $_POST['open_time_date'] : '';
$mytimes['close_time'] = isset($_POST['close_time_time']) ? $_POST['close_time_time'] : '';
$mytimes['close_date'] = isset($_POST['close_time_date']) ? $_POST['close_time_date'] : '';
$mytimes['open_time'] = isset($_POST['open_time_time']) ? IPSText::parseCleanValue( $_POST['open_time_time'] ) : '';
$mytimes['open_date'] = isset($_POST['open_time_date']) ? IPSText::parseCleanValue( $_POST['open_time_date'] ) : '';
$mytimes['close_time'] = isset($_POST['close_time_time']) ? IPSText::parseCleanValue( $_POST['close_time_time'] ) : '';
$mytimes['close_date'] = isset($_POST['close_time_date']) ? IPSText::parseCleanValue( $_POST['close_time_date'] ) : '';
if( $this->_originalPost['new_topic'] )
{
@@ -1067,7 +1088,7 @@ class classPostForms extends classPost
}
}
if ( $formType == 'edit' AND ( ! isset($_POST['question']) OR ! is_array( $_POST['question'] ) OR ! count( $_POST['question'] ) ) )
if ( $formType == 'edit' AND ( ! isset($_POST['question']) OR ! is_array( $_POST['question'] ) OR ! count( $_POST['question'] ) OR $this->getIsPreview() ) )
{
//-----------------------------------------
// Load the poll from the DB
@@ -1075,11 +1096,11 @@ class classPostForms extends classPost
$this->poll_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'polls', 'where' => "tid=".$this->getTopicID() ) );
$this->poll_answers = unserialize(stripslashes($this->poll_data['choices']));
$this->poll_answers = IPSLib::safeUnserialize(stripslashes($this->poll_data['choices']));
if( !is_array($this->poll_answers) OR !count($this->poll_answers) )
{
$this->poll_answers = unserialize( preg_replace( '!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", stripslashes( $this->poll_data['choices'] ) ) );
$this->poll_answers = IPSLib::safeUnserialize( preg_replace( '!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", stripslashes( $this->poll_data['choices'] ) ) );
}
if ( !is_array($this->poll_answers) OR !count($this->poll_answers) )
{
@@ -1156,17 +1177,19 @@ class classPostForms extends classPost
protected function _generatePostPreview( $postContent="", $post_key='' )
{
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ) );
IPSText::getTextClass('bbcode')->parse_html = (intval($this->request['post_htmlstatus']) AND $this->getForumData('use_html') AND $this->getAuthor('g_dohtml')) ? 1 : 0;
IPSText::getTextClass('bbcode')->parse_nl2br = $this->request['post_htmlstatus'] == 2 ? 1 : 0;
IPSText::getTextClass('bbcode')->parse_smilies = intval($this->getSettings('enableEmoticons'));
IPSText::getTextClass('bbcode')->parse_bbcode = $this->getForumData('use_ibc');
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
IPSText::getTextClass('bbcode')->parsing_mgroup = $this->memberData['member_group_id'];
IPSText::getTextClass('bbcode' )->parsing_mgroup_others = $this->memberData['mgroup_others'];
# Make sure we have the pre-display look
$postContent = IPSText::getTextClass('bbcode')->preDisplayParse( $postContent );
/* Load parser */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser' );
$parser = new $classToLoad();
$parser->set( array( 'memberData' => $this->memberData,
'parseBBCode' => $this->getForumData('use_ibc'),
'parseArea' => 'topics',
'parseHtml' => (intval($this->request['post_htmlstatus']) AND $this->getForumData('use_html') AND $this->getAuthor('g_dohtml')) ? 1 : 0,
'parseEmoticons' => $this->getSettings('enableEmoticons') ) );
# Make sure we have the display look
$postContent = $parser->display( $postContent );
if ( ! is_object( $this->class_attach ) )
{