Version 3.0.5
This commit is contained in:
1 parent
19b38c7c74
commit
1d4720f3e2
3755 files changed
+508378
-664541
No files matched your search
+166
-290
@@ -1,128 +1,58 @@
|
||||
<?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
|
||||
* Converge Handler
|
||||
* Last Updated: $Date: 2009-10-01 10:02:08 -0400 (Thu, 01 Oct 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
|
||||
* @subpackage IP.Converge
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 2.1.0
|
||||
* @version $Revision: 5190 $
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Script type
|
||||
*
|
||||
*/
|
||||
define( 'IPB_THIS_SCRIPT', 'public' );
|
||||
define( 'IPB_LOAD_SQL' , 'queries' );
|
||||
define( 'IPB_THIS_SCRIPT', 'api' );
|
||||
|
||||
require_once( '../init.php' );
|
||||
/**
|
||||
* Matches IP address of requesting API
|
||||
* Set to 0 to not match with IP address
|
||||
*/
|
||||
define( 'CVG_IP_MATCH', 1 );
|
||||
|
||||
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";
|
||||
|
||||
# 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 );
|
||||
$registry = ipsRegistry::instance();
|
||||
$registry->init();
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the FUNC
|
||||
//--------------------------------
|
||||
|
||||
$ipsclass->initiate_ipsclass();
|
||||
|
||||
//--------------------------------
|
||||
// Initialize the FUNC
|
||||
//--------------------------------
|
||||
|
||||
if ( ! $ipsclass->vars['ipconverge_public_enable'] )
|
||||
if ( ! ipsRegistry::$settings['ipconverge_enabled'] )
|
||||
{
|
||||
@header( "Content-type: text/xml" );
|
||||
print"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<methodResponse>
|
||||
<fault>
|
||||
<value>
|
||||
@@ -136,7 +66,7 @@ if ( ! $ipsclass->vars['ipconverge_public_enable'] )
|
||||
<member>
|
||||
<name>faultString</name>
|
||||
<value>
|
||||
<string>IP.Converge is not enabled from your ACP Control Panel. Log into your IP.Board ACP and visit: Tools & Settings -> IP.Converge Configuration and update "Enable IP.Converge"</string>
|
||||
<string>IP.Converge is not enabled from your ACP Control Panel. Log into your IP.Board ACP and visit: System -> Log In Management, and click the red x icon for the IP.Converge login method to enable it.</string>
|
||||
</value>
|
||||
</member>
|
||||
</struct>
|
||||
@@ -150,18 +80,18 @@ if ( ! $ipsclass->vars['ipconverge_public_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();
|
||||
$webservice = new handshake_server( $ipsclass );
|
||||
$webservice->class_api_server =& $server;
|
||||
$api = $server->decode_request();
|
||||
$server = new classApiServer();
|
||||
$webservice = new handshake_server( $registry );
|
||||
$webservice->classApiServer =& $server;
|
||||
$api = $server->decodeRequest();
|
||||
|
||||
$server->add_object_map( $webservice, 'UTF-8' );
|
||||
$server->addObjectMap( $webservice, 'UTF-8' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Saying "info" or actually doing some
|
||||
@@ -178,7 +108,7 @@ if ( $_REQUEST['info'] )
|
||||
{
|
||||
@header( "Content-type: text/plain" );
|
||||
print "<info>\n";
|
||||
print "\t<productname>" . htmlspecialchars( $ipsclass->vars['board_name'] ) . "</productname>\n";
|
||||
print "\t<productname>" . htmlspecialchars( ipsRegistry::$settings['board_name'] ) . "</productname>\n";
|
||||
print "\t<productcode>IPB</productcode>\n";
|
||||
print "</info>";
|
||||
exit();
|
||||
@@ -206,41 +136,38 @@ else if ( $_REQUEST['postlogin'] )
|
||||
// Get converge
|
||||
//-----------------------------------------
|
||||
|
||||
$converge = $ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
$converge = $registry->DB()->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'converge_local',
|
||||
'where' => "converge_active=1 AND converge_product_id=".$product_id ) );
|
||||
'where' => "converge_active=1 AND converge_product_id=" . $product_id ) );
|
||||
//-----------------------------------------
|
||||
// Get member....
|
||||
//-----------------------------------------
|
||||
|
||||
$session = $ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
|
||||
$session = $registry->DB()->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'sessions',
|
||||
'where' => "id='" . $session_id . "' AND member_id=".$member_id ) );
|
||||
|
||||
'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 ) );
|
||||
$member = IPSMember::load( $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 );
|
||||
IPSCookie::set( "member_id" , $member['member_id'] , 1 );
|
||||
IPSCookie::set( "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'] );
|
||||
IPSCookie::set( "session_id", $session_id , -1);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update session
|
||||
//-----------------------------------------
|
||||
|
||||
$ipsclass->DB->do_update( 'sessions', array( 'browser' => $ipsclass->user_agent,
|
||||
'ip_address' => $ipsclass->ip_address ), "id='" . $session_id . "'" );
|
||||
$registry->DB()->update( 'sessions', array( 'browser' => $registry->member()->user_agent,
|
||||
'ip_address' => $registry->member()->ip_address ), "id='" . $session_id . "'" );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -250,11 +177,11 @@ else if ( $_REQUEST['postlogin'] )
|
||||
|
||||
if ( $member['members_created_remote'] )
|
||||
{
|
||||
$pmember = $ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'members_partial', 'where' => "partial_member_id={$member['id']}" ) );
|
||||
$pmember = $registry->DB()->buildAndFetch( array( 'select' => '*', 'from' => 'members_partial', 'where' => "partial_member_id={$member['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'] );
|
||||
ipsRegistry::getClass('output')->silentRedirect( ipsRegistry::$settings['board_url'].'/index.'.ipsRegistry::$settings['php_ext'] . '?act=reg&do=complete_login&mid='.$member['member_id'].'&key='.$pmember['partial_date'] );
|
||||
exit();
|
||||
}
|
||||
else
|
||||
@@ -263,7 +190,7 @@ else if ( $_REQUEST['postlogin'] )
|
||||
// Redirect...
|
||||
//-----------------------------------------
|
||||
|
||||
$ipsclass->boink_it( $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'] );
|
||||
ipsRegistry::getClass('output')->silentRedirect( ipsRegistry::$settings['board_url'].'/index.'.ipsRegistry::$settings['php_ext'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -272,12 +199,12 @@ else if ( $_REQUEST['postlogin'] )
|
||||
// Redirect...
|
||||
//-----------------------------------------
|
||||
|
||||
$ipsclass->boink_it( $ipsclass->vars['board_url'].'/index.'.$ipsclass->vars['php_ext'] );
|
||||
ipsRegistry::getClass('output')->silentRedirect( ipsRegistry::$settings['board_url'].'/index.'.ipsRegistry::$settings['php_ext'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$server->get_xml_rpc();
|
||||
$server->getXmlRpc();
|
||||
}
|
||||
|
||||
|
||||
@@ -288,39 +215,43 @@ class handshake_server
|
||||
{
|
||||
/**
|
||||
* Defines the service for WSDL
|
||||
* @access Private
|
||||
* @var array
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
var $__dispatch_map = array();
|
||||
public $__dispatch_map = array();
|
||||
|
||||
/**
|
||||
* IPS Global Class
|
||||
* @access Private
|
||||
* @var object
|
||||
* Global registry
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
var $ipsclass;
|
||||
private $registry;
|
||||
|
||||
/**
|
||||
* IPS API SERVER Class
|
||||
* @access Private
|
||||
* @var object
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
var $class_api_server;
|
||||
public $classApiServer;
|
||||
|
||||
/**
|
||||
* Converge_Server::Converge_Server()
|
||||
*
|
||||
* CONSTRUCTOR
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
function handshake_server( & $ipsclass )
|
||||
public function __construct( $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Set IPS CLASS
|
||||
// Store registry reference
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass = $ipsclass;
|
||||
$this->registry = $registry;
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
|
||||
//-----------------------------------------
|
||||
// Build dispatch list
|
||||
@@ -366,26 +297,29 @@ class handshake_server
|
||||
*
|
||||
* 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
|
||||
* @access public
|
||||
* @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 mixed xml / boolean false
|
||||
**/
|
||||
function handshakeStart( $reg_id='', $reg_code='', $reg_date='', $reg_product_id='', $converge_url='', $acp_email='', $acp_md5_password='', $http_user='', $http_pass='' )
|
||||
public function handshakeStart( $reg_id='', $reg_code='', $reg_date='', $reg_product_id='', $converge_url='', $acp_email='', $acp_md5_password='', $http_user='', $http_pass='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$reg_id = intval( $reg_id );
|
||||
$reg_code = $this->ipsclass->txt_md5_clean( $reg_code );
|
||||
$reg_code = IPSText::md5Clean( $reg_code );
|
||||
$reg_date = intval( $reg_date );
|
||||
$reg_product_id = intval( $reg_product_id );
|
||||
$converge_url = $this->ipsclass->parse_clean_value( $converge_url );
|
||||
$acp_email = $this->ipsclass->parse_clean_value( $acp_email );
|
||||
$acp_md5_password = $this->ipsclass->txt_md5_clean( $acp_md5_password );
|
||||
$converge_url = IPSText::parseCleanValue( $converge_url );
|
||||
$acp_email = IPSText::parseCleanValue( $acp_email );
|
||||
$acp_md5_password = IPSText::md5Clean( $acp_md5_password );
|
||||
|
||||
$this->registry->getClass( 'class_localization' )->loadLanguageFile( array( 'api_langbits' ), 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check ACP user
|
||||
@@ -393,68 +327,38 @@ class handshake_server
|
||||
|
||||
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;
|
||||
$this->classApiServer->apiSendError( 500, $this->lang->words['missing_email'] );
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->converge->converge_load_member( $acp_email );
|
||||
|
||||
if ( ! $this->ipsclass->converge->member['converge_id'] )
|
||||
$member = IPSMember::load( $acp_email, 'extendedProfile,groups' );
|
||||
|
||||
if ( ! $member['member_id'] )
|
||||
{
|
||||
$this->class_api_server->api_send_error( 501, 'ACP Email or Password Incorrect' );
|
||||
return FALSE;
|
||||
$this->classApiServer->apiSendError( 501, $this->lang->words['bad_email'] );
|
||||
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, 'The ACP member does not have ACP access' );
|
||||
return FALSE;
|
||||
$this->classApiServer->apiSendError( 501, $this->lang->words['no_acp_access'] );
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we a root admin?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $member['mgroup'] != $this->ipsclass->vars['admin_group'] )
|
||||
{
|
||||
$this->class_api_server->api_send_error( 501, 'The ACP member is not a root admin' );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Check password...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->converge->converge_authenticate_member( $acp_md5_password ) != TRUE )
|
||||
if ( IPSMember::authenticateMember( $member['member_id'], $acp_md5_password ) != true )
|
||||
{
|
||||
$this->class_api_server->api_send_error( 501, 'ACP Email or Password Incorrect' );
|
||||
return FALSE;
|
||||
$this->classApiServer->apiSendError( 501, $this->lang->words['bad_email'] );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -476,10 +380,10 @@ class handshake_server
|
||||
// Add into DB
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'converge_local', array( 'converge_api_code' => $reg_code,
|
||||
$this->registry->DB()->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_ip_address' => my_getenv('REMOTE_ADDR'),
|
||||
'converge_url' => $converge_url,
|
||||
'converge_active' => 0,
|
||||
'converge_http_user' => $http_user,
|
||||
@@ -490,7 +394,7 @@ class handshake_server
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$this->class_api_server->api_send_reply( $reply );
|
||||
$this->classApiServer->apiSendReply( $reply );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -498,34 +402,37 @@ class handshake_server
|
||||
*
|
||||
* 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
|
||||
* @access public
|
||||
* @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 mixed xml / boolean false
|
||||
**/
|
||||
function handshakeEnd( $reg_id='', $reg_code='', $reg_date='', $reg_product_id='', $converge_url='', $handshake_completed='' )
|
||||
public function handshakeEnd( $reg_id='', $reg_code='', $reg_date='', $reg_product_id='', $converge_url='', $handshake_completed='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$reg_id = intval( $reg_id );
|
||||
$reg_code = $this->ipsclass->txt_md5_clean( $reg_code );
|
||||
$reg_code = IPSText::md5Clean( $reg_code );
|
||||
$reg_date = intval( $reg_date );
|
||||
$reg_product_id = intval( $reg_product_id );
|
||||
$converge_url = $this->ipsclass->parse_clean_value( $converge_url );
|
||||
$converge_url = IPSText::parseCleanValue( $converge_url );
|
||||
$handshake_completed = intval( $handshake_completed );
|
||||
|
||||
$this->registry->getClass( 'class_localization' )->loadLanguageFile( array( 'api_langbits' ), 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab data from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$converge = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
$converge = $this->registry->DB()->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'converge_local',
|
||||
'where' => "converge_api_code='".$reg_code."' AND converge_product_id=".$reg_product_id ) );
|
||||
'where' => "converge_api_code='" . $reg_code . "' AND converge_product_id=" . $reg_product_id ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Got it?
|
||||
@@ -533,53 +440,38 @@ class handshake_server
|
||||
|
||||
if ( $converge['converge_api_code'] )
|
||||
{
|
||||
$this->ipsclass->DB->do_update( 'converge_local', array( 'converge_active' => 0 ) );
|
||||
$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;
|
||||
$this->registry->DB()->update( 'converge_local', array( 'converge_active' => 0 ) );
|
||||
$this->registry->DB()->update( 'converge_local', array( 'converge_active' => 1 ), "converge_api_code = '" . $reg_code . "'" );
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out some vars
|
||||
// Update log in methods
|
||||
//-----------------------------------------
|
||||
|
||||
$_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,
|
||||
$this->registry->DB()->update( "login_methods", array( "login_enabled" => 1,
|
||||
"login_login_url" => '',
|
||||
"login_maintain_url" => '',
|
||||
'login_user_id' => 'email',
|
||||
"login_logout_url" => '',
|
||||
"login_register_url" => '' ), "login_folder_name='ipconverge'" );
|
||||
|
||||
$this->class_api_server->api_send_reply( array( 'handshake_updated' => 1 ) );
|
||||
$cache = array();
|
||||
|
||||
$this->registry->DB()->build( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1' ) );
|
||||
$this->registry->DB()->execute();
|
||||
|
||||
while ( $r = $this->registry->DB()->fetch() )
|
||||
{
|
||||
$cache[ $r['login_id'] ] = $r;
|
||||
}
|
||||
|
||||
ipsRegistry::cache()->setCache( 'login_methods', $cache, array( 'array' => 1 ) );
|
||||
|
||||
$this->classApiServer->apiSendReply( array( 'handshake_updated' => 1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->class_api_server->api_send_error( 500, 'Could not locate a Converge handshake to update' );
|
||||
return FALSE;
|
||||
$this->classApiServer->apiSendError( 500, $this->lang->words['no_handshake'] );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -588,26 +480,27 @@ class handshake_server
|
||||
*
|
||||
* 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
|
||||
* @access public
|
||||
* @param integer $reg_id Converge reg ID
|
||||
* @param string $reg_code Converge API Code (MUST BE PRESENT IN ALL RETURNED API REQUESTS).
|
||||
* @return mixed xml / boolean false
|
||||
**/
|
||||
function handshakeRemove( $reg_product_id='', $reg_code='' )
|
||||
public function handshakeRemove( $reg_product_id='', $reg_code='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$reg_product_id = intval( $reg_product_id );
|
||||
$reg_code = $this->ipsclass->txt_md5_clean( $reg_code );
|
||||
$reg_code = IPSText::md5Clean( $reg_code );
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab data from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$converge = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
$converge = $this->registry->DB()->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'converge_local',
|
||||
'where' => "converge_api_code='".$reg_code."' AND converge_product_id=".$reg_product_id ) );
|
||||
'where' => "converge_api_code='" . $reg_code . "' AND converge_product_id=" . $reg_product_id ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
@@ -619,50 +512,33 @@ class handshake_server
|
||||
// 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();
|
||||
$this->registry->DB()->delete( 'converge_local', 'converge_product_id=' . intval( $reg_product_id ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// 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->registry->DB()->update( "login_methods", array( "login_enabled" => 0 ), "login_folder_name='ipconverge'" );
|
||||
|
||||
$cache = array();
|
||||
|
||||
$this->registry->DB()->build( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1' ) );
|
||||
$this->registry->DB()->execute();
|
||||
|
||||
while ( $r = $this->registry->DB()->fetch() )
|
||||
{
|
||||
$cache[ $r['login_id'] ] = $r;
|
||||
}
|
||||
|
||||
ipsRegistry::cache()->setCache( 'login_methods', $cache, array( 'array' => 1 ) );
|
||||
|
||||
$this->class_api_server->api_send_reply( array( 'handshake_removed' => 1 ) );
|
||||
$this->classApiServer->apiSendReply( array( 'handshake_removed' => 1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->class_api_server->api_send_reply( array( 'handshake_removed' => 0 ) );
|
||||
$this->classApiServer->apiSendReply( array( 'handshake_removed' => 0 ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
||||
Reference in new issue
Block a user