";
?>
Execute($sql);
}
if (isset($_GET['voipenable']))
{
$operator_id = intval($_GET['voipenable']);
$sql = "UPDATE operator
SET voip = 1
WHERE operator_id = '$operator_id'";
$db->Execute($sql);
}
if (isset($_GET['disable']))
{
$operator_id = intval($_GET['disable']);
$sql = "UPDATE operator
SET enabled = 0
WHERE operator_id = '$operator_id'";
$db->Execute($sql);
}
if (isset($_GET['enable']))
{
$operator_id = intval($_GET['enable']);
$sql = "UPDATE operator
SET enabled = 1
WHERE operator_id = '$operator_id'";
$db->Execute($sql);
}
if (isset($_GET['operator_id']))
{
$operator_id = intval($_GET['operator_id']);
$sql = "SELECT *,SUBSTRING_INDEX(extension, '/', -1) as ext
FROM operator
WHERE operator_id = $operator_id";
$rs = $db->GetRow($sql);
if (!empty($rs))
{
$display = false;
if (isset($_GET['winbat']) || isset($_GET['sh']))
{
header("Content-Type: text/txt");
if (isset($_GET['winbat']))
header("Content-Disposition: attachment; filename=operator_$operator_id.bat");
else
header("Content-Disposition: attachment; filename=operator_$operator_id.sh");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Pragma: public"); // HTTP/1.0
if (isset($_GET['winbat']))
echo "voipclient.exe -i -u {$rs['ext']} -p {$rs['extension_password']} -h " . $_SERVER['SERVER_NAME'];
else
echo "./voipclient -i -u {$rs['ext']} -p {$rs['extension_password']} -h " . $_SERVER['SERVER_NAME'];
}
}
}
if ($display)
{
$sql = "SELECT
CONCAT(firstName, ' ', lastName) as name,
CONCAT('') as password,
CONCAT('') as timezone,
CONCAT('" . T_("Windows bat file") . "') as winbat,
CONCAT('" . T_("*nix script file") . "') as sh,
CASE WHEN enabled = 0 THEN
CONCAT('" . T_("Enable") . "')
ELSE
CONCAT('" . T_("Disable") . "')
END
as enabledisable,
CASE WHEN voip = 0 THEN
CONCAT('" . T_("Enable VoIP") . "')
ELSE
CONCAT('" . T_("Disable VoIP") . "')
END as voipenabledisable,
CONCAT('" . T_("Edit") . "') as edit,
username
FROM operator";
$rs = $db->GetAll($sql);
xhtml_head(T_("Operator list"),true,array("../css/table.css"));
$columns = array("name","username","enabledisable","edit");
$titles = array(T_("Operator"),T_("Username"),T_("Enable/Disable"),T_("Edit"));
if (VOIP_ENABLED)
{
print "
" . T_("Download the file for each user and save in the same folder as the voip.exe executable. When the file is executed, it will run the voip.exe program with the correct connection details to connect the operator to the VoIP server") . "