mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Remove direct limesurvey database call
This commit is contained in:
@@ -184,23 +184,25 @@ else
|
|||||||
//no link to limesurvey
|
//no link to limesurvey
|
||||||
echo "<p>" . T_("Limesurvey links:") . "</p>";
|
echo "<p>" . T_("Limesurvey links:") . "</p>";
|
||||||
|
|
||||||
$sql = "SELECT q.lime_sid, q.description
|
$sql = "SELECT q.lime_sid, q.description, r.rpc_url, r.username, r.password
|
||||||
FROM questionnaire as q, operator_questionnaire as oq
|
FROM questionnaire as q, operator_questionnaire as oq, remote as r
|
||||||
WHERE oq.operator_id = '$operator_id'
|
WHERE oq.operator_id = '$operator_id'
|
||||||
AND q.questionnaire_id = oq.questionnaire_id
|
AND q.questionnaire_id = oq.questionnaire_id
|
||||||
AND q.enabled = 1";
|
AND q.enabled = 1
|
||||||
|
AND r.id = q.remote_id";
|
||||||
|
|
||||||
$rs = $db->GetAll($sql);
|
$rs = $db->GetAll($sql);
|
||||||
|
|
||||||
if (!empty($rs))
|
if (!empty($rs))
|
||||||
{
|
{
|
||||||
foreach($rs as $r)
|
foreach($rs as $r)
|
||||||
{
|
{
|
||||||
$sql = "SELECT count(*)
|
//interrogate server for tokens table
|
||||||
FROM " . LIME_PREFIX ."tokens_{$r['lime_sid']}";
|
lime_rpc_init($r['rpc_url'],$r['username'],$r['password']);
|
||||||
$rs2 = $db->GetRow($sql);
|
|
||||||
|
|
||||||
if (empty($rs2))
|
$l = $limeRPC->get_summary($limeKey,$r['lime_sid'],'token_count'); //get number of tokens
|
||||||
|
|
||||||
|
if (isset($l['status']))
|
||||||
print "<p class='error'>" . T_("ERROR: No tokens table defined for LimeSurvey questionnaire") . " {$r['lime_sid']} " . T_("from questionnaire:") . " {$r['description']}</p>";
|
print "<p class='error'>" . T_("ERROR: No tokens table defined for LimeSurvey questionnaire") . " {$r['lime_sid']} " . T_("from questionnaire:") . " {$r['description']}</p>";
|
||||||
else
|
else
|
||||||
print "<p>{$r['description']}: " . T_("Tokens table exists for Limesurvey questionnaire:") . " {$r['lime_sid']}</p>";
|
print "<p>{$r['description']}: " . T_("Tokens table exists for Limesurvey questionnaire:") . " {$r['lime_sid']}</p>";
|
||||||
|
|||||||
Reference in New Issue
Block a user