Version 3.0.5
This commit is contained in:
1 parent
19b38c7c74
commit
1d4720f3e2
3755 files changed
+508378
-664541
No files matched your search
@@ -1,46 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2006 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Email: matt@invisionpower.com
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE SOFTWARE!
|
||||
| http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-02-01 18:16:26 +0000 (Wed, 01 Feb 2006) $
|
||||
| > $Revision: 132 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > CONVERGE Wrapper script
|
||||
| > Script written by Matt Mecham
|
||||
| > Date started: 6th March 2006
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main executable wrapper.
|
||||
*
|
||||
* Set-up and load module to run
|
||||
*
|
||||
* @package InvisionPowerBoard
|
||||
* @author Matt Mecham
|
||||
* @version 2.1
|
||||
*/
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Remote API integration gateway file
|
||||
* Last Updated: $Date: 2009-07-23 21:54:32 -0400 (Thu, 23 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4933 $
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Script type
|
||||
*
|
||||
*/
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
define( 'IPB_THIS_SCRIPT', 'api' );
|
||||
define( 'IPB_LOAD_SQL' , 'queries' );
|
||||
|
||||
/**
|
||||
@@ -49,77 +28,41 @@ define( 'IPB_LOAD_SQL' , 'queries' );
|
||||
*/
|
||||
define( 'CVG_IP_MATCH', 1 );
|
||||
|
||||
require_once( '../../init.php' );
|
||||
require_once( '../../initdata.php' );
|
||||
|
||||
//===========================================================================
|
||||
// MAIN PROGRAM
|
||||
//===========================================================================
|
||||
|
||||
$INFO = array();
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );
|
||||
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );
|
||||
|
||||
//--------------------------------
|
||||
// Load our classes
|
||||
//--------------------------------
|
||||
//-----------------------------------------
|
||||
// Set up cookie stuff
|
||||
//-----------------------------------------
|
||||
|
||||
require_once ROOT_PATH . "sources/ipsclass.php";
|
||||
require_once KERNEL_PATH . "class_converge.php";
|
||||
require_once ROOT_PATH . "conf_global.php";
|
||||
$registry = ipsRegistry::instance();
|
||||
$registry->init();
|
||||
|
||||
# Initiate super-class
|
||||
$ipsclass = new ipsclass();
|
||||
$ipsclass->vars = $INFO;
|
||||
|
||||
//--------------------------------
|
||||
// The clocks a' tickin'
|
||||
//--------------------------------
|
||||
|
||||
$Debug = new Debug;
|
||||
$Debug->startTimer();
|
||||
|
||||
//--------------------------------
|
||||
// Load the DB driver and such
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->init_db_connection();
|
||||
|
||||
# Turn off shutdown
|
||||
$ipsclass->DB->obj['use_shutdown'] = 0;
|
||||
IPSCookie::$sensitive_cookies = array( 'session_id', 'ipb_admin_session_id', 'member_id', 'pass_hash' );
|
||||
|
||||
//--------------------------------
|
||||
// Set up our vars
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->parse_incoming();
|
||||
$registry->DB()->obj['use_shutdown'] = 0;
|
||||
|
||||
//--------------------------------
|
||||
// Set converge
|
||||
// Set debug mode
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->converge = new class_converge( $ipsclass->DB );
|
||||
|
||||
//--------------------------------
|
||||
// Start off the cache array
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->cache_array = array('badwords','emoticons','attachtypes','bbcode', 'multimod','ranks','profilefields','components','banfilters', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'forum_cache', 'moderators', 'stats', 'languages' );
|
||||
|
||||
//===========================================================================
|
||||
// Get cache...
|
||||
//===========================================================================
|
||||
|
||||
$ipsclass->init_load_cache( $ipsclass->cache_array );
|
||||
$registry->DB()->setDebugMode( ipsRegistry::$settings['sql_debug'] == 1 ? intval($_GET['debug']) : 0 );
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the FUNC
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->initiate_ipsclass();
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the FUNC
|
||||
//--------------------------------
|
||||
|
||||
if ( ! $ipsclass->vars['xmlrpc_enable'] )
|
||||
if ( ! ipsRegistry::$settings['xmlrpc_enable'] )
|
||||
{
|
||||
@header( "Content-type: text/xml" );
|
||||
print"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
@@ -136,7 +79,7 @@ if ( ! $ipsclass->vars['xmlrpc_enable'] )
|
||||
<member>
|
||||
<name>faultString</name>
|
||||
<value>
|
||||
<string>IP.Board's XML-RPC API system is not enabled. Log into your IP.Board ACP and visit: Tools & Settings -> XML-RPC API and update "Enable XML-RPC API System"</string>
|
||||
<string>IP.Board's XML-RPC API system is not enabled. Log into your IP.Board ACP and visit: System -> System Settings -> Advanced -> XML-RPC API and update "Enable XML-RPC API System"</string>
|
||||
</value>
|
||||
</member>
|
||||
</struct>
|
||||
@@ -150,34 +93,33 @@ if ( ! $ipsclass->vars['xmlrpc_enable'] )
|
||||
// Define Service
|
||||
//===========================================================================
|
||||
|
||||
require_once( KERNEL_PATH . 'class_api_server.php' );
|
||||
require_once( IPS_KERNEL_PATH . 'classApiServer.php' );
|
||||
|
||||
//===========================================================================
|
||||
// Create the XML-RPC Server
|
||||
//===========================================================================
|
||||
|
||||
$server = new class_api_server();
|
||||
$api = $server->decode_request();
|
||||
$server = new classApiServer();
|
||||
$api = $server->decodeRequest();
|
||||
$module = $server->params['api_module'];
|
||||
$user = $ipsclass->txt_md5_clean( $server->params['api_key']);
|
||||
$user = IPSText::md5Clean( $server->params['api_key']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Check for module
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $module AND file_exists( ROOT_PATH . 'interface/board/modules/' . $module . '/api.php' ) )
|
||||
if ( $module AND file_exists( DOC_IPS_ROOT_PATH . 'interface/board/modules/' . $module . '/api.php' ) )
|
||||
{
|
||||
require_once( ROOT_PATH . 'interface/board/modules/' . $module . '/api.php' );
|
||||
require_once( DOC_IPS_ROOT_PATH . 'interface/board/modules/' . $module . '/api.php' );
|
||||
|
||||
$webservice = new API_Server( $ipsclass );
|
||||
$webservice->class_api_server =& $server;
|
||||
$webservice = new API_Server( $registry );
|
||||
$webservice->classApiServer =& $server;
|
||||
}
|
||||
else
|
||||
{
|
||||
$server->api_send_reply( array( 'faultCode' => '2',
|
||||
'faultString' => "IP.Board could not locate an API module called '{$module}'" ) );
|
||||
$server->apiSendError( '2', "IP.Board could not locate an API module called '{$module}'" );
|
||||
|
||||
$ipsclass->DB->do_insert( 'api_log', array( 'api_log_key' => $user,
|
||||
$registry->DB()->insert( 'api_log', array( 'api_log_key' => $user,
|
||||
'api_log_ip' => $_SERVER['REMOTE_ADDR'],
|
||||
'api_log_date' => time(),
|
||||
'api_log_query' => $server->raw_request,
|
||||
@@ -191,34 +133,32 @@ else
|
||||
|
||||
if ( $user )
|
||||
{
|
||||
$webservice->api_user = $ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
$webservice->api_user = $registry->DB()->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'api_users',
|
||||
'where' => "api_user_key='" . $user . "'" ) );
|
||||
|
||||
if ( ! $webservice->api_user['api_user_id'] )
|
||||
{
|
||||
$ipsclass->DB->do_insert( 'api_log', array( 'api_log_key' => $user,
|
||||
$registry->DB()->insert( 'api_log', array( 'api_log_key' => $user,
|
||||
'api_log_ip' => $_SERVER['REMOTE_ADDR'],
|
||||
'api_log_date' => time(),
|
||||
'api_log_query' => $server->raw_request,
|
||||
'api_log_allowed' => 0 ) );
|
||||
|
||||
$server->api_send_reply( array( 'faultCode' => '3',
|
||||
'faultString' => "IP.Board could not locate a valid API user with that API key" ) );
|
||||
$server->apiSendError( '3', "IP.Board could not locate a valid API user with that API key" );
|
||||
|
||||
exit();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ipsclass->DB->do_insert( 'api_log', array( 'api_log_key' => $user,
|
||||
$registry->DB()->insert( 'api_log', array( 'api_log_key' => $user,
|
||||
'api_log_ip' => $_SERVER['REMOTE_ADDR'],
|
||||
'api_log_date' => time(),
|
||||
'api_log_query' => $server->raw_request,
|
||||
'api_log_allowed' => 0 ) );
|
||||
|
||||
$server->api_send_reply( array( 'faultCode' => '4',
|
||||
'faultString' => "No API Key was sent in the request" ) );
|
||||
$server->apiSendError( '4', "No API Key was sent in the request" );
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -230,14 +170,13 @@ if ( $webservice->api_user['api_user_ip'] )
|
||||
{
|
||||
if ( $_SERVER['REMOTE_ADDR'] != $webservice->api_user['api_user_ip'] )
|
||||
{
|
||||
$ipsclass->DB->do_insert( 'api_log', array( 'api_log_key' => $user,
|
||||
$registry->DB()->insert( 'api_log', array( 'api_log_key' => $user,
|
||||
'api_log_ip' => $_SERVER['REMOTE_ADDR'],
|
||||
'api_log_date' => time(),
|
||||
'api_log_query' => $server->raw_request,
|
||||
'api_log_allowed' => 0 ) );
|
||||
|
||||
$server->api_send_reply( array( 'faultCode' => '5',
|
||||
'faultString' => "Incorrect IP Address ({$_SERVER['REMOTE_ADDR']}). You must update the API User Key with that IP Address." ) );
|
||||
$server->apiSendError( '5', "Incorrect IP Address ({$_SERVER['REMOTE_ADDR']}). You must update the API User Key with that IP Address." );
|
||||
|
||||
exit();
|
||||
}
|
||||
@@ -247,15 +186,12 @@ if ( $webservice->api_user['api_user_ip'] )
|
||||
// Add web service
|
||||
//-----------------------------------------
|
||||
|
||||
$server->add_object_map( $webservice, 'UTF-8' );
|
||||
$server->addObjectMap( $webservice, IPS_DOC_CHAR_SET );
|
||||
|
||||
//-----------------------------------------
|
||||
// Process....
|
||||
//-----------------------------------------
|
||||
|
||||
$server->get_xml_rpc();
|
||||
$server->getXmlRpc();
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
?>
|
||||
exit;
|
||||
Reference in new issue
Block a user