Version 2.2.0 RC-1
This commit is contained in:
1 parent
f73f8bff6d
commit
22f1b963ee
1034 files changed
+178610
-70897
No files matched your search
@@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
Reference in new issue
Block a user