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

+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