2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Add ability to connect to Lime RPC servers with basic error checking

This commit is contained in:
Adam Zammit
2017-01-10 15:31:03 +11:00
parent d2f56f0a58
commit 161f5a9135
3 changed files with 171 additions and 0 deletions

View File

@@ -42,6 +42,37 @@ include_once(dirname(__FILE__).'/../config.inc.php');
*/
include_once(dirname(__FILE__).'/../db.inc.php');
/**
* JSON RPC
*/
include_once(dirname(__FILE__).'/../include/JsonRPCClient.php');
$limeRPC = "";
$limeKey = "";
function limerpc_init ($url,$user,$pass)
{
global $limeRPC;
global $limeKey;
$limeRPC = new \org\jsonrpcphp\JsonRPCClient($url);
try {
$limeKey = $limeRPC->get_session_key($user,$pass);
} catch (Exception $e) {
return $e->getMessage();
}
if (is_array($limeKey) && isset($limeKey['status'])) {
return $limeKey['status'];
}
return true;
}
/**
* Strip comments from email taken from limesurvey common functions