Version 2.2.0 RC-1

This commit is contained in:
Neo committed 2025-12-19 00:22:37 -08:00
1 parent f73f8bff6d
commit 22f1b963ee
1034 files changed
+178610 -70897

No files matched your search

+1 -1
View File
@@ -833,4 +833,4 @@ class Text_Diff_Op_change extends Text_Diff_Op {
return $reverse = &new Text_Diff_Op_change($this->final, $this->orig);
}
}
}
@@ -205,4 +205,4 @@ class Text_Diff_Renderer {
return $this->_deleted($orig) . "---\n" . $this->_added($final);
}
}
}
@@ -136,4 +136,4 @@ class Text_Diff_Renderer_inline extends Text_Diff_Renderer {
return $words;
}
}
}
@@ -46,4 +46,4 @@ class Text_Diff_Renderer_unified extends Text_Diff_Renderer {
return $this->_deleted($orig) . $this->_added($final);
}
}
}
+1 -1
View File
@@ -256,4 +256,4 @@ class Text_Diff3_BlockBuilder {
array_splice($array, sizeof($array), 0, $lines);
}
}
}
+168 -32
View File
@@ -2,25 +2,16 @@
/*
+---------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power KERNEL
| =============================================
| Invision Power Board
| ========================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2006 Invision Power Services
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
| ========================================
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
| INVISION POWER BOARD IS NOT FREE SOFTWARE!
| http://www.invisionboard.com
+---------------------------------------------------------------------------
|
| > API SERVER: Send and receive API data
@@ -91,6 +82,30 @@ class class_api_server
*/
var $xml_server;
/**
* Return cookie information
* @var array
*/
var $cookies = array();
/**
* XML-RPC cookie serialized 64 key
* @var string
*/
var $cookie_serialized_key = '__cookie__serialized64__';
/**
* HTTP Auth required
*/
var $auth_user = '';
var $auth_pass = '';
/**
* Errors array
* @var array
*/
var $errors = array();
/*-------------------------------------------------------------------------*/
// Constructor
/*-------------------------------------------------------------------------*/
@@ -102,8 +117,46 @@ class class_api_server
require_once( IPS_CLASSES_PATH . '/class_xml_rpc.php' );
$this->xmlrpc = new class_xml_rpc();
}
$this->cookies = array();
}
/*-------------------------------------------------------------------------*/
// MIMIC SOAP SERVER: Decode request
/*-------------------------------------------------------------------------*/
/**
* Add object map to this class
*
* @param string Incoming data
* @return string api
*/
function decode_request( $incoming='' )
{
if ( ! $incoming )
{
$incoming = isset( $GLOBALS['HTTP_RAW_POST_DATA'] ) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
}
//-----------------------------------------
// Get data and dispatch
//-----------------------------------------
$this->api_decode_request( $incoming );
$api_call = explode( ".", $this->method_name );
if ( count($api_call) > 1 )
{
$this->method_name = $api_call[1];
return $api_call[0];
}
else
{
return "default";
}
}
/*-------------------------------------------------------------------------*/
// MIMIC SOAP SERVER: Add object map
/*-------------------------------------------------------------------------*/
@@ -140,22 +193,11 @@ class class_api_server
*/
function get_xml_rpc( $incoming='' )
{
if ( ! $incoming )
{
$incoming = $GLOBALS['HTTP_RAW_POST_DATA'];
}
if ( ! $this->xml_server )
{
return FALSE;
}
//-----------------------------------------
// Get data and dispatch
//-----------------------------------------
$this->api_decode_request( $incoming );
//-----------------------------------------
// Got function?
//-----------------------------------------
@@ -194,6 +236,9 @@ class class_api_server
case 'base64':
$_var = trim($_var);
break;
case 'struct':
$_var = is_array($_var) ? $_var : (string) $_var;
break;
}
$_params[ $field ] = $_var;
@@ -215,11 +260,29 @@ class class_api_server
// Return false
//-----------------------------------------
$this->api_send_error( 100, 'No methodRequest function defined / found' );
$this->api_send_error( 100, 'No methodRequest function -' . $this->method_name . 'defined / found' );
exit();
}
}
/*-------------------------------------------------------------------------*/
// Add cookies
/*-------------------------------------------------------------------------*/
/**
* Return API Request
*
* @param array Array of params to send
* @param int Complex data: Encode before sending
* @return nuffink
*/
function api_add_cookie_data( $data )
{
if ( $data['name'] )
{
$this->cookies[ $data['name'] ] = $data;
}
}
/*-------------------------------------------------------------------------*/
// Return API Request
/*-------------------------------------------------------------------------*/
@@ -230,13 +293,27 @@ class class_api_server
* @param int Complex data: Encode before sending
* @return nuffink
*/
function api_send_reply( $data=array(), $complex_data=0 )
function api_send_reply( $data=array(), $complex_data=0, $force=array() )
{
//-----------------------------------------
// Cookies?
//-----------------------------------------
if ( is_array( $this->cookies ) AND count( $this->cookies ) )
{
$data[ $this->cookie_serialized_key ] = $this->encode_base64_array( $this->cookies );
$this->xmlrpc->map_type_to_key[ $this->cookie_serialized_key ] = 'base64';
}
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! is_array( $data ) OR ! count( $data ) )
if ( ! is_array( $data ) )
{
$this->xmlrpc->xml_rpc_return_value( $data );
}
elseif ( ! count( $data ) )
{
# No data? Just return true
$this->xmlrpc->xml_rpc_return_true();
@@ -254,6 +331,18 @@ class class_api_server
$this->xmlrpc->map_type_to_key[ $this->serialized_key ] = 'base64';
}
//-----------------------------------------
// Force type?
//-----------------------------------------
if ( is_array($force) AND count($force) > 0 )
{
foreach ( $force as $key => $type )
{
$this->xmlrpc->map_type_to_key[ $key ] = $type;
}
}
//-----------------------------------------
// Send...
//-----------------------------------------
@@ -322,8 +411,21 @@ class class_api_server
// INIT
//-----------------------------------------
$return_data = array();
$raw = array();
$return_data = array();
$raw = array();
$this->xmlrpc->errors = array();
$this->xmlrpc->auth_user = $this->auth_user;
$this->xmlrpc->auth_pass = $this->auth_pass;
//-----------------------------------------
// Cookies?
//-----------------------------------------
if ( is_array( $this->cookies ) AND count( $this->cookies ) )
{
$data[ $this->cookie_serialized_key ] = $this->encode_base64_array( $this->cookies );
$this->xmlrpc->map_type_to_key[ $this->cookie_serialized_key ] = 'base64';
}
//-----------------------------------------
// Complex data?
@@ -389,7 +491,7 @@ class class_api_server
// Fix up params
//-----------------------------------------
if ( is_array( $_params[0] ) )
if ( isset($_params[0]) AND is_array( $_params[0] ) )
{
foreach( $_params[0] as $k => $v )
{
@@ -402,12 +504,46 @@ class class_api_server
$this->params = array_merge( $this->params, $_tmp );
}
}
else if ( $k == $this->cookie_serialized_key )
{
$_cookies = $this->decode_base64_array( $v );
if ( is_array( $_cookies ) and count( $_cookies ) )
{
foreach( $_cookies as $cookie_data )
{
if ( $cookie_data['sticky'] == 1 )
{
$cookie_data['expires'] = time() + 60*60*24*365;
}
$cookie_data['path'] = $cookie_data['path'] ? $cookie_data['path'] : '/';
@setcookie( $cookie_data['name'], $cookie_data['value'], $cookie_data['expires'], $cookie_data['path'], $cookie_data['domain'] );
if ( IPS_XML_RPC_DEBUG_ON )
{
$this->xmlrpc->_add_debug( "API_PROCESS_DECODE: SETTING COOKIE: " . var_export( $cookie_data, TRUE ) );
}
}
}
}
else
{
$this->params[ $k ] = $v;
}
}
}
else if ( is_array( $_params ) )
{
$i = 0;
foreach( $_params as $v )
{
$this->params['param'.$i] = $v;
$i++;
}
}
}
/*-------------------------------------------------------------------------*/
+150
View File
@@ -0,0 +1,150 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Services Kernel [Cache Abstraction]
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
+---------------------------------------------------------------------------
| THIS IS NOT FREE / OPEN SOURCE SOFTWARE
+---------------------------------------------------------------------------
|
| > Core Module
| > Module written by Brandon Farber
| > Date started: Friday 19th May 2006 17:33
|
| > Module Version Number: 1.0
+--------------------------------------------------------------------------
*/
/**
* IPS Kernel Pages: Cache Object Core
* -- Hard-disk Cache Storage
*
* Basic Usage Examples
* <code>
* $cache = new cache_lib( 'identifier' );
* Update:
* $db->do_put( 'key', 'value' [, 'ttl'] );
* Remove
* $db->do_remove( 'key' );
* Retrieve
* $db->do_get( 'key' );
* </code>
*
* @package IPS_KERNEL
* @subpackage Cache Abstraction
* @author Brandon Mecham
* @version 1.0
*/
class cache_lib
{
var $identifier;
var $crashed = 0;
function cache_lib( $identifier='' )
{
if( !is_writeable( ROOT_PATH.'cache' ) )
{
$this->crashed = 1;
return FALSE;
}
if( !$identifier )
{
$this->identifier = md5( uniqid( rand(), TRUE ) );
}
else
{
$this->identifier = $identifier;
}
unset( $identifier );
}
function disconnect()
{
return TRUE;
}
function do_put( $key, $value, $ttl=0 )
{
// We ignore TTL
$fh = fopen( ROOT_PATH.'cache/'.md5( $this->identifier . $key ).'.php', 'wb' );
if( !$fh )
{
return FALSE;
}
$extra_flag = "";
if( is_array( $value ) )
{
$value = serialize($value);
$extra_flag = "\n".'$is_array = 1;'."\n\n";
}
$extra_flag .= "\n".'$ttl = '.$ttl.";\n\n";
$value = '"'.addslashes( $value ).'"';
$file_content = "<?"."php\n\n".'$value = '.$value.";\n".$extra_flag."\n?".'>';
flock( $fh, LOCK_EX );
fwrite( $fh, $file_content );
flock( $fh, LOCK_UN );
fclose( $fh );
@chmod( ROOT_PATH.'cache/'.md5( $this->identifier . $key ).'.php', 0777 );
}
function do_get( $key )
{
$return_val = "";
if( file_exists( ROOT_PATH.'cache/'.md5( $this->identifier . $key ).'.php' ) )
{
require ROOT_PATH.'cache/'.md5( $this->identifier . $key ).'.php';
$return_val = stripslashes($value);
if( isset($is_array) AND $is_array == 1 )
{
$return_val = unserialize($return_val);
}
if( isset($ttl) AND $ttl > 0 )
{
if( $mtime = filemtime( ROOT_PATH.'cache/'.md5( $this->identifier . $key ).'.php' ) )
{
if( time() - $mtime > $ttl )
{
return FALSE;
}
}
}
}
return $return_val;
}
function do_remove( $key )
{
if( file_exists( ROOT_PATH.'cache/'.md5( $this->identifier . $key ).'.php' ) )
{
@unlink( ROOT_PATH.'cache/'.md5( $this->identifier . $key ).'.php' );
}
}
}
?>
@@ -0,0 +1,102 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Services Kernel [Cache Abstraction]
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
+---------------------------------------------------------------------------
| THIS IS NOT FREE / OPEN SOURCE SOFTWARE
+---------------------------------------------------------------------------
|
| > Core Module
| > Module written by Brandon Farber
| > Date started: Friday 19th May 2006 17:33
|
| > Module Version Number: 1.0
+--------------------------------------------------------------------------
*/
/**
* IPS Kernel Pages: Cache Object Core
* -- Eaccelerator Cache Storage
*
* Basic Usage Examples
* <code>
* $cache = new cache_lib( 'identifier' );
* Update:
* $db->do_put( 'key', 'value' [, 'ttl'] );
* Remove
* $db->do_remove( 'key' );
* Retrieve
* $db->do_get( 'key' );
* </code>
*
* @package IPS_KERNEL
* @subpackage Cache Abstraction
* @author Brandon Mecham
* @version 1.0
*/
class cache_lib
{
var $identifier;
var $crashed = 0;
function cache_lib( $identifier='' )
{
if( !function_exists('eaccelerator_get') )
{
$this->crashed = 1;
return FALSE;
}
if( !$identifier )
{
$this->identifier = md5( uniqid( rand(), TRUE ) );
}
else
{
$this->identifier = $identifier;
}
unset( $identifier );
}
function disconnect()
{
return TRUE;
}
function do_put( $key, $value, $ttl=0 )
{
eaccelerator_lock( md5( $this->identifier . $key ) );
eaccelerator_put( md5( $this->identifier . $key ),
$value,
intval($ttl) );
eaccelerator_unlock( md5( $this->identifier . $key ) );
}
function do_get( $key )
{
$return_val = eaccelerator_get( md5( $this->identifier . $key ) );
return $return_val;
}
function do_remove( $key )
{
eaccelerator_rm( md5( $this->identifier . $key ) );
}
}
?>
+146
View File
@@ -0,0 +1,146 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Services Kernel [Cache Abstraction]
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
+---------------------------------------------------------------------------
| THIS IS NOT FREE / OPEN SOURCE SOFTWARE
+---------------------------------------------------------------------------
|
| > Core Module
| > Module written by Brandon Farber
| > Date started: Friday 19th May 2006 17:33
|
| > Module Version Number: 1.0
+--------------------------------------------------------------------------
*/
/**
* IPS Kernel Pages: Cache Object Core
* -- Memcache Cache Storage
*
* Basic Usage Examples
* <code>
* $cache = new cache_lib( 'identifier' );
* Update:
* $db->do_put( 'key', 'value' [, 'ttl'] );
* Remove
* $db->do_remove( 'key' );
* Retrieve
* $db->do_get( 'key' );
* </code>
*
* @package IPS_KERNEL
* @subpackage Cache Abstraction
* @author Brandon Mecham
* @version 1.0
*/
class cache_lib
{
var $identifier;
var $crashed = 0;
var $link;
function cache_lib( $identifier='' )
{
if( !function_exists('memcache_connect') )
{
$this->crashed = 1;
return FALSE;
}
if( !$identifier )
{
$this->identifier = md5( uniqid( rand(), TRUE ) );
}
else
{
$this->identifier = $identifier;
}
unset( $identifier );
}
function connect( $server_info=array() )
{
if( !count($server_info) )
{
$this->crashed = 1;
return FALSE;
}
if( !isset($server_info['memcache_server_1']) OR !isset($server_info['memcache_port_1']) )
{
$this->crashed = 1;
return FALSE;
}
$this->link = memcache_connect( $server_info['memcache_server_1'], $server_info['memcache_port_1'] );
if( !$this->link )
{
$this->crashed = 1;
return FALSE;
}
if( isset($server_info['memcache_server_2']) AND isset($server_info['memcache_port_2']) )
{
memcache_add_server( $this->link, $server_info['memcache_server_2'], $server_info['memcache_port_2'] );
}
if( isset($server_info['memcache_server_3']) AND isset($server_info['memcache_port_3']) )
{
memcache_add_server( $this->link, $server_info['memcache_server_3'], $server_info['memcache_port_3'] );
}
if( function_exists('memcache_set_compress_threshold') )
{
memcache_set_compress_threshold( $this->link, 20000, 0.2 );
}
return TRUE;
}
function disconnect()
{
if( $this->link )
{
memcache_close( $this->link );
}
return TRUE;
}
function do_put( $key, $value, $ttl=0 )
{
memcache_set( $this->link, md5( $this->identifier . $key ),
$value,
MEMCACHE_COMPRESSED,
intval($ttl) );
}
function do_get( $key )
{
$return_val = memcache_get( $this->link, md5( $this->identifier . $key ) );
return $return_val;
}
function do_remove( $key )
{
memcache_delete( $this->link, md5( $this->identifier . $key ) );
}
}
?>
+102
View File
@@ -0,0 +1,102 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Services Kernel [Cache Abstraction]
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
+---------------------------------------------------------------------------
| THIS IS NOT FREE / OPEN SOURCE SOFTWARE
+---------------------------------------------------------------------------
|
| > Core Module
| > Module written by Brandon Farber
| > Date started: Friday 19th May 2006 17:33
|
| > Module Version Number: 1.0
+--------------------------------------------------------------------------
*/
/**
* IPS Kernel Pages: Cache Object Core
* -- Turck-MMCache Cache Storage
*
* Basic Usage Examples
* <code>
* $cache = new cache_lib( 'identifier' );
* Update:
* $db->do_put( 'key', 'value' [, 'ttl'] );
* Remove
* $db->do_remove( 'key' );
* Retrieve
* $db->do_get( 'key' );
* </code>
*
* @package IPS_KERNEL
* @subpackage Cache Abstraction
* @author Brandon Mecham
* @version 1.0
*/
class cache_lib
{
var $identifier;
var $crashed = 0;
function cache_lib( $identifier='' )
{
if( !function_exists('mmcache_get') )
{
$this->crashed = 1;
return FALSE;
}
if( !$identifier )
{
$this->identifier = md5( uniqid( rand(), TRUE ) );
}
else
{
$this->identifier = $identifier;
}
unset( $identifier );
}
function disconnect()
{
return TRUE;
}
function do_put( $key, $value, $ttl=0 )
{
mmcache_lock( md5( $this->identifier . $key ) );
mmcache_put( md5( $this->identifier . $key ),
$value,
intval($ttl) );
mmcache_unlock( md5( $this->identifier . $key ) );
}
function do_get( $key )
{
$return_val = mmcache_get( md5( $this->identifier . $key ) );
return $return_val;
}
function do_remove( $key )
{
mmcache_rm( md5( $this->identifier . $key ) );
}
}
?>
+7 -16
View File
@@ -2,25 +2,16 @@
/*
+---------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power KERNEL
| =============================================
| Invision Power Board
| ========================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2006 Invision Power Services
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
| ========================================
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
| INVISION POWER BOARD IS NOT FREE SOFTWARE!
| http://www.invisionboard.com
+---------------------------------------------------------------------------
|
| > Communication Class: Allows data to be sent via HTTP:POST
@@ -294,7 +285,7 @@ class class_communication
// Try CURL first...
//-------------------------------
if ( function_exists("curl_init") )
if ( function_exists("curl_init") AND function_exists("curl_exec") )
{
if ( $sock = curl_init() )
{
+2 -12
View File
@@ -2,24 +2,14 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-10-10 14:03:20 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 22 $
+15 -19
View File
@@ -2,24 +2,15 @@
/*
+---------------------------------------------------------------------------
| Invision Power Board 2.1.7
| =============================================
| Invision Power Board
| ========================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2004 Invision Power Services
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
| ========================================
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
| INVISION POWER BOARD IS NOT FREE SOFTWARE!
| http://www.invisionboard.com
+---------------------------------------------------------------------------
|
| > CONVERT CHAR SET FUNCTIONS (Simple, light parser)
@@ -110,11 +101,16 @@ class class_convert_charset
return;
}
if( !$t OR $t == '' )
{
return $string;
}
//-----------------------------------------
// Do the convert
// Do the convert - internally..
//-----------------------------------------
if ( function_exists( 'mb_convert_encoding' ) )
/*if ( function_exists( 'mb_convert_encoding' ) )
{
$text = mb_convert_encoding( $string, $destination_char_set, $string_char_set );
}
@@ -127,11 +123,11 @@ class class_convert_charset
$text = iconv( $string_char_set, $destination_char_set.'//TRANSLIT', $string);
}
else
{
{*/
require_once( IPS_CLASSES_PATH . '/i18n/convertcharset/ConvertCharset.class.php' );
$convert = new ConvertCharset();
$text = $convert->Convert($string, $string_char_set, $destination_char_set, false );
}
//}
return $text ? $text : $t;
}
+183 -58
View File
@@ -2,25 +2,16 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Services Kernel [DB Abstraction]
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
| THIS IS NOT FREE / OPEN SOURCE SOFTWARE
+---------------------------------------------------------------------------
|
| > Core Module
@@ -80,6 +71,19 @@
* @version 2.1
*/
//-----------------------------------------
// Allow SUB SELECTS?
//-----------------------------------------
/**
* This can be overridden by using
* $DB->allow_sub_select = 1;
* before any query construct
*/
define( 'IPS_DB_ALLOW_SUB_SELECTS', 0 );
class db_main
{
# Global OBJECT
@@ -89,19 +93,21 @@ class db_main
*
* @var array
*/
var $obj = array ( "sql_database" => "" ,
"sql_user" => "root" ,
"sql_pass" => "" ,
"sql_host" => "localhost",
"sql_port" => "" ,
"persistent" => "0" ,
"sql_tbl_prefix" => "ibf_" ,
"cached_queries" => array() ,
'shutdown_queries' => array() ,
'debug' => 0 ,
'use_shutdown' => 1 ,
'query_cache_file' => '' ,
'force_new_connection' => 0 ,
var $obj = array ( "sql_database" => "" ,
"sql_user" => "root" ,
"sql_pass" => "" ,
"sql_host" => "localhost",
"sql_port" => "" ,
"persistent" => "0" ,
"sql_tbl_prefix" => "ibf_" ,
"cached_queries" => array() ,
'shutdown_queries' => array() ,
'debug' => 0 ,
'use_shutdown' => 1 ,
'query_cache_file' => '' ,
'force_new_connection' => 0 ,
'error_log' => '' ,
'use_error_log' => 0 ,
);
/**
@@ -109,7 +115,8 @@ class db_main
*
* @var string
*/
var $error = "";
var $error = "";
var $error_no = "";
/**
* Return error message or die inline
@@ -229,6 +236,17 @@ class db_main
* @var string
*/
var $sql_queries_name = 'sql_queries';
var $mysql_version;
var $true_version;
/*
* Allow sub selects for this query
*
* @var int
*/
var $allow_sub_select = 0;
/*-------------------------------------------------------------------------*/
// Constructor
@@ -302,7 +320,7 @@ class db_main
{
if ( ! file_exists( $filepath ) )
{
print "Íåâîçìîæíî íàéòè $filepath!";
print "Cannot locate $filepath - exiting!";
exit();
}
else
@@ -465,6 +483,17 @@ class db_main
$this->do_insert( $tbl, $arr, TRUE );
}
/*-------------------------------------------------------------------------*/
// Quick function: DO DELETE
/*-------------------------------------------------------------------------*/
function do_delete( $table, $where="" )
{
$this->build_and_exec_query( array( 'delete' => $table,
'where' => $where ) );
}
/*-------------------------------------------------------------------------*/
// Simple elements
/*-------------------------------------------------------------------------*/
@@ -477,34 +506,39 @@ class db_main
function build_query( $a )
{
if ( $a['select'] )
if ( isset($a['select']) && $a['select'] )
{
if ( is_array( $a['add_join'] ) )
if ( isset($a['add_join']) && is_array( $a['add_join'] ) )
{
$this->simple_select_with_join( $a['select'], $a['from'], $a['where'], $a['add_join'] );
$this->simple_select_with_join( $a['select'], $a['from'], isset($a['where']) ? $a['where'] : '', $a['add_join'] );
}
else
{
$this->simple_select( $a['select'], $a['from'], $a['where'] );
$this->simple_select( $a['select'], $a['from'], isset($a['where']) ? $a['where'] : '' );
}
}
if ( $a['update'] )
if ( isset($a['update']) && $a['update'] )
{
$this->simple_update( $a['update'], $a['set'], $a['where'], $a['lowpro'] );
$this->simple_update( $a['update'], $a['set'], isset($a['where']) ? $a['where'] : '', isset($a['lowpro']) ? $a['lowpro'] : '' );
}
if ( $a['delete'] )
if ( isset($a['delete']) && $a['delete'] )
{
$this->simple_delete( $a['delete'], $a['where'] );
}
if ( $a['order'] )
if ( isset($a['group']) && $a['group'] )
{
$this->simple_group( $a['group'] );
}
if ( isset($a['order']) && $a['order'] )
{
$this->simple_order( $a['order'] );
}
if ( is_array( $a['limit'] ) )
if ( isset($a['limit']) && is_array( $a['limit'] ) )
{
$this->simple_limit( $a['limit'][0], $a['limit'][1] );
}
@@ -529,7 +563,7 @@ class db_main
$ci = $this->exec_query();
if ( $a['select'] )
if ( isset($a['select']) AND $a['select'] )
{
return $this->fetch_row( $ci );
}
@@ -658,7 +692,8 @@ class db_main
{
return $this->query_count;
}
/*-------------------------------------------------------------------------*/
// Flushes the in memory query string
/*-------------------------------------------------------------------------*/
@@ -687,29 +722,57 @@ class db_main
function fatal_error($the_error="")
{
// Are we simply returning the error?
//-----------------------------------------
// INIT
//-----------------------------------------
if ($this->return_die == 1)
$this->error = $this->_get_error_string();
$this->error_no = $this->_get_error_number();
if ( $this->return_die == 1 )
{
$this->error = $this->_get_error_string();
$this->error_no = $this->_get_error_number();
$this->failed = 1;
$this->error = ( $this->error == "" ? $the_error : $this->error );
$this->failed = 1;
return;
}
else if ( $this->obj['use_error_log'] AND $this->obj['error_log'] )
{
$_error_string = "\n===================================================";
$_error_string .= "\n Date: ". date( 'r' );
$_error_string .= "\n Error Number: " . $this->error_no;
$_error_string .= "\n Error: " . $this->error;
$_error_string .= "\n IP Address: " . $_SERVER['REMOTE_ADDR'];
$_error_string .= "\n ".$the_error;
if ( $FH = @fopen( $this->obj['error_log'], 'a' ) )
{
@fwrite( $FH, $_error_string );
@fclose( $FH );
}
print "<html><head><title>IPS Driver Error</title>
<style>P,BODY{ font-family:arial,sans-serif; font-size:11px; }</style></head><body>
<blockquote><h1>IPS Driver Error</h1><b>There appears to be an error with the database.</b><br>
You can try to refresh the page by clicking <a href=\"javascript:window.location=window.location;\">here</a>
</body></html>";
}
else
{
$the_error .= "\n\nSQL error: ".$this->error."\n";
$the_error .= "SQL error code: ".$this->error_no."\n";
$the_error .= "Date: ".date("l dS \o\f F Y h:i:s A");
$the_error .= "\n\nSQL error: ".$this->_get_error_string()."\n";
$the_error .= "SQL error code: ".$this->error_no."\n";
$the_error .= "Date: ".date("j.n.Y, G:i");
$out = "<html><head><title>IPS Driver Error</title>
<style>P,BODY{ font-family:arial,sans-serif; font-size:11px; }</style></head><body>
&nbsp;<br><br><blockquote><b>Îøèáêà ñ áàçîé äàííûõ.</b><br>
Âû ìîæåòå ïîïðîáîâàòü îáíîâèòü ýòó ñòðàíèöó, íàæàâ <a href=\"javascript:window.location=window.location;\">ñþäà</a>.
<br><br><b>Âîçâðàùàåìàÿ îøèáêà</b><br>
<form name='mysql'><textarea rows=\"15\" cols=\"60\">".htmlspecialchars($the_error)."</textarea></form><br>Ïðèíîñèì ñâîè èçâèíåíèÿ çà ïðåäîñòàâëåííûå íåóäîáñòâà.</blockquote></body></html>";
$out = "<html><head><title>IPS Driver Error</title>
<style>P,BODY{ font-family:arial,sans-serif; font-size:11px; }</style></head><body>
<blockquote><h1>IPS Driver Error</h1><b>There appears to be an error with the database.</b><br>
You can try to refresh the page by clicking <a href=\"javascript:window.location=window.location;\">here</a>.
<br><br><b>Error Returned</b><br>
<form name='mysql'><textarea rows=\"15\" cols=\"60\">".htmlspecialchars($the_error)."</textarea></form><br>We apologise for any inconvenience</blockquote></body></html>";
print $out;
print $out;
}
exit();
}
@@ -741,7 +804,7 @@ class db_main
$add_slashes = 0;
}
if ( $this->no_escape_fields[ $k ] )
if ( isset($this->no_escape_fields[ $k ]) AND $this->no_escape_fields[ $k ] )
{
$add_slashes = 0;
}
@@ -757,7 +820,7 @@ class db_main
// Forcing data type?
//-----------------------------------------
if ( $this->force_data_type[ $k ] )
if ( isset($this->force_data_type[ $k ]) AND $this->force_data_type[ $k ] )
{
if ( $this->force_data_type[ $k ] == 'string' )
{
@@ -831,7 +894,7 @@ class db_main
$add_slashes = 0;
}
if ( $this->no_escape_fields[ $k ] )
if ( isset($this->no_escape_fields[ $k ]) && $this->no_escape_fields[ $k ] )
{
$add_slashes = 0;
}
@@ -845,7 +908,7 @@ class db_main
// Forcing data type?
//-----------------------------------------
if ( $this->force_data_type[ $k ] )
if ( isset($this->force_data_type[ $k ]) && $this->force_data_type[ $k ] )
{
if ( $this->force_data_type[ $k ] == 'string' )
{
@@ -901,6 +964,68 @@ class db_main
# Driver specific
}
/*-------------------------------------------------------------------------*/
// Removes quotes from a DB query
/*-------------------------------------------------------------------------*/
function remove_all_quotes( $t )
{
//-----------------------------------------
// Remove quotes
//-----------------------------------------
$t = preg_replace( "#\\\{1,}[\"']#s", "", $t );
$t = preg_replace( "#'[^'].*'#s" , "", $t );
$t = preg_replace( "#\"[^\"].*\"#s" , "", $t );
$t = preg_replace( "#\"\"#s" , "", $t );
$t = preg_replace( "#''#s" , "", $t );
//-----------------------------------------
// Remove comments
//-----------------------------------------
$t = preg_replace( "#/\*(.??)\*/#s", "", $t );
$t = preg_replace( "#/\*.+?\*/#s", "", $t );
return $t;
}
/*-------------------------------------------------------------------------*/
// Basic error handler
/*-------------------------------------------------------------------------*/
/**
* Prints SQL error message
*
* @param string Additional error message
*
* @return integer Optional, if var $return_die is set to 1
*/
function write_debug_log( $query, $data, $endtime )
{
//-----------------------------------------
// INIT
//-----------------------------------------
if ( $this->obj['use_debug_log'] AND $this->obj['debug_log'] )
{
$_string = "\n==============================================================================";
$_string .= "\n Date: ". date( 'r' );
$_string .= "\n IP Address: " . $_SERVER['REMOTE_ADDR'];
$_string .= "\n Time Taken: ".$endtime;
$_string .= "\n ".$query;
$_string .= "\n==============================================================================";
$_string .= "\n".$data;
if ( $FH = @fopen( $this->obj['debug_log'], 'a' ) )
{
@fwrite( $FH, $_string );
@fclose( $FH );
}
}
}
/*-------------------------------------------------------------------------*/
// INTERNAL: Get error number
/*-------------------------------------------------------------------------*/
+22 -816
View File
@@ -2,25 +2,16 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Services Kernel [DB Abstraction]
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
| THIS IS NOT FREE / OPEN SOURCE SOFTWARE
+---------------------------------------------------------------------------
|
| > MySQL Driver Module
@@ -42,819 +33,34 @@
*/
/**
* Handle base class definitions
* Gateway for mysql/mysqli client
*
*/
//-----------------------------------------
// Define KERNEL_PATH if not
// defined - i.e. installation
//-----------------------------------------
if ( ! defined('KERNEL_PATH') )
{
define( 'KERNEL_PATH', dirname(__FILE__) . '/' );
if( defined('INS_KERNEL_PATH') )
{
define( 'KERNEL_PATH', INS_KERNEL_PATH );
}
else
{
define( 'KERNEL_PATH', str_replace( "//", "/", str_replace( "\\", "/", dirname( __FILE__ ) ) ) . "/" );
}
}
if ( ! class_exists( 'db_main' ) )
if ( extension_loaded('mysqli') AND ! defined( 'FORCE_MYSQL_ONLY' ) )
{
require_once( KERNEL_PATH.'class_db.php' );
require( KERNEL_PATH."class_db_mysqli_client.php" );
}
/**
* Allow < 4.3.0 PHP client access
*
*/
if ( ! defined('IPS_MAIN_DB_CLASS_LEGACY') )
else
{
define('IPS_MAIN_DB_CLASS_LEGACY', ( PHP_VERSION < '4.3.0' ) ? TRUE : FALSE );
require( KERNEL_PATH."class_db_mysql_client.php" );
}
/**
* DB Class: Driver Methods
*
* Base class for database abstraction
*
* @package IPS_KERNEL
* @subpackage DatabaseAbstraction
* @author Matt Mecham
* @version 2.1
*/
class db_driver extends db_main
{
/*-------------------------------------------------------------------------*/
// Set up required vars
/*-------------------------------------------------------------------------*/
function db_driver()
{
//--------------------------
// Set up any required connect
// vars here:
// Will be populated by obj
// caller
//--------------------------
$this->connect_vars['mysql_tbl_type'] = "";
}
/*-------------------------------------------------------------------------*/
// Connect to the database
/*-------------------------------------------------------------------------*/
function connect()
{
//-----------------------------------------
// Done SQL prefix yet?
//-----------------------------------------
$this->_set_prefix();
//-----------------------------------------
// Load query file
//-----------------------------------------
$this->_load_cache_file();
//-----------------------------------------
// Connect
//-----------------------------------------
if ( $this->obj['persistent'] AND ! IPS_MAIN_DB_CLASS_LEGACY )
{
$this->connection_id = mysql_pconnect( $this->obj['sql_host'] ,
$this->obj['sql_user'] ,
$this->obj['sql_pass'] ,
$this->obj['force_new_connection']
);
}
else
{
if ( IPS_MAIN_DB_CLASS_LEGACY )
{
$this->connection_id = mysql_connect( $this->obj['sql_host'] ,
$this->obj['sql_user'] ,
$this->obj['sql_pass']
);
}
else
{
$this->connection_id = mysql_connect( $this->obj['sql_host'] ,
$this->obj['sql_user'] ,
$this->obj['sql_pass'] ,
$this->obj['force_new_connection']
);
}
}
if ( ! $this->connection_id )
{
$this->fatal_error();
return FALSE;
}
if ( ! mysql_select_db($this->obj['sql_database'], $this->connection_id) )
{
$this->fatal_error();
return FALSE;
}
return TRUE;
}
/*-------------------------------------------------------------------------*/
// Quick function: DO UPDATE
/*-------------------------------------------------------------------------*/
function do_update( $tbl, $arr, $where="", $shutdown=FALSE )
{
//-----------------------------------------
// Form query
//-----------------------------------------
$dba = $this->compile_db_update_string( $arr );
$query = "UPDATE ".$this->obj['sql_tbl_prefix']."$tbl SET $dba";
if ( $where )
{
$query .= " WHERE ".$where;
}
//-----------------------------------------
// Shut down query?
//-----------------------------------------
if ( $shutdown )
{
if ( ! $this->obj['use_shutdown'] )
{
$this->is_shutdown = 1;
return $this->query( $query );
}
else
{
$this->obj['shutdown_queries'][] = $query;
$this->cur_query = "";
}
}
else
{
return $this->query( $query );
}
}
/*-------------------------------------------------------------------------*/
// Quick function: DO INSERT
/*-------------------------------------------------------------------------*/
function do_insert( $tbl, $arr, $shutdown=FALSE )
{
//-----------------------------------------
// Form query
//-----------------------------------------
$dba = $this->compile_db_insert_string( $arr );
$query = "INSERT INTO ".$this->obj['sql_tbl_prefix']."$tbl ({$dba['FIELD_NAMES']}) VALUES({$dba['FIELD_VALUES']})";
//-----------------------------------------
// Shut down query?
//-----------------------------------------
if ( $shutdown )
{
if ( ! $this->obj['use_shutdown'] )
{
$this->is_shutdown = 1;
return $this->query( $query );
}
else
{
$this->obj['shutdown_queries'][] = $query;
$this->cur_query = "";
}
}
else
{
return $this->query( $query );
}
}
/*-------------------------------------------------------------------------*/
// SIMPLE: UPDATE
/*-------------------------------------------------------------------------*/
function simple_update( $tbl, $set, $where, $low_pro='' )
{
if ( $low_pro )
{
$low_pro = ' LOW_PRIORITY ';
}
$this->cur_query .= "UPDATE ". $low_pro . $this->obj['sql_tbl_prefix']."$tbl SET $set";
if ( $where )
{
$this->cur_query .= " WHERE $where";
}
}
/*-------------------------------------------------------------------------*/
// SIMPLE: DELETE
/*-------------------------------------------------------------------------*/
function simple_delete( $tbl, $where )
{
$this->cur_query .= "DELETE FROM ".$this->obj['sql_tbl_prefix']."$tbl";
if ( $where )
{
$this->cur_query .= " WHERE $where";
}
}
/*-------------------------------------------------------------------------*/
// SIMPLE: ORDER
/*-------------------------------------------------------------------------*/
function simple_order( $a )
{
if ( $a )
{
$this->cur_query .= ' ORDER BY '.$a;
}
}
/*-------------------------------------------------------------------------*/
// SIMPLE: LIMIT WITH CHECK
/*-------------------------------------------------------------------------*/
function simple_limit_with_check( $offset, $limit="" )
{
if ( ! preg_match( "#LIMIT\s+?\d+,#i", $this->cur_query ) )
{
$this->simple_limit( $offset, $limit );
}
}
/*-------------------------------------------------------------------------*/
// SIMPLE: LIMIT
/*-------------------------------------------------------------------------*/
function simple_limit( $offset, $limit="" )
{
if ( $limit )
{
$this->cur_query .= ' LIMIT '.$offset.','.$limit;
}
else
{
$this->cur_query .= ' LIMIT '.$offset;
}
}
/*-------------------------------------------------------------------------*/
// SIMPLE: SELECT
/*-------------------------------------------------------------------------*/
function simple_select( $get, $table, $where="" )
{
$this->cur_query .= "SELECT $get FROM ".$this->obj['sql_tbl_prefix']."$table";
if ( $where != "" )
{
$this->cur_query .= " WHERE ".$where;
}
}
/*-------------------------------------------------------------------------*/
// SIMPLE: SELECT WITH JOIN
/*-------------------------------------------------------------------------*/
function simple_select_with_join( $get, $table, $where="", $add_join=array() )
{
//-----------------------------------------
// OK, here we go...
//-----------------------------------------
$select_array = array();
$from_array = array();
$joinleft_array = array();
$where_array = array();
$final_from = array();
$select_array[] = $get;
$from_array[] = $table;
if ( $where )
{
$where_array[] = $where;
}
//-----------------------------------------
// Loop through JOINs and sort info
//-----------------------------------------
if ( is_array( $add_join ) and count( $add_join ) )
{
foreach( $add_join as $i => $join )
{
# Push join's select to stack
if ( $join['select'] )
{
$select_array[] = $join['select'];
}
if ( $join['type'] == 'inner' )
{
# Join is inline
$from_array[] = $join['from'];
if ( $join['where'] )
{
$where_array[] = $join['where'];
}
}
else if ( $join['type'] == 'left' )
{
# Join is left
$tmp = " LEFT JOIN ";
foreach( $join['from'] as $tbl => $alias )
{
$tmp .= $this->obj['sql_tbl_prefix'].$tbl.' '.$alias;
}
if ( $join['where'] )
{
$tmp .= " ON ( ".$join['where']." ) ";
}
$joinleft_array[] = $tmp;
unset( $tmp );
}
else
{
# Not using any other type of join
}
}
}
//-----------------------------------------
// Build it..
//-----------------------------------------
foreach( $from_array as $i )
{
foreach( $i as $tbl => $alias )
{
$final_from[] = $this->obj['sql_tbl_prefix'].$tbl.' '.$alias;
}
}
$get = implode( "," , $select_array );
$table = implode( "," , $final_from );
$where = implode( " AND " , $where_array );
$join = implode( "\n" , $joinleft_array );
$this->cur_query .= "SELECT $get FROM $table";
if ( $join )
{
$this->cur_query .= " ".$join." ";
}
if ( $where != "" )
{
$this->cur_query .= " WHERE ".$where;
}
}
/*-------------------------------------------------------------------------*/
// Process a manual query
/*-------------------------------------------------------------------------*/
function query($the_query, $bypass=0)
{
//-----------------------------------------
// Change the table prefix if needed
//-----------------------------------------
if ( $this->no_prefix_convert )
{
$bypass = 1;
}
if ( ! $bypass )
{
if ( $this->obj['sql_tbl_prefix'] != "ibf_" and ! $this->prefix_changed )
{
$the_query = preg_replace("/\sibf_(\S+?)([\s\.,]|$)/", " ".$this->obj['sql_tbl_prefix']."\\1\\2", $the_query);
}
}
//-----------------------------------------
// Debug?
//-----------------------------------------
if ($this->obj['debug'])
{
global $Debug;
$Debug->startTimer();
}
//-----------------------------------------
// Run the query
//-----------------------------------------
$this->query_id = mysql_query($the_query, $this->connection_id);
//-----------------------------------------
// Reset array...
//-----------------------------------------
$this->force_data_type = array();
if (! $this->query_id )
{
$this->fatal_error("mySQL query error: $the_query");
}
//-----------------------------------------
// Debug?
//-----------------------------------------
if ($this->obj['debug'])
{
$endtime = $Debug->endTimer();
$shutdown = $this->is_shutdown ? 'SHUTDOWN QUERY: ' : '';
if ( preg_match( "/^select/i", $the_query ) )
{
$eid = mysql_query("EXPLAIN $the_query", $this->connection_id);
$this->debug_html .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FFE8F3' align='center'>
<tr>
<td colspan='8' style='font-size:14px' bgcolor='#FFC5Cb'><b>{$shutdown}Select Query</b></td>
</tr>
<tr>
<td colspan='8' style='font-family:courier, monaco, arial;font-size:14px;color:black'>$the_query</td>
</tr>
<tr bgcolor='#FFC5Cb'>
<td><b>table</b></td><td><b>type</b></td><td><b>possible_keys</b></td>
<td><b>key</b></td><td><b>key_len</b></td><td><b>ref</b></td>
<td><b>rows</b></td><td><b>Extra</b></td>
</tr>\n";
while( $array = mysql_fetch_array($eid) )
{
$type_col = '#FFFFFF';
if ($array['type'] == 'ref' or $array['type'] == 'eq_ref' or $array['type'] == 'const')
{
$type_col = '#D8FFD4';
}
else if ($array['type'] == 'ALL')
{
$type_col = '#FFEEBA';
}
$this->debug_html .= "<tr bgcolor='#FFFFFF'>
<td>$array[table]&nbsp;</td>
<td bgcolor='$type_col'>$array[type]&nbsp;</td>
<td>$array[possible_keys]&nbsp;</td>
<td>$array[key]&nbsp;</td>
<td>$array[key_len]&nbsp;</td>
<td>$array[ref]&nbsp;</td>
<td>$array[rows]&nbsp;</td>
<td>$array[Extra]&nbsp;</td>
</tr>\n";
}
$this->sql_time += $endtime;
if ($endtime > 0.1)
{
$endtime = "<span style='color:red'><b>$endtime</b></span>";
}
$this->debug_html .= "<tr>
<td colspan='8' bgcolor='#FFD6DC' style='font-size:14px'><b>MySQL time</b>: $endtime</b></td>
</tr>
</table>\n<br />\n";
}
else
{
$this->debug_html .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FEFEFE' align='center'>
<tr>
<td style='font-size:14px' bgcolor='#EFEFEF'><b>{$shutdown}Non Select Query</b></td>
</tr>
<tr>
<td style='font-family:courier, monaco, arial;font-size:14px'>$the_query</td>
</tr>
<tr>
<td style='font-size:14px' bgcolor='#EFEFEF'><b>MySQL time</b>: $endtime</span></td>
</tr>
</table><br />\n\n";
}
}
$this->query_count++;
$this->obj['cached_queries'][] = $the_query;
return $this->query_id;
}
/*-------------------------------------------------------------------------*/
// Fetch a row based on the last query
/*-------------------------------------------------------------------------*/
function fetch_row($query_id = "")
{
if ($query_id == "")
{
$query_id = $this->query_id;
}
$this->record_row = mysql_fetch_array($query_id, MYSQL_ASSOC);
return $this->record_row;
}
/*-------------------------------------------------------------------------*/
// DROP TABLE
/*-------------------------------------------------------------------------*/
function sql_drop_table( $table )
{
$this->query( "DROP TABLE if exists ".$this->obj['sql_tbl_prefix']."{$table}" );
}
/*-------------------------------------------------------------------------*/
// DROP FIELD
/*-------------------------------------------------------------------------*/
function sql_drop_field( $table, $field )
{
$this->query( "ALTER TABLE ".$this->obj['sql_tbl_prefix']."{$table} DROP $field" );
}
/*-------------------------------------------------------------------------*/
// ADD FIELD
/*-------------------------------------------------------------------------*/
function sql_add_field( $table, $field_name, $field_type, $field_default="''" )
{
$this->query( "ALTER TABLE ".$this->obj['sql_tbl_prefix']."{$table} ADD $field_name $field_type default {$field_default}" );
}
/*-------------------------------------------------------------------------*/
// OPTIMIZE TABLE
/*-------------------------------------------------------------------------*/
function sql_optimize_table( $table )
{
$this->query( "OPTIMIZE TABLE ".$this->obj['sql_tbl_prefix']."{$table}" );
}
/*-------------------------------------------------------------------------*/
// ADD FULLTEXT INDEX
/*-------------------------------------------------------------------------*/
function sql_add_fulltext_index( $table, $field )
{
$this->query( "alter table ".$this->obj['sql_tbl_prefix']."{$table} ADD FULLTEXT({$field})" );
}
/*-------------------------------------------------------------------------*/
// GET TABLE SCHEMATIC
/*-------------------------------------------------------------------------*/
function sql_get_table_schematic( $table )
{
$this->query( "SHOW CREATE TABLE ".$this->obj['sql_tbl_prefix']."{$table}" );
return $this->fetch_row();
}
/*-------------------------------------------------------------------------*/
// IS ALREADY TABLE FULLTEXT?
/*-------------------------------------------------------------------------*/
function sql_is_currently_fulltext( $table )
{
$result = $this->sql_get_table_schematic( $table );
if ( preg_match( "/FULLTEXT KEY/i", $result['Create Table'] ) )
{
return TRUE;
}
else
{
return FALSE;
}
}
/*-------------------------------------------------------------------------*/
// Return the version number of the SQL server
// Should return 'true' version string (ie: 3.23.0)
// And formatted string (ie: 3230 )
/*-------------------------------------------------------------------------*/
function sql_get_version()
{
if ( ! $this->mysql_version and ! $this->true_version )
{
$this->query("SELECT VERSION() AS version");
if ( ! $row = $this->fetch_row() )
{
$this->query("SHOW VARIABLES LIKE 'version'");
$row = $this->fetch_row();
}
$this->true_version = $row['version'];
$tmp = explode( '.', preg_replace( "#[^\d\.]#", "\\1", $row['version'] ) );
$this->mysql_version = sprintf('%d%02d%02d', $tmp[0], $tmp[1], $tmp[2] );
}
}
/*-------------------------------------------------------------------------*/
// sql_can_fulltext
// returns whether SQL engine has fulltext abilities
// returns TRUE or FALSE
/*-------------------------------------------------------------------------*/
function sql_can_fulltext()
{
$this->sql_get_version();
if ( $this->mysql_version >= 32323 AND strtolower($this->connect_vars['mysql_tbl_type']) == 'myisam' )
{
return TRUE;
}
else
{
return FALSE;
}
}
/*-------------------------------------------------------------------------*/
// sql_can_fulltext_boolean
// returns whether SQL engine has boolean fulltext abilities
// (+word -word, etc)
// returns TRUE or FALSE
/*-------------------------------------------------------------------------*/
function sql_can_fulltext_boolean()
{
$this->sql_get_version();
if ( $this->mysql_version >= 40010 AND strtolower($this->connect_vars['mysql_tbl_type']) == 'myisam' )
{
return TRUE;
}
else
{
return FALSE;
}
}
/*-------------------------------------------------------------------------*/
// Fetch the number of rows affected by the last query
/*-------------------------------------------------------------------------*/
function get_affected_rows()
{
return mysql_affected_rows($this->connection_id);
}
/*-------------------------------------------------------------------------*/
// Fetch the number of rows in a result set
/*-------------------------------------------------------------------------*/
function get_num_rows()
{
return mysql_num_rows($this->query_id);
}
/*-------------------------------------------------------------------------*/
// Fetch the last insert id from an sql autoincrement
/*-------------------------------------------------------------------------*/
function get_insert_id()
{
return mysql_insert_id($this->connection_id);
}
/*-------------------------------------------------------------------------*/
// Free the result set from mySQLs memory
/*-------------------------------------------------------------------------*/
function free_result($query_id="")
{
if ($query_id == "") {
$query_id = $this->query_id;
}
@mysql_free_result($query_id);
}
/*-------------------------------------------------------------------------*/
// Shut down the database
/*-------------------------------------------------------------------------*/
function close_db()
{
if ( $this->connection_id )
{
return @mysql_close( $this->connection_id );
}
}
/*-------------------------------------------------------------------------*/
// Return an array of tables
/*-------------------------------------------------------------------------*/
function get_table_names()
{
$result = mysql_list_tables($this->obj['sql_database']);
$num_tables = @mysql_numrows($result);
for ($i = 0; $i < $num_tables; $i++)
{
$tables[] = mysql_tablename($result, $i);
}
mysql_free_result($result);
return $tables;
}
/*-------------------------------------------------------------------------*/
// Return an array of fields
/*-------------------------------------------------------------------------*/
function get_result_fields($query_id="")
{
if ($query_id == "")
{
$query_id = $this->query_id;
}
while ($field = mysql_fetch_field($query_id))
{
$Fields[] = $field;
}
return $Fields;
}
/*-------------------------------------------------------------------------*/
// INTERNAL: Get error number
/*-------------------------------------------------------------------------*/
function _get_error_number()
{
return mysql_errno();
}
/*-------------------------------------------------------------------------*/
// INTERNAL: Get error number
/*-------------------------------------------------------------------------*/
function _get_error_string()
{
return mysql_error();
}
/*-------------------------------------------------------------------------*/
// Use different escape method for different SQL engines
/*-------------------------------------------------------------------------*/
function add_slashes( $t )
{
return ( IPS_MAIN_DB_CLASS_LEGACY ) ? mysql_escape_string($t) : mysql_real_escape_string($t, $this->connection_id );
}
/*-------------------------------------------------------------------------*/
// Use different escape method for different SQL engines
/*-------------------------------------------------------------------------*/
function remove_slashes( $t )
{
# Not required for MySQL because we use the mysql_real_escape_string
/*if ( get_magic_quotes_gpc() )
{
$t = stripslashes($t);
}*/
return $t;
}
} // end class
?>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+5 -17
View File
@@ -1,25 +1,13 @@
<?php
/*
+---------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Services Kernel Module
| Invision Power Board
| ========================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2005 Invision Power Services
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
| ========================================
+---------------------------------------------------------------------------
|
| > Difference Engine.
@@ -148,7 +136,7 @@ class class_difference
$c = 0;
$diff_res_array = array();
foreach( $diff_res as $bleh => $l_val )
foreach( $diff_res as $l_val )
{
if ( intval($l_val) )
{
@@ -265,7 +253,7 @@ class class_difference
reset($str_array);
foreach( $str_array as $hehe => $low )
foreach( $str_array as $low )
{
$all_words = $this->_explode_trim( ' ', $low, 1 );
$out_array = array_merge($out_array, $all_words);
+4 -13
View File
@@ -2,26 +2,17 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Services Kernel [Email Functions]
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
| THIS IS NOT FREE / OPEN SOURCE SOFTWARE
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+--------------------------------------------------------------------------
|
| > Core Module
| > Module written by Matt Mecham
@@ -146,7 +137,7 @@ class class_email
*
* @var string
*/
var $char_set = 'windows-1251';
var $char_set = 'iso-8859-1';
/**
* SMTP:
+160 -23
View File
@@ -1,26 +1,17 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| =============================================
+---------------------------------------------------------------------------
| Invision Power Board
| ========================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2004 Invision Power Services
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
| ========================================
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
| INVISION POWER BOARD IS NOT FREE SOFTWARE!
| http://www.invisionboard.com
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+--------------------------------------------------------------------------
|
| > File Management Functions
| > Script written by Matt Mecham
@@ -72,6 +63,14 @@ class class_file_management
*/
var $errors = array();
/**
* HTTP Status Code/Text
*
* @var array
*/
var $http_status_code = 0;
var $http_status_text = "";
/**#@+
* Set Authentication
*
@@ -120,7 +119,7 @@ class class_file_management
return FALSE;
}
if ( ! stristr( $file_location, 'http://' ) )
if ( ! stristr( $file_location, 'http://' ) AND ! stristr( $file_location, 'https://' ) )
{
//-------------------------------
// It's a path!
@@ -128,7 +127,7 @@ class class_file_management
if ( ! file_exists( $file_location ) )
{
$this->errors[] = "Ôàéë '$file_location' íå ñóùåñòâóåò, ïîæàëóéñòà ïðîâåðüòå íàñòðîéêè ññûëêè íà øàáëîíû.";
$this->errors[] = "File '$file_location' does not exist, please check the path.";
return;
}
@@ -246,34 +245,38 @@ class class_file_management
if ( ! $fp = @fsockopen( $host, $port, $errno, $errstr, $fsocket_timeout ) )
{
$this->errors[] = "CONNECTION REFUSED FROM $host";
$this->errors[] = "Could not establish a connection with $host";
return FALSE;
}
else
{
$final_carriage = "";
if( ! $this->auth_req )
{
$final_carriage = "\r\n";
}
if ( ! fputs( $fp, "GET $path HTTP/1.0\r\nHost:$host\r\nConnection: Keep-Alive\r\n{$final_carriage}" ) )
{
$this->errors[] = "Unable to send request to $host!";
return FALSE;
}
if( $this->auth_req )
if ( $this->auth_req )
{
if( $this->auth_user && $this->auth_pass )
if ( $this->auth_user && $this->auth_pass )
{
$header = "Authorization: Basic ".base64_encode("{$this->auth_user}:{$this->auth_pass}")."\r\n\r\n";
if ( ! fputs( $fp, $header ) )
{
$this->errors[] = "Authorization Failed!";
return FALSE;
}
}
}
}
}
@stream_set_timeout($fp, $fsocket_timeout);
@@ -292,6 +295,10 @@ class class_file_management
// Strip headers
//-------------------------------
// HTTP/1.1 ### ABCD
$this->http_status_code = substr( $data, 9, 3 );
$this->http_status_text = substr( $data, 13, ( strpos( $data, "\r\n" ) - 13 ) );
$tmp = split("\r\n\r\n", $data, 2);
$data = $tmp[1];
@@ -309,7 +316,7 @@ class class_file_management
*/
function get_contents_with_curl( $file_location )
{
if ( function_exists( 'curl_init' ) )
if ( function_exists( 'curl_init' ) AND function_exists("curl_exec") )
{
$ch = curl_init( $file_location );
@@ -329,6 +336,136 @@ class class_file_management
}
}
/*-------------------------------------------------------------------------*/
// dir_copy_dir
//
// Copies to contents of a dir to a new dir, creating
// destination dir if needed.
//
/*-------------------------------------------------------------------------*/
function dir_copy_dir($from_path, $to_path, $mode = 0777)
{
$this->errors = "";
//-----------------------------------------
// Strip off trailing slashes...
//-----------------------------------------
$from_path = preg_replace( "#/$#", "", $from_path);
$to_path = preg_replace( "#/$#", "", $to_path);
if ( ! is_dir( $from_path ) )
{
$this->errors[] = "Could not locate directory '$from_path'";
return FALSE;
}
if ( ! is_dir( $to_path ) )
{
if ( ! @mkdir( $to_path, $mode ) )
{
$this->errors[] = "Could not create directory '$to_path' please check the CHMOD permissions and re-try";
return FALSE;
}
else
{
@chmod( $to_path, $mode );
}
}
if ( is_dir( $from_path ) )
{
$handle = opendir($from_path);
while ( ($file = readdir($handle)) !== false )
{
if ( ($file != ".") && ($file != "..") )
{
if ( is_dir( $from_path."/".$file ) )
{
$this->dir_copy_dir($from_path."/".$file, $to_path."/".$file);
}
if ( is_file( $from_path."/".$file ) )
{
copy($from_path."/".$file, $to_path."/".$file);
@chmod($to_path."/".$file, 0777);
}
}
}
closedir($handle);
}
if ( ! count( $this->errors ) )
{
return TRUE;
}
}
/*-------------------------------------------------------------------------*/
// dir_rm_dir
//
// Removes directories, if non empty, removes
// content and directories
/*-------------------------------------------------------------------------*/
function dir_rm_dir($file)
{
$errors = 0;
//-----------------------------------------
// Remove trailing slashes..
//-----------------------------------------
$file = preg_replace( "#/$#", "", $file );
if ( file_exists($file) )
{
//-----------------------------------------
// Attempt CHMOD
//-----------------------------------------
@chmod($file, 0777);
if ( is_dir($file) )
{
$handle = opendir($file);
while ( ($filename = readdir($handle)) !== false )
{
if ( ($filename != ".") && ($filename != "..") )
{
$this->dir_rm_dir($file."/".$filename);
}
}
closedir($handle);
if ( ! @rmdir($file) )
{
$errors++;
}
}
else
{
if ( ! @unlink($file) )
{
$errors++;
}
}
}
if ($errors == 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
}
?>
+35 -31
View File
@@ -2,24 +2,14 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-10-10 14:03:20 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 22 $
@@ -280,8 +270,10 @@ class class_image
'cur_height' => $img_size[1]
) );
$return['thumb_width'] = $im['img_width'];
$return['thumb_height'] = $im['img_height'];
$return['thumb_width'] = $im['img_width'];
$return['thumb_height'] = $im['img_height'];
$return['original_width'] = $img_size[0];
$return['original_height'] = $img_size[1];
//-----------------------------------------------
// May as well scale properly.
@@ -313,9 +305,11 @@ class class_image
{
if ( $this->out_type == 'file' )
{
$return['thumb_width'] = $this->desired_width;
$return['thumb_height'] = $this->desired_height;
$return['thumb_location'] = $this->in_file_name;
$return['thumb_width'] = $this->desired_width;
$return['thumb_height'] = $this->desired_height;
$return['thumb_location'] = $this->in_file_name;
$return['original_width'] = $img_size[0];
$return['original_height'] = $img_size[1];
}
else
{
@@ -341,9 +335,11 @@ class class_image
{
if ( $this->out_type == 'file' )
{
$return['thumb_width'] = $this->desired_width;
$return['thumb_height'] = $this->desired_height;
$return['thumb_location'] = $this->in_file_name;
$return['thumb_width'] = $this->desired_width;
$return['thumb_height'] = $this->desired_height;
$return['thumb_location'] = $this->in_file_name;
$return['original_width'] = $img_size[0];
$return['original_height'] = $img_size[1];
}
else
{
@@ -369,9 +365,11 @@ class class_image
{
if ( $this->out_type == 'file' )
{
$return['thumb_width'] = $this->desired_width;
$return['thumb_height'] = $this->desired_height;
$return['thumb_location'] = $this->in_file_name;
$return['thumb_width'] = $this->desired_width;
$return['thumb_height'] = $this->desired_height;
$return['thumb_location'] = $this->in_file_name;
$return['original_width'] = $img_size[0];
$return['original_height'] = $img_size[1];
}
else
{
@@ -444,9 +442,11 @@ class class_image
// Can't save...
//--------------------------------------
$return['thumb_width'] = $this->desired_width;
$return['thumb_height'] = $this->desired_height;
$return['thumb_location'] = $this->in_file_name;
$return['thumb_width'] = $this->desired_width;
$return['thumb_height'] = $this->desired_height;
$return['thumb_location'] = $this->in_file_name;
$return['original_width'] = $img_size[0];
$return['original_height'] = $img_size[1];
return $return;
}
@@ -469,9 +469,11 @@ class class_image
if ( $this->out_type == 'file' )
{
$return['thumb_width'] = $this->desired_width;
$return['thumb_height'] = $this->desired_height;
$return['thumb_location'] = $this->in_file_name;
$return['thumb_width'] = $this->desired_width;
$return['thumb_height'] = $this->desired_height;
$return['thumb_location'] = $this->in_file_name;
$return['original_width'] = $img_size[0];
$return['original_height'] = $img_size[1];
}
else
{
@@ -493,8 +495,10 @@ class class_image
{
if ( $this->out_type == 'file' )
{
$return['thumb_width'] = $img_size[0];
$return['thumb_height'] = $img_size[1];
$return['thumb_width'] = $img_size[0];
$return['thumb_height'] = $img_size[1];
$return['original_width'] = $img_size[0];
$return['original_height'] = $img_size[1];
return $return;
}
+42 -44
View File
@@ -1,25 +1,16 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| =============================================
+---------------------------------------------------------------------------
| Invision Power Board
| ========================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2004 Invision Power Services
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
| ========================================
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
| INVISION POWER BOARD IS NOT FREE SOFTWARE!
| http://www.invisionboard.com
+---------------------------------------------------------------------------
|
| > RSS FUNCTIONS (Simple, light parser)
@@ -131,6 +122,7 @@ class class_rss
* @ var string
*/
var $doc_type = 'UTF-8';
var $orig_doc_type = "";
/**
* Error capture
@@ -247,6 +239,8 @@ class class_rss
*/
var $convert_charset = 0;
var $collapse_newlines = 0;
/**
* Destination charset
*
@@ -305,7 +299,7 @@ class class_rss
{
if ( ! count( $this->channels ) )
{
$this->errors[] = "Êàíàëû íå îïðåäåëåíû";
$this->errors[] = "No channels defined";
}
$this->rss_document = '<?xml version="1.0" encoding="'.$this->doc_type.'" ?'.'>'."\n";
@@ -347,9 +341,9 @@ class class_rss
// Got image?
//-------------------------------
if ( is_array( $this->channel_images[ $idx ] ) and count( $this->channel_images[ $idx ] ) )
if ( isset($this->channel_images[ $idx ]) AND is_array( $this->channel_images[ $idx ] ) AND count( $this->channel_images[ $idx ] ) )
{
foreach( $this->channel_images[ $idx ] as $i => $image )
foreach( $this->channel_images[ $idx ] as $image )
{
$tmp_data .= "\t<image>\n";
@@ -368,7 +362,7 @@ class class_rss
if ( is_array( $this->items[ $idx ] ) and count( $this->items[ $idx ] ) )
{
foreach( $this->items[ $idx ] as $i => $item )
foreach( $this->items[ $idx ] as $item )
{
$tmp_data .= "\t<item>\n";
@@ -601,32 +595,33 @@ class class_rss
if ( count( $this->class_file_management->errors ) )
{
$this->errors = $this->class_file_management->errors;
xml_parser_free($xml_parser); // Let's kill the parser before we return
@xml_parser_free($xml_parser); // Let's kill the parser before we return
return FALSE;
}
if( preg_match( "#encoding=[\"'](\S+?)[\"']#si", $data, $matches ) )
{
$this->orig_doc_type = $matches[1];
}
if( preg_match( "#charset=(\S+?)#si", $data, $matches ) )
{
$this->orig_doc_type = $matches[1];
}
//-----------------------------------------
// Charset conversion?
//-----------------------------------------
if ( $this->convert_charset AND $data )
{
if ( $this->feed_charset != $this->destination_charset )
if ( $this->feed_charset != $this->doc_type )
{
if ( ! is_object( $this->class_convert_charset ) )
{
require_once( IPS_CLASSES_PATH.'/class_convert_charset.php' );
$this->class_convert_charset = new class_convert_charset();
}
$data = $this->class_convert_charset->convert_charset( $data, $this->feed_charset, $this->destination_charset );
$data = $this->ipsclass->txt_convert_charsets( $data, $this->feed_charset );
# Replace any char-set= data
$data = preg_replace( "#encoding=[\"'](\S+?)[\"']#si", "encoding=\"".$this->destination_charset."\"", $data );
$data = preg_replace( "#charset=(\S+?)#si" , "charset=".$this->destination_charset , $data );
# Reset doc type
$this->doc_type = $this->destination_charset;
$data = preg_replace( "#encoding=[\"'](\S+?)[\"']#si", "encoding=\"".$this->doc_type."\"", $data );
$data = preg_replace( "#charset=(\S+?)#si" , "charset=".$this->doc_type , $data );
}
}
@@ -634,6 +629,9 @@ class class_rss
// Generate XML parser
//-------------------------------
$supported_encodings = array( "utf-8", "iso-8859-1", "us-ascii" );
$this->doc_type = in_array( strtolower($this->doc_type), $supported_encodings ) ? $this->doc_type : "utf-8";
$xml_parser = xml_parser_create( $this->doc_type );
xml_set_element_handler( $xml_parser, array( &$this, "parse_startElement" ), array( &$this, "parse_endElement") );
xml_set_character_data_handler($xml_parser, array( &$this, "parse_characterData" ) );
@@ -644,14 +642,14 @@ class class_rss
if ( ! xml_parse( $xml_parser, $data ) )
{
$this->errors[] = sprintf("XML îøèáêà: %s â ñòðîêå %d", xml_error_string( xml_get_error_code($xml_parser) ), xml_get_current_line_number($xml_parser) );
$this->errors[] = sprintf("XML error: %s at line %d", xml_error_string( xml_get_error_code($xml_parser) ), xml_get_current_line_number($xml_parser) );
}
//-------------------------------
// Free memory used by XML parser
//-------------------------------
xml_parser_free($xml_parser);
@xml_parser_free($xml_parser);
}
/*-------------------------------------------------------------------------*/
@@ -706,7 +704,7 @@ class class_rss
if ( ! xml_parse( $xml_parser, $data, TRUE ) )
{
$this->errors[] = sprintf("XML îøèáêà: %s ñòðîêà %d", xml_error_string( xml_get_error_code($xml_parser) ), xml_get_current_line_number($xml_parser) );
$this->errors[] = sprintf("XML error: %s at line %d", xml_error_string( xml_get_error_code($xml_parser) ), xml_get_current_line_number($xml_parser) );
}
//-------------------------------
@@ -752,18 +750,18 @@ class class_rss
if ( $this->in_channel )
{
$this->in_channel++;
$this->tag = $this->rss_tag_names[ $name ];
$this->tag = isset($this->rss_tag_names[ $name ]) ? $this->rss_tag_names[ $name ] : '';
}
if ( $this->rss_tag_names[ $name ] == "ITEM" )
if ( isset($this->rss_tag_names[ $name ]) AND $this->rss_tag_names[ $name ] == "ITEM" )
{
$this->in_item = 1;
}
else if ( $this->rss_tag_names[ $name ] == "IMAGE")
else if ( isset($this->rss_tag_names[ $name ]) AND $this->rss_tag_names[ $name ] == "IMAGE")
{
$this->in_image = 1;
}
else if ( $this->rss_tag_names[ $name ] == "CHANNEL")
else if ( isset($this->rss_tag_names[ $name ]) AND $this->rss_tag_names[ $name ] == "CHANNEL")
{
$this->in_channel = 1;
}
@@ -789,7 +787,7 @@ class class_rss
$name = strtoupper($name);
if ( $this->rss_tag_names[ $name ] == "IMAGE" )
if ( isset($this->rss_tag_names[ $name ]) AND $this->rss_tag_names[ $name ] == "IMAGE" )
{
$this->rss_images[ $this->cur_channel ]['url'] = $this->rss_img_image;
$this->rss_images[ $this->cur_channel ]['title'] = $this->rss_img_title;
@@ -801,7 +799,7 @@ class class_rss
$this->_kill_image_elements();
$this->in_image = 0;
}
else if ( $this->rss_tag_names[ $name ] == "CHANNEL" )
else if ( isset($this->rss_tag_names[ $name ]) AND $this->rss_tag_names[ $name ] == "CHANNEL" )
{
//-------------------------------
// Add data
@@ -827,7 +825,7 @@ class class_rss
$this->_kill_channel_elements();
$this->in_channel = 0;
}
else if ( $this->rss_tag_names[ $name ] == "ITEM" )
else if ( isset($this->rss_tag_names[ $name ]) AND $this->rss_tag_names[ $name ] == "ITEM" )
{
if ( $this->rss_count < $this->rss_max_show )
{
+3 -13
View File
@@ -2,24 +2,14 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-10-10 14:03:20 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 22 $
@@ -46,7 +36,7 @@
*
* Example Usage:
* <code>
* <if="ibf.vars['threaded_per_page'] == 10">
* <if="$bf.vars['threaded_per_page'] == 10">
* html here
* </if>
* <else if="ibf.vars['threaded_per_page'] >= 100 or some_var == 'this'">
+104 -18
View File
@@ -2,24 +2,14 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-10-10 14:03:20 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 22 $
@@ -89,6 +79,11 @@ class class_template
*/
var $foreach_blocks = array();
/**
* Allow PHP code to execute
*/
var $allow_php_code = 1;
function class_template()
{
@@ -109,6 +104,12 @@ class class_template
*/
function convert_cache_to_eval($data='', $full_class_name='')
{
//-----------------------------------------
// INIT
//-----------------------------------------
$final_content = '';
//-----------------------------------------
// Remove PHP tags
//-----------------------------------------
@@ -219,19 +220,30 @@ class class_template
if ( $compile )
{
$_func_code = '"' . $this->compile_html_to_php( $func_html, $func_data ) . '"';
$_func_code = '"' . $this->compile_html_to_php( trim( $func_html ), $func_data ) . '"';
}
else
{
$_func_code = "<<<EOF\n" . $this->unconvert_tags( $func_html ) . "\nEOF";
}
//-----------------------------------------
// Make safe.. clear up any potential escapes
//-----------------------------------------
$_func_code = preg_replace( "#\\\{1,}\"#s", '\\"', $_func_code );
//-----------------------------------------
// Continue...
//-----------------------------------------
$top = "//===========================================================================\n".
"// <ips:{$func_name}:desc:{$func_desc}:trigger:{$com_bit_update_trigger}>\n".
"//===========================================================================\n";
$start = "function {$func_name}($func_data) {\n\$IPBHTML = \"\";\n//--starthtml--//\n";
$middle = '$IPBHTML .= '.$_func_code.';';
$end = "\n//--endhtml--//\nreturn \$IPBHTML;\n}\n";
//-------------------------------
@@ -250,13 +262,31 @@ class class_template
{
$end = preg_replace( "#<xxforeach_([^>]+?)xx>(.+?)</xxforeach_\\1xx>#si", "\".\\2.\"", $end );
}
//-----------------------------------------
// Remove raw PHP tags
//-----------------------------------------
$end = preg_replace( "#<php>(.+?)</php>#si", "", $end );
}
//-----------------------------------------
// Sort out the rest of the PHP tags
//-----------------------------------------
$php_tags = $this->_process_raw_php_tags( $_func_code );
//-----------------------------------------
// Remove raw PHP tags
//-----------------------------------------
$middle = preg_replace( "#<php>(.+?)</php>#si", "", $middle );
//-------------------------------
// Return
//-------------------------------
return $top.$start.$middle.$end;
return $top.$start.$php_tags.$middle.$end;
}
/*-------------------------------------------------------------------------*/
@@ -341,7 +371,7 @@ class class_template
{
$text = str_replace('\\\\$', '\\$', $text);
}
return $text;
}
@@ -596,6 +626,8 @@ class class_template
$function_name = '__foreach_loop__'. uniqid( 'id_' );
$php_statement = '<xxforeach_'.$function_name.'xx>$this->'.$function_name.'('.$clean_func_data.')</xxforeach_'.$function_name.'xx>';
$php_block = $this->_process_raw_html_logic( addslashes($block) );
$php_tags = $this->_process_raw_php_tags( $block );
$this->foreach_blocks[] = <<<EOF
//===========================================================================
@@ -605,8 +637,10 @@ class class_template
function {$function_name}($normal_func_data)
{
\$_ips___x_retval = '';
foreach( $statement )
{
{$php_tags}
\$_ips___x_retval .= "{$php_block}";
}
@@ -621,6 +655,52 @@ EOF;
return str_replace("\\'", "'", $template);
}
/*-------------------------------------------------------------------------*/
// Convert HTML PHP tags
/*-------------------------------------------------------------------------*/
function _process_raw_php_tags( $text )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$php = "";
//-----------------------------------------
// Allow PHP code in templates?
//-----------------------------------------
if ( ! $this->allow_php_code )
{
return '';
}
//-----------------------------------------
// EXTRACT!
//-----------------------------------------
preg_match_all( "#<php>(.+?)</php>#si", $text, $match );
for ( $i = 0; $i < count($match[0]); $i++ )
{
$php_code = trim( $match[1][$i] );
$complete_tag = $match[0][$i];
$str_find = array('\\"', '\\\\');
$str_replace = array('"' , '\\' );
$str_find[] = "\\'";
$str_replace[] = "'";
$php_code = str_replace($str_find, $str_replace, $php_code);
$php .= "\n".$php_code."\n";
}
return $php;
}
/*-------------------------------------------------------------------------*/
// Convert HTML logic to cached PHP (work function)
/*-------------------------------------------------------------------------*/
@@ -653,6 +733,12 @@ EOF;
while ( 1 == 1 )
{
//-----------------------------------------
// Update template length
//-----------------------------------------
$total_length = strlen( $template );
$_end = 0;
//----------------------------------------
@@ -936,9 +1022,9 @@ EOF;
$t = preg_replace( "/\{ips\.vars\[(['\"])?(sql_driver|sql_host|sql_database|sql_pass|sql_user|sql_port|sql_tbl_prefix|smtp_host|smtp_port|smtp_user|smtp_pass|html_dir|base_dir|upload_dir)(['\"])?\]\}/", "" , $t );
# IPB 2.1+ Kernel
$t = preg_replace( "/{ips\.script_url}/i" , '{$this->ipsclass->base_url}' , $t);
$t = preg_replace( "/{ips\.session_id}/i" , '{$this->ipsclass->session_id}', $t);
$t = preg_replace( "#ips\.(member|vars|skin|lang|input)#i", '$this->ipsclass->\\1' , $t );
$t = preg_replace( "/{ip(s|b|d)\.script_url}/i" , '{$this->ipsclass->base_url}' , $t);
$t = preg_replace( "/{ip(s|b|d)\.session_id}/i" , '{$this->ipsclass->session_id}', $t);
$t = preg_replace( "#ip(?:s|b|d)\.(member|vars|skin|lang|input)#i", '$this->ipsclass->\\1' , $t );
return $t;
}
+8 -17
View File
@@ -2,24 +2,14 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-10-10 14:03:20 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 22 $
@@ -255,9 +245,9 @@ class class_upload
// Set up some variables to stop carpals developing
//-------------------------------------------------
$FILE_NAME = $_FILES[ $this->upload_form_field ]['name'];
$FILE_SIZE = $_FILES[ $this->upload_form_field ]['size'];
$FILE_TYPE = $_FILES[ $this->upload_form_field ]['type'];
$FILE_NAME = isset($_FILES[ $this->upload_form_field ]['name']) ? $_FILES[ $this->upload_form_field ]['name'] : '';
$FILE_SIZE = isset($_FILES[ $this->upload_form_field ]['size']) ? $_FILES[ $this->upload_form_field ]['size'] : '';
$FILE_TYPE = isset($_FILES[ $this->upload_form_field ]['type']) ? $_FILES[ $this->upload_form_field ]['type'] : '';
//-------------------------------------------------
// Naughty Opera adds the filename on the end of the
@@ -271,7 +261,8 @@ class class_upload
// I love universal languages that aren't universal.
//-------------------------------------------------
if ($_FILES[ $this->upload_form_field ]['name'] == ""
if ( !isset($_FILES[ $this->upload_form_field ]['name'])
or $_FILES[ $this->upload_form_field ]['name'] == ""
or !$_FILES[ $this->upload_form_field ]['name']
or !$_FILES[ $this->upload_form_field ]['size']
or ($_FILES[ $this->upload_form_field ]['name'] == "none") )
@@ -343,7 +334,7 @@ class class_upload
}
else
{
$this->parsed_file_name = preg_replace( '#\.'.$this->file_extension."#is", "", $FILE_NAME );
$this->parsed_file_name = str_replace( '.'.$this->file_extension, "", $FILE_NAME );
}
//-------------------------------------------------
+14 -15
View File
@@ -2,24 +2,14 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD îå ñ÷ìñåôóñ âåóðìáôîùí ðòïçòáííîùí ïâåóðåþåîéåí!
| ðÒÁ×Á ÎÁ ðï ÐÒÉÎÁÄÌÅÖÁÔ Invision Power Services
| ðÒÁ×Á ÎÁ ÐÅÒÅ×ÏÄ IBResource (http://www.ibresource.ru))
+---------------------------------------------------------------------------
| > $Date: 2005-10-10 14:03:20 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 22 $
@@ -200,14 +190,14 @@ class class_xml
*
* @var integer
*/
var $lite_parser = 1;
var $lite_parser = 0;
/**
* DOC type
*
* @ var string
*/
var $doc_type = 'WINDOWS-1251';
var $doc_type = 'ISO-8859-1';
/*-------------------------------------------------------------------------*/
// CONSTRUCTOR
@@ -215,6 +205,8 @@ class class_xml
function class_xml()
{
ini_set("memory_limit", "32M");
//$this->header = '<?xml version="1.0" encoding="'.$this->doc_type.'"?'.'>';
}
@@ -255,7 +247,14 @@ class class_xml
//-----------------------------------------
else
{
$parser = xml_parser_create();
if ( $this->use_doctype && in_array( strtolower($this->doc_type), array( 'us-ascii', 'utf-8', 'iso-8859-1' ) ) )
{
$parser = xml_parser_create( $this->doc_type );
}
else
{
$parser = xml_parser_create();
}
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE , 0);
File diff suppressed because it is too large. Load diff
+112 -39
View File
@@ -2,24 +2,14 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-10-10 14:03:20 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 22 $
@@ -74,7 +64,7 @@
* to prevent it loading as plain text via HTTP which would show
* the entire contents of the file.
*/
define( 'IPS_XML_RPC_DEBUG_ON' , 0 );
define( 'IPS_XML_RPC_DEBUG_ON' , 1 );
define( 'IPS_XML_RPC_DEBUG_FILE', dirname( __FILE__ ) . '/../cache/debug.php' );
/**
@@ -126,6 +116,12 @@ class class_xml_rpc
*/
var $map_type_to_key = array();
/**
* Auth required
*/
var $auth_user = '';
var $auth_pass = '';
/*-------------------------------------------------------------------------*/
// CONSTRUCTOR
/*-------------------------------------------------------------------------*/
@@ -147,7 +143,7 @@ class class_xml_rpc
*/
function xml_rpc_decode( $_xml )
{
$xml_parser = new xmlrpc_parser();
$xml_parser =& new xmlrpc_parser();
$data = $xml_parser->parse( $_xml );
$xml_parser->destruct();
@@ -184,7 +180,7 @@ class class_xml_rpc
{
if ( ! is_array($current_node['array']['data']) )
{
return array();
$temp = array();
}
else
{
@@ -196,7 +192,7 @@ class class_xml_rpc
for( $n = 0 ; $n < $count ; $n++ )
{
$temp2[$n] = & $this->xml_rpc_adjust_value(&$temp[$n]);
$temp2[$n] = & $this->xml_rpc_adjust_value($temp[$n]);
}
$temp = &$temp2;
@@ -204,7 +200,7 @@ class class_xml_rpc
}
else
{
$temp2 = & $this->xml_rpc_adjust_value(&$temp);
$temp2 = & $this->xml_rpc_adjust_value($temp);
$temp = array(&$temp2);
}
}
@@ -225,12 +221,12 @@ class class_xml_rpc
for( $n = 0 ; $n < $count ; $n++ )
{
$temp2[$temp[$n]['name']] = & $this->xml_rpc_adjust_value(&$temp[$n]['value']);
$temp2[$temp[$n]['name']] = & $this->xml_rpc_adjust_value($temp[$n]['value']);
}
}
else
{
$temp2[$temp['name']] = & $this->xml_rpc_adjust_value(&$temp['value']);
$temp2[$temp['name']] = & $this->xml_rpc_adjust_value($temp['value']);
}
$temp = &$temp2;
}
@@ -291,11 +287,11 @@ class class_xml_rpc
*/
function xml_rpc_get_params( $request )
{
if ( is_array( $request['methodCall']['params'] ) )
if ( isset( $request['methodCall']['params'] ) AND is_array( $request['methodCall']['params'] ) )
{
$temp = & $request['methodCall']['params']['param'];
}
else if ( is_array( $request['methodResponse']['params'] ) )
else if ( isset( $request['methodResponse']['params'] ) AND is_array( $request['methodResponse']['params'] ) )
{
$temp = & $request['methodResponse']['params']['param'];
}
@@ -310,7 +306,7 @@ class class_xml_rpc
for( $n = 0 ; $n < $count ; $n++)
{
$temp2[$n] = & $this->xml_rpc_adjust_value(&$temp[$n]['value']);
$temp2[$n] = & $this->xml_rpc_adjust_value($temp[$n]['value']);
}
}
else
@@ -328,7 +324,7 @@ class class_xml_rpc
*/
function xml_rpc_get_method_name( $request )
{
return $request['methodCall']['methodName'];
return isset( $request['methodCall']['methodName'] ) ? $request['methodCall']['methodName'] : '';
}
/*-------------------------------------------------------------------------*/
@@ -372,6 +368,33 @@ class class_xml_rpc
}
}
/*-------------------------------------------------------------------------*/
// Return single value
/*-------------------------------------------------------------------------*/
/**
* Prints a true document and exits
*
* @return void
*/
function xml_rpc_return_value( $value )
{
$to_print = $this->header."<methodResponse>
<params>
<param>
<value>{$value}</value>
</param>
</params>
</methodResponse>";
@header( "Connection: close" );
@header( "Content-length: ".strlen($to_print) );
@header( "Content-type: text/xml" );
@header( "Date: " . date("r") );
print $to_print;
exit();
}
/*-------------------------------------------------------------------------*/
// Creates an XML-RPC complex document
/*-------------------------------------------------------------------------*/
@@ -416,19 +439,51 @@ class class_xml_rpc
$xmldata .= "\t<params>\n";
$xmldata .= "\t\t<param>\n";
$xmldata .= "\t\t\t<value>\n";
$xmldata .= "\t\t\t<struct>\n";
foreach( $data_array as $k => $v )
if ( isset( $data_array[0] ) AND is_array( $data_array[0] ) )
{
$_type = $this->map_type_to_key[ $k ] ? $this->map_type_to_key[ $k ] : $this->get_xmlrpc_string_type( $v );
$xmldata .= "\t\t\t\t<member>\n";
$xmldata .= "\t\t\t\t\t<name>".$k."</name>\n";
$xmldata .= "\t\t\t\t\t<value><".$_type.">" . htmlspecialchars($v) . "</".$_type."></value>\n";
$xmldata .= "\t\t\t\t</member>\n";
$xmldata .= "\t\t\t<array>\n";
$xmldata .= "\t\t\t\t<data>\n";
foreach( $data_array as $k => $v )
{
$xmldata .= "\t\t\t\t\t<value>\n";
$xmldata .= "\t\t\t\t\t\t<struct>\n";
foreach( $v as $k2 => $v2 )
{
$_type = $this->map_type_to_key[ $k2 ] ? $this->map_type_to_key[ $k2 ] : $this->get_xmlrpc_string_type( $v2 );
$xmldata .= "\t\t\t\t\t\t\t<member>\n";
$xmldata .= "\t\t\t\t\t\t\t\t<name>".$k2."</name>\n";
$xmldata .= "\t\t\t\t\t\t\t\t<value><".$_type.">" . htmlspecialchars($v2) . "</".$_type."></value>\n";
$xmldata .= "\t\t\t\t\t\t\t</member>\n";
}
$xmldata .= "\t\t\t\t\t\t</struct>\n";
$xmldata .= "\t\t\t\t\t</value>\n";
}
$xmldata .= "\t\t\t\t</data>\n";
$xmldata .= "\t\t\t</array>\n";
}
$xmldata .= "\t\t\t</struct>\n";
else
{
$xmldata .= "\t\t\t<struct>\n";
foreach( $data_array as $k => $v )
{
$_type = isset( $this->map_type_to_key[ $k ] ) ? $this->map_type_to_key[ $k ] : $this->get_xmlrpc_string_type( $v );
$xmldata .= "\t\t\t\t<member>\n";
$xmldata .= "\t\t\t\t\t<name>".$k."</name>\n";
$xmldata .= "\t\t\t\t\t<value><".$_type.">" . htmlspecialchars($v) . "</".$_type."></value>\n";
$xmldata .= "\t\t\t\t</member>\n";
}
$xmldata .= "\t\t\t</struct>\n";
}
$xmldata .= "\t\t\t</value>\n";
$xmldata .= "\t\t</param>\n";
$xmldata .= "\t</params>\n";
@@ -550,6 +605,7 @@ class class_xml_rpc
$data = null;
$fsocket_timeout = 10;
$header = "";
//-----------------------------------------
// Send it..
@@ -568,7 +624,8 @@ class class_xml_rpc
//-------------------------------
$host = $url_parts['host'];
$port = ( isset($url_parts['port']) ) ? $url_parts['port'] : 80;
$port = ( isset($url_parts['port']) ) ? $url_parts['port'] : 80;
//-------------------------------
// Tidy up path
@@ -598,6 +655,14 @@ class class_xml_rpc
{
$header = "POST $path HTTP/1.0\r\n";
$header .= "Host: $host\r\n";
if ( $this->auth_user && $this->auth_pass )
{
$this->_add_debug( "Authorization: Basic Performed" );
$header .= "Authorization: Basic ".base64_encode("{$this->auth_user}:{$this->auth_pass}")."\r\n";
}
$header .= "Connection: close\r\n";
$header .= "Content-Type: text/xml\r\n";
$header .= "Content-Length: " . strlen($xmldata) . "\r\n\r\n";
@@ -683,14 +748,14 @@ class class_xml_rpc
*/
function _add_debug( $msg )
{
if ( IPS_XML_RPC_DEBUG_FILE )
if ( IPS_XML_RPC_DEBUG_FILE AND file_exists( IPS_XML_RPC_DEBUG_FILE ) )
{
$full_msg = "==================================================================\n"
. "SCRIPT NAME: " . $_SERVER["SCRIPT_NAME"] . "\n"
. gmdate( 'r' ) . ' - ' . $_SERVER['REMOTE_ADDR'] . ' - ' . $msg . "\n"
. "==================================================================\n";
$FH = fopen( IPS_XML_RPC_DEBUG_FILE, 'a' );
$FH = fopen( IPS_XML_RPC_DEBUG_FILE, 'a+' );
fwrite( $FH, $full_msg, strlen( $full_msg ) );
fclose( $FH );
@@ -734,7 +799,7 @@ class xmlrpc_parser
$this->parser = xml_parser_create();
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_object( $this->parser, &$this);
xml_set_object( $this->parser, $this);
xml_set_element_handler( $this->parser, "rpc_open", "rpc_close");
xml_set_character_data_handler($this->parser, "rpc_data");
}
@@ -824,8 +889,16 @@ class xmlrpc_parser
$this->parent[$key] = array();
$this->parent = &$this->parent[$key];
array_unshift($this->parents, &$this->parent);
//array_unshift($this->parents, &$this->parent);
$this->array_unshift_ref($this->parents, $this->parent);
}
function array_unshift_ref(&$array, &$value)
{
$return = array_unshift($array,'');
$array[0] =& $value;
return $return;
}
/**
* XML data handler
+12 -19
View File
@@ -2,24 +2,14 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-10-10 14:03:20 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 22 $
@@ -233,21 +223,24 @@ class class_xmlarchive
{
$this->file_array = array();
foreach( $this->xml->xml_array['xmlarchive']['fileset']['file'] as $idx => $entry )
foreach( $this->xml->xml_array['xmlarchive']['fileset']['file'] as $entry )
{
$this_array = array();
foreach ( $entry as $k => $v )
if( is_array( $entry ) )
{
if ( $k == 'content' )
foreach ( $entry as $k => $v )
{
$v['VALUE'] = base64_decode( preg_replace( "/\s/", "", $entry['content']['VALUE'] ) );
if ( $k == 'content' )
{
$v['VALUE'] = base64_decode( preg_replace( "/\s/", "", $entry['content']['VALUE'] ) );
}
$this_array[ $k ] = $v['VALUE'];
}
$this_array[ $k ] = $v['VALUE'];
$this->file_array[] = $this_array;
}
$this->file_array[] = $this_array;
}
}
}
@@ -9,7 +9,7 @@
**/
$PATH_TO_CLASS = dirname(ereg_replace("\\\\","/",__FILE__)) . "/" . "ConvertTables" . "/";
define ("CONVERT_TABLES_DIR", $PATH_TO_CLASS);
define ("DEBUG_MODE", 1);
define ("DEBUG_MODE", -1);
/**
* -- 1.0 2004-07-28 --
+1 -15
View File
@@ -1,15 +1 @@
<html>
<head><title>Ошибка &lt; Русская версия Invision Power Board</title></head>
<body>
<h1>Ошибка &lt; Русская версия Invision Power Board</h1>
<hr>
Вы попали на несуществующую страницу!<br>Пожалуйста нажмите на кнопочку &laquo;<b>Назад</b>&raquo;
в вашем браузере для возвращения на предыдущую страницу.
<hr>
<b>Invision Power Board:</b>
<ul>
<li><a href="http://www.bestwarez.ru" title="BestWarez.Ru - Только лучший Варез!">Русская версия</a></li>
<li><a href="http://www.invisionboard.com" title="Official Site">English version</a></li>
</ul>
</body>
</html>
<html>␍<head><title>Invision Power Board - Bulletin Board System</title></head>␍<body>␍<h1>403: Invision Power Board -> Forbidden</h1>␍<hr>␍You have reached this Page in error, please use␍your back button to return to Invision Board.␍<hr>␍<a href="http://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>␍