mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Fixes by Alex (thank you)
Changed session backend to files to save some db processing
This commit is contained in:
@@ -39,18 +39,13 @@ include_once(dirname(__FILE__) . "/../config.inc.php");
|
||||
*/
|
||||
include_once(dirname(__FILE__) . "/../db.inc.php");
|
||||
|
||||
|
||||
//get session name from DB
|
||||
//
|
||||
$sql = "SELECT stg_value
|
||||
FROM " . LIME_PREFIX . "settings_global
|
||||
WHERE stg_name = 'SessionName'";
|
||||
|
||||
session_name($db->GetOne($sql));
|
||||
session_name(LS_SESSION_NAME);
|
||||
|
||||
session_set_cookie_params(0,QUEXS_PATH);
|
||||
|
||||
session_start();
|
||||
if ((defined('PHP_SESSION_ACTIVE') && session_status() !== PHP_SESSION_ACTIVE) || !session_id()) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
//check if the session exists or loginID not set
|
||||
if (session_id() == "" || !isset($_SESSION['loginID']))
|
||||
|
||||
@@ -140,18 +140,18 @@ if (isset($_POST['submit']))
|
||||
}
|
||||
|
||||
/* delete client from quexs and lime tables*/ //requires data-toggle-confirmation to finalize
|
||||
if (isset($_POST['delete']) && isset($_POST['uid']))
|
||||
if (isset($_GET['delete']) && isset($_GET['uid']) && isset($_GET['uname']))
|
||||
{
|
||||
$client_id = intval($_POST['delete']);
|
||||
$uid = intval($_POST['uid']);
|
||||
$uname = $_POST['uname'];
|
||||
|
||||
$client_id = intval($_GET['delete']);
|
||||
$uid = intval($_GET['uid']);
|
||||
$uname = $_GET['uname'];
|
||||
|
||||
global $db;
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
|
||||
if ($uid !=1){ //double protect superadmin from being deleted
|
||||
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
$sql = "DELETE FROM " . LIME_PREFIX . "templates_rights WHERE `uid` = '$uid' AND `uid` != 1";
|
||||
$db->Execute($sql);
|
||||
|
||||
@@ -164,20 +164,19 @@ if (isset($_POST['delete']) && isset($_POST['uid']))
|
||||
$sql = "DELETE FROM " . LIME_PREFIX . "users WHERE `uid` = '$uid' AND `uid` != 1";
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM `client_questionnaire` WHERE `client_id` = '$client_id' ";
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM `client` WHERE `client_id` = '$client_id'";
|
||||
$db->Execute($sql);
|
||||
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM `client_questionnaire` WHERE `client_id` = '$client_id' ";
|
||||
$db->Execute($sql);
|
||||
|
||||
$sql = "DELETE FROM `client` WHERE `client_id` = '$client_id'";
|
||||
$db->Execute($sql);
|
||||
|
||||
$db->CompleteTrans();
|
||||
|
||||
if ($db->CompleteTrans()) $msg = "<p class='alert alert-info'>". T_("Client with username $uname deleted") . "</p>";
|
||||
else $msg = "<p class='alert alert-warning'>". T_("ERROR deleting client with username $uname") . "</p>";
|
||||
else $msg = "<p class='alert alert-warning'>". T_("ERROR deleting client with username $uname") . "</p>";
|
||||
|
||||
unset($_POST['delete'], $_POST['uid'], $_POST['uname'], $client_id, $username, $uid);
|
||||
unset($_GET['delete'], $_GET['uid'], $_GET['uname'], $client_id, $username, $uid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -124,6 +124,9 @@ if (isset($_POST['client']) && !empty($_POST['client']))
|
||||
}
|
||||
}
|
||||
else $a = T_("Username") . " " . $client . ". " . T_("is already in use");
|
||||
|
||||
$client =""; $firstname="";$lastname="";$email=""; $time_zone_name="";
|
||||
unset($_POST['client'],$_POST['password'],$_POST['lastname'],$_POST['firstname'],$_POST['email'],$_POST['Time_zone_name']);
|
||||
}
|
||||
|
||||
$header = T_("Add a client");
|
||||
|
||||
@@ -581,6 +581,7 @@ else
|
||||
CONCAT('<a href=\'outcomes.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Outcomes for questionnaire"). " ',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-bar-chart fa-2x\'></i></a>')
|
||||
END as outcomes,
|
||||
CONCAT('<a href=\'callhistory.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Call history"). " " . TQ_("questionnaire"). " ',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-phone fa-2x\'></i></a>') as calls,
|
||||
CONCAT('<a href=\'set_outcomes.php?qid=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Set outcomes"). " \n" . TQ_("questionnaire"). " ',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-list-ol fa-2x\'></i></a>') as setoutcomes,
|
||||
CASE WHEN enabled = 0 THEN
|
||||
CONCAT('<i class=\'btn fa fa-download fa-2x\' style=\'color:lightgrey;\'></i>')
|
||||
ELSE
|
||||
@@ -604,7 +605,7 @@ else
|
||||
FROM questionnaire";
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
$columns = array("qid","description","status","enabledisable","outcomes","calls","casestatus","shifts","assample","quotareport","dataout","modify","inlime","prefill","deletee");
|
||||
$columns = array("qid","description","status","enabledisable","outcomes","calls","casestatus","shifts","assample","quotareport","dataout","modify","setoutcomes","inlime","prefill","deletee");
|
||||
xhtml_table($rs,$columns,false,"table-hover table-condensed ");
|
||||
|
||||
print "</div>";
|
||||
|
||||
@@ -197,8 +197,14 @@ if (isset($_GET['qid'])) {
|
||||
/* for default outcomes */
|
||||
if (isset($_GET['default'])) {
|
||||
|
||||
$sql = "SELECT o.*, ot.description as type,
|
||||
CONCAT('<input type=\'number\' name=\"delay[', o.outcome_id ,']\" class=\'form-control text-right\' style=\'width:7em;\' max=50000 min=0 required value=\'', o.default_delay_minutes ,'\' />') as `delay`,
|
||||
/* allow delay edit only to superadmins (currenlty admin) */
|
||||
if ($_SESSION['user'] === "admin"){
|
||||
$delay = "CONCAT('<input type=\'number\' name=\"delay[', o.outcome_id ,']\" class=\'form-control text-right\' style=\'width:7em;\' max=50000 min=0 required value=\'', o.default_delay_minutes ,'\' />') ";
|
||||
}
|
||||
else {
|
||||
$delay = "CONCAT('<span class=\'pull-right\' >', o.default_delay_minutes ,' </span>')";
|
||||
}
|
||||
$sql = "SELECT o.*, ot.description as type, $delay as `delay`,
|
||||
CONCAT('<h4> <span class=\"label label-', CASE WHEN o.tryanother = 1 THEN 'primary\">" . T_("Yes") . "' ELSE 'default\">" . T_("No") . "' END , '</span></h4>') as tryanother,
|
||||
CONCAT('<h4> <span class=\"label label-', CASE WHEN o.tryagain = 1 THEN 'primary\">" . T_("Yes") . "' ELSE 'default\">" . T_("No") . "' END , '</span></h4>') as tryagain,
|
||||
CONCAT('<h4> <span class=\"label label-', CASE WHEN o.contacted = 1 THEN 'primary\">" . T_("Yes") . "' ELSE 'default\">" . T_("No") . "' END , '</span></h4>') as contacted,
|
||||
@@ -214,9 +220,6 @@ if (isset($_GET['default'])) {
|
||||
$row = array("outcome_id","description","select","type","delay","contacted","tryanother","tryagain","eligible","require_note");
|
||||
$hdr = array(T_("Outcome ID"),T_("Description"),T_("Default"),T_("Outcome type"),T_("Delay, min"),T_("Contacted"),T_("Try another"),T_("Try again"),T_("Eligible"),T_("Require note"));
|
||||
|
||||
/* allow delay edit only to superadmins (currenlty admin) */
|
||||
if ( $_SESSION['user'] != "admin"){ unset($row[4]); unset($hdr[4]); }
|
||||
|
||||
$hid = "default";
|
||||
$value = "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user