Version 3.4.5

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

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,148 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* IP.Content custom bbcode
* Last Updated: $Date: 2012-06-01 13:11:08 -0400 (Fri, 01 Jun 2012) $
* </pre>
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Content
* @link http://www.invisionpower.com
* @version $Rev: 10855 $
*/
if( !class_exists('bbcode_parent_main_class') )
{
require_once( IPS_ROOT_PATH . 'sources/classes/text/parser/bbcode/defaults.php' );/*noLibHook*/
}
class bbcode_plugin_page extends bbcode_parent_main_class
{
/**
* Constructor
*
* @access public
* @param object Registry object
* @param object Parent
* @return @e void
*/
public function __construct( ipsRegistry $registry, $_parent=null )
{
$this->currentBbcode = 'page';
parent::__construct( $registry, $_parent );
}
/**
* Do the actual replacement
*
* @access protected
* @param string $txt Parsed text from database to be edited
* @return string BBCode content, ready for editing
*/
protected function _replaceText( $txt )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$tag = '[' . $this->currentBbcode . ']';
$_curPage = $this->request['pg'] ? $this->request['pg'] : 1;
$_ttlPages = 1;
$_ttlPages += substr_count( $txt, $tag );
if( $this->caches['pagination_url'] )
{
$_reconstructed = rtrim( $this->caches['pagination_url'], '/' );
}
else
{
$_requestUri = rtrim( $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : @getenv('REQUEST_URI'), '/' );
$_reconstructed = ( ( $_SERVER['HTTPS'] and $_SERVER['HTTPS'] != 'off' ) ? "https://" : "http://" ) . $_SERVER['HTTP_HOST'] . ( substr( $_requestUri, 0, 1 ) == '/' ? $_requestUri : '/' . $_requestUri );
}
//-----------------------------------------
// Get rid of existing pg= params
//-----------------------------------------
$_reconstructed = preg_replace( "/pg=(\d+)/", '', $_reconstructed );
$_reconstructed = rtrim($_reconstructed, '?&' );
$_reconstructed = str_replace( '&', '&amp;', $_reconstructed );
//-----------------------------------------
// Add on the parameter separator
//-----------------------------------------
if( $this->settings['url_type'] == 'query_string' )
{
if( substr_count( $_reconstructed, '?' ) > 1 )
{
$_reconstructed .= '&amp;';
}
else
{
$_reconstructed .= '?';
}
}
else
{
if( strpos( $_reconstructed, '?' ) !== false )
{
$_reconstructed .= '&amp;';
}
else
{
$_reconstructed .= '?';
}
}
//-----------------------------------------
// If no pages, no need to have links
//-----------------------------------------
if( $_ttlPages < 2 )
{
return $txt;
}
//-----------------------------------------
// Do replacements
//-----------------------------------------
if( !$_curPage )
{
$txt = substr( $txt, 0, strpos( $txt, $tag ) );
}
else
{
$bits = explode( $tag, $txt );
$txt = $bits[ $_curPage - 1 ];
}
//-----------------------------------------
// Clean up leading <br /> tags
//-----------------------------------------
$txt = trim($txt);
if( substr( $txt, 0, 15 ) == '~~~~~_____~~~~~' )
{
$txt = substr( $txt, 15 );
}
//-----------------------------------------
// And start generating output
//-----------------------------------------
$txt .= $this->registry->output->getTemplate('ccs_global')->articlePages( $_ttlPages, $_curPage, $_reconstructed );
return $txt;
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,145 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* Text Parsing: LEGACY CR..STUFF
* Last Updated: $Date: 2012-06-08 09:28:02 +0100 (Fri, 08 Jun 2012) $
* </pre>
*
* @author $Author: mmecham $
* @copyright (c) 2001 - 2012 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: 10894 $
*
* Revised in 3.4 by Matt Mecham
* Refactored into a text parsing module
*
*/
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_text_parser_legacy extends classes_text_parser
{
/**
* Constructor
*
* @access public
* @param object Registry object
* @return @e void
*/
public function __construct()
{
return parent::__construct();
}
/**
* Takes data from the editor (HTML) and makes it BBCode
* @param string $content
*/
public function postEditor( $content )
{
$content = $this->_postPurifyCodeBoxes( $content );
/* Restore preserved newlines */
$content = str_replace( "<!-preserve.newline-->", "\n", $content );
if ( self::$Perms['parseHtml'] !== true )
{
$content = $this->HtmlToBBCode( $content );
}
return $content;
}
/**
* Takes stuff given and makes it all lovely for the editor
* @param string $content
*/
public function preEditor( $content )
{
$content = $this->_postPurifyCodeBoxes( $content );
/* Restore preserved newlines */
$content = str_replace( "<!-preserve.newline-->", "\n", $content );
$content = $this->BBCodeToHtml( $content );
/* Fix up old PRE tags */
$content = preg_replace( '#<pre class=(["\'])prettyprint#', '<pre class=\1_prettyXprint', $content );
return $content;
}
/**
* Additional methods for preDbParse
*/
public function preDbParse( $content )
{
$content = $this->_postPurifyCodeBoxes( $content );
return $content;
}
/**
* Check and make safe embedded codes (removes mark-up HTML purify might have added)
* @param array $matches
*/
protected function _postPurifyCodeBoxes( $content )
{
/* Fetch paired opening and closing tags */
$data = $this->getTagPositions( $content, 'CODE', array( '[', ']') );
if ( is_array( $data ) && count( $data ) )
{
foreach( $data['open'] as $id => $val )
{
$o = $data['open'][ $id ];
$c = $data['close'][ $id ] - $o;
$slice = substr( $content, $o, $c );
$_origLen = strlen( $slice );
$slice = IPSText::stripTags( $slice, '<pre>,<br>' );
$slice = str_replace( "<br />" , "\n", $slice );
$slice = str_replace( "\n" , "<!-preserve.newline-->", $slice );
$slice = preg_replace( '#(https|http|ftp)://#' , '\1&#58;//', $slice );
$content = substr_replace( $content, $slice, $o, $c );
$_newLen = strlen( $slice );
if ( $_newLen != $_origLen )
{
/* Bump up next */
foreach( $data['open'] as $_id => $_val )
{
$_o = $data['open'][ $_id ];
/* Ascii face alert */
if ( $_o > $o )
{
$data['open'][ $_id ] += ( $_newLen - $_origLen );
$data['close'][ $_id ] += ( $_newLen - $_origLen );
}
}
}
}
}
return $content;
}
}