">
+
diff --git a/admin/remote.php b/admin/remote.php
new file mode 100644
index 00000000..61bf51f9
--- /dev/null
+++ b/admin/remote.php
@@ -0,0 +1,139 @@
+
+ * @copyright Australian Consortium for Social and Political Research Inc (2011)
+ * @package queXS
+ * @subpackage admin
+ * @link http://www.acspri.org.au/ queXS was writen for ACSPRI
+ * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
+ *
+ *
+ */
+
+/**
+ * Configuration file
+ */
+include("../config.inc.php");
+
+/**
+ * Database file
+ */
+include ("../db.inc.php");
+
+/**
+ * Authentication file
+ */
+require ("auth-admin.php");
+
+/**
+ * XHTML functions
+ */
+include("../functions/functions.xhtml.php");
+
+/**
+ * Display functions
+ */
+include("../functions/functions.display.php");
+
+/**
+ * Input functions
+ */
+include("../functions/functions.input.php");
+
+/**
+ * Limesurvey functions
+ */
+include("../functions/functions.limesurvey.php");
+
+$css = array(
+"../include/bootstrap/css/bootstrap.min.css",
+"../css/custom.css"
+ );
+$js_head = array(
+ );
+$js_foot = array(
+"../js/window.js",
+"../js/custom.js"
+ );
+global $db;
+
+xhtml_head(T_("Questionnaire services"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js")
+
+$error = false;
+
+if (isset($_POST['description']))
+{
+ $test = limerpc_init($_POST['rpc_url'],$_POST['username'],$_POST['password']);
+
+ if ($test === true) {
+ $description = $db->qstr($_POST['description']);
+ $rpc_url = $db->qstr($_POST['rpc_url']);
+ $username = $db->qstr($_POST['username']);
+ $password = $db->qstr($_POST['password']);
+ $entry_url = $db->qstr($_POST['entry_url']);
+
+ $sql = "INSERT INTO `remote` (description,rpc_url,username,password,entry_url)
+ VALUES ($description,$rpc_url,$username,$password,$entry_url)";
+
+ $db->Execute($sql);
+ } else {
+ $error = $test;
+ }
+}
+
+//view groups
+$sql = "SELECT id, rpc_url, username, description,
+ CONCAT('". TQ_("Modify") . "') as link
+ FROM remote";
+
+ $rs = $db->GetAll($sql);
+
+print "" . T_("Questionnaire services available. Services include Limesurvey remote control.") . "
";
+
+if ($error !== false) {
+ print "" . T_("Service not added. Error: ") . $error . "
";
+
+}
+
+if (empty($rs))
+ print "" . T_("No questionnaire services defined") . "
";
+else{
+ print "";
+ xhtml_table($rs,array("id","description","link"),array(T_("ID"),T_("Service"),T_("Modify")),"table table-hover");
+ print "
";
+}
+
+//add a service
+?>
+
+
diff --git a/functions/functions.limesurvey.php b/functions/functions.limesurvey.php
index 5f7d9dae..a3bbf8e1 100644
--- a/functions/functions.limesurvey.php
+++ b/functions/functions.limesurvey.php
@@ -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