Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
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.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Posting display formatting methods
|
||||
* Last Updated: $Date: 2010-10-20 09:03:17 -0400 (Wed, 20 Oct 2010) $
|
||||
* Last Updated: $Date: 2011-09-29 22:09:09 -0400 (Thu, 29 Sep 2011) $
|
||||
* </pre>
|
||||
* File Created By: Matt Mecham
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @author $Author: bfarber $
|
||||
* @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 $Revision: 7003 $
|
||||
* @link http://hatynka.in
|
||||
* @version $Revision: 9570 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -28,7 +28,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
@@ -42,7 +41,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Magic __call method
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
@@ -54,7 +52,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Displays the ajax edit box
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML
|
||||
*/
|
||||
public function displayAjaxEditForm()
|
||||
@@ -85,10 +82,24 @@ class classPostForms extends classPost
|
||||
throw new Exception( $e );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Form specific...
|
||||
//-----------------------------------------
|
||||
|
||||
try
|
||||
{
|
||||
$topic = $this->editSetUp();
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
throw new Exception( $error->getMessage() );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Appending a reason for the edit?
|
||||
//-----------------------------------------
|
||||
|
||||
$extraData['showAppendEdit'] = 0;
|
||||
|
||||
if ( $this->getAuthor('g_append_edit') )
|
||||
@@ -113,19 +124,6 @@ class classPostForms extends classPost
|
||||
$extraData['showReason'] = 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Form specific...
|
||||
//-----------------------------------------
|
||||
|
||||
try
|
||||
{
|
||||
$topic = $this->editSetUp();
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
throw new Exception( $error->getMessage() );
|
||||
}
|
||||
|
||||
/* Reset reason for edit */
|
||||
$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'];
|
||||
@@ -138,12 +136,8 @@ class classPostForms extends classPost
|
||||
|
||||
$post = $this->compilePostData();
|
||||
$postContent = $this->getPostContentPreFormatted() ? $this->getPostContentPreFormatted() : $this->getPostContent();
|
||||
$postContent = $this->_afterPostCompile( $postContent, 'edit' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Hmmmmm....
|
||||
//-----------------------------------------
|
||||
|
||||
$postContent = IPSText::getTextClass('editor')->unProcessRawPost( $this->_afterPostCompile( $postContent, 'edit' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have any posting errors?
|
||||
@@ -153,6 +147,23 @@ class classPostForms extends classPost
|
||||
{
|
||||
$errors = isset($this->lang->words[ $this->_postErrors ]) ? $this->lang->words[ $this->_postErrors ] : $this->_postErrors;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we need to tell browser to load the JS?
|
||||
//-----------------------------------------
|
||||
|
||||
$extraData['_loadJs'] = false;
|
||||
$extraData['smilies'] = null;
|
||||
|
||||
if (
|
||||
( $this->registry->permissions->check( 'reply', $this->getForumData() ) != TRUE )
|
||||
or ( $this->getTopicData('state') == 'closed' AND !$this->memberData['g_post_closed'] )
|
||||
//or ( $this->getTopicData('_ppd_ok') === FALSE )
|
||||
or ( $this->getTopicData('poll_only') ) )
|
||||
{
|
||||
$extraData['_loadJs'] = true;
|
||||
$extraData['smilies'] = $this->editor->fetchEmoticons();
|
||||
}
|
||||
|
||||
$html = $this->registry->getClass('output')->getTemplate('editors')->ajaxEditBox( $postContent, $this->getPostID(), $errors, $extraData );
|
||||
|
||||
@@ -162,7 +173,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Show the reply form
|
||||
*
|
||||
* @access protected
|
||||
* @param string Type of form (new/reply/add)
|
||||
* @param array Array of extra data
|
||||
* @return void [Passes data to classOutput]
|
||||
@@ -173,12 +183,13 @@ class classPostForms extends classPost
|
||||
// Set up
|
||||
//-----------------------------------------
|
||||
|
||||
$output = '';
|
||||
$titleText = '';
|
||||
$buttonText = '';
|
||||
$doCode = '';
|
||||
$topText = '';
|
||||
$checkFunc = '';
|
||||
$output = '';
|
||||
$titleText = '';
|
||||
$buttonText = '';
|
||||
$doCode = '';
|
||||
$topText = '';
|
||||
$checkFunc = '';
|
||||
$autoSaveKey = '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Work out function type
|
||||
@@ -236,28 +247,79 @@ class classPostForms extends classPost
|
||||
//-----------------------------------------
|
||||
// Work out elements
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
switch( $formType )
|
||||
{
|
||||
default:
|
||||
case 'reply':
|
||||
$doCode = 'reply_post_do';
|
||||
$titleText = $this->lang->words['top_txt_reply'] . ' ' . $topic['title'];
|
||||
$buttonText = $this->lang->words['submit_reply'];
|
||||
$topText = $this->lang->words['replying_in'] . ' ' . $topic['title'];
|
||||
$doCode = 'reply_post_do';
|
||||
$titleText = $this->lang->words['top_txt_reply'] . ' ' . $topic['title'];
|
||||
$buttonText = $this->lang->words['submit_reply'];
|
||||
$topText = $this->lang->words['replying_in'] . ' ' . $topic['title'];
|
||||
$autoSaveKey = 'reply-' . intval( $this->request['t'] );
|
||||
break;
|
||||
case 'new':
|
||||
$doCode = 'new_post_do';
|
||||
$titleText = $this->lang->words['top_txt_new'] . $this->getForumData('name');
|
||||
$buttonText = $this->lang->words['submit_new'];
|
||||
$topText = $this->lang->words['posting_new_topic'];
|
||||
$doCode = 'new_post_do';
|
||||
$titleText = $this->lang->words['top_txt_new'] . $this->getForumData('name');
|
||||
$buttonText = $this->lang->words['submit_new'];
|
||||
$topText = $this->lang->words['posting_new_topic'];
|
||||
$autoSaveKey = 'new-' . intval( $this->request['f'] );
|
||||
$tagBox = '';
|
||||
|
||||
$where = array( 'meta_parent_id' => intval( $this->request['f'] ),
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'existing_tags' => explode( ',', IPSText::cleanPermString( $_REQUEST['ipsTags'] ) ) );
|
||||
|
||||
if ( $this->registry->tags->can( 'add', $where ) )
|
||||
{
|
||||
$tagBox = $this->registry->tags->render('entryBox', $where);
|
||||
}
|
||||
break;
|
||||
case 'edit':
|
||||
$doCode = 'edit_post_do';
|
||||
$titleText = $this->lang->words['top_txt_edit'] . ' ' . $topic['title'];
|
||||
$buttonText = $this->lang->words['submit_edit'];
|
||||
$topText = $this->lang->words['editing_post'] . ' ' . $topic['title'];
|
||||
$doCode = 'edit_post_do';
|
||||
$titleText = $this->lang->words['top_txt_edit'] . ' ' . $topic['title'];
|
||||
$buttonText = $this->lang->words['submit_edit'];
|
||||
$topText = $this->lang->words['editing_post'] . ' ' . $topic['title'];
|
||||
$autoSaveKey = 'edit-' . intval( $this->request['p'] );
|
||||
|
||||
$where = array( 'meta_id' => $topic['tid'],
|
||||
'meta_parent_id' => intval( $this->request['f'] ),
|
||||
'member_id' => $this->memberData['member_id'] );
|
||||
|
||||
if( $_REQUEST['ipsTags'] )
|
||||
{
|
||||
$where['existing_tags'] = explode( ',', IPSText::cleanPermString( $_REQUEST['ipsTags'] ) );
|
||||
}
|
||||
|
||||
if ( $this->registry->tags->can( 'edit', $where ) && ( $this->request['p'] == $topic['topic_firstpost'] ) )
|
||||
{
|
||||
$tagBox = $this->registry->tags->render('entryBox', $where);
|
||||
}
|
||||
|
||||
/* Are we following? */
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
|
||||
$_like = classes_like::bootstrap( 'forums','topics' );
|
||||
$_likes = $_like->isLiked( $this->getTopicData('tid'), $this->getAuthor('member_id') );
|
||||
|
||||
//-----------------------------------------
|
||||
// Appending a reason for the edit?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->getAuthor('g_append_edit') )
|
||||
{
|
||||
$extraData['showEditOptions'] = 1;
|
||||
|
||||
if ( !empty( $this->_originalPost['append_edit'] ) )
|
||||
{
|
||||
$extraData['checked'] = "checked";
|
||||
}
|
||||
}
|
||||
|
||||
if ( !empty( $this->moderator['edit_post'] ) OR $this->getAuthor('g_is_supmod') )
|
||||
{
|
||||
$extraData['showReason'] = 1;
|
||||
}
|
||||
|
||||
/* Reset reason for edit */
|
||||
$extraData['reasonForEdit'] = $this->request['post_edit_reason'] ? $this->request['post_edit_reason'] : $this->_originalPost['post_edit_reason'];
|
||||
|
||||
@@ -265,7 +327,7 @@ class classPostForms extends classPost
|
||||
$this->setSettings( array( 'enableSignature' => $this->_originalPost['use_sig'],
|
||||
'enableEmoticons' => $this->_originalPost['use_emo'],
|
||||
'post_htmlstatus' => $this->_originalPost['post_htmlstate'],
|
||||
'enableTracker' => ( (intval($this->request['enabletrack']) != 0) OR $this->getIsPreview() !== TRUE ) ? 1 : 0 ) );
|
||||
'enableTracker' => ( intval($this->request['enabletrack']) != 0 ? 1 : ( $_likes ? 1 : 0 ) ) ) );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -285,27 +347,18 @@ class classPostForms extends classPost
|
||||
//-----------------------------------------
|
||||
// Compile the poll
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$this->poll_questions = $this->compilePollData();
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we quoting posts?
|
||||
//-----------------------------------------
|
||||
|
||||
$postContent = $this->_checkMultiQuote( $postContent );
|
||||
|
||||
//-----------------------------------------
|
||||
// RTE? Convert RIGHT tags that QUOTE would
|
||||
// have put there
|
||||
// Commented out 14/7/08 - _afterPostCompile handles this for edit, and should
|
||||
// also handle for any other type if they need it...
|
||||
//-----------------------------------------
|
||||
/* Set content in editor */
|
||||
$this->editor->setContent( $postContent );
|
||||
|
||||
/*if ( IPSText::getTextClass('editor')->method == 'rte' )
|
||||
{
|
||||
$postContent = IPSText::getTextClass('bbcode')->convertForRTE( $postContent );
|
||||
}*/
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have any posting errors?
|
||||
//-----------------------------------------
|
||||
@@ -350,7 +403,7 @@ class classPostForms extends classPost
|
||||
$class_attach->attach_post_key = $this->post_key;
|
||||
$class_attach->init();
|
||||
$class_attach->getUploadFormSettings();
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// START TABLE
|
||||
//-----------------------------------------
|
||||
@@ -358,10 +411,9 @@ class classPostForms extends classPost
|
||||
$output .= $this->registry->getClass('output')->getTemplate('post')->postFormTemplate( array( 'title' => $titleText,
|
||||
'captchaHTML' => $this->_generateGuestCaptchaHTML(),
|
||||
'checkBoxes' => $this->_generateCheckBoxes( $formType, isset( $topic['tid'] ) ? $topic['tid'] : 0, $this->getForumData('id') ),
|
||||
'editor' => IPSText::getTextClass('editor')->showEditor( $postContent, 'Post' ),
|
||||
'editor' => $this->editor->show( 'Post', array( 'autoSaveKey' => $autoSaveKey, 'height' => 350 ) ),
|
||||
'buttonText' => $buttonText,
|
||||
'uploadForm' => ( $this->can_upload ) ? $this->registry->getClass('output')->getTemplate('post')->uploadForm( $this->post_key, 'post', $class_attach->attach_stats, $this->getPostID(), $this->getForumData('id') ) : "",
|
||||
'postIconSelected' => $this->_generatePostIcons( $post['icon_id'] ),
|
||||
'topicSummary' => $this->_generateTopicSummary( $topic['tid'] ),
|
||||
'formType' => $formType,
|
||||
'extraData' => $extraData,
|
||||
@@ -369,10 +421,10 @@ class classPostForms extends classPost
|
||||
'pollBoxHTML' => $this->_generatePollBox( $formType ),
|
||||
'canEditTitle' => $this->edit_title,
|
||||
'topicTitle' => $this->_topicTitle ? $this->_topicTitle : $topic['title'],
|
||||
'topicDesc' => $this->_topicDescription ? $this->_topicDescription : $topic['description'],
|
||||
'seoTopic' => $topic['title_seo'],
|
||||
'seoForum' => $this->getForumData('name_seo'),
|
||||
'statusMsg' => $_statusMsg
|
||||
'statusMsg' => $_statusMsg,
|
||||
'tagBox' => $tagBox
|
||||
),
|
||||
array( 'doCode' => $doCode,
|
||||
'p' => $this->getPostID(),
|
||||
@@ -397,7 +449,7 @@ class classPostForms extends classPost
|
||||
|
||||
$this->nav = $this->registry->getClass('class_forums')->forumsBreadcrumbNav( $this->getForumData('id') );
|
||||
|
||||
if ( isset($topic['tid']) AND $topic['tid'] )
|
||||
if ( !empty($topic['tid']) )
|
||||
{
|
||||
$this->nav[] = array( $topic['title'], "showtopic={$topic['tid']}", $topic['title_seo'], 'showtopic' );
|
||||
}
|
||||
@@ -417,7 +469,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Show the edit form
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML to show
|
||||
*/
|
||||
public function showEditForm()
|
||||
@@ -434,25 +485,6 @@ class classPostForms extends classPost
|
||||
$_moderator = $this->getAuthor('forumsModeratorData');
|
||||
$this->moderator = $_moderator[ $this->getForumID() ];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Appending a reason for the edit?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->getAuthor('g_append_edit') )
|
||||
{
|
||||
$extraData['showEditOptions'] = 1;
|
||||
|
||||
if ( isset( $this->_originalPost['append_edit'] ) && $this->_originalPost['append_edit'] )
|
||||
{
|
||||
$extraData['checked'] = "checked";
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( isset( $this->moderator['edit_post'] ) && $this->moderator['edit_post'] ) OR $this->getAuthor('g_is_supmod') )
|
||||
{
|
||||
$extraData['showReason'] = 1;
|
||||
}
|
||||
|
||||
$this->_displayForm( 'edit', $extraData );
|
||||
}
|
||||
@@ -460,7 +492,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Show the reply form
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML to show
|
||||
*/
|
||||
public function showReplyForm()
|
||||
@@ -471,7 +502,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Show the topic form
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML to show
|
||||
*/
|
||||
public function showTopicForm()
|
||||
@@ -484,7 +514,6 @@ class classPostForms extends classPost
|
||||
*
|
||||
* @param string Post content
|
||||
* @param string Form type (new/edit/reply)
|
||||
* @access protected
|
||||
* @author MattMecham
|
||||
*/
|
||||
protected function _afterPostCompile( $postContent, $formType )
|
||||
@@ -497,97 +526,9 @@ class classPostForms extends classPost
|
||||
// Unconvert the saved post if required
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! isset($_POST['Post']) )
|
||||
if ( isset($_POST['Post']) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// If we're using RTE, then just clean up html
|
||||
//-----------------------------------------
|
||||
|
||||
if ( IPSText::getTextClass('editor')->method == 'rte' )
|
||||
{
|
||||
IPSText::getTextClass('bbcode')->parse_wordwrap = 0;
|
||||
IPSText::getTextClass('bbcode')->parse_html = 0;
|
||||
|
||||
$postContent = IPSText::getTextClass('bbcode')->convertForRTE( $postContent );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_originalPost['post_htmlstate'] = isset($this->_originalPost['post_htmlstate']) ? $this->_originalPost['post_htmlstate'] : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_html = intval($this->_originalPost['post_htmlstate']) AND $this->getForumData('use_html') AND $this->getAuthor('g_dohtml') ? 1 : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = (isset($this->_originalPost['post_htmlstate']) AND $this->_originalPost['post_htmlstate'] == 2) ? 1 : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = intval($this->_originalPost['use_emo']);
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = $this->getForumData('use_ibc');
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
|
||||
|
||||
if ( IPSText::getTextClass('bbcode')->parse_html )
|
||||
{
|
||||
if ( ! IPSText::getTextClass('bbcode')->parse_nl2br )
|
||||
{
|
||||
$postContent = str_replace( '<br />', "", $postContent );
|
||||
$postContent = str_replace( '<br>' , "", $postContent );
|
||||
}
|
||||
}
|
||||
|
||||
$postContent = IPSText::getTextClass('bbcode')->preEditParse( $postContent );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( IPSText::getTextClass('editor')->method != 'rte' && $this->request['_from'] != 'quickedit' )
|
||||
{
|
||||
$_POST['Post'] = str_replace( '&', '&', $_POST['Post'] );
|
||||
$_POST['Post'] = str_replace( '&#092;', '\', $_POST['Post'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Coming from quick edit, need to fix the
|
||||
// HTML entities - we could even check
|
||||
// request['_from'] == 'quickedit' here if need be
|
||||
//-----------------------------------------
|
||||
|
||||
$_POST['Post'] = str_replace( '&', '&', $_POST['Post'] );
|
||||
|
||||
}
|
||||
|
||||
$postContent = IPSText::stripslashes( $_POST['Post'] );
|
||||
//print nl2br(htmlspecialchars($postContent));exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Need to unparse if we're showing the form again
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->getIsPreview() === true OR $this->_postErrors )
|
||||
{
|
||||
if ( IPSText::getTextClass('editor')->method == 'rte' )
|
||||
{
|
||||
IPSText::getTextClass('bbcode')->bypass_badwords = true;
|
||||
|
||||
$postContent = IPSText::getTextClass('bbcode')->convertForRTE( $postContent );
|
||||
}
|
||||
else
|
||||
{
|
||||
IPSText::getTextClass('bbcode')->parse_html = intval($_POST['post_htmlstate']) AND $this->getForumData('use_html') AND $this->getAuthor('g_dohtml') ? 1 : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = (isset($_POST['post_htmlstate']) AND $_POST['post_htmlstate'] == 2) ? 1 : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = intval($_POST['use_emo']);
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = $this->getForumData('use_ibc');
|
||||
IPSText::getTextClass('bbcode')->bypass_badwords = true; // don't do the changeouts to the text that will be in the form
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
|
||||
|
||||
if ( ! IPSText::getTextClass('bbcode')->parse_html )
|
||||
{
|
||||
if ( IPSText::getTextClass('bbcode')->parse_nl2br )
|
||||
{
|
||||
$postContent = str_replace( '<br />', "", $postContent );
|
||||
$postContent = str_replace( '<br>' , "", $postContent );
|
||||
}
|
||||
}
|
||||
|
||||
$postContent = IPSText::getTextClass('bbcode')->preEditParse( $postContent );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,7 +540,6 @@ class classPostForms extends classPost
|
||||
*
|
||||
* @param int Topic ID
|
||||
* @return string HTML elements
|
||||
* @access protected
|
||||
* @author MattMecham
|
||||
*/
|
||||
protected function _generateTopicSummary( $topicID )
|
||||
@@ -626,14 +566,30 @@ class classPostForms extends classPost
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Set ignored users
|
||||
//-----------------------------------------
|
||||
|
||||
$ignored_users = array();
|
||||
|
||||
foreach( $this->member->ignored_users as $_i )
|
||||
{
|
||||
if( $_i['ignore_topics'] )
|
||||
{
|
||||
$ignored_users[] = $_i['ignore_ignore_id'];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the posts
|
||||
// This section will probably change at some point
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$_queued = $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible' ), 'p.' );
|
||||
|
||||
$this->DB->build( array( 'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.topic_id=' . $topicID . ' AND p.queued=0',
|
||||
'where' => 'p.topic_id=' . $topicID . ' AND ' . $_queued,
|
||||
'order' => 'pid DESC',
|
||||
'limit' => array( 0, 10 ),
|
||||
'add_join' => array(
|
||||
@@ -675,13 +631,19 @@ class classPostForms extends classPost
|
||||
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'] );
|
||||
$row['post'] = IPSText::truncate( IPSText::getTextClass( 'bbcode' )->preDisplayParse( $row['post'] ), 1000 );
|
||||
|
||||
//-----------------------------------------
|
||||
// View image...
|
||||
//-----------------------------------------
|
||||
/* Bit crude */
|
||||
$od = substr_count( $row['post'], '<div' );
|
||||
$cd = substr_count( $row['post'], '</div>' );
|
||||
|
||||
$row['post'] = IPSText::getTextClass( 'bbcode' )->memberViewImages( $row['post'] );
|
||||
if ( $od > $cd )
|
||||
{
|
||||
for( $i = 0 ; $i < $od ; $i++ )
|
||||
{
|
||||
$row['post'] .= "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
$posts[ $row['pid'] ] = $row;
|
||||
|
||||
@@ -689,9 +651,9 @@ class classPostForms extends classPost
|
||||
// Are we giving this bloke a good ignoring?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->getAuthor('ignored_users') )
|
||||
if ( count($ignored_users) )
|
||||
{
|
||||
if ( in_array( $row['author_id'], $this->getAuthor('ignored_users') ) and $this->request['qpid'] != $row['pid'] )
|
||||
if ( in_array( $row['author_id'], $ignored_users ) and $this->request['qpid'] != $row['pid'] )
|
||||
{
|
||||
if ( ! strstr( $this->settings['cannot_ignore_groups'], ','.$row['member_group_id'].',' ) )
|
||||
{
|
||||
@@ -741,7 +703,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Generates checkboxes
|
||||
*
|
||||
* @access protected
|
||||
* @param string Type of form
|
||||
* @param int Topic ID
|
||||
* @param int Forum ID
|
||||
@@ -772,7 +733,7 @@ class classPostForms extends classPost
|
||||
$return['emo'] = "";
|
||||
}
|
||||
|
||||
if ( $this->registry->class_forums->forum_by_id[ $forumID ]['use_html'] and $group_cache[ $this->getAuthor('member_group_id') ]['g_dohtml'] )
|
||||
if ( $this->registry->class_forums->forum_by_id[ $forumID ]['use_html'] and $this->getAuthor('g_dohtml') )
|
||||
{
|
||||
$options_array[ $this->getSettings('post_htmlstatus') ] = ' selected="selected"';
|
||||
|
||||
@@ -783,12 +744,15 @@ class classPostForms extends classPost
|
||||
{
|
||||
if ( $topicID and $this->getAuthor('member_id') )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'trid',
|
||||
'from' => 'tracker',
|
||||
'where' => "topic_id=" . $topicID . " AND member_id=".$this->getAuthor('member_id') ) );
|
||||
$this->DB->execute();
|
||||
//-----------------------------------------
|
||||
// Like class
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->DB->getTotalRows() )
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
|
||||
$_like = classes_like::bootstrap( 'forums', 'topics' );
|
||||
$_track = $_like->isLiked( $topicID, $this->getAuthor('member_id') );
|
||||
|
||||
if ( $_track )
|
||||
{
|
||||
$return['tra'] = '-tracking-';
|
||||
}
|
||||
@@ -801,7 +765,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Generates mod options dropdown
|
||||
*
|
||||
* @access protected
|
||||
* @param array Topic data
|
||||
* @param string Type of form (new/edit/reply)
|
||||
* @return string HTML of dropdown box
|
||||
@@ -951,9 +914,9 @@ class classPostForms extends classPost
|
||||
|
||||
if( $this->_originalPost['new_topic'] )
|
||||
{
|
||||
if ( !isset($mytimes['open_date']) OR !$mytimes['open_date'] )
|
||||
if ( empty($mytimes['open_date']) )
|
||||
{
|
||||
if ( isset($topic['topic_open_time']) AND $topic['topic_open_time'] )
|
||||
if ( !empty($topic['topic_open_time']) )
|
||||
{
|
||||
# Bug 23258 - add on TZ as we take this off when saving time
|
||||
$date = IPSTime::unixstamp_to_human( $topic['topic_open_time'] + $this->registry->class_localization->getTimeOffset() );
|
||||
@@ -962,9 +925,9 @@ class classPostForms extends classPost
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isset($mytimes['close_date']) OR !$mytimes['close_date'] )
|
||||
if ( empty($mytimes['close_date']) )
|
||||
{
|
||||
if ( isset($topic['topic_close_time']) AND $topic['topic_close_time'] )
|
||||
if ( !empty($topic['topic_close_time']) )
|
||||
{
|
||||
# Bug 23258 - add on TZ as we take this off when saving time
|
||||
$date = IPSTime::unixstamp_to_human( $topic['topic_close_time'] + $this->registry->class_localization->getTimeOffset() );
|
||||
@@ -988,36 +951,10 @@ class classPostForms extends classPost
|
||||
'canSetCloseTime' => $this->can_set_close_time,
|
||||
'myTimes' => $mytimes );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the post icons
|
||||
*
|
||||
* @access protected
|
||||
* @param string Chosen post icon (optional)
|
||||
* @return string HTML
|
||||
*/
|
||||
protected function _generatePostIcons( $post_icon="" )
|
||||
{
|
||||
$postIcons = array();
|
||||
$post_icon = ( $post_icon ) ? $post_icon : intval($this->request['iconid']);
|
||||
|
||||
if ( isset( $post_icon ) )
|
||||
{
|
||||
$postIcons[ $post_icon ] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We use a key incase we use keys for post icons */
|
||||
$postIcons['0'] = 1;
|
||||
}
|
||||
|
||||
return $postIcons;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates the captcha if required
|
||||
*
|
||||
* @access protected
|
||||
* @return string Captcha IMG id
|
||||
*/
|
||||
protected function _generateGuestCaptchaHTML()
|
||||
@@ -1036,7 +973,6 @@ class classPostForms extends classPost
|
||||
* @param string Form type (new/edit/reply)
|
||||
* @return string HTML
|
||||
* @author MattMecham
|
||||
* @access protected
|
||||
*/
|
||||
protected function _generatePollBox( $formType )
|
||||
{
|
||||
@@ -1054,8 +990,13 @@ class classPostForms extends classPost
|
||||
$show_open = 0;
|
||||
$is_mod = 0;
|
||||
$poll_votes = array();
|
||||
$poll_only = array();
|
||||
$poll_multi = array();
|
||||
$poll_only = 0;
|
||||
$poll_multi = array();
|
||||
|
||||
if( $this->settings['ipb_poll_only'] AND ipsRegistry::$request['poll_only'] AND ipsRegistry::$request['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = 1;
|
||||
}
|
||||
|
||||
if ( isset($_POST['question']) AND is_array( $_POST['question'] ) and count( $_POST['question'] ) )
|
||||
{
|
||||
@@ -1093,13 +1034,6 @@ class classPostForms extends classPost
|
||||
$poll_votes[ $id ] = $vote;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$poll_only = 0;
|
||||
|
||||
if( $this->settings['ipb_poll_only'] AND ipsRegistry::$request['poll_only'] AND ipsRegistry::$request['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = 1;
|
||||
}
|
||||
|
||||
if ( $formType == 'edit' AND ( ! isset($_POST['question']) OR ! is_array( $_POST['question'] ) OR ! count( $_POST['question'] ) ) )
|
||||
@@ -1109,7 +1043,17 @@ class classPostForms extends classPost
|
||||
//-----------------------------------------
|
||||
|
||||
$this->poll_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'polls', 'where' => "tid=".$this->getTopicID() ) );
|
||||
$this->poll_answers = $this->poll_data['choices'] ? unserialize(stripslashes($this->poll_data['choices'])) : array();
|
||||
|
||||
$this->poll_answers = unserialize(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'] ) ) );
|
||||
}
|
||||
if ( !is_array($this->poll_answers) OR !count($this->poll_answers) )
|
||||
{
|
||||
$this->poll_answers = array();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Lezz go
|
||||
@@ -1127,7 +1071,7 @@ class classPostForms extends classPost
|
||||
|
||||
foreach( $data['choice'] as $choice_id => $text )
|
||||
{
|
||||
$poll_choices[ $question_id . '_' . $choice_id ] = $text;
|
||||
$poll_choices[ $question_id . '_' . $choice_id ] = stripslashes( $text );
|
||||
$poll_votes[ $question_id . '_' . $choice_id ] = intval($data['votes'][ $choice_id ]);
|
||||
}
|
||||
}
|
||||
@@ -1136,7 +1080,7 @@ class classPostForms extends classPost
|
||||
|
||||
if ( $this->settings['ipb_poll_only'] AND $this->poll_data['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = "checked='checked'";
|
||||
$poll_only = 1;
|
||||
}
|
||||
|
||||
$poll_view_voters = $this->poll_data['poll_view_voters'];
|
||||
@@ -1149,7 +1093,22 @@ class classPostForms extends classPost
|
||||
$poll_view_voters = $this->request['poll_view_voters'];
|
||||
}
|
||||
|
||||
return $this->registry->getClass('output')->getTemplate('post')->pollBox( $this->max_poll_questions, $this->max_poll_choices_per_question, IPSText::simpleJsonEncode( $poll_questions ), IPSText::simpleJsonEncode( $poll_choices ), IPSText::simpleJsonEncode( $poll_votes ), $show_open, $poll_question, $is_mod, json_encode( $poll_multi ), $poll_only, $poll_view_voters, intval( $this->poll_data['votes'] ) );
|
||||
return $this->registry->getClass('output')->getTemplate('post')->pollBox( array(
|
||||
'max_poll_questions' => $this->max_poll_questions,
|
||||
'max_poll_choices' => $this->max_poll_choices_per_question,
|
||||
'poll_questions' => IPSText::simpleJsonEncode( $poll_questions ),
|
||||
'poll_choices' => IPSText::simpleJsonEncode( $poll_choices ),
|
||||
'poll_votes' => IPSText::simpleJsonEncode( $poll_votes ),
|
||||
'show_open' => $show_open,
|
||||
'poll_question' => $poll_question,
|
||||
'is_mod' => $is_mod,
|
||||
'poll_multi' => json_encode( $poll_multi ),
|
||||
'poll_only' => $poll_only,
|
||||
'poll_view_voters' => $poll_view_voters,
|
||||
'poll_total_votes' => intval( $this->poll_data['votes'] ),
|
||||
'poll_data' => $this->poll_data,
|
||||
'poll_answers' => $this->poll_answers
|
||||
) );
|
||||
}
|
||||
|
||||
return '';
|
||||
@@ -1161,20 +1120,19 @@ class classPostForms extends classPost
|
||||
* @param string Post Content
|
||||
* @param string MD5 post key for attachments
|
||||
* @return string HTML
|
||||
* @access protected
|
||||
* @author Matt Mecham
|
||||
*/
|
||||
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'];
|
||||
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 );
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionboard.com/">IP.Board</a>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user