diff --git a/.bzrignore b/.bzrignore index 7b1ec8ca..168db902 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1 +1,5 @@ no vars +./config.inc.local.php +./.htaccess +./admin/.htaccess +./include/limesurvey/admin/.htaccess diff --git a/.htaccess.example b/.htaccess.example deleted file mode 100644 index 6351c87a..00000000 --- a/.htaccess.example +++ /dev/null @@ -1,5 +0,0 @@ -AuthType Basic -AuthName "queXS CATI: Authentication Required" -AuthUserFile /var/opt/quexs/htpasswd -AuthGroupFile /var/opt/quexs/htgroup -require group interviewers diff --git a/CHANGELOG b/CHANGELOG index 7528fb92..9e138199 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,12 +1,82 @@ -required DB updates: - -ALTER TABLE `outcome` ADD `deflt` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Used as default for questionnaire outcomes' AFTER `calc`, ADD `const` TINYINT(1) UNSIGNED NOT NULL COMMENT 'Permanent outcome, used for all questionnaires, not possible to de-select' AFTER `deflt`; - -UPDATE `outcome` SET `const` = '1' WHERE `outcome`.`outcome_id` IN (1,2,3,7,9,10,14,17,18,19,30,31) ; - -ALTER TABLE `questionnaire` ADD `outcomes` VARCHAR(256) NULL DEFAULT '1,2,3,7,10' COMMENT 'coma-separated string of outcomes defined for the questionnaire' AFTER `enabled`; +queXS 1.14.0 - Changes since 1.13.1 +Changes for session authentication: + +queXS now uses the Limesurvey session based authentication system to authenticate all users. +Sessions are stored in the lime_sessions table and are managed by adodb. + +If this is a fresh install - you can ignore the notes below. Otherwise - please read through +the following for converting from directory based authentication to session based authentication. + +File changes for session authentication: + +If you have used the example .htaccess files or created your own, and you want to move to purely +session based authentication, you can remove these files. They are typcially at these locations: + +.htaccess +client/.htaccess +admin/.htaccess +include/limesurvey/.htaccess +include/limesurvey/admin/.htaccess + +This will remove restrictions for access via directory based authentication and rely solely on session authentication. + +Database changes for session authentication: + +These queries will: +1. Make the first queXS user an admin user, and assign them the password "password" +2. Make all other users regular users, and assign them the password "password" +3. Make all clients regular clients, and assign them the password "password" + +Once you have run these - please go to the operator management page and update passwords for all users. + +/* Make the first user the admin user - with default password of: password */ +INSERT INTO `lime_users` (`users_name`, `password`, `full_name`, `parent_id`, `lang`, `superadmin`) +SELECT username, '0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438', firstName, 0, 'auto', 1 +FROM operator +WHERE operator_id = 1; + +/* Make all other users operators - with default password of: password */ +INSERT INTO `lime_users` (`users_name`, `password`, `full_name`, `parent_id`, `lang`, `superadmin`) +SELECT username, '0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438', firstName, 1, 'auto', 0 +FROM operator +WHERE operator_id != 1; + +/* Make all clients - with default password of: password */ +INSERT INTO `lime_users` (`users_name`, `password`, `full_name`, `parent_id`, `lang`, `superadmin`) +SELECT username, '0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438', firstName, 1, 'auto', 0 +FROM client +WHERE 1; + +/* Remove redundant table */ +DROP TABLE `sessions2`; + + +queXS 1.13.1 - Changes since 1.13.0 + +Fixed Bug: Remove references to old DEFAULT_TIME_ZONE config constant (use get_settings instead) +Fixed Bug: lp:1480880 - disable create new questionnaire if no active Limesurvey available +Fixed Bug: Update FreePBX compatability to 2.11 / Make IAX extensions start from 1000 +Fixed Bug: Checkbox group selection and HTML errors in operator / skills / assignment pages +Fixed Bug: Max call attempts should be temporary outcome as value can change +Fixed Bug: Fix sample import given new database structure (sample_var table) +Fixed Bug: lp:1408870 Add "Maximum attempts reached" as an outcome +Fixed Bug: PHP notices when using call history + +New Feature: Pre-generation of cases and copying of sample variables to Limesurvey attributes for "Web First" then CATI methodology + +Updated translations from Launchpad - Thank you! + +Database updates required: + +/* Fix max attempt outcomes */ + +DELETE FROM `outcome` WHERE outcome_id IN (42,43,44,45); +INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(42, '3.90', 'Max call attempts reached (Unknown eligibility)', 0, 1, 0, 1, 1, 0, 0, 'UH'); +INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(43, '3.90', 'Max calls reached (Unknown eligibility)', 0, 1, 0, 1, 1, 0, 0, 'UH'); +INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(44, '2.30', 'Max call attempts reached (Eligible)', 0, 1, 0, 1, 1, 1, 0, 'O'); +INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(45, '2.30', 'Max calls reached (Eligible)', 0, 1, 0, 1, 1, 1, 0, 'O'); queXS 1.13.0 - Changes since 1.12.1 diff --git a/DB update CHANGELOG b/DB update CHANGELOG new file mode 100644 index 00000000..7092e214 --- /dev/null +++ b/DB update CHANGELOG @@ -0,0 +1,15 @@ +required DB updates: + +ALTER TABLE `outcome` ADD `deflt` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Used as default for questionnaire outcomes' AFTER `calc`, ADD `const` TINYINT(1) UNSIGNED NOT NULL COMMENT 'Permanent outcome, used for all questionnaires, not possible to de-select' AFTER `deflt`; + +UPDATE `outcome` SET `const` = '1' WHERE `outcome`.`outcome_id` IN (1,2,3,7,9,10,14,17,18,19,30,31) ; + +ALTER TABLE `questionnaire` ADD `outcomes` VARCHAR(256) NULL DEFAULT '1,2,3,7,10' COMMENT 'coma-separated string of outcomes defined for the questionnaire' AFTER `enabled`; + + + +queXS 1.13.0 - Changes since 1.12.1 +--- + + + diff --git a/admin/.htaccess.example b/admin/.htaccess.example deleted file mode 100644 index 416f0f13..00000000 --- a/admin/.htaccess.example +++ /dev/null @@ -1,5 +0,0 @@ -AuthType Basic -AuthName "queXS CATI: Authentication Required" -AuthUserFile /var/opt/quexs/htpasswd -AuthGroupFile /var/opt/quexs/htgroup -require group admin diff --git a/admin/addshift.php b/admin/addshift.php index ffed2451..271e90fc 100644 --- a/admin/addshift.php +++ b/admin/addshift.php @@ -39,6 +39,11 @@ include ("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/assignsample.php b/admin/assignsample.php index 61c563a0..d4522b5a 100644 --- a/admin/assignsample.php +++ b/admin/assignsample.php @@ -40,6 +40,11 @@ include("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/assigntimeslots.php b/admin/assigntimeslots.php index 1e92ec99..ff191027 100644 --- a/admin/assigntimeslots.php +++ b/admin/assigntimeslots.php @@ -40,6 +40,11 @@ include("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/auth-admin.php b/admin/auth-admin.php new file mode 100644 index 00000000..b650c000 --- /dev/null +++ b/admin/auth-admin.php @@ -0,0 +1,70 @@ + + * @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2013 + * @package queXS + * @subpackage user + * @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_once(dirname(__FILE__) . "/../config.inc.php"); + +/** + * Database file + */ +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_start(); + +//check if the session exists or loginID not set +if (session_id() == "" || !isset($_SESSION['loginID'])) +{ + //need to log in + header('Location: ../include/limesurvey/admin/admin.php'); + die(); +} + +if ($_SESSION['USER_RIGHT_SUPERADMIN'] != 1) +{ + include_once(dirname(__FILE__) . "/../lang.inc.php"); + include_once(dirname(__FILE__) . "/../functions/functions.xhtml.php"); + xhtml_head(); + print "

" . T_("You do not have permission to access this area") . "

"; + print "

" . T_("Logout") . "

"; + xhtml_foot(); + die(); +} diff --git a/admin/availability.php b/admin/availability.php index 892d438a..0808e9bf 100644 --- a/admin/availability.php +++ b/admin/availability.php @@ -39,6 +39,12 @@ include ("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + + /** * XHTML functions */ diff --git a/admin/availabilitygroup.php b/admin/availabilitygroup.php index 4b7db070..2029f348 100644 --- a/admin/availabilitygroup.php +++ b/admin/availabilitygroup.php @@ -40,6 +40,11 @@ include("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/bulkappointment.php b/admin/bulkappointment.php index 567bc8f6..e3afc406 100644 --- a/admin/bulkappointment.php +++ b/admin/bulkappointment.php @@ -44,6 +44,11 @@ include ("../functions/functions.xhtml.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * Operator functions */ diff --git a/admin/callhistory.php b/admin/callhistory.php index 49fce497..102e3cca 100644 --- a/admin/callhistory.php +++ b/admin/callhistory.php @@ -39,6 +39,11 @@ include ("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ @@ -100,18 +105,21 @@ if ($operator_id) if (!isset($_GET['csv'])) $sql .= " LIMIT 500"; - else $sql .= " LIMIT 5000"; +// else $sql .= " LIMIT 5000"; no limit when using CSV $rs = $db->Execute($sql); if (empty($rs)) { + xhtml_head(T_("Call History List"),true,$css,$js_head); print "

" . T_("No calls ever made") . "

"; } else { if (isset($_GET['csv'])) - { - $qds = str_replace(' ','_',$_GET['dq']); $smpds = str_replace(' ','_',$_GET['ds']); + { + $qds = $smpds = ""; + if (isset($_GET['dq'])) $qds = str_replace(' ','_',$_GET['dq']); + if (isset($_GET['ds'])) $smpds = str_replace(' ','_',$_GET['ds']); $fn = "callhistory-" . $qds . $smpds . date("_d-M-Y_H-i") . ".csv"; header("Content-Type: text/csv"); @@ -160,7 +168,17 @@ if ($operator_id) print "

" . T_("Sample") . " ID: $sid " . $ds . "

"; unset($datacol[5]); unset($headers[5]); } - print "  " . T_("Download Call History List") . " + print "  " . T_("Download Call History List") . " "; // " . T_("Go to Call History Report") . "  xhtml_table($rs,$datacol,$headers,"tclass",false,false,"bs-table"); diff --git a/admin/callrestrict.php b/admin/callrestrict.php index a078dbba..2d6c591c 100644 --- a/admin/callrestrict.php +++ b/admin/callrestrict.php @@ -39,6 +39,11 @@ include ("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/casesbyoutcome.php b/admin/casesbyoutcome.php index 61704e6d..cb3d5b48 100644 --- a/admin/casesbyoutcome.php +++ b/admin/casesbyoutcome.php @@ -39,6 +39,11 @@ include ("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/casestatus.php b/admin/casestatus.php index 25fbfb70..f44e201a 100644 --- a/admin/casestatus.php +++ b/admin/casestatus.php @@ -12,6 +12,11 @@ include_once(dirname(__FILE__).'/../config.inc.php'); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/centreinfo.php b/admin/centreinfo.php index cd14a844..9bc2929b 100644 --- a/admin/centreinfo.php +++ b/admin/centreinfo.php @@ -40,6 +40,11 @@ include("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/clientquestionnaire.php b/admin/clientquestionnaire.php index 17385e3f..67ad774d 100644 --- a/admin/clientquestionnaire.php +++ b/admin/clientquestionnaire.php @@ -39,6 +39,11 @@ include ("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/clients.php b/admin/clients.php index c59cb1ef..f9309c2a 100644 --- a/admin/clients.php +++ b/admin/clients.php @@ -42,6 +42,11 @@ include ("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ @@ -56,6 +61,7 @@ if (isset($_POST['client'])) { $client = $db->qstr($_POST['client'],get_magic_quotes_gpc()); $firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc()); + $email = $db->qstr($_POST['email'],get_magic_quotes_gpc()); $lastname = $db->qstr($_POST['lastname'],get_magic_quotes_gpc()); $time_zone_name = $db->qstr($_POST['Time_zone_name'],get_magic_quotes_gpc()); @@ -67,17 +73,15 @@ if (isset($_POST['client'])) if ($db->Execute($sql)) { - if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) - { - //Get password and add it to the configured htpassword - include_once("../functions/functions.htpasswd.php"); - $htp = New Htpasswd(HTPASSWD_PATH); - $htg = New Htgroup(HTGROUP_PATH); - - $htp->addUser($_POST['client'],$_POST['password']); - $htg->addUserToGroup($_POST['client'],HTGROUP_CLIENT); - } + include_once("../include/limesurvey/admin/classes/core/sha256.php"); + //Insert into lime_users + $sql = "INSERT INTO " . LIME_PREFIX . "users (`users_name`,`password`,`full_name`,`parent_id`,`superadmin`,`email`,`lang`) + VALUES ($client, '" . SHA256::hashing($_POST['password']) . "',$firstname,1,0,$email,'auto')"; + + $db->Execute($sql); + + $a = T_("Added: $client"); } else @@ -142,23 +146,20 @@ function generate() {

-

-
- +
   " class="btn btn-default fa" /> 
-
@@ -166,7 +167,11 @@ function generate() {
-
+
+
+ + +
"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",get_setting("DEFAULT_TIME_ZONE")),true,"pull-left"); ?> diff --git a/admin/dataoutput.php b/admin/dataoutput.php index 5874df97..1ad770b3 100644 --- a/admin/dataoutput.php +++ b/admin/dataoutput.php @@ -1,4 +1,5 @@ -GetRow($sql); - } + } else $rs = array(); print "" . T_("Go back") . ""; ?> diff --git a/admin/import.php b/admin/import.php index 63b8132a..5cbc9581 100644 --- a/admin/import.php +++ b/admin/import.php @@ -8,6 +8,11 @@ */ include ("../config.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/index.php b/admin/index.php index d3c4c1ab..10aa11b8 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,6 +1,5 @@ - + diff --git a/admin/new.php b/admin/new.php index 1f8b82bc..4b648b88 100644 --- a/admin/new.php +++ b/admin/new.php @@ -11,6 +11,11 @@ include ("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ @@ -394,4 +399,4 @@ else { ?> \ No newline at end of file +?> diff --git a/admin/operatorlist.php b/admin/operatorlist.php index f459f787..8a6d95d2 100644 --- a/admin/operatorlist.php +++ b/admin/operatorlist.php @@ -39,6 +39,11 @@ include_once(dirname(__FILE__).'/../config.inc.php'); */ include_once(dirname(__FILE__).'/../db.inc.php'); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ @@ -50,30 +55,50 @@ $msg = ""; if (isset($_POST['submit'])) { $operator_id = intval($_POST['operator_id']); - $chat_enable = $voip = $enabled = 0; + $superadmin = $chat_enable = $voip = $enabled = 0; if (isset($_POST['voip'])) $voip = 1; if (isset($_POST['chat_enable'])) $chat_enable = 1; if (isset($_POST['enabled'])) $enabled = 1; + if (isset($_POST['admin'])) $superadmin = 1; - if (HTPASSWD_PATH !== false && $_POST['existing_username'] != $_POST['username'] && empty($_POST['password'])) - { - $msg = "

" . T_("If changing usernames, you must specify a new password") . "

"; - } - else - { - $sql = "UPDATE operator - SET username = " . $db->qstr($_POST['username']) . ", - lastName = " . $db->qstr($_POST['lastName']) . ", - firstName = " . $db->qstr($_POST['firstName']) . ", - chat_user = " . $db->qstr($_POST['chat_user']) . ", - chat_password = " . $db->qstr($_POST['chat_password']) . ", - Time_zone_name = " . $db->qstr($_POST['timezone']) . ", - voip = $voip, enabled = $enabled, chat_enable = $chat_enable - WHERE operator_id = $operator_id"; + //get username + $sql = "SELECT username + FROM operator + WHERE operator_id = $operator_id"; - $rs = $db->Execute($sql); + $uname = $db->GetOne($sql); - if (!empty($rs)) + $sql = "UPDATE " . LIME_PREFIX . "users + SET users_name = " . $db->qstr($_POST['username']) . ", + email = " . $db->qstr($_POST['email']) . ", + full_name = " . $db->qstr($_POST['firstName']) . ", + superadmin = $superadmin"; + + if (!empty($_POST['password'])) + { + include_once("../include/limesurvey/admin/classes/core/sha256.php"); + $sql .= ", password = '" . SHA256::hashing($_POST['password']) . "' "; + } + + $sql .= " WHERE users_name = '$uname'"; + + $rs = $db->Execute($sql); + + if (!empty($rs)) + { + $sql = "UPDATE operator + SET username = " . $db->qstr($_POST['username']) . ", + lastName = " . $db->qstr($_POST['lastName']) . ", + firstName = " . $db->qstr($_POST['firstName']) . ", + chat_user = " . $db->qstr($_POST['chat_user']) . ", + chat_password = " . $db->qstr($_POST['chat_password']) . ", + Time_zone_name = " . $db->qstr($_POST['timezone']) . ", + voip = $voip, enabled = $enabled, chat_enable = $chat_enable + WHERE operator_id = $operator_id"; + + $rs = $db->Execute($sql); + + if (!empty($rs)) { //only update extension if we aren't on a case $sql = "SELECT case_id @@ -89,38 +114,28 @@ if (isset($_POST['submit'])) WHERE current_operator_id= $operator_id"; $db->Execute($sql); - + if (!empty($_POST['extension_id'])) { $sql = "UPDATE extension SET current_operator_id = $operator_id WHERE extension_id = " . intval($_POST['extension_id']); - + $db->Execute($sql); } } - - if (HTPASSWD_PATH !== false && !empty($_POST['password'])) - { - //update password in htaccess - include_once(dirname(__FILE__).'/../functions/functions.htpasswd.php'); - $htp = New Htpasswd(HTPASSWD_PATH); - $htp->deleteUser($_POST["existing_username"]); - $htp->deleteUser($_POST["username"]); - $htp->addUser($_POST["username"],$_POST["password"]); - $htg = New Htgroup(HTGROUP_PATH); - $htg->deleteUserFromGroup($_POST["existing_username"],HTGROUP_INTERVIEWER); - $htg->addUserToGroup($_POST["username"],HTGROUP_INTERVIEWER); - } - - $msg = "

" . T_("Successfully updated user") . ": " . $_POST['username'] . "

"; - } - else - { - $msg = "

" . T_("Failed to update user") . ": " . $_POST['username'] . " " . T_("Please make sure the username is unique") . "

"; - } - } - $_GET['edit'] = $operator_id; + $msg = "

" . T_("Successfully updated user") . ": " . $_POST['username'] . "

"; + } + else + { + $msg = "

" . T_("Failed to update user") . ": " . $_POST['username'] . " " . T_("Please make sure the username is unique") . "

"; + } + } + else + { + $msg = "

" . T_("Failed to update user") . ": " . $_POST['username'] . " " . T_("Please make sure the username is unique") . "

"; + } + $_GET['edit'] = $operator_id; } @@ -130,9 +145,10 @@ if (isset($_GET['edit'])) $operator_id = intval($_GET['edit']); - $sql = "SELECT * - FROM operator - WHERE operator_id = $operator_id"; + $sql = "SELECT o.*,l.superadmin,l.email,l.parent_id + FROM operator as o, " . LIME_PREFIX ."users as l + WHERE o.operator_id = $operator_id + AND l.users_name = o.username"; $rs = $db->GetRow($sql); @@ -200,7 +216,6 @@ function generate() {
-
"/>
@@ -209,7 +224,6 @@ function generate() {
-
@@ -218,6 +232,10 @@ function generate() {
+
+ +
+
@@ -245,6 +263,10 @@ function generate() {
+
+
+ +
" data-off="" data-offstyle="primary" data-onstyle="danger" value="1"/>
@@ -380,11 +402,11 @@ if ($display) $titles[] = T_("Win file");//Windows VoIP $titles[] = T_("*nix flle");//*nix VoIP } - echo "
"; + echo "
"; xhtml_table($rs,$columns,$titles); echo "
"; - echo "
+ echo "
diff --git a/admin/operatorperformance.php b/admin/operatorperformance.php index 0b81c3a9..8b796a75 100644 --- a/admin/operatorperformance.php +++ b/admin/operatorperformance.php @@ -38,6 +38,11 @@ include_once(dirname(__FILE__).'/../config.inc.php'); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/operatorquestionnaire.php b/admin/operatorquestionnaire.php index b6c5cc93..b6a9760d 100644 --- a/admin/operatorquestionnaire.php +++ b/admin/operatorquestionnaire.php @@ -39,6 +39,11 @@ include ("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ @@ -159,7 +164,7 @@ xhtml_head(T_("Assign operators to questionnaires"),true,array("../include/boots print "questionnaire_id = new Array("; $s = ""; - +$q = array(); foreach($questionnaires as $q) { $s .= "'{$q['questionnaire_id']}',"; @@ -246,7 +251,7 @@ foreach($questionnaires as $q) } print ""; - +$v = array(); foreach($operators as $v) { diff --git a/admin/operators.php b/admin/operators.php index c54aa46b..657fb80c 100644 --- a/admin/operators.php +++ b/admin/operators.php @@ -39,6 +39,11 @@ include ("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ @@ -52,6 +57,8 @@ $a = false; if (isset($_POST['operator']) && isset($_POST['adduser'])) { $operator = $db->qstr($_POST['operator'],get_magic_quotes_gpc()); + $email= $db->qstr($_POST['email'],get_magic_quotes_gpc()); + $password = $db->qstr($_POST['password'],get_magic_quotes_gpc()); $firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc()); $lastname = $db->qstr($_POST['lastname'],get_magic_quotes_gpc()); $chat_user = $db->qstr($_POST['chat_user'],get_magic_quotes_gpc()); @@ -91,12 +98,14 @@ if (isset($_POST['operator']) && isset($_POST['adduser'])) } $supervisor = 0; $temporary = 0; + $admin = 0; $refusal = 0; $voip = 0; $chat = 0; if (isset($_POST['supervisor']) && $_POST['supervisor'] == "on") $supervisor = 1; if (isset($_POST['refusal']) && $_POST['refusal'] == "on") $refusal = 1; if (isset($_POST['temporary']) && $_POST['temporary'] == "on") $temporary = 1; + if (isset($_POST['admin']) && $_POST['admin'] == "on") $admin = 1; if (isset($_POST['voip']) && $_POST['voip'] == "on") $voip = 1; if (isset($_POST['chat_enable']) && $_POST['chat_enable'] == "on") $chat = 1; @@ -108,7 +117,15 @@ if (isset($_POST['operator']) && isset($_POST['adduser'])) if ($db->Execute($sql)) { - $oid = $db->Insert_ID(); + $oid = $db->Insert_ID(); + + include_once("../include/limesurvey/admin/classes/core/sha256.php"); + + //Insert into lime_users + $sql = "INSERT INTO " . LIME_PREFIX . "users (`users_name`,`password`,`full_name`,`parent_id`,`superadmin`,`email`,`lang`) + VALUES ($operator, '" . SHA256::hashing($_POST['password']) . "',$firstname,1,$admin,$email,'auto')"; + + $db->Execute($sql); if (FREEPBX_PATH !== false) { @@ -130,20 +147,6 @@ if (isset($_POST['operator']) && isset($_POST['adduser'])) $db->Execute($sql); } - if (HTPASSWD_PATH !== false && HTGROUP_PATH !== false) - { - //Get password and add it to the configured htpassword - include_once("../functions/functions.htpasswd.php"); - $htp = New Htpasswd(HTPASSWD_PATH); - $htg = New Htgroup(HTGROUP_PATH); - - $htp->addUser($_POST['operator'],$_POST['password']); - $htg->addUserToGroup($_POST['operator'],HTGROUP_INTERVIEWER); - - if ($supervisor) - $htg->addUserGroup(HTGROUP_ADMIN); - } - $a = "

" . T_("Added operator :") . " " . $operator . "

"; if (FREEPBX_PATH !== false) @@ -183,7 +186,7 @@ if ($a) { else { echo "
"; //echo "

" . T_("Adding an operator here will give the user the ability to call cases") . "" . T_("Assign Operator to Questionnaire") . "" . T_("tool") . ".

"; - echo "

" . T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here.") . "

"; + //echo "

" . T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here.") . "

"; echo "

" . T_("The username and extension must be unique for each operator.") . "

"; echo "
"; } @@ -242,16 +245,14 @@ function generate() {
-
-
+
" class="btn btn-default fa" /> 
-
@@ -260,6 +261,10 @@ function generate() {
+
+ +
+
@@ -295,6 +300,10 @@ function generate() {
" data-off="" />
+
+ +
" data-off="" data-offstyle="primary" data-onstyle="danger"/>
+
" data-off="" data-offstyle="danger" checked="checked"/>
diff --git a/admin/operatorskill.php b/admin/operatorskill.php index d115c0ce..48cef0ff 100644 --- a/admin/operatorskill.php +++ b/admin/operatorskill.php @@ -39,6 +39,11 @@ include ("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/outcomes.php b/admin/outcomes.php index 26aa5208..a187d901 100644 --- a/admin/outcomes.php +++ b/admin/outcomes.php @@ -12,6 +12,11 @@ include_once(dirname(__FILE__).'/../config.inc.php'); */ include_once(dirname(__FILE__).'/../db.inc.php'); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/process.php b/admin/process.php index c6da8ad4..0ca6e49c 100644 --- a/admin/process.php +++ b/admin/process.php @@ -39,6 +39,11 @@ include (dirname(__FILE__) . "/../config.inc.php"); */ include (dirname(__FILE__) . "/../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * Process */ diff --git a/admin/questionnairelist.php b/admin/questionnairelist.php index e99658be..81675919 100644 --- a/admin/questionnairelist.php +++ b/admin/questionnairelist.php @@ -39,6 +39,11 @@ include("../config.inc.php"); */ include("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ @@ -533,7 +538,7 @@ else if (isset($_GET['delete'])) } else { - xhtml_head(T_("Questionnaire management"),true,$css,$js_head, false, false, false, "Questionnaire list"); + xhtml_head(T_("Questionnaire management"),true,$css,$js_head, false, false, false,T_("Questionnaire list")); echo "
 " . T_("Go back") . "  " . T_("Create a new questionnaire") . " diff --git a/admin/questionnaireprefill.php b/admin/questionnaireprefill.php index 94dbff31..8afea37c 100644 --- a/admin/questionnaireprefill.php +++ b/admin/questionnaireprefill.php @@ -40,6 +40,11 @@ include("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/quota.php b/admin/quota.php index fce93b21..f12b6c16 100755 --- a/admin/quota.php +++ b/admin/quota.php @@ -40,6 +40,11 @@ include("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/quotareport.php b/admin/quotareport.php index a915574d..40666da2 100644 --- a/admin/quotareport.php +++ b/admin/quotareport.php @@ -41,6 +41,11 @@ include_once(dirname(__FILE__).'/../config.inc.php'); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/quotarow.php b/admin/quotarow.php index 129f3910..c5176f6c 100755 --- a/admin/quotarow.php +++ b/admin/quotarow.php @@ -41,6 +41,11 @@ include("../config.inc.php"); */ include ("../db.inc.php"); +/** + * Authentication file + */ +include ("auth-admin.php"); + /** * XHTML functions */ diff --git a/admin/samplecallattempts.php b/admin/samplecallattempts.php index 3de6161f..c6d42669 100644 --- a/admin/samplecallattempts.php +++ b/admin/samplecallattempts.php @@ -1,4 +1,5 @@ - $val) { if ($val == 3) $prph++; else if ($val == 5) $pcd++; @@ -288,17 +293,17 @@ if (isset($_GET['edit']) ) $sql = "SELECT * FROM sample_import WHERE sample_import_id = $sample_import_id"; $sd = $db->GetRow($sql); - if($sd['enabled'] == 1) $dis = disabled; // -> disable edit and delete if sample is enabled + if($sd['enabled'] == 1) $dis = "disabled"; else $dis = false;// -> disable edit and delete if sample is enabled $sql = "SELECT type, description FROM sample_var_type"; $rd = $db->GetAll($sql); - + $selected = "selected=\"selected\""; $sql = "SELECT sir.var_id, CONCAT('') as var, CONCAT (' +