Version 3.0.5

This commit is contained in:
Neo committed 2025-12-19 00:31:03 -08:00
1 parent 19b38c7c74
commit 1d4720f3e2
3755 files changed
+508378 -664541

No files matched your search

@@ -0,0 +1,387 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Editor Library: Gateway
* Last Updated: $Date: 2009-08-13 19:35:55 -0400 (Thu, 13 Aug 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @link http://www.iinvisionpower.com
* @since 9th March 2005 11:03
* @version $Revision: 5015 $
*/
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 hanEditor
{
/**
* Editor reference
*
* @access public
* @var object
*/
public $class_editor;
/**
* Editing method (rte|std)
*
* @access public
* @var string
*/
public $method = '';
/**
* Editor width
*
* @access public
* @var string
* @deprecated
*/
public $ed_width = '650px';
/**
* Editor height
*
* @access public
* @var string
* @deprecated
*/
public $ed_height = '250px';
/**
* RTE enabled?
*
* @access public
* @var boolean
*/
public $rte_on = false;
/**
* Images directory (for acp)
*
* @access public
* @var string
*/
public $image_dir = '';
/**
* Emoticons directory (for acp)
*
* @access public
* @var string
*/
public $emo_dir = '';
/**
* Current editor id
*
* @access public
* @var string
*/
public $editor_id = 'ed-0';
/**
* Remove emoticons from editor
*
* @access public
* @var boolean
*/
public $remove_emoticons = false;
/**
* ACP editor id
*
* @access public
* @var integer
*/
public $acp_editor_id = 0;
/**#@+
* Registry objects
*
* @access protected
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $cache;
/**#@-*/
/**
* Constructor
*
* @access public
* @param object Registry object
* @return 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();
}
/**
* Init method
*
* @access public
* @param object Registry object
* @return void
*/
public function init()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$class = "";
if ( ! $this->settings['posting_allow_rte'] )
{
$this->member->setProperty( 'members_editor_choice', 'std' );
}
if ( ! $this->method )
{
$this->method = $this->memberData['members_editor_choice'];
}
//-----------------------------------------
// Fix width
//-----------------------------------------
$this->ed_width = $this->settings['rte_width'] ? $this->settings['rte_width'] : $this->ed_width;
//-----------------------------------------
// Make sure we haven't had any messin'
//-----------------------------------------
if ( isset( $_POST['editor_ids'] ) AND is_array( $_POST['editor_ids'] ) )
{
foreach( $_POST['editor_ids'] as $k => $v )
{
if ( isset($_POST[ $v . '_wysiwyg_used']) AND intval($_POST[ $v . '_wysiwyg_used']) == 1)
{
$this->method = 'rte';
}
else
{
$this->method = 'std';
}
}
}
if ( isset($_POST['ed-0_wysiwyg_used']) AND intval($_POST['ed-0_wysiwyg_used']) == 1 )
{
$this->method = 'rte';
}
//-----------------------------------------
// Force STD editor.. if needed
//-----------------------------------------
if ( ( isset($_POST['std_used']) AND intval($_POST['std_used']) ) )
{
$this->method = 'std';
}
//-----------------------------------------
// Sneaky Opera or Safari
//-----------------------------------------
if ( $this->method == 'rte' )
{
if ( $this->memberData['_canUseRTE'] !== TRUE )
{
$this->method = 'std';
$this->force_editor_change = 1;
}
}
//-----------------------------------------
// Which class
//-----------------------------------------
switch( $this->method )
{
case 'rte':
$class = 'class_editor_rte.php';
$this->rte_on = 1;
break;
case 'std':
$class = 'class_editor_std.php';
$this->rte_on = 0;
break;
default:
$class = 'class_editor_std.php';
$this->rte_on = 0;
}
//-----------------------------------------
// Load classes
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/classes/editor/class_editor.php' );
require_once( IPS_ROOT_PATH . 'sources/classes/editor/' . $class );
$this->class_editor = new class_editor_module( $this->registry );
$this->class_editor->allow_unicode = IPS_ALLOW_UNICODE;
$this->class_editor->get_magic_quotes = IPS_MAGIC_QUOTES;
//-----------------------------------------
// Load lang file
//-----------------------------------------
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_editors' ), 'core' );
//-----------------------------------------
// Init class
//-----------------------------------------
$this->class_editor->editorInit();
//-----------------------------------------
// Load skin and language
//-----------------------------------------
if ( IN_ACP )
{
$image_set = $this->DB->buildAndFetch( array( 'select' => 'set_image_dir, set_emo_dir', 'from' => 'skin_collections', 'where' => 'set_is_default=1' ) );
$this->image_dir = $image_set['set_image_dir'];
$this->emo_dir = $image_set['set_emo_dir'];
$this->settings['img_url'] = $this->settings['board_url'] . "/public/style_images/{$this->image_dir}" ;
//-----------------------------------------
// Remove side panel
//-----------------------------------------
$this->remove_emoticons = 1;
}
else
{
$this->emo_dir = ipsRegistry::getClass('output')->skin['set_emo_dir'];
}
}
/**
* Show the editor
*
* @access public
* @param string Raw text with bbcode
* @param string Form field name
* @return string Editor HTML
*/
public function showEditor( $text, $form_field='post_content' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$smilies = IPSLib::fetchEmoticonsAsJson( $this->emo_dir );
$total = 0;
$count = 0;
$smilie_id = 0;
//-----------------------------------------
// Load skin and language
//-----------------------------------------
//if ( IN_ACP )
//{
//-----------------------------------------
// Sort out editor id
//-----------------------------------------
$this->editor_id = 'ed-'.$this->acp_editor_id;
$this->acp_editor_id++;
//}
//-----------------------------------------
// Emoticons
//-----------------------------------------
$this->settings['_remove_emoticons'] = $this->remove_emoticons;
//-----------------------------------------
// Pre parse...
//-----------------------------------------
$text = $this->class_editor->processBeforeForm( $text );
//-----------------------------------------
// Weird script tag stuff...
//-----------------------------------------
if( $this->method == 'rte' )
{
$text = preg_replace( "#(<|&lt;|&amp;lt;|&\#60;)script#si", "&amp;lt;script", $text );
}
//-----------------------------------------
// Comment
//-----------------------------------------
if ( IN_ACP )
{
$return_html = $this->registry->getClass('output')->global_template->ips_editor( $form_field, $text, $this->settings['img_url'].'/folder_editor_images/', $this->rte_on, $this->editor_id, $smilies );
$return_html = preg_replace( "#([^/\.])js/#is", "\\1".$this->settings['board_url']."/public/js/" , $return_html );
$return_html = str_replace( "<#IMG_DIR#>" , $this->settings['board_url']."/public/style_images/{$this->image_dir}", $return_html );
}
else
{
$return_html = $this->registry->getClass('output')->getTemplate('editors')->ips_editor( $form_field, $text, $this->settings['img_url'].'/folder_editor_images/', $this->rte_on, $this->editor_id, $smilies );
}
return $return_html;
}
/**
* Retrieve the posted contents from the editor
*
* @access public
* @param string Form field name OR raw text
* @return string Editor HTML
*/
public function processRawPost( $form_field )
{
return $this->class_editor->processAfterForm( $form_field );
}
/**
* Runs through processBeforeForm
*
* @access public
* @param string Raw text
* @return string Processed text
*/
public function unProcessRawPost( $text )
{
return $this->class_editor->processBeforeForm( $text );
}
}
+479
View File
@@ -0,0 +1,479 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* API: Core
* Last Updated: $Date: 2009-11-11 20:48:24 -0500 (Wed, 11 Nov 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @link http://www.iinvisionpower.com
* @version $Rev: 5376 $
*/
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 hanEmail
{
/**
* Emailer object reference
*
* @access public
* @var object
*/
public $emailer;
/**
* Email header
*
* @access public
* @var string
*/
public $header;
/**
* Email footer
*
* @access public
* @var string
*/
public $footer;
/**
* Email from
*
* @access public
* @var string
*/
public $from;
/**
* Email to
*
* @access public
* @var string
*/
public $to;
/**
* Email bcc's
*
* @access public
* @var array
*/
public $bcc = array();
/**
* Email subject
*
* @access public
* @var string
*/
public $subject;
/**
* Email body
*
* @access public
* @var string
*/
public $message;
/**
* Temp word swapping array
*
* @access public
* @var array
*/
private $_words;
/**
* Headers to pass to email lib
*
* @access private
* @var array
*/
private $temp_headers = array();
/**#@+
* Registry Object Shortcuts
*
* @access public
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
/**#@-*/
/**
* Construct
*
* @access public
* @param object ipsRegistry reference
* @return 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();
}
/**
* Init method (setup stuff)
*
* @access public
* @return void
*/
public function init()
{
$this->header = $this->settings['email_header'] ? $this->settings['email_header'] : '';
$this->footer = $this->settings['email_footer'] ? $this->settings['email_footer'] : '';
require_once( IPS_KERNEL_PATH . 'classEmail.php' );
$this->emailer = new classEmail(
array(
'debug' => $this->settings['fake_mail'] ? $this->settings['fake_mail'] : '0',
'debug_path' => DOC_IPS_ROOT_PATH . '_mail',
'smtp_host' => $this->settings['smtp_host'] ? $this->settings['smtp_host'] : 'localhost',
'smtp_port' => intval($this->settings['smtp_port']) ? intval($this->settings['smtp_port']) : 25,
'smtp_user' => $this->settings['smtp_user'],
'smtp_pass' => $this->settings['smtp_pass'],
'smtp_helo' => $this->settings['smtp_helo'],
'method' => $this->settings['mail_method'],
'wrap_brackets' => $this->settings['mail_wrap_brackets'],
'extra_opts' => $this->settings['php_mail_extra'],
'charset' => IPS_DOC_CHAR_SET,
'html' => intval($this->settings['html_email']),
)
);
}
/**
* Clear out any temporary headers
*
* @access public
* @return void
*/
public function clearHeaders()
{
$this->temp_headers = array();
}
/**
* Manually set an email header
*
* @access public
* @param string Header key
* @param string Header value
* @return void
*/
public function setHeader( $key, $value )
{
$this->temp_headers[ $key ] = $value;
}
/**
* Send an email
*
* @access public
* @return boolean Email sent successfully
*/
public function sendMail()
{
//$this->emailer->clearEmail();
//$this->emailer->clearError();
$this->init();
$this->settings['board_name'] = $this->cleanMessage($this->settings['board_name']);
$this->emailer->setFrom( $this->from ? $this->from : $this->settings['email_out'], $this->settings['board_name'] );
$this->emailer->setTo( $this->to );
foreach( $this->bcc as $bcc )
{
$this->emailer->addBCC( $bcc );
}
if( count($this->temp_headers) )
{
foreach( $this->temp_headers as $k => $v )
{
$this->emailer->setHeader( $k, $v );
}
}
$this->emailer->setSubject( $this->subject );
$this->emailer->setBody( $this->message );
$this->emailer->sendMail();
if( $this->emailer->error )
{
return $this->fatalError( $this->emailer->error_msg, $this->emailer->error_help );
}
return true;
}
/**
* Retrieve an email template
*
* @access public
* @param string Template key
* @param string Language to use
* @param string Language file to load
* @param string Application of language file
* @return void
*/
public function getTemplate( $name, $language="", $lang_file='public_email_content', $app='core' )
{
//-----------------------------------------
// Check..
//-----------------------------------------
if( $name == "" )
{
$this->error++;
$this->fatalError( "A valid email template ID was not passed to the email library during template parsing", "" );
}
//-----------------------------------------
// Default?
//-----------------------------------------
if( ! $language )
{
$language = IPSLib::getDefaultLanguage();
}
//-----------------------------------------
// Check and get
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( $lang_file ), $app, $language, TRUE );
//-----------------------------------------
// Stored KEY?
//-----------------------------------------
if ( ! isset($this->lang->words[ $name ]) )
{
if ( $language == IPSLib::getDefaultLanguage() )
{
$this->fatalError( "Could not find an email template with an ID of '{$name}'", "" );
}
else
{
$this->registry->class_localization->loadLanguageFile( array( $lang_file ), $app, IPSLib::getDefaultLanguage() );
if ( ! isset($this->lang->words[ $name ]) )
{
$this->fatalError( "Could not find an email template with an ID of '{$name}'", "" );
}
}
}
//-----------------------------------------
// Subject?
//-----------------------------------------
if ( isset( $this->lang->words[ 'subject__'. $name ] ) )
{
$this->subject = stripslashes( $this->lang->words[ 'subject__'. $name ] );
}
//-----------------------------------------
// Return
//-----------------------------------------
$this->template = stripslashes($this->lang->words['email_header']) . stripslashes($this->lang->words[ $name ]) . stripslashes($this->lang->words['email_footer']);
}
/**
* Builds an email from a template, replacing variables
*
* @access public
* @param array Replacement keys to values
* @param bool Do not "clean"
* @return void
*/
public function buildMessage( $words, $noClean=false )
{
if( $this->template == "" )
{
$this->error++;
$this->fatalError( "Could not build the email message, no template assigned", "Make sure a template is assigned first." );
}
$this->message = $this->template;
if( $noClean )
{
$this->message = str_replace( "\n", "<br />", str_replace( "\r", "", $this->message ) );
}
//-----------------------------------------
// Add some default words
//-----------------------------------------
$words['BOARD_ADDRESS'] = $this->settings['board_url'] . '/index.' . $this->settings['php_ext'];
$words['WEB_ADDRESS'] = $this->settings['home_url'];
$words['BOARD_NAME'] = $this->settings['board_name'];
$words['SIGNATURE'] = $this->settings['signature'] ? $this->settings['signature'] : '';
//-----------------------------------------
// Swap the words
// 10.7.08 - Added replacements in subject
//-----------------------------------------
if( !$noClean )
{
foreach( $words as $k => $v )
{
$words[ $k ] = $this->cleanMessage( $v );
}
}
$this->_words = $words;
$this->message = preg_replace_callback( "/<#(.+?)#>/", array( &$this, '_swapWords' ), $this->message );
$this->subject = preg_replace_callback( "/<#(.+?)#>/", array( &$this, '_swapWords' ), $this->subject );
$this->_words = array();
}
/**
* Replaces key with value
*
* @access private
* @param string Key
* @return string Replaced variable
*/
private function _swapWords( $matches )
{
return $this->_words[ $matches[1] ];
}
/**
* Cleans an email message
*
* @access public
* @param string Email content
* @return string Cleaned email content
*/
public function cleanMessage( $message = "" )
{
$message = preg_replace( "#\[quote.*\](.+?)\[/quote\]#", "<br /><br />------------ QUOTE ----------<br />\\1<br />-----------------------------<br /><br />" , $message );
$message = preg_replace_callback( "#\[url=(.+?)\](.+?)\[/url\]#", array( $this, "_formatUrl" ), $message );
//-----------------------------------------
// Unconvert smilies 'cos at this point they are img tags
//-----------------------------------------
$message = IPSText::getTextClass('bbcode')->unconvertSmilies( $message );
//-----------------------------------------
// We may want to adjust this later, but for
// now just strip any other html
//-----------------------------------------
$message = strip_tags( $message, '<br>' );
IPSText::getTextClass( 'bbcode' )->parse_html = 0;
IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 0;
IPSText::getTextClass( 'bbcode' )->parse_wordwrap = -1;
$message = IPSText::getTextClass('bbcode')->stripAllTags( $message, true, false );
//-----------------------------------------
// Bear with me...
//-----------------------------------------
$message = str_replace( "\n" , "\r\n", $message );
$message = str_replace( "\r" , "" , $message );
$message = str_replace( "<br>" , "\r\n", $message );
$message = str_replace( "<br />" , "\r\n", $message );
$message = str_replace( "\r\n\r\n" , "\r\n", $message );
$message = str_replace( "&quot;", '"' , $message );
$message = str_replace( "&#092;", "\\", $message );
$message = str_replace( "&#036;", "\$", $message );
$message = str_replace( "&#33;" , "!" , $message );
$message = str_replace( "&#34;" , '"' , $message );
$message = str_replace( "&#39;" , "'" , $message );
$message = str_replace( "&#40;" , "(" , $message );
$message = str_replace( "&#41;" , ")" , $message );
$message = str_replace( "&lt;" , "<" , $message );
$message = str_replace( "&gt;" , ">" , $message );
$message = str_replace( "&#124;", '|' , $message );
$message = str_replace( "&amp;" , "&" , $message );
$message = str_replace( "&#38;" , '&' , $message );
$message = str_replace( "&#58;" , ":" , $message );
$message = str_replace( "&#91;" , "[" , $message );
$message = str_replace( "&#93;" , "]" , $message );
$message = str_replace( "&#064;", '@' , $message );
$message = str_replace( "&#60;" , '<' , $message );
$message = str_replace( "&#62;" , '>' , $message );
$message = str_replace( "&nbsp;" , ' ', $message );
return $message;
}
/**
* Format url for email
*
* @access public
* @param array preg_replace matches
* @return string Formatted url
*/
public function _formatUrl( $matches )
{
$matches[1] = str_replace( array( '"', "'", '&quot;', '&#039;', '&#39;' ), '', $matches[1] );
return $matches[2] . ' (' . $matches[1] . ')';
}
/**
* Log a fatal error
*
* @access private
* @param string Message
* @param string Help key (deprecated)
* @return bool
*/
private function fatalError( $msg, $help="" )
{
$this->DB->insert( 'mail_error_logs',
array(
'mlog_date' => time(),
'mlog_to' => $this->to,
'mlog_from' => $this->from,
'mlog_subject' => $this->subject,
'mlog_content' => substr( $this->message, 0, 200 ),
'mlog_msg' => $msg,
'mlog_code' => $this->emailer->smtp_code,
'mlog_smtp_msg' => $this->emailer->smtp_msg
)
);
return false;
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,578 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* BBCode parsing gateway.
* Last Updated: $Date: 2009-11-11 20:48:24 -0500 (Wed, 11 Nov 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @link http://www.iinvisionpower.com
* @since 9th March 2005 11:03
* @version $Revision: 5376 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class parseBbcode
{
/**
* Allowed to update the caches if not present
*
* @access public
* @var boolean
*/
public $allow_update_caches = true;
/**
* Parse emoticons?
*
* @access public
* @var boolean
*/
public $parse_smilies = true;
/**
* Parse HTML?
* HIGHLY NOT RECOMMENDED IN MOST CASES
*
* @access public
* @var boolean
*/
public $parse_html = false;
/**
* Parse bbcode?
*
* @access public
* @var boolean
*/
public $parse_bbcode = true;
/**
* Strip quotes?
* Strips quotes from the resulting text
*
* @access public
* @var boolean
*/
public $strip_quotes = false;
/**
* Auto convert newlines to html line breaks
*
* @access public
* @var boolean
*/
public $parse_nl2br = true;
/**
* Parse wordwrap
*
* @access public
* @var boolean
*/
public $parse_wordwrap = 0;
/**
* Bypass badwords?
*
* @access public
* @var boolean
*/
public $bypass_badwords = false;
/**
* Section keyword for parsing area
*
* @access public
* @var string
*/
public $parsing_section = 'post';
/**
* Group id of poster
*
* @access public
* @var int
*/
public $parsing_mgroup = 0;
/**
* Value of mgroup_others for poster
*
* @access public
* @var string
*/
public $parsing_mgroup_others = '';
/**
* Error code stored
*
* @access public
* @var string
*/
public $error = '';
/**
* Warning code stored
*
* @access public
* @var string
*/
public $warning = '';
/**
* BBCode library object
*
* @access protected
* @var object
*/
protected $bbclass;
/**
* Already loaded the classes?
*
* @access protected
* @var boolean
*/
protected $classes_loaded = false;
/**
* 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;
/**
* Cache object
*
* @access protected
* @var object
*/
protected $cache;
/**
* Constructor
*
* @access public
* @param object Registry object
* @param string Parsing method to use
* @return void
*/
public function __construct( ipsRegistry $registry, $method='normal' )
{
/* 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();
$this->pre_edit_parse_method = $method;
/* Initialize our bbcode class */
$this->_loadClasses();
/* And some default properties */
$this->bypass_badwords = $this->memberData ? intval( $this->memberData['g_bypass_badwords'] ) : 0;
$this->strip_quotes = $this->settings['strip_quotes'];
$this->parse_wordwrap = $this->settings['post_wordwrap'];
}
/**
* Load the required bbcode classes and initialize the object
*
* @access private
* @return void
*/
private function _loadClasses()
{
$_NOW = IPSDebug::getMemoryDebugFlag();
if ( ! $this->classes_loaded )
{
$_NOW = IPSDebug::getMemoryDebugFlag();
require_once( IPS_ROOT_PATH . 'sources/classes/bbcode/core.php' );
IPSDebug::setMemoryDebugFlag( "Require once call for core.php", $_NOW );
switch( $this->pre_edit_parse_method )
{
case 'legacy':
$file = 'legacy.php';
$class = 'class_bbcode_legacy';
break;
default:
$file = '';//'normal.php';
$class = 'class_bbcode_core';
break;
}
if( $file )
{
require_once ( IPS_ROOT_PATH . 'sources/classes/bbcode/' . $file );
}
$this->bbclass = new $class( $this->registry );
$this->classes_loaded = true;
$this->error =& $this->bbclass->error;
$this->warning =& $this->bbclass->warning;
}
IPSDebug::setMemoryDebugFlag( "BBCode classes loaded", $_NOW );
}
/**
* Pass off our settings to our bbcode handler
*
* @access private
* @return void
*/
private function _passSettings()
{
//-----------------------------------------
// Pass the settings
//-----------------------------------------
$this->cache->updateCacheWithoutSaving( '_tmp_section', $this->parsing_section );
$this->bbclass->bypass_badwords = $this->bypass_badwords;
$this->bbclass->parse_smilies = $this->parse_smilies;
$this->bbclass->parse_html = $this->parse_html;
$this->bbclass->parse_bbcode = $this->parse_bbcode;
$this->bbclass->strip_quotes = $this->strip_quotes;
$this->bbclass->parse_nl2br = $this->parse_nl2br;
$this->bbclass->parse_wordwrap = $this->parse_wordwrap;
$this->bbclass->parsing_section = $this->parsing_section;
$this->bbclass->parsing_mgroup = $this->parsing_mgroup;
$this->bbclass->parsing_mgroup_others = $this->parsing_mgroup_others;
$this->bbclass->initOurBbcodes();
}
/**
* Parses the bbcode to be stored into the database.
* If all bbcodes are parse on display, this method does nothing really
*
* @access public
* @param string Raw input text to parse
* @return string Parsed text ready to be stored in database
*/
public function preDbParse( $text )
{
$this->_passSettings();
//-----------------------------------------
// Pass off to the main handler
//-----------------------------------------
return $this->bbclass->preDbParse( trim($text) );
}
/**
* Parses the bbcode to be shown in the STD editor.
* If all bbcodes are parse on display, this method does nothing really
*
* @access public
* @param string Raw input text to parse
* @return string Parsed text ready to be stored in database
*/
public function preEditParse( $text )
{
$this->_passSettings();
//-----------------------------------------
// Parse
//-----------------------------------------
return $this->bbclass->preEditParse( $text );
}
/**
* Parses the bbcode to be shown in the browser. Expects preDbParse has already been done before the save.
* If all bbcodes are parse on save, this method does nothing really
*
* @access public
* @param string Raw input text to parse
* @return string Parsed text ready to be displayed
*/
public function preDisplayParse( $text )
{
$_NOW = IPSDebug::getMemoryDebugFlag();
$this->_passSettings();
//-----------------------------------------
// Parse
//-----------------------------------------
$text = $this->bbclass->preDisplayParse( $text );
IPSDebug::setMemoryDebugFlag( "PreDisplayParse completed", $_NOW );
return $text;
}
/**
* Parses the bbcode to be shown in the polls.
* Parses img and url, if enabled
*
* @access public
* @param string Raw input text to parse
* @return string Parsed text ready to be displayed
*/
public function parsePollTags( $text )
{
if( $this->settings['poll_tags'] )
{
$text = $this->bbclass->parseBbcode( $text, 'display', array( 'img', 'url' ) );
$text = $this->bbclass->finishNonParsed( $text, 'display' );
}
return $text;
}
/**
* Converts the STD contents to RTE compatible output
* Used when switching editors or taking the bbcode post and putting into the RTE
*
* @access public
* @param string BBCode text
* @return string RTE-compatible text
*/
public function convertStdToRte( $t )
{
//-----------------------------------------
// Ensure no slashy slashy
//-----------------------------------------
$t = str_replace( '"','&quot;', $t );
$t = str_replace( "'",'&apos;', $t );
//-----------------------------------------
// Convert <>
//-----------------------------------------
if( $this->parse_nl2br )
{
$t = str_replace( "<br />", "\n", $t );
}
$t = str_replace( '<', '&lt;', $t );
$t = str_replace( '>', '&gt;', $t );
//-----------------------------------------
// RTE expects <br /> not \n
//-----------------------------------------
$t = str_replace( "\n", "<br />", str_replace( "\r\n", "\n", $t ) );
//-----------------------------------------
// Okay, convert ready for RTE
//-----------------------------------------
$t = $this->preDbParse( $t );
$t = $this->convertForRTE( $t );
return $t;
}
/**
* Converts "IP.Board HTML" to regular (RTE) HTML
*
* @access public
* @param string Parsed text
* @return string RTE-compatible text
*/
public function convertForRTE( $t )
{
$this->_passSettings();
return $this->bbclass->convertForRTE( $t );
}
/**
* Strip all HTML and bbcode tags
*
* @access public
* @param string BBCode + HTML text
* @param boolean Run through pre_edit_parse
* @param boolean Check "strip from search" option
* @return string Raw text with no tags
*/
public function stripAllTags( $t, $pre_edit_parse=true, $only_search=true )
{
$this->_passSettings();
return $this->bbclass->stripAllTags( $t, $pre_edit_parse, $only_search );
}
/**
* Strip quotes
*
* @access public
* @param string Raw posted text
* @return string Raw text with no quotes
*/
public function stripQuotes( $t )
{
$this->_passSettings();
return $this->bbclass->stripBbcode( 'quote', $t );
}
/**
* Strip emoticons
*
* @access public
* @param string Raw posted text
* @return string Raw text with no emoticons
*/
public function stripEmoticons( $t )
{
$this->_passSettings();
return $this->bbclass->stripEmoticons( $t );
}
/**
* Unconvert emoticons
*
* @access public
* @param string Raw posted text
* @return string Raw text with text emoticons
*/
public function unconvertSmilies( $t )
{
$this->_passSettings();
return $this->bbclass->unconvertSmilies( $t );
}
/**
* Strip badwords
*
* @access public
* @param string Raw posted text
* @return string Raw text with no badwords
*/
public function stripBadWords( $t )
{
$this->_passSettings();
return $this->bbclass->badWords( $t );
}
/**
* Apply word wrapping
*
* @access public
* @param string BBCode + HTML text
* @param integer Number of characters to wrap after
* @param string Break string
* @return string Raw text with no tags
*/
public function wordWrap( $t, $chars=80, $break="\n" )
{
$this->parse_wordwrap = $chars;
$this->_passSettings();
return $this->bbclass->applyWordwrap( $t, $chars, $break );
}
/**
* Make data in quotes "safe"
*
* @access public
* @param string Raw posted text
* @return string Raw text safe for use in quote tag
*/
public function makeQuoteSafe( $t )
{
$this->_passSettings();
return $this->bbclass->makeQuoteSafe( $t );
}
/**
* Clean content from XSS (best shot at least)
*
* @access public
* @param string Raw posted text
* @param boolean Attempt to fix script tag
* @return string Cleaned text
*/
public function xssHtmlClean( $t, $fixScript=true )
{
$this->_passSettings();
return $this->bbclass->checkXss( $t, $fixScript );
}
/**
* Determines if member is viewing images
* If not, unparses smilies
*
* @access public
* @param string Raw input text to parse
* @return string Parsed text ready to be stored in database
*/
public function memberViewImages( $text )
{
return IPSLib::memberViewImages( $text );
}
}
+1
View File
@@ -0,0 +1 @@
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> 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.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍