* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2007,2008,2009,2010,2011 * @package queXS * @subpackage admin * @link http://www.acspri.org.au/software 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 */ include_once(dirname(__FILE__).'/../db.inc.php'); /** * Authentication file */ require ("auth-admin.php"); /** * XHTML functions */ include_once(dirname(__FILE__).'/../functions/functions.xhtml.php'); $display = true; $msg = ""; if (isset($_POST['submit'])) { $operator_id = intval($_POST['operator_id']); $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; //get username $sql = "SELECT username FROM operator WHERE operator_id = $operator_id"; $uname = $db->GetOne($sql); $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, create_survey = $superadmin, configurator = $superadmin, manage_template = $superadmin, manage_label = $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 FROM `case` WHERE current_operator_id = $operator_id"; $cc= $db->GetOne($sql); if (empty($cc)) { $sql = "UPDATE extension SET current_operator_id = NULL 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); } } $msg = "