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
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+---------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2006 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE SOFTWARE!
|
||||
| http://www.invisionboard.com
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Id$
|
||||
| > $Revision: 102 $
|
||||
| > $Date: 2005-12-22 10:14:15 +0000 (Thu, 22 Dec 2005) $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > CONVERGE SOAP: ALLOWED METHODS (YES)
|
||||
| > Script written by Matt Mecham
|
||||
| > Date started: Friday 6th January 2006 (11:28)
|
||||
|
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
$_CONVERGE_ALLOWED_METHODS = array();
|
||||
|
||||
/**
|
||||
* CONVERGE LOG OUT
|
||||
* Passes info to complete local log out
|
||||
*/
|
||||
$_CONVERGE_ALLOWED_METHODS['converge_log_out'] = array(
|
||||
'in' => array(
|
||||
'auth_key' => 'string',
|
||||
'product_id' => 'integer',
|
||||
'email_address' => 'string',
|
||||
),
|
||||
'out' => array(
|
||||
'response' => 'xmlrpc'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Disable converge from the system
|
||||
*/
|
||||
$_CONVERGE_ALLOWED_METHODS['converge_disable'] = array(
|
||||
'in' => array(
|
||||
'auth_key' => 'string',
|
||||
'product_id' => 'integer',
|
||||
),
|
||||
'out' => array(
|
||||
'response' => 'xmlrpc'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* ON Member Delete
|
||||
* Delete the member
|
||||
*/
|
||||
$_CONVERGE_ALLOWED_METHODS['on_member_delete'] = array(
|
||||
'in' => array(
|
||||
'auth_key' => 'string',
|
||||
'product_id' => 'integer',
|
||||
'multiple_email_addresses' => 'string',
|
||||
),
|
||||
'out' => array(
|
||||
'response' => 'xmlrpc'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* ON Password change
|
||||
* Give the local app a chance to perform a new member log in key request
|
||||
*/
|
||||
$_CONVERGE_ALLOWED_METHODS['on_password_change'] = array(
|
||||
'in' => array(
|
||||
'auth_key' => 'string',
|
||||
'product_id' => 'integer',
|
||||
'email_address' => 'string',
|
||||
'md5_once_password' => 'string',
|
||||
),
|
||||
'out' => array(
|
||||
'response' => 'xmlrpc'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* ON EMAIL CHANGE
|
||||
* Update the local app with the new email address
|
||||
*/
|
||||
$_CONVERGE_ALLOWED_METHODS['on_email_change'] = array(
|
||||
'in' => array(
|
||||
'auth_key' => 'string',
|
||||
'product_id' => 'integer',
|
||||
'old_email_address' => 'string',
|
||||
'new_email_address' => 'string',
|
||||
),
|
||||
'out' => array(
|
||||
'response' => 'xmlrpc'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* CONVERGE LOG IN
|
||||
* Passes info to complete local log in
|
||||
*/
|
||||
$_CONVERGE_ALLOWED_METHODS['converge_log_in'] = array(
|
||||
'in' => array(
|
||||
'auth_key' => 'string',
|
||||
'product_id' => 'integer',
|
||||
'email_address' => 'string',
|
||||
'md5_once_password' => 'string',
|
||||
'ip_address' => 'string',
|
||||
'unix_join_date' => 'integer',
|
||||
'timezone' => 'integer',
|
||||
'dst_autocorrect' => 'integer',
|
||||
),
|
||||
'out' => array(
|
||||
'response' => 'xmlrpc'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Get a batch of members to import
|
||||
*
|
||||
*/
|
||||
$_CONVERGE_ALLOWED_METHODS['import_members'] = array(
|
||||
'in' => array(
|
||||
'auth_key' => 'string',
|
||||
'product_id' => 'integer',
|
||||
'limit_a' => 'integer',
|
||||
'limit_b' => 'integer',
|
||||
),
|
||||
'out' => array(
|
||||
'response' => 'xmlrpc'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Get number of members and last ID
|
||||
*
|
||||
*/
|
||||
$_CONVERGE_ALLOWED_METHODS['get_members_info'] = array(
|
||||
'in' => array(
|
||||
'auth_key' => 'string',
|
||||
'product_id' => 'integer',
|
||||
),
|
||||
'out' => array(
|
||||
'response' => 'xmlrpc'
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,732 @@
|
||||
<?php
|
||||
/*
|
||||
+---------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2006 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE SOFTWARE!
|
||||
| http://www.invisionboard.com
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Id$
|
||||
| > $Revision: 102 $
|
||||
| > $Date: 2005-12-22 10:14:15 +0000 (Thu, 22 Dec 2005) $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > CONVERGE SOAP: SERVER FUNCTIONS
|
||||
| > Script written by Josh Williams, Matt Mecham
|
||||
| > Date started: Friday 6th January 2006 (11:28)
|
||||
|
|
||||
+---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
class Converge_Server
|
||||
{
|
||||
/**
|
||||
* Defines the service for WSDL
|
||||
* @access Private
|
||||
* @var array
|
||||
*/
|
||||
var $__dispatch_map = array();
|
||||
|
||||
/**
|
||||
* IPS Global Class
|
||||
* @access Private
|
||||
* @var object
|
||||
*/
|
||||
var $ipsclass;
|
||||
|
||||
/**
|
||||
* IPS API SERVER Class
|
||||
* @access Private
|
||||
* @var object
|
||||
*/
|
||||
var $class_api_server;
|
||||
|
||||
/**
|
||||
* Converge_Server::Converge_Server()
|
||||
*
|
||||
* CONSTRUCTOR
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function Converge_Server( & $ipsclass )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Set IPS CLASS
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass = $ipsclass;
|
||||
|
||||
//-----------------------------------------
|
||||
// Load allowed methods and build dispatch
|
||||
// list
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( ROOT_PATH . 'converge_local/apis/allowed_methods.php' );
|
||||
|
||||
if ( is_array( $_CONVERGE_ALLOWED_METHODS ) and count( $_CONVERGE_ALLOWED_METHODS ) )
|
||||
{
|
||||
foreach( $_CONVERGE_ALLOWED_METHODS as $_method => $_data )
|
||||
{
|
||||
$this->__dispatch_map[ $_method ] = $_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converge_Server::on_member_delete()
|
||||
*
|
||||
* Deletes the member.
|
||||
* Keep in mind that the member may not be in the local DB
|
||||
* if they've not yet visited this site.
|
||||
*
|
||||
* This will return a param "response" with either
|
||||
* - FAILED (Unknown failure)
|
||||
* - SUCCESS (Added OK)
|
||||
*
|
||||
*
|
||||
* @param int $product_id Product ID
|
||||
* @param string $auth_key Authentication Key
|
||||
* @param string $multiple_email_addresses Comma delimited list of email addresses
|
||||
* @return xml
|
||||
**/
|
||||
function on_member_delete( $auth_key, $product_id, $multiple_email_addresses='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$return = 'FAILED';
|
||||
$emails = explode( ",", $multiple_email_addresses );
|
||||
$member_ids = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Authenticate
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->__authenticate( $auth_key, $product_id ) !== FALSE )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get member IDs
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'id',
|
||||
'from' => 'members',
|
||||
'where' => "email IN ('" . implode( "','", $emails ) . "')" ) );
|
||||
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
while( $row = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$member_ids[ $row['id'] ] = $row['id'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove the members
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $member_ids ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get the member class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( ROOT_PATH . "sources/action_admin/member.php" );
|
||||
$lib = new ad_member();
|
||||
$lib->ipsclass =& $this->ipsclass;
|
||||
|
||||
# Set up
|
||||
$this->ipsclass->member['mgroup'] = $this->ipsclass->vars['admin_group'];
|
||||
|
||||
$lib->member_delete_do( $member_ids );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// return
|
||||
//-----------------------------------------
|
||||
|
||||
$return = 'SUCCESS';
|
||||
|
||||
$this->class_api_server->api_send_reply( array( 'complete' => 1,
|
||||
'response' => $return ) );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converge_Server::on_password_change()
|
||||
*
|
||||
* handles new password change
|
||||
*
|
||||
* This will return a param "response" with either
|
||||
* - FAILED (Unknown failure)
|
||||
* - SUCCESS (Added OK)
|
||||
*
|
||||
*
|
||||
* @param int $product_id Product ID
|
||||
* @param string $auth_key Authentication Key
|
||||
* @param string $email_address Email address
|
||||
* @param string $md5_once_password Plain text password hashed by MD5
|
||||
* @return xml
|
||||
**/
|
||||
function on_password_change( $auth_key, $product_id, $email_address, $md5_once_password )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$return = 'FAILED';
|
||||
|
||||
//-----------------------------------------
|
||||
// Authenticate
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->__authenticate( $auth_key, $product_id ) !== FALSE )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update: CONVERGE
|
||||
//-----------------------------------------
|
||||
|
||||
$salt = $this->ipsclass->converge->generate_password_salt(5);
|
||||
$passhash = $this->ipsclass->converge->generate_compiled_passhash( $salt, $md5_once_password );
|
||||
|
||||
$converge = array(
|
||||
'converge_pass_hash' => $passhash,
|
||||
'converge_pass_salt' => str_replace( '\\', "\\\\", $salt )
|
||||
);
|
||||
|
||||
$this->ipsclass->DB->do_update( 'members_converge', $converge, "converge_email='" . $email_address . "'" );
|
||||
|
||||
$return = 'SUCCESS';
|
||||
|
||||
$this->class_api_server->api_send_reply( array( 'complete' => 1,
|
||||
'response' => $return ) );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converge_Server::on_email_change()
|
||||
*
|
||||
* Updates the local app's DB
|
||||
*
|
||||
* This will return a param "response" with either
|
||||
* - FAILED (Unknown failure)
|
||||
* - SUCCESS (Added OK)
|
||||
*
|
||||
*
|
||||
* @param int $product_id Product ID
|
||||
* @param string $auth_key Authentication Key
|
||||
* @param string $old_email_address Existing email address
|
||||
* @param string $new_email_address NEW email address to change
|
||||
* @return xml
|
||||
**/
|
||||
function on_email_change( $auth_key, $product_id, $old_email_address, $new_email_address )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$return = 'FAILED';
|
||||
|
||||
//-----------------------------------------
|
||||
// Get member
|
||||
//-----------------------------------------
|
||||
|
||||
$member = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'members',
|
||||
'where' => "email='".$old_email_address."'" ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Authenticate
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->__authenticate( $auth_key, $product_id ) !== FALSE )
|
||||
{
|
||||
if ( $old_email_address AND $new_email_address )
|
||||
{
|
||||
$this->ipsclass->DB->do_update( 'members_converge', array( 'converge_email' => $new_email_address ), "converge_email='" . $old_email_address . "'" );
|
||||
|
||||
$this->ipsclass->DB->do_update( 'members' , array( 'email' => $new_email_address ), "email='" . $old_email_address . "'" );
|
||||
|
||||
//-----------------------------------------
|
||||
// Update member's username?
|
||||
// This happens when a converge member is
|
||||
// created
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $member['email'] == $old_email_address )
|
||||
{
|
||||
$this->ipsclass->DB->do_update( 'members', array( 'username' => $new_email_address ), "id='" . $member['id'] . "'" );
|
||||
}
|
||||
|
||||
$return = 'SUCCESS';
|
||||
}
|
||||
|
||||
$this->class_api_server->api_send_reply( array( 'complete' => 1,
|
||||
'response' => $return ) );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converge_Server::import_members()
|
||||
*
|
||||
* Returns a batch of members to import
|
||||
* Important!
|
||||
* Each member row must return the following:
|
||||
* - email_address
|
||||
* - pass_salt (5 chr salt)
|
||||
* - password (md5 hash of: md5( md5( $salt ) . md5( $raw_pass ) );
|
||||
* - ip_address (optional)
|
||||
* - join_date (optional)
|
||||
*
|
||||
* EACH BATCH MUST BE ORDERED BY ID ASC (low to high)
|
||||
*
|
||||
* @param string $auth_key Authentication Key
|
||||
* @param int $product_id Product ID
|
||||
* @param int $limit_a SQL limit a
|
||||
* @param int $limit_b SQL limit b
|
||||
* @return xml
|
||||
**/
|
||||
function import_members( $auth_key, $product_id, $limit_a, $limit_b )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Authenticate
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->__authenticate( $auth_key, $product_id ) !== FALSE )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$members = array();
|
||||
$done = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Get Data
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => '*',
|
||||
'from' => 'members_converge',
|
||||
'order' => 'converge_id ASC',
|
||||
'limit' => array( $limit_a, $limit_b ) ) );
|
||||
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
|
||||
while( $row = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$members[ $row['converge_id'] ] = array( 'email_address' => $row['converge_email'],
|
||||
'pass_salt' => $row['converge_pass_salt'],
|
||||
'password' => $row['converge_pass_hash'],
|
||||
'join_date' => $row['converge_joined'] );
|
||||
}
|
||||
|
||||
if ( ! count( $members ) )
|
||||
{
|
||||
$done = 1;
|
||||
}
|
||||
|
||||
$return = array( 'complete' => $done,
|
||||
'members' => $members );
|
||||
|
||||
# return complex data
|
||||
$this->class_api_server->api_send_reply( $return, 1 );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converge_Server::get_members_info()
|
||||
*
|
||||
* IP.Converge uses this to gather how many users the local application has,
|
||||
* and the last ID entered into the local application’s member table.
|
||||
*
|
||||
* Expected repsonse:
|
||||
* count => The number of users
|
||||
* last_id => The last ID
|
||||
*
|
||||
* @param string $auth_key Authentication Key
|
||||
* @param int $product_id Product ID
|
||||
* @return xml
|
||||
**/
|
||||
function get_members_info( $auth_key, $product_id )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Authenticate
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->__authenticate( $auth_key, $product_id ) !== FALSE )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get Data
|
||||
//-----------------------------------------
|
||||
|
||||
$member_count = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'COUNT(*) as count',
|
||||
'from' => 'members' ) );
|
||||
|
||||
$member_last = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'MAX(id) as max',
|
||||
'from' => 'members' ) );
|
||||
|
||||
|
||||
$this->class_api_server->api_send_reply( array( 'count' => intval( $member_count['count'] ),
|
||||
'last_id' => intval( $member_last['max'] ) ) );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converge_Server::converge_log_out()
|
||||
*
|
||||
* Logs in the member out of local application
|
||||
*
|
||||
* This will return a param "response" with either
|
||||
* - FAILED (Unknown failure)
|
||||
* - SUCCESS (Added OK)
|
||||
*
|
||||
*
|
||||
* @param string $auth_key Authentication Key
|
||||
* @param int $product_id Product ID
|
||||
* @param string $email_address Email address of user logged in
|
||||
* @return xml
|
||||
**/
|
||||
function converge_log_out( $auth_key, $product_id, $email_address='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$update = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Authenticate
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->__authenticate( $auth_key, $product_id ) !== FALSE )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get member
|
||||
//-----------------------------------------
|
||||
|
||||
$member = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'members',
|
||||
'where' => "email='".$email_address."'" ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// If we've got a member, delete their session
|
||||
// and change the log in key so that the members
|
||||
// auto-log in cookies won't work.
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $member['id'] )
|
||||
{
|
||||
$update['member_login_key'] = $this->ipsclass->converge->generate_auto_log_in_key();
|
||||
$update['login_anonymous'] = '0&0';
|
||||
$update['last_visit'] = time();
|
||||
$update['last_activity'] = time();
|
||||
|
||||
$this->ipsclass->DB->do_update( 'members', $update, 'id=' . $member['id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Delete session
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_and_exec_query( array( 'delete' => 'sessions',
|
||||
'where' => 'member_id='.$member['id'] ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add cookies
|
||||
//-----------------------------------------
|
||||
|
||||
$this->class_api_server->api_add_cookie_data( array( 'name' => $this->ipsclass->vars['cookie_id'] . 'member_id',
|
||||
'value' => 0,
|
||||
'path' => $this->ipsclass->vars['cookie_path'],
|
||||
'domain' => $this->ipsclass->vars['cookie_domain'],
|
||||
'sticky' => 1 ) );
|
||||
|
||||
$this->class_api_server->api_add_cookie_data( array( 'name' => $this->ipsclass->vars['cookie_id'] . 'pass_hash',
|
||||
'value' => 0,
|
||||
'path' => $this->ipsclass->vars['cookie_path'],
|
||||
'domain' => $this->ipsclass->vars['cookie_domain'],
|
||||
'sticky' => 1 ) );
|
||||
|
||||
$this->class_api_server->api_add_cookie_data( array( 'name' => $this->ipsclass->vars['cookie_id'] . 'session_id',
|
||||
'value' => 0,
|
||||
'path' => $this->ipsclass->vars['cookie_path'],
|
||||
'domain' => $this->ipsclass->vars['cookie_domain'],
|
||||
'sticky' => 0 ) );
|
||||
|
||||
$this->class_api_server->api_send_reply( array( 'complete' => 1,
|
||||
'response' => 'SUCCESS' ) );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converge_Server::converge_log_in()
|
||||
*
|
||||
* Logs in the member to the local application
|
||||
*
|
||||
* This must return
|
||||
* - complete [ All done.. ]
|
||||
* - session_id [ Session ID created ]*
|
||||
* - member_id [ Member's log in ID / email ]
|
||||
* - log_in_key [ Member's log in key or password ]
|
||||
* -- RESPONSE
|
||||
* - FAILED (Unknown failure)
|
||||
* - SUCCESS (Added OK)
|
||||
*
|
||||
* The session key and password/log in key will be posted to
|
||||
* this apps handshake API so that the app can return cookies.
|
||||
*
|
||||
* @param int $product_id Product ID
|
||||
* @param string $auth_key Authentication Key
|
||||
* @param string $email_address Email address of user logged in
|
||||
* @param string $md5_once_password The plain text password, hashed once
|
||||
* @param string $ip_address IP Address of registree
|
||||
* @param string $unix_join_date The member's join date in unix format
|
||||
* @param string $timezone The member's timezone
|
||||
* @param string $dst_autocorrect The member's DST autocorrect settings
|
||||
* @return xml
|
||||
**/
|
||||
function converge_log_in( $auth_key, $product_id, $email_address='', $md5_once_password='', $ip_address='', $unix_join_date='', $timezone=0, $dst_autocorrect=0 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$return = 'FAILED';
|
||||
|
||||
//-----------------------------------------
|
||||
// Authenticate
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->__authenticate( $auth_key, $product_id ) !== FALSE )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get member
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->member = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'members',
|
||||
'where' => "email='".$email_address."'" ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// No such user? Create one!
|
||||
// FAIL SAFE
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->ipsclass->member['id'] )
|
||||
{
|
||||
$unix_join_date = $unix_join_date ? $unix_join_date : time();
|
||||
$md5_once_password = $md5_once_password ? $md5_once_password : md5( $email_address . $unix_join_date . uniqid( microtime() ) );
|
||||
$ip_address = $ip_address ? $ip_address : '127.0.0.1';
|
||||
|
||||
$this->ipsclass->member = $this->__create_user_account( $email_address, $md5_once_password, $ip_address, $unix_join_date, $timezone, $dst_autocorrect );
|
||||
$return = 'SUCCESS';
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = 'SUCCESS';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Start session
|
||||
//-----------------------------------------
|
||||
|
||||
$session = $this->__create_user_session( $this->ipsclass->member );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add cookies
|
||||
//-----------------------------------------
|
||||
|
||||
$this->class_api_server->api_add_cookie_data( array( 'name' => $this->ipsclass->vars['cookie_id'] . 'member_id',
|
||||
'value' => $session['id'],
|
||||
'path' => $this->ipsclass->vars['cookie_path'],
|
||||
'domain' => $this->ipsclass->vars['cookie_domain'],
|
||||
'sticky' => 1 ) );
|
||||
|
||||
$this->class_api_server->api_add_cookie_data( array( 'name' => $this->ipsclass->vars['cookie_id'] . 'pass_hash',
|
||||
'value' => $session['member_login_key'],
|
||||
'path' => $this->ipsclass->vars['cookie_path'],
|
||||
'domain' => $this->ipsclass->vars['cookie_domain'],
|
||||
'sticky' => 1 ) );
|
||||
|
||||
$this->class_api_server->api_add_cookie_data( array( 'name' => $this->ipsclass->vars['cookie_id'] . 'session_id',
|
||||
'value' => $session['_session_id'],
|
||||
'path' => $this->ipsclass->vars['cookie_path'],
|
||||
'domain' => $this->ipsclass->vars['cookie_domain'],
|
||||
'sticky' => 0 ) );
|
||||
|
||||
$this->class_api_server->api_send_reply( array( 'complete' => 1,
|
||||
'response' => $return,
|
||||
'session_id' => $session->session_id,
|
||||
'member_id' => $session->member['id'],
|
||||
'log_in_key' => $session->member['member_login_key'] ) );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converge_Server::__create_user_session()
|
||||
*
|
||||
* Has to return at least the member ID, member log in key and session ID
|
||||
*
|
||||
*
|
||||
* @param array $member Array of member information
|
||||
* @return array $session Session information
|
||||
**/
|
||||
function __create_user_session( $member )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$update = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate a new log in key
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->vars['login_change_key'] OR ! $member['member_login_key'] )
|
||||
{
|
||||
$update['member_login_key'] = $this->ipsclass->converge->generate_auto_log_in_key();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Set our privacy status
|
||||
//-----------------------------------------
|
||||
|
||||
$update['login_anonymous'] = '0&1';
|
||||
|
||||
//-----------------------------------------
|
||||
// Update member?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $update ) and count( $update ) )
|
||||
{
|
||||
$this->ipsclass->DB->do_update( 'members', $update, 'id=' . $member['id'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Still here? Create a new session
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( ROOT_PATH . 'sources/classes/class_session.php' );
|
||||
$session = new session();
|
||||
$session->ipsclass =& $this->ipsclass;
|
||||
$session->time_now = time();
|
||||
$session->member = $member;
|
||||
|
||||
$session->create_member_session();
|
||||
|
||||
$session->member['_session_id'] = $session->session_id;
|
||||
|
||||
return $session->member;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converge_Server::__create_user_account()
|
||||
*
|
||||
* Routine to create a local user account
|
||||
*
|
||||
*
|
||||
* @param string $email_address Email address of user logged in
|
||||
* @param string $md5_once_password The plain text password, hashed once
|
||||
* @param string $ip_address IP Address of registree
|
||||
* @param string $unix_join_date The member's join date in unix format
|
||||
* @param string $timezone The member's timezone
|
||||
* @param string $dst_autocorrect The member's DST autocorrect settings
|
||||
* @return array $member Newly created member array
|
||||
**/
|
||||
function __create_user_account( $email_address='', $md5_once_password, $ip_address, $unix_join_date, $timezone=0, $dst_autocorrect=0 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check to make sure there's not already
|
||||
// a member registered.
|
||||
//-----------------------------------------
|
||||
|
||||
$member = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'members',
|
||||
'where' => "email='".$email_address."'" ) );
|
||||
|
||||
if ( $member['id'] )
|
||||
{
|
||||
return $member;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$unix_join_date = $unix_join_date ? $unix_join_date : time();
|
||||
$ip_address = $ip_address ? $ip_address : $this->ipsclass->ip_address;
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab module..
|
||||
//-----------------------------------------
|
||||
|
||||
require( ROOT_PATH . "sources/loginauth/login_core.php" );
|
||||
$login_core = new login_core();
|
||||
$login_core->ipsclass = $this->ipsclass;
|
||||
|
||||
//-----------------------------------------
|
||||
// Create member
|
||||
//-----------------------------------------
|
||||
|
||||
$member = $login_core->_create_local_member( $email_address, $md5_once_password, $email_address, $unix_join_date, $ip_address );
|
||||
|
||||
return $member;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converge_Server::__authenticate()
|
||||
*
|
||||
* Checks to see if the request is allowed
|
||||
*
|
||||
* @param string $key Authenticate Key
|
||||
* @param string $product_id Product ID
|
||||
* @access Private
|
||||
* @return string Error message, if any
|
||||
**/
|
||||
function __authenticate( $key, $product_id )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check converge users API DB
|
||||
//-----------------------------------------
|
||||
|
||||
$info = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'converge_local',
|
||||
'where' => "converge_product_id=" . intval($product_id) . " AND converge_active=1 AND converge_api_code='{$key}'" ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Got a user?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $info['converge_api_code'] )
|
||||
{
|
||||
$this->class_api_server->api_send_error( 100, 'Unauthorized User' );
|
||||
return FALSE;
|
||||
}
|
||||
else if ( CVG_IP_MATCH AND ( $this->ipsclass->my_getenv('REMOTE_ADDR') != $info['converge_ip_address'] ) )
|
||||
{
|
||||
$this->class_api_server->api_send_error( 101, 'IP ADDRESS not registered' );
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,591 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Script type
|
||||
*
|
||||
*/
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
define( 'IPB_LOAD_SQL' , 'queries' );
|
||||
|
||||
require_once( '../init.php' );
|
||||
|
||||
//===========================================================================
|
||||
// MAIN PROGRAM
|
||||
//===========================================================================
|
||||
|
||||
$INFO = array();
|
||||
|
||||
//--------------------------------
|
||||
// Load our classes
|
||||
//--------------------------------
|
||||
|
||||
require_once ROOT_PATH . "sources/ipsclass.php";
|
||||
require_once KERNEL_PATH . "class_converge.php";
|
||||
require_once ROOT_PATH . "conf_global.php";
|
||||
|
||||
# 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;
|
||||
|
||||
//--------------------------------
|
||||
// Set up our vars
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->parse_incoming();
|
||||
|
||||
//--------------------------------
|
||||
// Set converge
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->converge = new class_converge( $ipsclass->DB );
|
||||
|
||||
//--------------------------------
|
||||
// Start off the cache array
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->cache_array = array('components','banfilters', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'forum_cache', 'moderators', 'stats', 'languages' );
|
||||
|
||||
//===========================================================================
|
||||
// Get cache...
|
||||
//===========================================================================
|
||||
|
||||
$ipsclass->init_load_cache( $ipsclass->cache_array );
|
||||
|
||||
//--------------------------------
|
||||
// Set debug mode
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->DB->set_debug_mode( $ipsclass->vars['sql_debug'] == 1 ? intval($_GET['debug']) : 0 );
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the FUNC
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->initiate_ipsclass();
|
||||
|
||||
//===========================================================================
|
||||
// Define Service
|
||||
//===========================================================================
|
||||
|
||||
require_once( KERNEL_PATH . 'class_api_server.php' );
|
||||
|
||||
//===========================================================================
|
||||
// Create the XML-RPC Server
|
||||
//===========================================================================
|
||||
|
||||
$server = new class_api_server();
|
||||
$webservice = new handshake_server( $ipsclass );
|
||||
$webservice->class_api_server =& $server;
|
||||
$api = $server->decode_request();
|
||||
|
||||
$server->add_object_map( $webservice, 'UTF-8' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Saying "info" or actually doing some
|
||||
// work? INfo is used by converge app to
|
||||
// ensure this file exists and to grab the
|
||||
// apps name.
|
||||
// Codes:
|
||||
// IPB : Invision Power Board
|
||||
// IPD : Invision Power Dynamic
|
||||
// IPN : Invision Power Nexus
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $_REQUEST['info'] )
|
||||
{
|
||||
@header( "Content-type: text/plain" );
|
||||
print "<info>\n";
|
||||
print "\t<productname>" . htmlspecialchars( $ipsclass->vars['board_name'] ) . "</productname>\n";
|
||||
print "\t<productcode>IPB</productcode>\n";
|
||||
print "</info>";
|
||||
exit();
|
||||
}
|
||||
//-----------------------------------------
|
||||
// Post log in:
|
||||
// This is hit after a successful converge
|
||||
// log in has been made. It's up the the local
|
||||
// app to check the incoming data, and set
|
||||
// cookies (optional)
|
||||
//-----------------------------------------
|
||||
else if ( $_REQUEST['postlogin'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$session_id = addslashes( substr( trim( $_GET['session_id'] ), 0, 32 ) );
|
||||
$key = substr( trim( $_GET['key'] ), 0, 32 );
|
||||
$member_id = intval( $_GET['member_id'] );
|
||||
$product_id = intval( $_GET['product_id'] );
|
||||
$set_cookies = intval( $_GET['cookies'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get converge
|
||||
//-----------------------------------------
|
||||
|
||||
$converge = $ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'converge_local',
|
||||
'where' => "converge_active=1 AND converge_product_id=".$product_id ) );
|
||||
//-----------------------------------------
|
||||
// Get member....
|
||||
//-----------------------------------------
|
||||
|
||||
$session = $ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'sessions',
|
||||
'where' => "id='" . $session_id . "' AND member_id=".$member_id ) );
|
||||
|
||||
if ( $session['member_id'] )
|
||||
{
|
||||
$member = $ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'members',
|
||||
'where' => "id=".$member_id ) );
|
||||
|
||||
if ( md5( $member['member_login_key'] . $converge['converge_api_code'] ) == $key )
|
||||
{
|
||||
if ( $set_cookies )
|
||||
{
|
||||
$ipsclass->my_setcookie( "member_id" , $member['id'] , 1 );
|
||||
$ipsclass->my_setcookie( "pass_hash" , $member['member_login_key'], 1 );
|
||||
}
|
||||
|
||||
$ipsclass->my_setcookie( "session_id", $session_id , -1);
|
||||
$ipsclass->stronghold_set_cookie( $member['id'], $member['member_login_key'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update session
|
||||
//-----------------------------------------
|
||||
|
||||
$ipsclass->DB->do_update( 'sessions', array( 'browser' => $ipsclass->user_agent,
|
||||
'ip_address' => $ipsclass->ip_address ), "id='" . $session_id . "'" );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Is this a partial member?
|
||||
// Not completed their sign in?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $member['members_created_remote'] )
|
||||
{
|
||||
$pmember = $ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'members_partial', 'where' => "partial_member_id={$member['id']}" ) );
|
||||
|
||||
if ( $pmember['partial_member_id'] )
|
||||
{
|
||||
$ipsclass->boink_it( $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'] . '?act=reg&CODE=complete_login&mid='.$member['id'].'&key='.$pmember['partial_date'] );
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Redirect...
|
||||
//-----------------------------------------
|
||||
|
||||
$ipsclass->boink_it( $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Redirect...
|
||||
//-----------------------------------------
|
||||
|
||||
$ipsclass->boink_it( $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$server->get_xml_rpc();
|
||||
}
|
||||
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
class handshake_server
|
||||
{
|
||||
/**
|
||||
* Defines the service for WSDL
|
||||
* @access Private
|
||||
* @var array
|
||||
*/
|
||||
var $__dispatch_map = array();
|
||||
|
||||
/**
|
||||
* IPS Global Class
|
||||
* @access Private
|
||||
* @var object
|
||||
*/
|
||||
var $ipsclass;
|
||||
|
||||
/**
|
||||
* IPS API SERVER Class
|
||||
* @access Private
|
||||
* @var object
|
||||
*/
|
||||
var $class_api_server;
|
||||
|
||||
/**
|
||||
* Converge_Server::Converge_Server()
|
||||
*
|
||||
* CONSTRUCTOR
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function handshake_server( & $ipsclass )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Set IPS CLASS
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass = $ipsclass;
|
||||
|
||||
//-----------------------------------------
|
||||
// Build dispatch list
|
||||
//-----------------------------------------
|
||||
|
||||
$this->__dispatch_map[ 'handshake_start' ] = array(
|
||||
'in' => array(
|
||||
'reg_id' => 'int',
|
||||
'reg_code' => 'string',
|
||||
'reg_date' => 'string',
|
||||
'reg_product_id' => 'int',
|
||||
'converge_url' => 'string',
|
||||
'acp_email' => 'string',
|
||||
'acp_md5_password' => 'string',
|
||||
'http_user' => 'string',
|
||||
'http_pass' => 'string' ),
|
||||
'out' => array( 'response' => 'xmlrpc' )
|
||||
);
|
||||
|
||||
$this->__dispatch_map[ 'handshake_end' ] = array(
|
||||
'in' => array(
|
||||
'reg_id' => 'int',
|
||||
'reg_code' => 'string',
|
||||
'reg_date' => 'string',
|
||||
'reg_product_id' => 'int',
|
||||
'converge_url' => 'string',
|
||||
'handshake_completed' => 'int' ),
|
||||
'out' => array( 'response' => 'xmlrpc' )
|
||||
);
|
||||
|
||||
$this->__dispatch_map[ 'handshake_remove' ] = array(
|
||||
'in' => array(
|
||||
'reg_product_id' => 'int',
|
||||
'reg_code' => 'string' ),
|
||||
'out' => array( 'response' => 'xmlrpc' )
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* handshake_server::handshake_start()
|
||||
*
|
||||
* Returns all data...
|
||||
*
|
||||
* @param integer $reg_id Converge reg ID
|
||||
* @param string $reg_code Converge API Code (MUST BE PRESENT IN ALL RETURNED API REQUESTS).
|
||||
* @param integer $reg_date Unix stamp of converge request start time
|
||||
* @param integer $reg_product_id Converge product ID (MUST BE PRESENT IN ALL RETURNED API REQUESTS)
|
||||
* @param string $converge_url Converge application base url (no slashes or paths)
|
||||
* @return xml
|
||||
**/
|
||||
function handshake_start( $reg_id='', $reg_code='', $reg_date='', $reg_product_id='', $converge_url='', $acp_email='', $acp_md5_password='', $http_user='', $http_pass='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check ACP user
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $acp_email AND ! $acp_md5_password )
|
||||
{
|
||||
$this->class_api_server->api_send_error( 500, 'Missing ACP Email address and/or ACP Password' );
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->converge->converge_load_member( $acp_email );
|
||||
|
||||
if ( ! $this->ipsclass->converge->member['converge_id'] )
|
||||
{
|
||||
$this->class_api_server->api_send_error( 501, 'ACP Email or Password Incorrect' );
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get member
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_query( array(
|
||||
'select' => 'm.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "id=".intval($this->ipsclass->converge->member['converge_id']),
|
||||
'add_join' => array( 0 => array( 'select' => 'g.*',
|
||||
'from' => array( 'groups' => 'g' ),
|
||||
'where' => 'm.mgroup=g.g_id',
|
||||
'type' => 'inner'
|
||||
)
|
||||
)
|
||||
) );
|
||||
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
$member = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we an admin?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $member['g_access_cp'] != 1 )
|
||||
{
|
||||
$this->class_api_server->api_send_error( 501, 'ACP Email or Password Incorrect' );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check password...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->converge->converge_authenticate_member( $acp_md5_password ) != TRUE )
|
||||
{
|
||||
$this->class_api_server->api_send_error( 501, 'ACP Email or Password Incorrect' );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Just send it all back and start
|
||||
// A row in the converge_local table with
|
||||
// the info, but don't flag as active...
|
||||
//-----------------------------------------
|
||||
|
||||
$reply = array( 'master_response' => 1,
|
||||
'reg_id' => $reg_id,
|
||||
'reg_code' => $reg_code,
|
||||
'reg_date' => $reg_date,
|
||||
'reg_product_id' => $reg_product_id,
|
||||
'converge_url' => $converge_url );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add into DB
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'converge_local', array( 'converge_api_code' => $reg_code,
|
||||
'converge_product_id' => $reg_product_id,
|
||||
'converge_added' => $reg_date,
|
||||
'converge_ip_address' => $this->ipsclass->my_getenv('REMOTE_ADDR'),
|
||||
'converge_url' => $converge_url,
|
||||
'converge_active' => 0,
|
||||
'converge_http_user' => $http_user,
|
||||
'converge_http_pass' => $http_pass ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Send reply...
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$this->class_api_server->api_send_reply( $reply );
|
||||
}
|
||||
|
||||
/**
|
||||
* handshake_server::handshake_end()
|
||||
*
|
||||
* Returns all data...
|
||||
*
|
||||
* @param integer $reg_id Converge reg ID
|
||||
* @param string $reg_code Converge API Code (MUST BE PRESENT IN ALL RETURNED API REQUESTS).
|
||||
* @param integer $reg_date Unix stamp of converge request start time
|
||||
* @param integer $reg_product_id Converge product ID (MUST BE PRESENT IN ALL RETURNED API REQUESTS)
|
||||
* @param string $converge_url Converge application base url (no slashes or paths)
|
||||
* @param integer $handshake_completed All done flag
|
||||
* @return xml
|
||||
**/
|
||||
function handshake_end( $reg_id='', $reg_code='', $reg_date='', $reg_product_id='', $converge_url='', $handshake_completed='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab data from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$converge = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'converge_local',
|
||||
'where' => "converge_api_code='".$reg_code."' AND converge_product_id=".$reg_product_id ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Update as done...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $converge['converge_api_code'] )
|
||||
{
|
||||
$this->ipsclass->DB->do_update( 'converge_local', array( 'converge_active' => 0 ), "converge_url = '".$converge_url."'" );
|
||||
$this->ipsclass->DB->do_update( 'converge_local', array( 'converge_active' => 1 ), "converge_api_code = '".$reg_code."'" );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update the settings...
|
||||
//-----------------------------------------
|
||||
|
||||
require( ROOT_PATH . "sources/action_admin/settings.php" );
|
||||
$settings = new ad_settings();
|
||||
$settings->ipsclass =& $this->ipsclass;
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out some vars
|
||||
//-----------------------------------------
|
||||
|
||||
$_full_url = preg_replace( "#/$#", "", $converge_url ) . '/?p='.$reg_product_id;
|
||||
|
||||
//-----------------------------------------
|
||||
// Update...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_update( "conf_settings", array( "conf_value" => 1 ) , "conf_key='ipconverge_enabled'" );
|
||||
$this->ipsclass->DB->do_update( "conf_settings", array( "conf_value" => $converge_url ) , "conf_key='ipconverge_url'" );
|
||||
$this->ipsclass->DB->do_update( "conf_settings", array( "conf_value" => $reg_product_id ) , "conf_key='ipconverge_pid'" );
|
||||
$this->ipsclass->DB->do_update( 'conf_settings', array( 'conf_value' => 'converge' ), "conf_key='ipbli_key'" );
|
||||
$this->ipsclass->DB->do_update( 'conf_settings', array( 'conf_value' => 'email' ) , "conf_key='ipbli_usertype'" );
|
||||
|
||||
$settings->setting_rebuildcache();
|
||||
|
||||
//-----------------------------------------
|
||||
// Switch over log in methods
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_update( "login_methods", array( "login_enabled" => 0 ) );
|
||||
$this->ipsclass->DB->do_update( "login_methods", array( "login_enabled" => 1,
|
||||
"login_login_url" => $_full_url,
|
||||
"login_maintain_url" => $_full_url . '&redirect=options',
|
||||
"login_logout_url" => $_full_url . '&redirect=logout',
|
||||
"login_register_url" => $_full_url ), "login_folder_name='ipconverge'" );
|
||||
|
||||
$this->class_api_server->api_send_reply( array( 'handshake_updated' => 1 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* handshake_server::handshake_remove()
|
||||
*
|
||||
* Unconverges an application
|
||||
*
|
||||
* @param integer $reg_id Converge reg ID
|
||||
* @param string $reg_code Converge API Code (MUST BE PRESENT IN ALL RETURNED API REQUESTS).
|
||||
* @return xml
|
||||
**/
|
||||
function handshake_remove( $reg_product_id='', $reg_code='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab data from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$converge = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'converge_local',
|
||||
'where' => "converge_api_code='".$reg_code."' AND converge_product_id=".$reg_product_id ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $converge['converge_active'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Remove app stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_and_exec_query( array( 'delete' => 'converge_local',
|
||||
'where' => 'converge_product_id=' . intval( $reg_id ) ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Update the settings...
|
||||
//-----------------------------------------
|
||||
|
||||
require( ROOT_PATH . "sources/action_admin/settings.php" );
|
||||
$settings = new ad_settings();
|
||||
$settings->ipsclass =& $this->ipsclass;
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out some vars
|
||||
//-----------------------------------------
|
||||
|
||||
$_full_url = preg_replace( "#/$#", "", $converge_url ) . '/?p='.$reg_product_id;
|
||||
|
||||
//-----------------------------------------
|
||||
// Update...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_update( "conf_settings", array( "conf_value" => 0 ) , "conf_key='ipconverge_enabled'" );
|
||||
$this->ipsclass->DB->do_update( "conf_settings", array( "conf_value" => '' ) , "conf_key='ipconverge_url'" );
|
||||
$this->ipsclass->DB->do_update( "conf_settings", array( "conf_value" => 0 ) , "conf_key='ipconverge_pid'" );
|
||||
$this->ipsclass->DB->do_update( 'conf_settings', array( 'conf_value' => 'internal' ), "conf_key='ipbli_key'" );
|
||||
$this->ipsclass->DB->do_update( 'conf_settings', array( 'conf_value' => 'username' ), "conf_key='ipbli_usertype'" );
|
||||
|
||||
$settings->setting_rebuildcache();
|
||||
|
||||
//-----------------------------------------
|
||||
// Switch over log in methods
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_update( "login_methods", array( "login_enabled" => 0 ) );
|
||||
$this->ipsclass->DB->do_update( "login_methods", array( "login_enabled" => 1 ), "login_folder_name='internal'" );
|
||||
|
||||
$this->class_api_server->api_send_reply( array( 'handshake_removed' => 1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->class_api_server->api_send_reply( array( 'handshake_removed' => 0 ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
/**
|
||||
* Script type
|
||||
*
|
||||
*/
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
define( 'IPB_LOAD_SQL' , 'queries' );
|
||||
|
||||
/**
|
||||
* Matches IP address of requesting API
|
||||
* Set to 0 to not match with IP address
|
||||
*/
|
||||
define( 'CVG_IP_MATCH', 1 );
|
||||
|
||||
require_once( '../init.php' );
|
||||
|
||||
//===========================================================================
|
||||
// MAIN PROGRAM
|
||||
//===========================================================================
|
||||
|
||||
$INFO = array();
|
||||
|
||||
//--------------------------------
|
||||
// Load our classes
|
||||
//--------------------------------
|
||||
|
||||
require_once ROOT_PATH . "sources/ipsclass.php";
|
||||
require_once KERNEL_PATH . "class_converge.php";
|
||||
require_once ROOT_PATH . "conf_global.php";
|
||||
|
||||
# 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;
|
||||
|
||||
//--------------------------------
|
||||
// Set up our vars
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->parse_incoming();
|
||||
|
||||
//--------------------------------
|
||||
// Set converge
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->converge = new class_converge( $ipsclass->DB );
|
||||
|
||||
//--------------------------------
|
||||
// Start off the cache array
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->cache_array = array('components','banfilters', 'settings', 'group_cache', 'systemvars', 'skin_id_cache', 'forum_cache', 'moderators', 'stats', 'languages' );
|
||||
|
||||
//===========================================================================
|
||||
// Get cache...
|
||||
//===========================================================================
|
||||
|
||||
$ipsclass->init_load_cache( $ipsclass->cache_array );
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the FUNC
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->initiate_ipsclass();
|
||||
|
||||
//===========================================================================
|
||||
// Define Service
|
||||
//===========================================================================
|
||||
|
||||
require_once( ROOT_PATH . 'converge_local/apis/server_functions.php' );
|
||||
require_once( KERNEL_PATH . 'class_api_server.php' );
|
||||
|
||||
//===========================================================================
|
||||
// Create the XML-RPC Server
|
||||
//===========================================================================
|
||||
|
||||
$server = new class_api_server();
|
||||
$webservice = new Converge_Server( $ipsclass );
|
||||
$webservice->class_api_server =& $server;
|
||||
$api = $server->decode_request();
|
||||
|
||||
$server->add_object_map( $webservice, 'UTF-8' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Process....
|
||||
//-----------------------------------------
|
||||
|
||||
$server->get_xml_rpc();
|
||||
|
||||
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user