Version 3.3.4

This commit is contained in:
Neo committed 2025-12-19 00:35:52 -08:00
1 parent 78706903a2
commit fb6b5baabc
2206 files changed
+409828 -382984

No files matched your search

@@ -1,267 +1,267 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Editor Library: Core Class
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @link http://hatynka.in
* @since 9th March 2005 11:03
* @version $Revision: 8644 $
*
* EXAMPLE USAGE
* <code>
* $han_editor = new han_editor();
*
* $han_editor->init();
*
* # To generate the HTML for the editor:
* $editor_html = $han_editor->showEditor( $raw_post, 'Post' );
*
* # $raw_post is either raw HTML for the rich text editor or raw BBCode tagged text when
* # using the standard editor. (See the document on the BBCode parser for more information)
* # 'Post' is the name of the form field you wish use. In this case it'll return $_POST['Post'].
*
* #To process the editor's text into tagged BBCode text:
* $post = $han_editor->processRawPost( 'Post' );
*
* #'Post' is the name of the form field you used when displaying the editor. As in $_POST['Post']
*
* # To use the HTML generated by editor class for displaying the actual editor (in our example; $editor_html)
* # you'll need to use it like this:
*
* <form id='postingform' onsubmit='return ValidateForm()' action="$url" method="post" name="REPLIER">
* {$editor_html}
* <br /><input type="submit" value="Post" /></div>
* </form>
*
* The form tag MUST have: id='postingform' onsubmit='return ValidateForm()' otherwise the editor will fail.
* </code>
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class class_editor
{
/**
* Allow unicode setting
*
* @access public
* @var boolean
*/
public $allow_unicode;
/**
* Get magic quotes
*
* @access public
* @var boolean
*/
public $get_magic_quotes;
/**
* Reverse font sizes
*
* @access public
* @var array
*/
public $rev_font_sizes = array();
/**
* Registry object
*
* @access protected
* @var object
*/
protected $registry;
/**
* Database object
*
* @access protected
* @var object
*/
protected $DB;
/**
* Settings object
*
* @access protected
* @var object
*/
protected $settings;
/**
* Request object
*
* @access protected
* @var object
*/
protected $request;
/**
* Language object
*
* @access protected
* @var object
*/
protected $lang;
/**
* Member object
*
* @access protected
* @var object
*/
protected $member;
protected $memberData;
/**
* Cache object
*
* @access protected
* @var object
*/
protected $cache;
protected $caches;
/**
* Main font sizes
*
* @access protected
* @var array
*/
protected $font_sizes = array( 1 => 8,
2 => 10,
3 => 12,
4 => 14,
5 => 18,
6 => 24,
7 => 36 );
/**
* Constructor
*
* @access public
* @param object Registry object
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
/* Make object */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
}
/**
* Main init: Prep font sizes
*
* @access public
* @return @e void
*/
public function editorInit( )
{
foreach( $this->font_sizes as $bbcode => $real )
{
$this->rev_font_sizes[ $real ] = $bbcode;
}
}
/**
* Get BBCode font size from real PX size
*
* @access public
* @param integer PX Size
* @return integer BBCode size
*/
public function convertRealsizeToBbsize( $real )
{
$real = intval( $real );
if ( $this->rev_font_sizes[ $real ] )
{
return $this->rev_font_sizes[ $real ];
}
else
{
return 2;
}
}
/**
* Clean up and make the post safe for the DB
*
* @access protected
* @param string Raw text
* @return string Converted text
*/
protected function _cleanPost( $t )
{
if ( $t == "" )
{
return "";
}
//-----------------------------------------
// Make it safe
//-----------------------------------------
$t = str_replace( "&" , "&amp;" , $t );
$t = str_replace( "<!--" , "&#60;&#33;--" , $t );
$t = str_replace( "-->" , "--&#62;" , $t );
$t = str_ireplace( "<script" , "&#60;script" , $t );
$t = str_replace( ">" , "&gt;" , $t );
$t = str_replace( "<" , "&lt;" , $t );
$t = str_replace( '"' , "&quot;" , $t );
$t = str_replace( "\n" , "<br />" , $t );
$t = str_replace( '$' , "&#036;" , $t );
$t = str_replace( "\r" , "" , $t );
$t = str_replace( "!" , "&#33;" , $t );
$t = str_replace( "'" , "&#39;" , $t );
//-----------------------------------------
// Ensure unicode chars are OK
//-----------------------------------------
if ( $this->allow_unicode )
{
$t = preg_replace("/&amp;#([0-9]+);/s", "&#\\1;", $t );
}
//-----------------------------------------
// Strip slashes if not already done so.
//-----------------------------------------
/*if ( $this->get_magic_quotes )
{
$t = stripslashes($t);
}*/
//-----------------------------------------
// Swap user inputted backslashes
//-----------------------------------------
$t = preg_replace( "/\\\(?!&amp;#|\?#)/", "&#092;", $t );
return $t;
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Editor Library: Core Class
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @link http://www.invisionpower.com
* @since 9th March 2005 11:03
* @version $Revision: 10914 $
*
* EXAMPLE USAGE
* <code>
* $han_editor = new han_editor();
*
* $han_editor->init();
*
* # To generate the HTML for the editor:
* $editor_html = $han_editor->showEditor( $raw_post, 'Post' );
*
* # $raw_post is either raw HTML for the rich text editor or raw BBCode tagged text when
* # using the standard editor. (See the document on the BBCode parser for more information)
* # 'Post' is the name of the form field you wish use. In this case it'll return $_POST['Post'].
*
* #To process the editor's text into tagged BBCode text:
* $post = $han_editor->processRawPost( 'Post' );
*
* #'Post' is the name of the form field you used when displaying the editor. As in $_POST['Post']
*
* # To use the HTML generated by editor class for displaying the actual editor (in our example; $editor_html)
* # you'll need to use it like this:
*
* <form id='postingform' onsubmit='return ValidateForm()' action="$url" method="post" name="REPLIER">
* {$editor_html}
* <br /><input type="submit" value="Post" /></div>
* </form>
*
* The form tag MUST have: id='postingform' onsubmit='return ValidateForm()' otherwise the editor will fail.
* </code>
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class class_editor
{
/**
* Allow unicode setting
*
* @access public
* @var boolean
*/
public $allow_unicode;
/**
* Get magic quotes
*
* @access public
* @var boolean
*/
public $get_magic_quotes;
/**
* Reverse font sizes
*
* @access public
* @var array
*/
public $rev_font_sizes = array();
/**
* Registry object
*
* @access protected
* @var object
*/
protected $registry;
/**
* Database object
*
* @access protected
* @var object
*/
protected $DB;
/**
* Settings object
*
* @access protected
* @var object
*/
protected $settings;
/**
* Request object
*
* @access protected
* @var object
*/
protected $request;
/**
* Language object
*
* @access protected
* @var object
*/
protected $lang;
/**
* Member object
*
* @access protected
* @var object
*/
protected $member;
protected $memberData;
/**
* Cache object
*
* @access protected
* @var object
*/
protected $cache;
protected $caches;
/**
* Main font sizes
*
* @access protected
* @var array
*/
protected $font_sizes = array( 1 => 8,
2 => 10,
3 => 12,
4 => 14,
5 => 18,
6 => 24,
7 => 36 );
/**
* Constructor
*
* @access public
* @param object Registry object
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
/* Make object */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
}
/**
* Main init: Prep font sizes
*
* @access public
* @return @e void
*/
public function editorInit( )
{
foreach( $this->font_sizes as $bbcode => $real )
{
$this->rev_font_sizes[ $real ] = $bbcode;
}
}
/**
* Get BBCode font size from real PX size
*
* @access public
* @param integer PX Size
* @return integer BBCode size
*/
public function convertRealsizeToBbsize( $real )
{
$real = intval( $real );
if ( $this->rev_font_sizes[ $real ] )
{
return $this->rev_font_sizes[ $real ];
}
else
{
return 2;
}
}
/**
* Clean up and make the post safe for the DB
*
* @access protected
* @param string Raw text
* @return string Converted text
*/
protected function _cleanPost( $t )
{
if ( $t == "" )
{
return "";
}
//-----------------------------------------
// Make it safe
//-----------------------------------------
$t = str_replace( "&" , "&amp;" , $t );
$t = str_replace( "<!--" , "&#60;&#33;--" , $t );
$t = str_replace( "-->" , "--&#62;" , $t );
$t = str_ireplace( "<script" , "&#60;script" , $t );
$t = str_replace( ">" , "&gt;" , $t );
$t = str_replace( "<" , "&lt;" , $t );
$t = str_replace( '"' , "&quot;" , $t );
$t = str_replace( "\n" , "<br />" , $t );
$t = str_replace( '$' , "&#036;" , $t );
$t = str_replace( "\r" , "" , $t );
$t = str_replace( "!" , "&#33;" , $t );
$t = str_replace( "'" , "&#39;" , $t );
//-----------------------------------------
// Ensure unicode chars are OK
//-----------------------------------------
if ( $this->allow_unicode )
{
$t = preg_replace("/&amp;#([0-9]+);/s", "&#\\1;", $t );
}
//-----------------------------------------
// Strip slashes if not already done so.
//-----------------------------------------
/*if ( $this->get_magic_quotes )
{
$t = stripslashes($t);
}*/
//-----------------------------------------
// Swap user inputted backslashes
//-----------------------------------------
$t = preg_replace( "/\\\(?!&amp;#|\?#)/", "&#092;", $t );
return $t;
}
}
@@ -3,18 +3,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* IP.Board v3.3.4
* Editor Library: RTE (WYSIWYG) Class
* Last Updated: $Date: 2011-04-19 12:42:57 -0400 (Tue, 19 Apr 2011) $
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @link http://hatynka.in
* @link http://www.invisionpower.com
* @since 9th March 2005 11:03
* @version $Revision: 8391 $
* @version $Revision: 10914 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -144,7 +144,7 @@ class class_editor_module extends class_editor
$t = str_ireplace( "<br />\n", "<br />", $t );
$t = str_ireplace( "<br />\r", "<br />", $t );
//$t = preg_replace( "/((?:\r)?\n?(?:[\r|\n|\t| ])+)/", " ", $t );
$t = preg_replace( "/((?:\r)?\n+)/u", " ", $t );
$t = preg_replace( "/((?:\r)?\n+)/", " ", $t );
}
else
@@ -285,7 +285,7 @@ class class_editor_module extends class_editor
$t = str_ireplace( "<br />\n", "<br />", $t );
$t = str_ireplace( "<br />\r", "<br />", $t );
//$t = preg_replace( "/((?:\r)?\n?(?:[\r|\n|\t| ])+)/", " ", $t );
$t = preg_replace( "/((?:\r)?\n+)/u", " ", $t );
$t = preg_replace( "/((?:\r)?\n+)/", " ", $t );
}
else
@@ -962,7 +962,7 @@ class class_editor_module extends class_editor
while ( $tag_begin_loc !== FALSE )
{
$lowtext = mb_strtolower($text);
$lowtext = strtolower($text);
$tag_begin_loc = @strpos( $lowtext, $open_tag, $start_search_pos );
$lentext = strlen($text);
$quoted = '';
@@ -3,18 +3,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* IP.Board v3.3.4
* Editor Library: Standard Class
* Last Updated: $Date: 2010-12-17 08:01:38 -0500 (Fri, 17 Dec 2010) $
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: ips_terabyte $
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @link http://hatynka.in
* @link http://www.invisionpower.com
* @since 9th March 2005 11:03
* @version $Revision: 7445 $
* @version $Revision: 10914 $
*/
if ( ! defined( 'IN_IPB' ) )
+507 -135
View File
@@ -3,18 +3,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* IP.Board v3.3.4
* Editor Library: RTE (WYSIWYG) Class
* Last Updated: $Date: 2011-10-11 07:49:07 -0400 (Tue, 11 Oct 2011) $
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: mmecham $
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @link http://hatynka.in
* @link http://www.invisionpower.com
* @since 9th March 2005 11:03
* @version $Revision: 9593 $
* @version $Revision: 10914 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -31,8 +31,8 @@ if ( ! defined( 'IN_IPB' ) )
* non char set characters converted into their numeric equivalent &#xxx; make
* every effort to not auto-parse typed in entities. That is, if someone types in &#39; it
* should NOT convert that to ' when they hit submit.
* Test input: < > ' " & ¦ $ \ ! &amp; &#39; &quot; &lt; &gt; &para;
* Should be processed as: &lt; &gt; &#39; &quot; &amp; ¦ $ &#92; ! &amp;amp; &amp;#39; &amp;quot; &amp;lt; &amp;gt; &amp;para;
* Test input: < > ' " & ¦ $ \ ! &amp; &#39; &quot; &lt; &gt; &para;
* Should be processed as: &lt; &gt; &#39; &quot; &amp; ¦ $ &#92; ! &amp;amp; &amp;#39; &amp;quot; &amp;lt; &amp;gt; &amp;para;
* This is *the* golden rule. Use this to test any fixes. It must work in the following modes:
* RTE > STD Switch
* STD > RTE Switch
@@ -65,6 +65,7 @@ class classes_editor_composite
* Use P for line breaks (std CKEditor mode)
*/
const IPS_P_MODE = true;
/**
* Parsing array
*
@@ -101,8 +102,9 @@ class classes_editor_composite
* Internal setting objects
*
* @var boolean
*/
protected $allowHtml = false;
*/
protected $isHtml = null;
protected $allowHtml = null;
protected $allowBbcode = true;
protected $content = null;
protected $rteEnabled = false;
@@ -176,6 +178,27 @@ class classes_editor_composite
}
}
/**
* @return the $isHtml
*/
public function getIsHtml()
{
return $this->isHtml;
}
/**
* @return the $isHtml
*/
public function setIsHtml( $isHtml )
{
$this->isHtml = $isHtml ? true : false;
if ( $isHtml )
{
$this->setAllowHtml( true );
}
}
/**
* @return the $allowSmilies
*/
@@ -221,6 +244,12 @@ class classes_editor_composite
*/
public function setAllowHtml( $allowHtml )
{
/* No mechanics in the mobile skin to deal with this */
if ( $this->registry->output->getAsMobileSkin() )
{
$allowHtml = false;
}
$this->allowHtml = $allowHtml ? true : false;
}
@@ -259,6 +288,12 @@ class classes_editor_composite
return $content;
}
/* Forcing HTML, forces STD */
if ( $this->getIsHtml() && ! IN_ACP )
{
$rteMethod = 'std';
}
/* Fix method */
switch ( $rteMethod )
{
@@ -273,45 +308,52 @@ class classes_editor_composite
break;
}
/* Setup our parser class partially here */
IPSText::getTextClass('bbcode')->parse_smilies = $this->getAllowSmilies();
IPSText::getTextClass('bbcode')->parse_bbcode = $this->getAllowBbcode();
IPSText::getTextClass('bbcode')->parsing_section = $section;
/* RTE needs a code tidy whereas STD needs BBCode */
if ( $isRte )
{
/* More parser setup #1 */
IPSText::getTextClass('bbcode')->parse_html = 0;
if ( $this->getAllowHtml() )
{
if ( ! IPSText::getTextClass('bbcode')->parse_nl2br )
{
$content = str_replace( '<br />', "", $content );
$content = str_replace( '<br>' , "", $content );
}
$content = IPSText::UNhtmlspecialchars( $content );
}
else
{
$content = $this->_rtePreShow( IPSText::getTextClass('bbcode')->convertForRTE( $content ), true );
}
$content = $this->_rtePreShow( IPSText::getTextClass('bbcode')->convertForRTE( $content ), true );
}
else
{
IPSText::getTextClass('bbcode')->parse_html = $this->getAllowHtml();
IPSText::getTextClass('bbcode')->parse_nl2br = 0;
IPSText::getTextClass('bbcode')->parse_smilies = $this->getAllowSmilies();
IPSText::getTextClass('bbcode')->parse_bbcode = $this->getAllowBbcode();
IPSText::getTextClass('bbcode')->parsing_section = $section;
if ( $this->getAllowHtml() )
{
if ( ! IPSText::getTextClass('bbcode')->parse_nl2br )
{
$content = str_replace( '<br />', "", $content );
$content = str_replace( '<br>' , "", $content );
}
}
/* More parser setup #2 */
IPSText::getTextClass('bbcode')->parse_html = $this->getAllowHtml();
IPSText::getTextClass('bbcode')->parse_nl2br = 0;
if ( IPS_QUICK_EDIT_TO_FULL )
{
$content = str_replace( '&', '&amp;', $content );
$content = preg_replace( '#<br([^>])?>#', '&lt;br\1&gt;', $content );
}
if ( IN_ACP && $this->getIsHtml() )
{
/* Test to see if we need to convert */
if ( strstr( $content, '[/' ) )
{
$content = str_replace( '<br />', "<br />\n", IPSText::getTextClass('bbcode')->convertForRTE( $content ) );
}
$content = $this->_stdPreShow( $content );
}
else
{
$content = $this->_stdPreShow( IPSText::getTextClass('bbcode')->preEditParse( $content ) );
}
$content = $this->_stdPreShow( IPSText::getTextClass('bbcode')->preEditParse( $content ) );
/* This is designed only for new STD forms with content and NOT when switching modes */
if ( ! IPS_IS_AJAX )
@@ -324,6 +366,7 @@ class classes_editor_composite
}
}
$content = $this->_convertNumericEntityToNamed( $content );
$content = $this->_allowNonUtf8CharsWhenNotUsingUtf8Doc( $content );
return $content;
@@ -351,6 +394,18 @@ class classes_editor_composite
*/
protected function _canWeRte()
{
/* Sent inline */
if ( isset( $_REQUEST['isRte'] ) && $_REQUEST['isRte'] == 1 )
{
return true;
}
/* Enforce bypass for mobile skin */
if ( $this->registry->output->getAsMobileSkin() && !IN_ACP )
{
return false;
}
$return = FALSE;
if ( $this->memberData['userAgentKey'] == 'explorer' AND $this->memberData['userAgentVersion'] >= 7 )
@@ -401,6 +456,18 @@ class classes_editor_composite
*/
protected function _isInSourceMode()
{
/* Forced into HTML mode? */
if ( $this->getIsHtml() )
{
return true;
}
/* If we're using the mobile skin, then force STD */
if ( $this->registry->getClass('output')->getAsMobileSkin() )
{
return true;
}
/* Sent inline */
if ( isset( $_REQUEST['isRte'] ) )
{
@@ -425,6 +492,12 @@ class classes_editor_composite
*/
public function show( $fieldName, $options=array(), $content='' )
{
/* Have we forced RTE? */
if ( ! empty( $this->request['isRte'] ) )
{
$options['isRte'] = intval( $this->request['isRte'] );
}
$_autoSaveKeyOrig = ( ! empty( $options['autoSaveKey'] ) ) ? $options['autoSaveKey'] : '';
$options['editorName'] = ( ! empty( $options['editorName'] ) ) ? $options['editorName'] : $this->_fetchEditorName();
$options['autoSaveKey'] = ( $_autoSaveKeyOrig && $this->memberData['member_id'] ) ? $this->_generateAutoSaveKey( $_autoSaveKeyOrig ) : '';
@@ -436,25 +509,195 @@ class classes_editor_composite
$options['delayInit'] = ( ! empty( $options['delayInit'] ) ) ? 1 : 0;
$options['smilies'] = $this->fetchEmoticons( 20 );
$options['bypassCKEditor'] = $this->getRteEnabled() ? 0 : 1;
$options['isRte'] = $this->_isInSourceMode() ? 0 : 1;
$options['isRte'] = ( isset( $options['isRte'] ) ) ? $options['isRte'] : ( $this->_isInSourceMode() ? 0 : 1 );
$html = '';
/* If we're using the mobile skin, then force STD */
if ( $this->registry->getClass('output')->getAsMobileSkin() )
{
$options['isRte'] = 0;
}
if ( isset( $options['recover'] ) )
{
$content = $_POST['Post'];
}
if ( ! empty( $options['isHtml'] ) )
{
$this->setIsHtml( true );
if ( IN_ACP )
{
$options['type'] = 'ipsacp';
}
}
else if ( $this->getIsHtml() )
{
$options['isHtml'] = 1;
}
/* inline content */
if ( $content )
{
$this->setContent( str_replace( '\\\'', '\'', $content ) );
}
/* Store last editor ID in case calling scripts need it */
$this->settings['_lastEditorId'] = $options['editorName'];
if ( IN_ACP )
{
{
$html = $this->registry->getClass('output')->global_template->editor( $fieldName, $this->getContent(), $options, $this->getAutoSavedContent( $_autoSaveKeyOrig ) );
}
else
{
$html = $this->registry->getClass('output')->getTemplate('editors')->editor( $fieldName, $this->getContent(), $options, $this->getAutoSavedContent( $_autoSaveKeyOrig ) );
$warningInfo = '';
$acknowledge = FALSE;
//-----------------------------------------
// Warnings
//-----------------------------------------
if ( isset( $options['warnInfo'] ) and $this->memberData['member_id'] )
{
$message = '';
/* Have they been restricted from posting? */
if ( $this->memberData['restrict_post'] )
{
$data = IPSMember::processBanEntry( $this->memberData['restrict_post'] );
if ( $data['date_end'] )
{
if ( time() >= $data['date_end'] )
{
IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'restrict_post' => 0 ) ) );
}
else
{
$message = sprintf( $this->lang->words['warnings_restrict_post_temp'], $this->lang->getDate( $data['date_end'], 'JOINED' ) );
}
}
else
{
$message = $this->lang->words['warnings_restrict_post_perm'];
}
if ( $this->memberData['unacknowledged_warnings'] )
{
$warn = ipsRegistry::DB()->buildAndFetch( array( 'select' => '*', 'from' => 'members_warn_logs', 'where' => "wl_member={$this->memberData['member_id']} AND wl_rpa<>0", 'order' => 'wl_date DESC', 'limit' => 1 ) );
if ( $warn['wl_id'] )
{
$moredetails = "<a href='javascript:void(0);' onclick='warningPopup( this, {$warn['wl_id']} )'>{$this->lang->words['warnings_moreinfo']}</a>";
}
}
if ( $options['warnInfo'] == 'full' )
{
$this->registry->getClass('output')->showError( "{$message} {$moredetails}", 103126, null, null, 403 );
}
}
/* Nope? - Requires a new if in case time restriction got just removed */
if ( empty($message) )
{
/* Do they have any warnings they have to acknowledge? */
if ( $this->memberData['unacknowledged_warnings'] )
{
$unAcknowledgedWarns = ipsRegistry::DB()->buildAndFetch( array( 'select' => '*', 'from' => 'members_warn_logs', 'where' => "wl_member={$this->memberData['member_id']} AND wl_acknowledged=0", 'order' => 'wl_date DESC', 'limit' => 1 ) );
if ( $unAcknowledgedWarns['wl_id'] )
{
if ( $options['warnInfo'] == 'full' )
{
$this->registry->getClass('output')->silentRedirect( $this->registry->getClass('output')->buildUrl( "app=members&amp;module=profile&amp;section=warnings&amp;do=acknowledge&amp;id={$unAcknowledgedWarns['wl_id']}" ) );
}
else
{
$this->lang->loadLanguageFile( 'public_profile', 'members' );
$acknowledge = $unAcknowledgedWarns['wl_id'];
}
}
}
/* No? Are they on mod queue? */
if ( $this->memberData['mod_posts'] )
{
$data = IPSMember::processBanEntry( $this->memberData['mod_posts'] );
if ( $data['date_end'] )
{
if ( time() >= $data['date_end'] )
{
IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'mod_posts' => 0 ) ) );
}
else
{
$message = sprintf( $this->lang->words['warnings_modqueue_temp'], $this->lang->getDate( $data['date_end'], 'JOINED' ) );
}
}
else
{
$message = $this->lang->words['warnings_modqueue_perm'];
}
if ( $message )
{
$warn = ipsRegistry::DB()->buildAndFetch( array( 'select' => '*', 'from' => 'members_warn_logs', 'where' => "wl_member={$this->memberData['member_id']} AND wl_mq<>0", 'order' => 'wl_date DESC', 'limit' => 1 ) );
if ( $warn['wl_id'] )
{
$moredetails = "<a href='javascript:void(0);' onclick='warningPopup( this, {$warn['wl_id']} )'>{$this->lang->words['warnings_moreinfo']}</a>";
}
}
}
/* How about our group? - Requires a new if in case mod queue restriction got just removed */
if ( empty($message) && $this->memberData['g_mod_preview'] )
{
/* Do we only limit for x posts/days? */
if ( $this->memberData['g_mod_post_unit'] )
{
if ( $this->memberData['gbw_mod_post_unit_type'] )
{
/* Days.. .*/
if ( $this->memberData['joined'] > ( time() - ( 86400 * $this->memberData['g_mod_post_unit'] ) ) )
{
$message = sprintf( $this->lang->words['ms_mod_q'] . ' ' . $this->lang->words['ms_mod_q_until'], $this->lang->getDate( $this->memberData['joined'] + ( 86400 * $this->memberData['g_mod_post_unit'] ), 'long' ) );
}
}
else
{
/* Posts */
if ( $this->memberData['posts'] < $this->memberData['g_mod_post_unit'] )
{
$message = sprintf( $this->lang->words['ms_mod_q'] . ' ' . $this->lang->words['ms_mod_q_until_posts'], $this->memberData['g_mod_post_unit'] - $this->memberData['posts'] );
}
}
}
else
{
/* No limit, but still checking moderating */
$message = $this->lang->words['ms_mod_q'];
}
}
/* Or just everyone? */
elseif ( $options['modAll'] and !$this->memberData['g_avoid_q'] )
{
$message = $this->lang->words['ms_mod_q'];
}
if ( $message )
{
$warningInfo = "{$message} {$moredetails}";
}
}
}
//-----------------------------------------
// Show the editor
//-----------------------------------------
$content = ( IPS_IS_AJAX ) ? str_replace( '&', '&amp;', $this->getContent() ) : $this->getContent();
$html = $this->registry->getClass('output')->getTemplate('editors')->editor( $fieldName, $content, $options, $this->getAutoSavedContent( $_autoSaveKeyOrig ), $warningInfo, $acknowledge );
}
return $html;
@@ -492,8 +735,8 @@ class classes_editor_composite
$return['key'] = $raw['eas_key'];
$return['updated'] = $raw['eas_updated'];
$return['raw'] = $raw['eas_content'];
$return['restore_rte'] = $this->switchContent( $return['raw'], false );
$return['restore_std'] = $this->switchContent( $return['raw'], true );
$return['restore_rte'] = $this->convertContent( nl2br($return['raw']), 'rte' );
$return['restore_std'] = $this->convertContent( nl2br($return['raw']), 'std' );
$return['updatedDate'] = $this->registry->getClass('class_localization')->getDate( $return['updated'], 'LONG' );
/* Now figure out previewable content */
@@ -592,33 +835,51 @@ class classes_editor_composite
{
IPSText::getTextClass('bbcode')->parse_html = false;
IPSText::getTextClass('bbcode')->parse_nl2br = 0;
IPSText::getTextClass('bbcode')->parse_smilies = true;
IPSText::getTextClass('bbcode')->parse_smilies = ( ! empty( $this->request['noSmilies'] ) ) ? false : true;
IPSText::getTextClass('bbcode')->parse_bbcode = true;
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
/* Default state for ACP */
if ( IN_ACP )
if ( IN_ACP && $this->getAllowHtml() === null )
{
IPSText::getTextClass('bbcode')->parse_html = true;
}
if ( $isRte )
{
$this->_isSwitchingFrom = 'std';
/* Assume RTE text has been sent in and we want BBCode */
$content = str_replace( '\\', '&#92;', $content ); # Makes manually entered < safe
$content = $this->_rteProcess( $content, IPS_EDITOR_NO_SANITIZE );
$content = IPSText::getTextClass('bbcode')->preEditParse( $content );
$content = $this->_stdPreShow( $content );
if ( ! $this->getAllowHtml() )
{
//IPSDebug::addLogMessage( $content, 'stdeditor', $_POST, true, true );
$content = $this->_rteProcess( $content, IPS_EDITOR_NO_SANITIZE );
//IPSDebug::addLogMessage( $content, 'stdeditor', false, true, false );
$content = IPSText::getTextClass('bbcode')->preEditParse( $content );
//IPSDebug::addLogMessage( $content, 'stdeditor', false, true, false );
$content = $this->_stdPreShow( $content );
//IPSDebug::addLogMessage( $content, 'stdeditor', false, true, false );
}
$content = str_replace( '&#92;', '\\', $content );
}
else
{
$this->_isSwitchingFrom = 'rte';
/* Assume BBCode has been sent in and we want RTE */
//$content = str_replace( '<', '&lt;', $content ); # Makes manually entered < safe
//$content = str_replace( '>', '&gt;', $content ); # Makes manually entered > safe
$content = $this->_rtePreShow( IPSText::getTextClass('bbcode')->convertForRTE( $this->_stdProcess( $content, IPS_EDITOR_NO_SANITIZE ) ), false, true );
if ( ! $this->getAllowHtml() )
{
//IPSDebug::addLogMessage( $content, 'editor', $_POST, true, true );
$content = $this->_stdProcess( $content, IPS_EDITOR_NO_SANITIZE );
//IPSDebug::addLogMessage( $content, 'editor', false, true, false );
$content = IPSText::getTextClass('bbcode')->convertForRTE( $content );
//IPSDebug::addLogMessage( $content, 'editor', false, true, false );
$content = $this->_rtePreShow( $content, false, true );
//IPSDebug::addLogMessage( $content, 'editor', false, true, false );
}
}
$this->_isSwitchingFrom = null;
@@ -638,9 +899,9 @@ class classes_editor_composite
$t = str_replace( array( "\r\n", "\r" ), "\n", $t );
IPSDebug::fireBug( 'info', array( 'Start (std): ' . nl2br($t) ) );
$t = IPSText::decodeNamedHtmlEntities( $t );
$t = IPSText::decodeNamedHtmlEntities( $t );
$t = str_replace( '&#33;', '!', $t );
$t = str_replace( '&#34;', '"', $t );
$t = str_replace( '&quot;', '"', $t );
@@ -654,6 +915,13 @@ class classes_editor_composite
$t = str_replace( '&#92;', '\\', $t );
$t = str_replace( '&#092;', '\\', $t );
$t = str_replace( '&#160;', ' ', $t );
$t = str_replace( '&#91;', '[', $t );
$t = str_replace( '&#93;', ']', $t );
$t = str_replace( '&#123;', '{', $t );
$t = str_replace( '&#125;', '}', $t );
$t = str_replace( '&nbsp;', ' ', $t );
$t = str_replace( "\t" , ' ', $t );
/* We replace \ to 092 so convert it back */
$t = str_replace( '&amp;#092;', '\\', $t );
@@ -664,9 +932,17 @@ class classes_editor_composite
}
$t = str_replace( '</textarea', '&lt;textarea', $t );
$t = str_replace( '<script' , '&lt;script' , $t );
$t = $this->_allowNonUtf8CharsWhenNotUsingUtf8Doc( $t );
/* Sect breaks on std editor @link http://community.invisionpower.com/tracker/issue-37498-gets-converted-into-sect%3B-when-editing-a-post/ */
$t = $this->_convertNumericEntityToNamed( $t );
/* We make paths safe in clean globals */
$t = str_replace( '&#46;&#46;/', '../', $t );
IPSDebug::fireBug( 'info', array( 'End (std): ' . nl2br($t) ) );
return $t;
@@ -682,13 +958,15 @@ class classes_editor_composite
* @return string Text ready for editor
*/
public function _rtePreShow( $t, $encodeEntities=false )
{
{
IPSDebug::fireBug( 'info', array( 'Start (rte): ' . nl2br($t) ) );
/* Trim and remove comments */
$t = preg_replace( '#\<\!\-\-(.+?)\-\-\>#is', "", $t );
$t = rtrim($t);
/* Parsing can kill img URLs as they are made 'safe' to not parse */
$t = str_replace( 'http&#58;', 'http:', $t );
/* Convert single/double quotes */
if ( strtolower(IPS_DOC_CHAR_SET) != 'utf-8' )
{
@@ -721,7 +999,7 @@ class classes_editor_composite
$t = str_replace( '&#10;', '<br />', $t );
/* AJAX content is inserted into editor via insertText which does not parse entities as they would normally display */
if( ! IPS_IS_AJAX )
if ( ! IPS_IS_AJAX )
{
$t = str_replace( '&', '&amp;', $t );
}
@@ -742,8 +1020,8 @@ class classes_editor_composite
$t = str_replace( "&lt;#IMG_DIR#&gt;", "<#IMG_DIR#>", $t );
$t = str_replace( "&lt;#EMO_DIR#&gt;", "<#EMO_DIR#>", $t );
/* Convert multiple spaces */
$t = str_replace( " ", "&nbsp;&nbsp;", $t );
/* Convert multiple spaces (Causes more issues than it fixes) */
//$t = str_replace( " ", "&nbsp;&nbsp;", $t );
/* Fix up lists */
$t = str_replace( '<br /></li>', '</li>', $t );
@@ -788,7 +1066,15 @@ class classes_editor_composite
}
IPSDebug::fireBug( 'info', array( 'End (rte): ' . $t ) );
if ( $this->getAllowHtml() )
{
$t = str_replace( '&amp;', '&', $t );
$t = str_replace( '&gt;', '>', $t );
$t = str_replace( '&lt;', '<', $t );
$t = str_replace( '&nbsp;', ' ', $t );
}
return $t;
}
@@ -818,7 +1104,12 @@ class classes_editor_composite
$content = preg_replace( '#^([ ]+?)\n#m', "\n", $content );
return trim( $this->_clean( $content, $NO_SANITIZE, false ) );
/* We make paths safe in clean globals */
$content = str_replace( '&#46;&#46;/', '../', $content );
$content = trim( $this->_clean( $content, $NO_SANITIZE, false ) );
return $content;
}
/**
@@ -849,7 +1140,7 @@ class classes_editor_composite
* <p>More data</p>
* <p><br /></p>
*/
if ( self::IPS_P_MODE )
if ( self::IPS_P_MODE && ! $this->getAllowHtml() )
{
/* Tidy up first */
$content = str_replace( '<div' , '<p' , $content );
@@ -862,22 +1153,27 @@ class classes_editor_composite
/* Before we content/strip newlines, lets make code safe */
$content = $this->_recurseAndParse( 'pre', $content, "_parsePreTag" );
//-----------------------------------------
// Fix up tabs/spaces
//-----------------------------------------
$content = str_replace( '&nbsp;&nbsp;&nbsp;&nbsp;', "{'tab'}", $content );
$content = str_replace( '&nbsp;', ' ', $content );
/* looks to be non RTE content that has ended up there */
if ( ! strstr( $content, '<br' ) && ! strstr( $content, '<p' ) && strstr( $content, "\n" ) )
if ( ! $this->getAllowHtml() )
{
$content = str_replace( "\n", "<br />", $content );
}
else
{
$content = str_replace( "\n", "", $content );
$content = str_replace( '&nbsp;&nbsp;&nbsp;&nbsp;', "{'tab'}", $content );
$content = str_replace( "\t", "{'tab'}", $content );
$content = str_replace( '&nbsp;', ' ', $content );
/* looks to be non RTE content that has ended up there */
if ( ! strstr( $content, '<br' ) && ! strstr( $content, '<p' ) && strstr( $content, "\n" ) )
{
$content = str_replace( "\n", "<br />", $content );
}
else
{
$content = str_replace( "\n", "", $content );
}
}
//-----------------------------------------
@@ -906,8 +1202,11 @@ class classes_editor_composite
// WYSI-Weirdness #1: BR tags to \n
//-----------------------------------------
$content = preg_replace( '#<br([^>]+?)>#', "<br />", $content );
$content = str_ireplace( array( "<br>", "<br />" ), "\n", $content );
if ( ! $this->getAllowHtml() )
{
$content = preg_replace( '#<br([^>]+?)>#', "<br />", $content );
$content = str_ireplace( array( "<br>", "<br />" ), "\n", $content );
}
$content = trim( $content );
@@ -952,7 +1251,10 @@ class classes_editor_composite
// WYSI-Weirdness #3: Headline tags
//-----------------------------------------
$content = preg_replace( "#<(h[0-9])(?:[^>]+?)?>(.+?)</\\1>#is", "\n[b]\\2[/b]\n", $content );
if ( ! $this->getAllowHtml() )
{
$content = preg_replace( "#<(h[0-9])(?:[^>]+?)?>(.+?)</\\1>#is", "\n[b]\\2[/b]\n", $content );
}
//-----------------------------------------
// WYSI-Weirdness #4: Font tags
@@ -993,7 +1295,7 @@ class classes_editor_composite
$content = preg_replace( '#\[img\](/)?public/style_(emoticons|images)#i', '[img]' . $this->settings['board_url'] . '/public/style_' . '\\2', $content );
//-----------------------------------------
// Clean up whitespace between lis
// Clean up whitespace between lists
//-----------------------------------------
$content = preg_replace( '#<li>\s+?(\S)#', '<li>\\1', $content );
@@ -1005,37 +1307,40 @@ class classes_editor_composite
// to make sure we get the nested ones
//-----------------------------------------
$content = $this->_recurseAndParse( 'b' , $content, "_parseSimpleTag", 'b' );
$content = $this->_recurseAndParse( 'u' , $content, "_parseSimpleTag", 'u' );
$content = $this->_recurseAndParse( 'strong' , $content, "_parseSimpleTag", 'b' );
$content = $this->_recurseAndParse( 'i' , $content, "_parseSimpleTag", 'i' );
$content = $this->_recurseAndParse( 'em' , $content, "_parseSimpleTag", 'i' );
$content = $this->_recurseAndParse( 'strike' , $content, "_parseSimpleTag", 's' );
$content = $this->_recurseAndParse( 'del' , $content, "_parseSimpleTag", 's' );
$content = $this->_recurseAndParse( 's' , $content, "_parseSimpleTag", 's' );
$content = $this->_recurseAndParse( 'blockquote', $content, "_parseSimpleTag", 'indent' );
$content = $this->_recurseAndParse( 'sup' , $content, "_parseSimpleTag", 'sup' );
$content = $this->_recurseAndParse( 'sub' , $content, "_parseSimpleTag", 'sub' );
//-----------------------------------------
// More complex tags
//-----------------------------------------
$content = $this->_recurseAndParse( 'a' , $content, "_parseAnchorTag" );
$content = $this->_recurseAndParse( 'font' , $content, "_parseFontTag" );
$content = $this->_recurseAndParse( 'div' , $content, "_parseDivTag" );
$content = $this->_recurseAndParse( 'p' , $content, "_parseParagraphTag" );
$content = $this->_recurseAndParse( 'span' , $content, "_parseSpanTag" );
if ( ! $this->getAllowHtml() )
{
$content = $this->_recurseAndParse( 'b' , $content, "_parseSimpleTag", 'b' );
$content = $this->_recurseAndParse( 'u' , $content, "_parseSimpleTag", 'u' );
$content = $this->_recurseAndParse( 'strong' , $content, "_parseSimpleTag", 'b' );
$content = $this->_recurseAndParse( 'i' , $content, "_parseSimpleTag", 'i' );
$content = $this->_recurseAndParse( 'em' , $content, "_parseSimpleTag", 'i' );
$content = $this->_recurseAndParse( 'strike' , $content, "_parseSimpleTag", 's' );
$content = $this->_recurseAndParse( 'del' , $content, "_parseSimpleTag", 's' );
$content = $this->_recurseAndParse( 's' , $content, "_parseSimpleTag", 's' );
$content = $this->_recurseAndParse( 'blockquote', $content, "_parseSimpleTag", 'indent' );
$content = $this->_recurseAndParse( 'sup' , $content, "_parseSimpleTag", 'sup' );
$content = $this->_recurseAndParse( 'sub' , $content, "_parseSimpleTag", 'sub' );
/* Possibility of preceeding \n because of P tag */
$content = trim( $content );
//-----------------------------------------
// Lists
//-----------------------------------------
$content = $this->_recurseAndParse( 'ol' , $content, "_parseListTag" );
$content = $this->_recurseAndParse( 'ul' , $content, "_parseListTag" );
//-----------------------------------------
// More complex tags
//-----------------------------------------
$content = $this->_recurseAndParse( 'a' , $content, "_parseAnchorTag" );
$content = $this->_recurseAndParse( 'font' , $content, "_parseFontTag" );
$content = $this->_recurseAndParse( 'div' , $content, "_parseDivTag" );
$content = $this->_recurseAndParse( 'p' , $content, "_parseParagraphTag" );
$content = $this->_recurseAndParse( 'span' , $content, "_parseSpanTag" );
/* Possibility of preceeding \n because of P tag */
$content = trim( $content );
//-----------------------------------------
// Lists
//-----------------------------------------
$content = $this->_recurseAndParse( 'ol' , $content, "_parseListTag" );
$content = $this->_recurseAndParse( 'ul' , $content, "_parseListTag" );
}
//-----------------------------------------
// WYSI-Weirdness #9: Fix up para tags
@@ -1047,7 +1352,10 @@ class classes_editor_composite
// WYSI-Weirdness #10: Random junk
//-----------------------------------------
$content = str_ireplace( array( "<a>", "</a>", "</li>" ), "", $content );
if ( ! $this->getAllowHtml() )
{
$content = str_ireplace( array( "<a>", "</a>", "</li>" ), "", $content );
}
//-----------------------------------------
// WYSI-Weirdness #11: Fix up list stuff
@@ -1059,18 +1367,24 @@ class classes_editor_composite
// WYSI-Weirdness #11.1: Safari badness
//-----------------------------------------
$content = str_replace( "</div>", "", $content );
if ( ! $this->getAllowHtml() )
{
$content = str_replace( "</div>", "", $content );
/* Sometimes, unclosed P tags remain if text is copied and pasted directly */
$content = preg_replace( '#<(p|div|ul|li)([^\>]+?)\>#is', '', $content );
}
/* Sometimes, unclosed P tags remain if text is copied and pasted directly */
$content = preg_replace( '#<(p|div|ul|li)([^\>]+?)\>#is', '', $content );
//-----------------------------------------
// WYSI-Weirdness #12: Convert rest to HTML
//-----------------------------------------
$content = str_replace( '&lt;' , '<', $content );
$content = str_replace( '&gt;' , '>', $content );
if ( ! $this->getAllowHtml() )
{
$content = str_replace( '&lt;' , '<', $content );
$content = str_replace( '&gt;' , '>', $content );
}
//-----------------------------------------
// WYSI-Weirdness #13: Remove useless tags
//-----------------------------------------
@@ -1078,10 +1392,10 @@ class classes_editor_composite
/* Remove embedded stuffs */
$content = preg_replace( '#\[(center|right|left)\]\[\1\]#i', '[\1]', $content );
$content = preg_replace( '#\[/(center|right|left)\]\[/\1\]#i', '[/\1]', $content );
while( preg_match( '#\[(url|img|b|u|i|s|email|list|indent|right|left|center)\](\s+?)?\[/\1\]#is', $content ) )
while( preg_match( '#\<(b|u|i|s|li)\>(\s+?)?\</\1\>#is', $content ) )
{
$content = preg_replace( '#\[(url|img|b|u|i|s|email|list|indent|right|left|center)\](\s+?)?\[/\1\]#is', "", $content );
$content = preg_replace( '#\<(b|u|i|s|li)\>(\s+?)?\</\1\>#is', "", $content );
}
//-----------------------------------------
@@ -1103,12 +1417,16 @@ class classes_editor_composite
$content = preg_replace( '#(http|https):\/\/index.php(.*?)#is', $this->settings['board_url'].'/index.php\\2', $content );
$content = preg_replace( '#\[url=[\'\"]index.php(.*?)[\"\']#is', "[url=\"".$this->settings['board_url'].'/index.php\\1"', $content );
/* Fix up incorrect tags outside of quotes */
$content = preg_replace( '#\[(b|u|s)\](\[quote)#' , '\2[\1]' , $content );
$content = preg_replace( '#(\[/quote])\[/(b|u|s)\]#', '[/\2]\1', $content );
//-----------------------------------------
// Replace tabs
//-----------------------------------------
#IPSDebug::addLogMessage( $content, 'editor', false, true );
$content = str_replace( "{'tab'}", "\t", $content );
//-----------------------------------------
// Now call the santize routine to make
// html and nasties safe. VITAL!!
@@ -1174,12 +1492,13 @@ class classes_editor_composite
protected function _parseListTag( $tag, $between_text, $opening_tag, $parse_tag )
{
$list_type = trim( preg_replace( '#"?list-style-type:\s+?([\d\w\_\-]+);?"?#si', '\\1', $this->_getValueOfOption( 'style', $opening_tag ) ) );
$css = $this->_getValueOfOption( 'class', $opening_tag );
//-----------------------------------------
// Set up a default...
//-----------------------------------------
if ( ! $list_type and $tag == 'ol' )
if ( ( stristr( $css, ' decimal' ) ) OR ! $list_type and $tag == 'ol' )
{
$list_type = 'decimal';
}
@@ -1551,15 +1870,16 @@ class classes_editor_composite
protected function _parseStyles( $opening_tag, &$start_tags, &$end_tags )
{
$style_list = array(
array('tag' => 'color' , 'rx' => '(?<![\w\-])color:\s*([^;]+);?' , 'match' => 1),
array('tag' => 'font' , 'rx' => 'font-family:\s*([^;]+);?' , 'match' => 1),
array('tag' => 'size' , 'rx' => 'font-size:\s*(.+);?' , 'match' => 1),
array('tag' => 'b' , 'rx' => 'font-weight:\s*(bold);?'),
array('tag' => 'i' , 'rx' => 'font-style:\s*(italic);?'),
array('tag' => 'u' , 'rx' => 'text-decoration:\s*(underline);?'),
array('tag' => 'left' , 'rx' => 'text-align:\s*(left);?'),
array('tag' => 'center', 'rx' => 'text-align:\s*(center);?'),
array('tag' => 'right' , 'rx' => 'text-align:\s*(right);?'),
array('tag' => 'color' , 'rx' => '(?<![\w\-])color:\s*([^;]+);?' , 'match' => 1),
array('tag' => 'font' , 'rx' => 'font-family:\s*([^;]+);?' , 'match' => 1),
array('tag' => 'size' , 'rx' => 'font-size:\s*(.+);?' , 'match' => 1),
array('tag' => 'b' , 'rx' => 'font-weight:\s*(bold);?'),
array('tag' => 'i' , 'rx' => 'font-style:\s*(italic);?'),
array('tag' => 'u' , 'rx' => 'text-decoration:\s*(underline);?'),
array('tag' => 'left' , 'rx' => 'text-align:\s*(left);?'),
array('tag' => 'center' , 'rx' => 'text-align:\s*(center);?'),
array('tag' => 'right' , 'rx' => 'text-align:\s*(right);?'),
array('tag' => 'background' , 'rx' => 'background-color:\s*([^;]+);?', 'match' => 1),
);
//-----------------------------------------
@@ -1939,7 +2259,9 @@ class classes_editor_composite
// ckeditor should have a more universal formatting so let's go with the one regex now
//if( $option == 'style' AND ( $this->memberData['userAgentKey'] == 'safari' OR $this->memberData['userAgentKey'] == 'chrome' ) )
//{
preg_match( "#{$option}(\s*?)?\=(\s*?)?[\"']?(.+?)([\"']|$|>)#is", $text, $matches );
/* @link http://community.invisionpower.com/tracker/issue-37385-editor-removes-apostrophe-from-url/
tightened up regex end ([\"'](\s|$|>)) */
preg_match( "#{$option}(\s*?)?\=(\s*?)?[\"']?(.+?)([\"'](\s|$|>))#is", $text, $matches );
//}
//else
//{
@@ -2063,7 +2385,7 @@ class classes_editor_composite
{
$image_set = $this->DB->buildAndFetch( array( 'select' => 'set_image_dir, set_emo_dir', 'from' => 'skin_collections', 'where' => 'set_is_default=1' ) );
return $image_set['set_image_dir'];
return $image_set['set_emo_dir'];
}
else
{
@@ -2095,6 +2417,11 @@ class classes_editor_composite
return "";
}
if ( $this->getAllowHtml() )
{
return $t;
}
if ( IPS_DOC_CHAR_SET == 'UTF-8' || $this->_isSwitchingFrom == 'std' )
{
$t = IPSText::decodeNamedHtmlEntities( $t );
@@ -2129,11 +2456,16 @@ class classes_editor_composite
$t = str_replace( "&#34;", '&quot;', $t );
$t = str_replace( "&#38;", '&amp;', $t );
$t = str_replace( "&#160;", ' ', $t );
/* Make tags safe */
$t = preg_replace( '#\{(style_image(?:s)?_url)\}#i', '&#123;\1&#125;', $t );
$t = str_replace( "\n", "<br />", $t );
$t = $this->_allowNonUtf8CharsWhenNotUsingUtf8Doc( $t );
$t = $this->_convertNumericEntityToNamed( $t );
// print header('Content-type: text/plain'); print $t; exit();
return $t;
}
@@ -2186,7 +2518,7 @@ class classes_editor_composite
$emoString = '';
$smilie_id = 0;
$total = 0;
foreach( ipsRegistry::cache()->getCache('emoticons') as $elmo )
{
if ( $elmo['emo_set'] != $emoDir )
@@ -2249,7 +2581,7 @@ class classes_editor_composite
* @return string Converted string
*/
protected function _allowNonUtf8CharsWhenNotUsingUtf8Doc( $string )
{
{
/* If we're not using UTF-8, lets try and handle encoded data. */
if ( IPS_DOC_CHAR_SET != 'UTF-8' )
{
@@ -2280,6 +2612,37 @@ class classes_editor_composite
return $string;
}
/**
* Converts numeric entities to their named equivalents
*
* @param string
* @return string
*/
protected function _convertNumericEntityToNamed( $string )
{
/* If we're not using UTF-8, lets try and handle encoded data. */
if ( IPS_DOC_CHAR_SET != 'UTF-8' )
{
/* First, convert any left over &acute; style chars */
preg_match_all( '/&#([0-9]{3,8});/', $string, $matches );
foreach( $matches[1] as $word )
{
if ( $word > 127 )
{
$converted = str_replace( '&', '&amp;', $this->_convertEntity( array( 1 => $word ), true ) );
if ( $converted )
{
$string = str_replace( '&#' . $word . ';', $converted, $string );
}
}
}
}
return $string;
}
/**
* Function to convert named entities to numeric entities
*
@@ -2287,7 +2650,7 @@ class classes_editor_composite
* @return string
* @link http://www.lazycat.org/php-convert-entities.php
*/
protected function _convertEntity( $matches )
protected function _convertEntity( $matches, $flip=false )
{
static $table = array(/*'quot' => '&#34;','amp' => '&#38;','lt' => '&#60;','gt' => '&#62;',*/'OElig' => '&#338;','oelig' => '&#339;','Scaron' => '&#352;','scaron' => '&#353;','Yuml' => '&#376;',
'circ' => '&#710;','tilde' => '&#732;','ensp' => '&#8194;','emsp' => '&#8195;','thinsp' => '&#8201;','zwnj' => '&#8204;','zwj' => '&#8205;','lrm' => '&#8206;','rlm' => '&#8207;',
@@ -2316,7 +2679,16 @@ class classes_editor_composite
'aring' => '&#229;','aelig' => '&#230;','ccedil' => '&#231;','egrave' => '&#232;','eacute' => '&#233;','ecirc' => '&#234;','euml' => '&#235;','igrave' => '&#236;','iacute' => '&#237;',
'icirc' => '&#238;','iuml' => '&#239;','eth' => '&#240;','ntilde' => '&#241;','ograve' => '&#242;','oacute' => '&#243;','ocirc' => '&#244;','otilde' => '&#245;','ouml' => '&#246;',
'divide' => '&#247;','oslash' => '&#248;','ugrave' => '&#249;','uacute' => '&#250;','ucirc' => '&#251;','uuml' => '&#252;','yacute' => '&#253;','thorn' => '&#254;','yuml' => '&#255;' );
if ( $flip === true )
{
$tmp = array_flip( $table );
$lookup = '&#' . $matches[1] . ';';
return isset( $tmp[ $lookup ] ) ? '&' . $tmp[ $lookup ] . ';' : $lookup;
}
return isset( $table[ $matches[1] ] ) ? $table[ $matches[1] ] : '&' . $matches[1] . ';';
}
}
@@ -1,10 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>