コード例 #1
0
    @header("Content-type: text/xml");
    print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\t\t\t<methodResponse>\n\t\t\t   <fault>\n\t\t\t      <value>\n\t\t\t         <struct>\n\t\t\t            <member>\n\t\t\t               <name>faultCode</name>\n\t\t\t               <value>\n\t\t\t                  <int>1</int>\n\t\t\t                  </value>\n\t\t\t               </member>\n\t\t\t            <member>\n\t\t\t               <name>faultString</name>\n\t\t\t               <value>\n\t\t\t                  <string>IP.Converge is not enabled from your ACP Control Panel. Log into your IP.Board ACP and visit: System -&gt; Log In Management, and click the red x icon for the IP.Converge login method to enable it.</string>\n\t\t\t               </value>\n\t\t\t               </member>\n\t\t\t            </struct>\n\t\t\t         </value>\n\t\t\t            </fault>\n\t\t\t   </methodResponse>";
    exit;
}
//===========================================================================
// Define Service
//===========================================================================
require_once IPS_KERNEL_PATH . 'classApiServer.php';
//===========================================================================
// Create the XML-RPC Server
//===========================================================================
$server = new classApiServer();
$webservice = new handshake_server($registry);
$webservice->classApiServer =& $server;
$api = $server->decodeRequest();
$server->addObjectMap($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(ipsRegistry::$settings['board_name']) . "</productname>\n";
    print "\t<productcode>IPB</productcode>\n";
コード例 #2
0
if ($user) {
    $webservice->api_user = $registry->DB()->buildAndFetch(array('select' => '*', 'from' => 'api_users', 'where' => "api_user_key='" . $user . "'"));
    if (!$webservice->api_user['api_user_id']) {
        $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->apiSendError('3', "IP.Board could not locate a valid API user with that API key");
        exit;
    }
} else {
    $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->apiSendError('4', "No API Key was sent in the request");
    exit;
}
//-----------------------------------------
// Check for IP address
//-----------------------------------------
if ($webservice->api_user['api_user_ip']) {
    if ($_SERVER['REMOTE_ADDR'] != $webservice->api_user['api_user_ip']) {
        $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->apiSendError('5', "Incorrect IP Address ({$_SERVER['REMOTE_ADDR']}). You must update the API User Key with that IP Address.");
        exit;
    }
}
//-----------------------------------------
// Add web service
//-----------------------------------------
$server->addObjectMap($webservice, IPS_DOC_CHAR_SET);
//-----------------------------------------
// Process....
//-----------------------------------------
$server->getXmlRpc();
exit;