- --- ../admin/sources/base/core.php (original)
- +++ ../admin/sources/base/core.php Thu Oct 25 22:48:40 2012
- @@ -2,21 +2,21 @@
- /**
- * <pre>
- * Invision Power Services
- - * IP.Board v3.3.2
- + * IP.Board v3.3.4
- * Static Classes for IP.Board 3
- *
- * These classes are not required as objects. We have grouped
- * together several singletons to prevent multiple file loads
- - * Last Updated: $Date: 2012-05-07 12:13:15 -0400 (Mon, 07 May 2012) $
- + * Last Updated: $Date: 2012-07-04 13:32:40 -0400 (Wed, 04 Jul 2012) $
- * </pre>
- *
- - * @author $Author: ips_terabyte $
- + * @author $Author: AndyMillne $
- * @copyright (c) 2001 - 2009 Invision Power Services, Inc.
- - * @license http://www.invisionpower.com/community/board/license.html
- + * @license http://www.invisionpower.com/company/standards.php#license
- * @package IP.Board
- * @link http://www.invisionpower.com
- * @since 12th March 2002
- - * @version $Revision: 10698 $
- + * @version $Revision: 11032 $
- *
- * @author Matt
- */
- @@ -1117,6 +1117,36 @@
- static protected $_lims = array();
- /**
- + * mixed safe_unserialize(string $serialized)
- + * Safely unserialize, that is only unserialize string, numbers and arrays, not objects
- + *
- + * @license Public Domain
- + * @author dcz (at) phpbb-seo (dot) com
- + */
- + static public function safeUnserialize( $serialized )
- + {
- + // unserialize will return false for object declared with small cap o
- + // as well as if there is any ws between O and :
- + if ( is_string( $serialized ) && strpos( $serialized, "\0" ) === false )
- + {
- + if ( strpos( $serialized, 'O:' ) === false )
- + {
- + // the easy case, nothing to worry about
- + // let unserialize do the job
- + return @unserialize( $serialized );
- + }
- + else if ( ! preg_match('/(^|;|{|})O:[0-9]+:"/', $serialized ) )
- + {
- + // in case we did have a string with O: in it,
- + // but it was not a true serialized object
- + return @unserialize( $serialized );
- + }
- + }
- +
- + return false;
- + }
- +
- + /**
- * Returns the class name to be instantiated, the class file will already be included
- *
- * @param string $filePath File location of the class (leave an empty string if you've already loaded the main file)
- @@ -4025,31 +4055,34 @@
- * @return mixed
- * @since 2.0
- */
- - static public function get($name)
- - {
- + static public function get($name)
- + {
- /* Check internal data first */
- if ( isset( self::$_cookiesSet[ $name ] ) )
- {
- return self::$_cookiesSet[ $name ];
- }
- - else if ( isset( $_COOKIE[ipsRegistry::$settings['cookie_id'].$name] ) )
- - {
- + else if ( isset( $_COOKIE[ipsRegistry::$settings['cookie_id'].$name] ) )
- + {
- $_value = $_COOKIE[ ipsRegistry::$settings['cookie_id'].$name ];
- - if ( substr( $_value, 0, 2 ) == 'a:' )
- - {
- - return unserialize( stripslashes( urldecode( $_value ) ) );
- - }
- - else
- - {
- + $_couldBeSerialized = stripslashes( urldecode( $_value ) );
- +
- + if ( substr( $_couldBeSerialized, 0, 2 ) == 'a:' )
- + {
- + return IPSLib::safeUnserialize( $_couldBeSerialized );
- + }
- + else
- + {
- return IPSText::parseCleanValue( urldecode( $_value ) );
- - }
- - }
- - else
- - {
- - return FALSE;
- - }
- - }
- + }
- + }
- + else
- + {
- + return FALSE;
- + }
- + }
- +
- }
- /**
- @@ -4610,12 +4643,37 @@
- }
- /**
- + * Strips out all non UTF-8 characters from a string
- + * This is best used when you have already converted / got UTF-8 data
- + * @param string In
- + * @return string Cleaned
- + */
- + public static function stripNonUtf8( $string )
- + {
- + $string = preg_replace('/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]|(?<=^|[\x00-\x7F])[\x80-\xBF]+|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*'.
- + '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})|[\xE0-\xEF](([\x80-\xBF](?![\x80-\xBF]))|(?![\x80-\xBF]{2})|[\x80-\xBF]{3,})/', '?', $string );
- +
- +
- + $string = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]|\xED[\xA0-\xBF][\x80-\xBF]/S','?', $string );
- +
- + return $string;
- + }
- +
- + /**
- * Decodes long named HTML entities in a string é without affecting other HTML entities (< etc) etc
- * @param string Raw string
- * @param string Converted string
- */
- public static function decodeNamedHtmlEntities( $string )
- {
- + /* Some manual conversions */
- + $manual = array( 'Alpha' => 'A', 'Beta' => 'B', 'alpha' => 'a', 'beta' => 'b' );
- +
- + foreach( $manual as $o => $r )
- + {
- + $string = str_replace( '&' . $o . ';', $r, $string );
- + }
- +
- preg_match_all( '#&([^;\s]+?);#', $string, $matches );
- $entities = array();
- $notList = array( 'amp', 'para', 'middot', 'gt', 'lt' );
- @@ -4630,9 +4688,11 @@
- }
- }
- }
- -
- - $translated = @explode( ' ', @html_entity_decode( @implode( ' ', $entities ), ENT_NOQUOTES, IPS_DOC_CHAR_SET ) );
- + /* -15 is the same as -1 but with Euro plus French and Finnish */
- + $charSet = ( IPS_DOC_CHAR_SET == 'ISO-8859-1' ) ? 'ISO-8859-15' : IPS_DOC_CHAR_SET;
- + $translated = @explode( ' ', @html_entity_decode( @implode( ' ', $entities ), ENT_NOQUOTES, $charSet ) );
- +
- if ( is_array( $translated ) AND count( $translated ) AND count( $translated ) == count( $entities ) )
- {
- return str_replace( $entities, $translated, $string );
- @@ -5006,12 +5066,23 @@
- */
- static public function searchHighlight( $text, $highlight )
- {
- - //-----------------------------------------
- - // INIT
- - //-----------------------------------------
- -
- + /* No highlight to do (1)? No point in wasting time then.. */
- + if ( $highlight == '' )
- + {
- + return $text;
- + }
- +
- $highlight = self::parseCleanValue( urldecode( $highlight ) );
- +
- + /* No highlight to do (2)? No point in wasting time then.. */
- + if ( $highlight == '' )
- + {
- + return $text;
- + }
- +
- + /* Init some more vars */
- $loosematch = 1;//strstr( $highlight, '*' ) ? 1 : 0;
- + $isPhrase = preg_match( '#("|&(amp;)?quot;)#', $highlight );
- $keywords = str_replace( '*', '', str_replace( "+", " ", str_replace( "++", "+", str_replace( '-', '', trim($highlight) ) ) ) );
- $keywords = str_replace( '"', '', str_replace( '\\', '\', str_replace( '&quot;', '', $keywords ) ) );
- $word_array = array();
- @@ -5049,7 +5120,7 @@
- $keywords = str_replace( $match[0], '', $keywords );
- }
- }
- - else if ( strstr( $keywords, ' ' ) )
- + else if ( ! $isPhrase && strstr( $keywords, ' ' ) )
- {
- $word_array = explode( ' ', str_replace( ' ', ' ', $keywords ) );
- }
- @@ -5757,6 +5828,7 @@
- static public function UNhtmlspecialchars($t="")
- {
- $t = str_replace( "&" , "&", $t );
- + $t = str_replace( "&" , "&", $t );
- $t = str_replace( "<" , "<", $t );
- $t = str_replace( ">" , ">", $t );
- $t = str_replace( """, '"', $t );
ipb33_oct12.diff
Posted by Anonymous on Fri 26th Oct 2012 06:58
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
kpaste.net RSS