Version 2.2.2
This commit is contained in:
1 parent
22f1b963ee
commit
a3bb603c96
858 files changed
+479463
-188140
No files matched your search
+332
-59
@@ -1,17 +1,27 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| Invision Power Board 2.2.2
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Monday 05th of March 2007 10:10:54 PM
|
||||
| Release: e3790216629e5a2aaf37070b32237f06
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-10-14 12:44:46 +0100 (Sat, 14 Oct 2006) $
|
||||
| > $Revision: 647 $
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-12-05 04:29:07 -0600 (Tue, 05 Dec 2006) $
|
||||
| > $Revision: 762 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
@@ -314,7 +324,14 @@ class ipsclass {
|
||||
|
||||
//$this->acpversion = '210015.060501.u';
|
||||
|
||||
list( $n, $b, $r ) = explode( ".", $this->acpversion );
|
||||
if ( strstr( $this->acpversion , '.' ) )
|
||||
{
|
||||
list( $n, $b, $r ) = explode( ".", $this->acpversion );
|
||||
}
|
||||
else
|
||||
{
|
||||
$n = $b = $r = '';
|
||||
}
|
||||
|
||||
$this->vn_full = $this->acpversion;
|
||||
$this->acpversion = $n;
|
||||
@@ -421,7 +438,7 @@ class ipsclass {
|
||||
// Char set
|
||||
//-----------------------------------------
|
||||
|
||||
$this->vars['gb_char_set'] = $this->vars['gb_char_set'] ? $this->vars['gb_char_set'] : 'iso-8859-1';
|
||||
$this->vars['gb_char_set'] = $this->vars['gb_char_set'] ? $this->vars['gb_char_set'] : 'windows-1251';
|
||||
|
||||
//-----------------------------------------
|
||||
// Max display name length
|
||||
@@ -528,6 +545,26 @@ class ipsclass {
|
||||
$this->cachelib->connect( $this->vars );
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
// XCache...
|
||||
//--------------------------------
|
||||
|
||||
else if( function_exists('xcache_get') AND isset($this->vars['use_xcache']) AND $this->vars['use_xcache'] == 1 )
|
||||
{
|
||||
require KERNEL_PATH.'class_cache_xcache.php';
|
||||
$this->cachelib = new cache_lib( $this->vars['board_url'] );
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
// APC...
|
||||
//--------------------------------
|
||||
|
||||
else if( function_exists('apc_fetch') AND isset($this->vars['use_apc']) AND $this->vars['use_apc'] == 1 )
|
||||
{
|
||||
require KERNEL_PATH.'class_cache_apc.php';
|
||||
$this->cachelib = new cache_lib( $this->vars['board_url'] );
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
// Diskcache
|
||||
//--------------------------------
|
||||
@@ -601,7 +638,7 @@ class ipsclass {
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( strstr( $temp_cache[$key], "s:" ) )
|
||||
if ( strstr( $temp_cache[$key], "a:" ) )
|
||||
{
|
||||
$this->cache[ $key ] = unserialize( $temp_cache[$key] );
|
||||
}
|
||||
@@ -747,6 +784,7 @@ class ipsclass {
|
||||
//--------------------------------
|
||||
|
||||
$this->vars['topic_title_max_len'] = $this->vars['topic_title_max_len'] ? $this->vars['topic_title_max_len'] : 50;
|
||||
#$this->vars['gb_char_set'] = 'UTF-8';
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -777,8 +815,13 @@ class ipsclass {
|
||||
$this->DB->obj['sql_user'] = $this->vars['sql_user'];
|
||||
$this->DB->obj['sql_pass'] = $this->vars['sql_pass'];
|
||||
$this->DB->obj['sql_host'] = $this->vars['sql_host'];
|
||||
$this->DB->obj['sql_tbl_prefix'] = $this->vars['sql_tbl_prefix'];
|
||||
$this->DB->obj['sql_tbl_prefix'] = $this->vars['sql_tbl_prefix'];
|
||||
$this->DB->obj['force_new_connection'] = isset($this->vars['sql_force_new_connection']) ? $this->vars['sql_force_new_connection'] : 0;
|
||||
|
||||
if ( isset( $this->vars['mysql_codepage'] ) ) {
|
||||
$this->DB->obj['mysql_codepage'] = $this->vars['mysql_codepage'];
|
||||
}
|
||||
|
||||
$this->DB->obj['use_shutdown'] = USE_SHUTDOWN;
|
||||
# Error log
|
||||
$this->DB->obj['error_log'] = ROOT_PATH . 'cache/sql_error_log_'.date('m_d_y').'.cgi';
|
||||
@@ -1048,7 +1091,7 @@ class ipsclass {
|
||||
// Put it together....
|
||||
//-----------------------------------------
|
||||
|
||||
$stronghold = md5( crypt( $member_id . "-" . $ip_octets[0] . '-' . $ip_octets[1] . '-' . $member_log_in_key, $crypt_salt ) );
|
||||
$stronghold = md5( md5( $member_id . "-" . $ip_octets[0] . '-' . $ip_octets[1] . '-' . $member_log_in_key ) . $crypt_salt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check against cookie
|
||||
@@ -1091,7 +1134,7 @@ class ipsclass {
|
||||
// Put it together....
|
||||
//-----------------------------------------
|
||||
|
||||
$stronghold = md5( crypt( $member_id . "-" . $ip_octets[0] . '-' . $ip_octets[1] . '-' . $member_log_in_key, $crypt_salt ) );
|
||||
$stronghold = md5( md5( $member_id . "-" . $ip_octets[0] . '-' . $ip_octets[1] . '-' . $member_log_in_key ) . $crypt_salt );
|
||||
|
||||
//-----------------------------------------
|
||||
// Set cookie
|
||||
@@ -1273,7 +1316,7 @@ class ipsclass {
|
||||
|
||||
$member['members_cache'] = $member['members_cache'] ? $member['members_cache'] : array();
|
||||
|
||||
$current_cache_array = unserialize( $member['members_cache'] );
|
||||
$current_cache_array = @unserialize( $member['members_cache'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -1374,7 +1417,7 @@ class ipsclass {
|
||||
$this->cache['forum_cache'][ $fr['id'] ] = $fr;
|
||||
}
|
||||
|
||||
$this->update_cache( array( 'name' => 'forum_cache', 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) );
|
||||
$this->update_cache( array( 'name' => 'forum_cache', 'array' => 1, 'deletefirst' => 0, 'donow' => 0 ) );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -1574,7 +1617,7 @@ class ipsclass {
|
||||
|
||||
$statline = explode( ",", str_replace( '"', '', $serverstats[0] ) );
|
||||
|
||||
$this->server_load = round( $statline[1], 4 );
|
||||
$this->server_load = round( $statline[1], 2 );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1645,16 +1688,6 @@ class ipsclass {
|
||||
|
||||
function process_mail_queue()
|
||||
{
|
||||
global $ROOT_PATH;
|
||||
|
||||
//-----------------------------------------
|
||||
// Bug in PHP?
|
||||
// shutdown func can't use relative
|
||||
// path..
|
||||
//-----------------------------------------
|
||||
|
||||
$ROOT_PATH = $ROOT_PATH ? $ROOT_PATH.'/' : ROOT_PATH;
|
||||
|
||||
//-----------------------------------------
|
||||
// SET UP
|
||||
//-----------------------------------------
|
||||
@@ -1671,8 +1704,8 @@ class ipsclass {
|
||||
// Require the emailer...
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( $ROOT_PATH.'sources/classes/class_email.php' );
|
||||
$emailer = new emailer($ROOT_PATH);
|
||||
require_once( ROOT_PATH . 'sources/classes/class_email.php' );
|
||||
$emailer = new emailer(ROOT_PATH);
|
||||
$emailer->ipsclass =& $this;
|
||||
$emailer->email_init();
|
||||
|
||||
@@ -1780,7 +1813,7 @@ class ipsclass {
|
||||
|
||||
if ( ! $this->lang_id )
|
||||
{
|
||||
$this->lang_id = 'en';
|
||||
$this->lang_id = 'ru';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2133,7 +2166,7 @@ class ipsclass {
|
||||
// Do we have a cache?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! is_array( $this->cache['skin_id_cache'] ) )
|
||||
if ( ! is_array( $this->cache['skin_id_cache'] ) OR !count( $this->cache['skin_id_cache'] ) )
|
||||
{
|
||||
require_once( ROOT_PATH.'sources/lib/admin_cache_functions.php' );
|
||||
$admin = new admin_cache_functions();
|
||||
@@ -2248,11 +2281,11 @@ class ipsclass {
|
||||
|
||||
if( !is_array($db_skin) OR !count($db_skin) )
|
||||
{
|
||||
$db_skin = $this->DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => 'set_skin_set_id='.$id ) );
|
||||
$db_skin = $this->DB->simple_exec_query( array( 'select' => 'set_cache_css,set_cache_wrapper,set_cache_macro,set_image_dir,set_emoticon_folder,set_skin_set_id,set_name,set_css_method', 'from' => 'skin_sets', 'where' => 'set_skin_set_id='.$id ) );
|
||||
|
||||
if( is_object($this->cachelib) )
|
||||
{
|
||||
$this->cachelib->do_put( 'Skin_Store_' . $id, $db_skin );
|
||||
$this->cachelib->do_put( 'Skin_Store_' . $id, $db_skin, 86400 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2271,6 +2304,7 @@ class ipsclass {
|
||||
if ( IN_DEV )
|
||||
{
|
||||
$this->skin['_skincacheid'] = file_exists( CACHE_PATH.'cache/skin_cache/cacheid_1' ) ? 1 : $db_skin['set_skin_set_id'];
|
||||
$this->skin['_usecsscache'] = file_exists( CACHE_PATH.'style_images/css_'. $this->skin['_csscacheid'] .'.css' ) ? 1 : 0;
|
||||
$this->skin['_csscacheid'] = 1;
|
||||
}
|
||||
|
||||
@@ -2289,6 +2323,8 @@ class ipsclass {
|
||||
$this->member['skin'] = $id;
|
||||
}
|
||||
|
||||
unset($db_skin);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2305,7 +2341,7 @@ class ipsclass {
|
||||
*/
|
||||
function load_language( $file="" )
|
||||
{
|
||||
$this->vars['default_language'] = isset($this->vars['default_language']) ? $this->vars['default_language'] : 'en';
|
||||
$this->vars['default_language'] = isset($this->vars['default_language']) ? $this->vars['default_language'] : 'ru';
|
||||
|
||||
if ( ! $this->lang_id )
|
||||
{
|
||||
@@ -2322,7 +2358,7 @@ class ipsclass {
|
||||
|
||||
if ( ! $this->lang_id )
|
||||
{
|
||||
$this->lang_id = 'en';
|
||||
$this->lang_id = 'ru';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2404,7 +2440,7 @@ class ipsclass {
|
||||
$msg['msg_post'] = $parser->strip_all_tags( $msg['msg_post'] );
|
||||
|
||||
$msg['msg_post'] = preg_replace("#([^\s<>'\"/\.\\-\?&\n\r\%]{80})#i", " \\1"."<br />", $msg['msg_post']);
|
||||
$msg['msg_post'] = str_replace( "\n", "<br \>", trim($msg['msg_post']) );
|
||||
$msg['msg_post'] = str_replace( "\n", "<br />", trim($msg['msg_post']) );
|
||||
|
||||
if ( strlen( $msg['msg_post'] ) > 300 )
|
||||
{
|
||||
@@ -2468,6 +2504,78 @@ class ipsclass {
|
||||
return $return;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Content search hightlight
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Replaces text with highlighted blocks
|
||||
*
|
||||
* @param string Incoming Content
|
||||
* @param string HL attribute
|
||||
* @return string Formatted text
|
||||
* @since 2.2.0
|
||||
*/
|
||||
|
||||
function content_search_highlight( $text, $highlight )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$highlight = $this->parse_clean_value( urldecode( $highlight ) );
|
||||
$loosematch = strstr( $highlight, '*' ) ? 1 : 0;
|
||||
$keywords = str_replace( '*', '', str_replace( "+", " ", str_replace( "++", "+", str_replace( '-', '', trim($highlight) ) ) ) );
|
||||
$word_array = array();
|
||||
$endmatch = "(.)?";
|
||||
$beginmatch = "(.)?";
|
||||
|
||||
//-----------------------------------------
|
||||
// Go!
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $keywords )
|
||||
{
|
||||
if ( preg_match("/,(and|or),/i", $keywords) )
|
||||
{
|
||||
while ( preg_match("/,(and|or),/i", $keywords, $match) )
|
||||
{
|
||||
$word_array = explode( ",".$match[1].",", $keywords );
|
||||
$keywords = str_replace( $match[0], '' ,$keywords );
|
||||
}
|
||||
}
|
||||
else if ( strstr( $keywords, ' ' ) )
|
||||
{
|
||||
$word_array = explode( ' ', str_replace( ' ', ' ', $keywords ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$word_array[] = $keywords;
|
||||
}
|
||||
|
||||
if ( ! $loosematch )
|
||||
{
|
||||
$beginmatch = "(^|\s|\>|;)";
|
||||
$endmatch = "(\s|,|\.|!|<br|&|$)";
|
||||
}
|
||||
|
||||
if ( is_array($word_array) )
|
||||
{
|
||||
foreach ( $word_array as $keywords )
|
||||
{
|
||||
preg_match_all( "/{$beginmatch}(".preg_quote($keywords, '/')."){$endmatch}/is", $text, $matches );
|
||||
|
||||
for ( $i = 0; $i < count($matches[0]); $i++ )
|
||||
{
|
||||
$text = str_replace( $matches[0][$i], $matches[1][$i]."<span class='searchlite'>".$matches[2][$i]."</span>".$matches[3][$i], $text );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// XSS Clean: URLs
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -2619,6 +2727,71 @@ class ipsclass {
|
||||
return $text ? $text : $t;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Wordwrap text string (multi-byte safe)
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Wordwrap a string at a given length (multi-byte character safe)
|
||||
*
|
||||
* @param string Input String
|
||||
* @param integer Desired break point
|
||||
* @param string Break point string
|
||||
* @return string Parsed string
|
||||
* @since 2.2
|
||||
*/
|
||||
|
||||
function txt_wordwrap( $text, $breakpoint=80, $char='<br />' )
|
||||
{
|
||||
$breakpoint = intval($breakpoint) > 0 ? intval($breakpoint) : 80;
|
||||
|
||||
$str_len = $this->txt_mb_strlen( $text );
|
||||
|
||||
if( $str_len < $breakpoint )
|
||||
{
|
||||
return $text;
|
||||
}
|
||||
|
||||
$str = "";
|
||||
$str_arr = array();
|
||||
|
||||
for( $i=0; $i<strlen($text); $i++ )
|
||||
{
|
||||
if( ord( substr( $text, $i, 1 ) ) > 128 AND ord( substr( $text, $i, 1 ) ) < 256 )
|
||||
{
|
||||
$str_arr[] = substr( $text, $i, 2 );
|
||||
$i += 1;
|
||||
}
|
||||
else if( ord( substr( $text, $i, 1 ) ) > 256 )
|
||||
{
|
||||
$str_arr[] = substr( $text, $i, 3 );
|
||||
$i += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
$str_arr[] = substr( $text, $i, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
$tmp = array_chunk( $str_arr, $breakpoint );
|
||||
|
||||
foreach( $tmp as $key => $val )
|
||||
{
|
||||
if( preg_match( "/\s+/", implode( "", $val ) ) )
|
||||
{
|
||||
$str .= implode( "", $val );
|
||||
}
|
||||
else
|
||||
{
|
||||
$str .= implode( "", $val ) . $char;
|
||||
}
|
||||
}
|
||||
|
||||
return $str;
|
||||
|
||||
//return preg_replace( "#([^\s<>'\"/\\-\?&\n\r\%]{{$breakpoint}})#i", "\\1{$char}", $text );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Truncate text string
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -2637,16 +2810,19 @@ class ipsclass {
|
||||
$text = str_replace( '&' , '&', $text );
|
||||
$text = str_replace( '"', '"', $text );
|
||||
|
||||
$start_text = $text;
|
||||
|
||||
$string_length = $this->txt_mb_strlen( $text );
|
||||
|
||||
if ( $string_length > $limit)
|
||||
{
|
||||
// Multi-byte support
|
||||
$text = preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,0}'.
|
||||
'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.intval($limit-3).'}).*#s',
|
||||
'$1',$text)."...";
|
||||
$text = $this->txt_mbsubstr( $text, 0, $limit );
|
||||
}
|
||||
|
||||
if( $text != $start_text )
|
||||
{
|
||||
$text .= "...";
|
||||
|
||||
//$text = substr($text,0, $limit - 3) . "...";
|
||||
$text = preg_replace( "/&(#{0,}([a-zA-Z0-9]+?)?)?\.\.\.$/", '...', $text );
|
||||
}
|
||||
else
|
||||
@@ -2680,16 +2856,38 @@ class ipsclass {
|
||||
|
||||
if( function_exists('mb_list_encodings') )
|
||||
{
|
||||
// PHP 5, preferred method
|
||||
|
||||
$valid_encodings = array();
|
||||
$valid_encodings = mb_list_encodings();
|
||||
|
||||
if( count($valid_encodings) )
|
||||
{
|
||||
if( in_array( $this->vars['gb_char_set'], $valid_encodings ) )
|
||||
if( in_array( strtoupper($this->vars['gb_char_set']), $valid_encodings ) )
|
||||
{
|
||||
return mb_substr( $text, $start, $limit, $this->vars['gb_char_set'] );
|
||||
return mb_substr( $text, $start, $limit, strtoupper($this->vars['gb_char_set']) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( function_exists('mb_substr') )
|
||||
{
|
||||
// PHP 4 support
|
||||
|
||||
// Though this is quite tedious, let's check to see if encoding is supported....
|
||||
// http://us2.php.net/manual/en/ref.mbstring.php
|
||||
|
||||
$valid_encodings = array( 'UCS-4', 'UCS-4BE', 'UCS-4LE', 'UCS-2', 'UCS-2BE', 'UCS-2LE', 'UTF-32', 'UTF-32BE',
|
||||
'UTF-32LE', 'UTF-16', 'UTF-16BE', 'UTF-16LE', 'UTF-7', 'UTF7-IMAP', 'UTF-8',
|
||||
'ASCII', 'EUC-JP', 'SJIS', 'EUCJP-WIN', 'SJIS-WIN', 'ISO-2022-JP', 'JIS', 'ISO-8859-1',
|
||||
'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7',
|
||||
'ISO-8859-8', 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15',
|
||||
'EUC-CN', 'CP936', 'EUC-TW', 'HZ', 'CP950', 'BIG-5', 'EUC-KR', 'CP949', 'ISO-2022-KR',
|
||||
'WINDOWS-1251', 'CP1251', 'WINDOWS-1252', 'CP1252', 'CP866', 'KOI8-R' );
|
||||
|
||||
if( in_array( strtoupper($this->vars['gb_char_set']), $valid_encodings ) )
|
||||
{
|
||||
return mb_substr( $text, $start, $limit, strtoupper($this->vars['gb_char_set']) );
|
||||
}
|
||||
}
|
||||
|
||||
// No? Let's do our handrolled method then
|
||||
@@ -2698,10 +2896,18 @@ class ipsclass {
|
||||
|
||||
if ( $string_length > $limit)
|
||||
{
|
||||
if( strtoupper($this->vars['gb_char_set']) == 'UTF-8' )
|
||||
{
|
||||
// Multi-byte support
|
||||
$text = preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,0}'.
|
||||
|
||||
$text = @preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,0}'.
|
||||
'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){'.intval($start).','.intval($limit).'}).*#s',
|
||||
'$1',$text);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = substr( $text, $start, $limit );
|
||||
}
|
||||
|
||||
$text = preg_replace( "/&(#(\d+?)?)?$/", '', $text );
|
||||
}
|
||||
@@ -2733,6 +2939,24 @@ class ipsclass {
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// txt_md5_clean
|
||||
// ------------------
|
||||
// Clean up MD5 hashes
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Returns a cleaned MD5 hash
|
||||
*
|
||||
* @param string Input String
|
||||
* @return string Parsed string
|
||||
* @since 2.1
|
||||
*/
|
||||
function txt_md5_clean( $t )
|
||||
{
|
||||
return preg_replace( "/[^a-zA-Z0-9]/", "" , substr( $t, 0, 32 ) );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// txt_alphanumerical_clean
|
||||
@@ -3492,9 +3716,11 @@ class ipsclass {
|
||||
{
|
||||
if ( ! is_object( $this->work_classes['class_captcha'] ) )
|
||||
{
|
||||
require_once( ROOT_PATH . 'sources/classes/class_captcha.php' );
|
||||
$this->work_classes['class_captcha'] = new class_captcha();
|
||||
$this->work_classes['class_captcha']->ipsclass =& $this;
|
||||
require_once( KERNEL_PATH . 'class_captcha.php' );
|
||||
$this->work_classes['class_captcha'] = new class_captcha();
|
||||
$this->work_classes['class_captcha']->ipsclass =& $this;
|
||||
$this->work_classes['class_captcha']->path_background = ROOT_PATH . 'style_captcha/captcha_backgrounds';
|
||||
$this->work_classes['class_captcha']->path_fonts = ROOT_PATH . 'style_captcha/captcha_fonts';
|
||||
}
|
||||
|
||||
return $this->work_classes['class_captcha']->captcha_show_gd_img( $content );
|
||||
@@ -3899,7 +4125,7 @@ class ipsclass {
|
||||
}
|
||||
}
|
||||
|
||||
$work['return'] = $this->compiled_templates['skin_global']->pagination_compile($work['first_page'],$previous_link,$work['st_dots'],$work['page_span'],$work['end_dots'],$next_link,$data['TOTAL_POSS'],$data['PER_PAGE'], $data['BASE_URL'], $data['no_dropdown']);
|
||||
$work['return'] = $this->compiled_templates['skin_global']->pagination_compile($work['first_page'],$previous_link,$work['st_dots'],$work['page_span'],$work['end_dots'],$next_link,$data['TOTAL_POSS'],$data['PER_PAGE'], $data['BASE_URL'], $data['no_dropdown'], $use_st);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4165,7 +4391,7 @@ class ipsclass {
|
||||
* @return string
|
||||
* @since 2.0
|
||||
*/
|
||||
function get_time($date, $method='h:i A')
|
||||
function get_time($date, $method='G:i')
|
||||
{
|
||||
if ($this->offset_set == 0)
|
||||
{
|
||||
@@ -4322,7 +4548,7 @@ class ipsclass {
|
||||
"weekday" => $weekday, // A full textual representation of the day of the week Sunday through Saturday
|
||||
"month" => $fmon, // A full textual representation of a month, such as January or Mar
|
||||
"week" => $week, // Week of the year
|
||||
"smonth" => $smon
|
||||
"smonth" => ($this->lang_id == 'ru') ? $this->lang[ $smon ] : $smon
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4392,7 +4618,7 @@ class ipsclass {
|
||||
|
||||
if ( $sticky == 1 )
|
||||
{
|
||||
$expires = time() + 60*60*24*365;
|
||||
$expires = time() + ( 60*60*24*365 );
|
||||
}
|
||||
else if ( $expires_x_days )
|
||||
{
|
||||
@@ -4418,7 +4644,14 @@ class ipsclass {
|
||||
{
|
||||
if ( PHP_VERSION < 5.2 )
|
||||
{
|
||||
@setcookie( $this->vars['cookie_id'].$name, $value, $expires, $this->vars['cookie_path'], $this->vars['cookie_domain'] . '; HttpOnly' );
|
||||
if ( $this->vars['cookie_domain'] )
|
||||
{
|
||||
@setcookie( $this->vars['cookie_id'].$name, $value, $expires, $this->vars['cookie_path'], $this->vars['cookie_domain'] . '; HttpOnly' );
|
||||
}
|
||||
else
|
||||
{
|
||||
@setcookie( $this->vars['cookie_id'].$name, $value, $expires, $this->vars['cookie_path'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4543,14 +4776,24 @@ class ipsclass {
|
||||
* Recursively cleans keys and values and
|
||||
* inserts them into the input array
|
||||
*/
|
||||
function parse_incoming_recursively( &$data, $input=array() )
|
||||
function parse_incoming_recursively( &$data, $input=array(), $iteration = 0 )
|
||||
{
|
||||
// Crafty hacker could send something like &foo[][][][][][]....to kill Apache process
|
||||
// We should never have an input array deeper than 10..
|
||||
|
||||
if( $iteration >= 10 )
|
||||
{
|
||||
return $input;
|
||||
}
|
||||
|
||||
if( count( $data ) )
|
||||
{
|
||||
foreach( $data as $k => $v )
|
||||
{
|
||||
if ( is_array( $v ) )
|
||||
{
|
||||
//$input = $this->parse_incoming_recursively( $data[ $k ], $input );
|
||||
$input[ $k ] = $this->parse_incoming_recursively( $data[ $k ], array() );
|
||||
$input[ $k ] = $this->parse_incoming_recursively( $data[ $k ], array(), $iteration++ );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4560,6 +4803,7 @@ class ipsclass {
|
||||
$input[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $input;
|
||||
}
|
||||
@@ -4571,13 +4815,23 @@ class ipsclass {
|
||||
* Performs basic cleaning
|
||||
* Null characters, etc
|
||||
*/
|
||||
function clean_globals( &$data )
|
||||
function clean_globals( &$data, $iteration = 0 )
|
||||
{
|
||||
// Crafty hacker could send something like &foo[][][][][][]....to kill Apache process
|
||||
// We should never have an globals array deeper than 10..
|
||||
|
||||
if( $iteration >= 10 )
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
|
||||
if( count( $data ) )
|
||||
{
|
||||
foreach( $data as $k => $v )
|
||||
{
|
||||
if ( is_array( $v ) )
|
||||
{
|
||||
$this->clean_globals( $data[ $k ] );
|
||||
$this->clean_globals( $data[ $k ], $iteration++ );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4593,6 +4847,7 @@ class ipsclass {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Key Cleaner - ensures no funny business with form elements
|
||||
@@ -4805,13 +5060,13 @@ class ipsclass {
|
||||
* @return string HTML
|
||||
* @since 2.0
|
||||
*/
|
||||
function get_avatar($member_avatar="", $member_view_avatars=0, $avatar_dims="x", $avatar_type='')
|
||||
function get_avatar($member_avatar="", $member_view_avatars=0, $avatar_dims="x", $avatar_type='', $no_cache=0 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// No avatar?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $member_avatar or $member_view_avatars == 0 or ! $this->vars['avatars_on'] or strpos( $member_avatar, "noavatar" ) )
|
||||
if ( ! $member_avatar or $member_view_avatars == 0 or ! $this->vars['avatars_on'] or ( strpos( $member_avatar, "noavatar" ) AND !strpos( $member_avatar, '.' ) ) )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
@@ -4825,9 +5080,9 @@ class ipsclass {
|
||||
// Defaults...
|
||||
//-----------------------------------------
|
||||
|
||||
$davatar_dims = explode( "x", $this->vars['avatar_dims'] );
|
||||
$default_a_dims = explode( "x", $this->vars['avatar_def'] );
|
||||
$this_dims = explode( "x", $avatar_dims );
|
||||
$davatar_dims = explode( "x", strtolower($this->vars['avatar_dims']) );
|
||||
$default_a_dims = explode( "x", strtolower($this->vars['avatar_def']) );
|
||||
$this_dims = explode( "x", strtolower($avatar_dims) );
|
||||
|
||||
if (!$this_dims[0]) $this_dims[0] = $davatar_dims[0];
|
||||
if (!$this_dims[1]) $this_dims[1] = $davatar_dims[1];
|
||||
@@ -4852,12 +5107,30 @@ class ipsclass {
|
||||
$avatar_type = 'local';
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// No cache?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $no_cache )
|
||||
{
|
||||
$member_avatar .= '?_time=' . time();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// No avatar?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $member_avatar == 'noavatar' )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// URL avatar?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $avatar_type == 'url' )
|
||||
else if ( $avatar_type == 'url' )
|
||||
{
|
||||
if ( substr( $member_avatar, -4 ) == ".swf" )
|
||||
{
|
||||
@@ -4950,7 +5223,7 @@ class ipsclass {
|
||||
|
||||
if ($this->vars['default_language'] == "")
|
||||
{
|
||||
$this->vars['default_language'] = 'en';
|
||||
$this->vars['default_language'] = 'ru';
|
||||
}
|
||||
|
||||
$this->lang_id = $this->member['language'] ? $this->member['language'] : $this->vars['default_language'];
|
||||
@@ -5109,7 +5382,7 @@ class ipsclass {
|
||||
|
||||
$this->load_language("lang_error");
|
||||
|
||||
$msg = preg_replace( "/\n/", "<br>", stripslashes( $row['conf_value'] ) );
|
||||
$msg = preg_replace( "/\n/", "<br />", stripslashes( $row['conf_value'] ) );
|
||||
|
||||
$html = $this->compiled_templates['skin_global']->board_offline( $msg );
|
||||
|
||||
|
||||
Reference in new issue
Block a user