mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Merged changes from vm line
This commit is contained in:
@@ -62,9 +62,41 @@ if (isset($_POST))
|
|||||||
$htp->addUser($_POST["username" . $operator_id],$val);
|
$htp->addUser($_POST["username" . $operator_id],$val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (substr($key,0,8) == "timezone")
|
||||||
|
{
|
||||||
|
$operator_id = intval(substr($key,8));
|
||||||
|
$tzone = $db->qstr($val);
|
||||||
|
$sql = "UPDATE operator
|
||||||
|
SET Time_zone_name = $tzone
|
||||||
|
WHERE operator_id = '$operator_id'";
|
||||||
|
$db->Execute($sql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['voipdisable']))
|
||||||
|
{
|
||||||
|
$operator_id = intval($_GET['voipdisable']);
|
||||||
|
|
||||||
|
$sql = "UPDATE operator
|
||||||
|
SET voip = 0
|
||||||
|
WHERE operator_id = '$operator_id'";
|
||||||
|
|
||||||
|
$db->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']))
|
if (isset($_GET['disable']))
|
||||||
{
|
{
|
||||||
$operator_id = intval($_GET['disable']);
|
$operator_id = intval($_GET['disable']);
|
||||||
@@ -113,9 +145,9 @@ if (isset($_GET['operator_id']))
|
|||||||
header("Pragma: public"); // HTTP/1.0
|
header("Pragma: public"); // HTTP/1.0
|
||||||
|
|
||||||
if (isset($_GET['winbat']))
|
if (isset($_GET['winbat']))
|
||||||
echo "voipclient.exe -i -u {$rs['ext']} -p {$rs['extension_password']} -h " . $_SERVER['SERVER_ADDR'];
|
echo "voipclient.exe -i -u {$rs['ext']} -p {$rs['extension_password']} -h " . $_SERVER['SERVER_NAME'];
|
||||||
else
|
else
|
||||||
echo "./voipclient -i -u {$rs['ext']} -p {$rs['extension_password']} -h " . $_SERVER['SERVER_ADDR'];
|
echo "./voipclient -i -u {$rs['ext']} -p {$rs['extension_password']} -h " . $_SERVER['SERVER_NAME'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,6 +157,12 @@ if ($display)
|
|||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
CONCAT(firstName, ' ', lastName) as name,
|
CONCAT(firstName, ' ', lastName) as name,
|
||||||
CONCAT('<form action=\'?\' method=\'post\'><input type=\'text\' name=\'password', operator_id, '\'/><input type=\'hidden\' name=\'username', operator_id, '\' value=\'', username, '\'/><input type=\'submit\' value=\'" . T_("Update password") . "\'/></form>') as password,
|
CONCAT('<form action=\'?\' method=\'post\'><input type=\'text\' name=\'password', operator_id, '\'/><input type=\'hidden\' name=\'username', operator_id, '\' value=\'', username, '\'/><input type=\'submit\' value=\'" . T_("Update password") . "\'/></form>') as password,
|
||||||
|
CONCAT('<form action=\'?\' method=\'post\'><select name=\'timezone', operator_id, '\'/>',
|
||||||
|
|
||||||
|
(SELECT GROUP_CONCAT(CONCAT('<option ', CASE WHEN timezone_template.Time_zone_name LIKE operator.Time_zone_name THEN ' selected=\"selected\" ' ELSE '' END ,'value=\"', Time_zone_name, '\">', Time_zone_name, '</option>') SEPARATOR '') as tzones
|
||||||
|
FROM timezone_template)
|
||||||
|
|
||||||
|
,'</select><input type=\'submit\' value=\'" . T_("Update timezone") . "\'/></form>') as timezone,
|
||||||
CONCAT('<a href=\'?winbat=winbat&operator_id=',operator_id,'\'>" . T_("Windows bat file") . "</a>') as winbat,
|
CONCAT('<a href=\'?winbat=winbat&operator_id=',operator_id,'\'>" . T_("Windows bat file") . "</a>') as winbat,
|
||||||
CONCAT('<a href=\'?sh=sh&operator_id=',operator_id,'\'>" . T_("*nix script file") . "</a>') as sh,
|
CONCAT('<a href=\'?sh=sh&operator_id=',operator_id,'\'>" . T_("*nix script file") . "</a>') as sh,
|
||||||
CASE WHEN enabled = 0 THEN
|
CASE WHEN enabled = 0 THEN
|
||||||
@@ -133,6 +171,12 @@ if ($display)
|
|||||||
CONCAT('<a href=\'?disable=',operator_id,'\'>" . T_("Disable") . "</a>')
|
CONCAT('<a href=\'?disable=',operator_id,'\'>" . T_("Disable") . "</a>')
|
||||||
END
|
END
|
||||||
as enabledisable,
|
as enabledisable,
|
||||||
|
CASE WHEN voip = 0 THEN
|
||||||
|
CONCAT('<a href=\'?voipenable=',operator_id,'\'>" . T_("Enable VoIP") . "</a>')
|
||||||
|
ELSE
|
||||||
|
CONCAT('<a href=\'?voipdisable=',operator_id,'\'>" . T_("Disable VoIP") . "</a>')
|
||||||
|
END
|
||||||
|
as voipenabledisable,
|
||||||
username
|
username
|
||||||
FROM operator";
|
FROM operator";
|
||||||
|
|
||||||
@@ -140,8 +184,8 @@ if ($display)
|
|||||||
|
|
||||||
xhtml_head(T_("Operator list"),true,array("../css/table.css"));
|
xhtml_head(T_("Operator list"),true,array("../css/table.css"));
|
||||||
|
|
||||||
$columns = array("name","username","enabledisable");
|
$columns = array("name","username","enabledisable","timezone");
|
||||||
$titles = array(T_("Operator"),T_("Username"),T_("Enable/Disable"));
|
$titles = array(T_("Operator"),T_("Username"),T_("Enable/Disable"),T_("Update timezone"));
|
||||||
|
|
||||||
if (VOIP_ENABLED)
|
if (VOIP_ENABLED)
|
||||||
{
|
{
|
||||||
@@ -150,8 +194,10 @@ if ($display)
|
|||||||
print "<p><a href='../voipclient.exe'>" . T_("Download Windows VoIP Executable") . "</a></p>";
|
print "<p><a href='../voipclient.exe'>" . T_("Download Windows VoIP Executable") . "</a></p>";
|
||||||
print "<p><a href='../voipclient'>" . T_("Download Linux VoIP Executable") . "</a></p>";
|
print "<p><a href='../voipclient'>" . T_("Download Linux VoIP Executable") . "</a></p>";
|
||||||
|
|
||||||
|
$columns[] = "voipenabledisable";
|
||||||
$columns[] = "winbat";
|
$columns[] = "winbat";
|
||||||
$columns[] = "sh";
|
$columns[] = "sh";
|
||||||
|
$titles[] = T_("Enable/Disable VoIP");
|
||||||
$titles[] = T_("Windows VoIP");
|
$titles[] = T_("Windows VoIP");
|
||||||
$titles[] = T_("*nix VoIP");
|
$titles[] = T_("*nix VoIP");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ if (isset($_POST['operator']))
|
|||||||
$a = T_("Added:") . " " . $operator;
|
$a = T_("Added:") . " " . $operator;
|
||||||
|
|
||||||
if (FREEPBX_PATH !== false)
|
if (FREEPBX_PATH !== false)
|
||||||
$a .= "<br/>" . T_("Please reload FreePBX for the new VoIP extension to take effect");
|
$a .= "<br/>" . T_("FreePBX has been reloaded for the new VoIP extension to take effect");
|
||||||
|
|
||||||
$oid = $db->Insert_ID();
|
$oid = $db->Insert_ID();
|
||||||
|
|
||||||
|
|||||||
@@ -114,9 +114,76 @@ function freepbx_add_extension($extension,$name,$password)
|
|||||||
|
|
||||||
freepbx_core_users_add($amp_conf,$astman,$vars);
|
freepbx_core_users_add($amp_conf,$astman,$vars);
|
||||||
freepbx_core_devices_add($amp_conf,$astman,$vars["deviceid"],$vars["tech"],$vars["devinfo_dial"],$vars["devicetype"],$vars["deviceuser"],$vars["description"],$vars["emergency_cid"],false,$vars);
|
freepbx_core_devices_add($amp_conf,$astman,$vars["deviceid"],$vars["tech"],$vars["devinfo_dial"],$vars["devicetype"],$vars["deviceuser"],$vars["description"],$vars["emergency_cid"],false,$vars);
|
||||||
freepbx_need_reload();
|
freepbx_do_reload($amp_conf,$astman,$asterisk_conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function freepbx_do_reload(&$amp_conf,&$astman,&$asterisk_conf)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
array($return);
|
||||||
|
|
||||||
|
if (isset($amp_conf["PRE_RELOAD"]) && !empty($amp_conf['PRE_RELOAD'])) {
|
||||||
|
exec( $amp_conf["PRE_RELOAD"], $output, $exit_val );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$retrieve = $amp_conf['AMPBIN'].'/retrieve_conf 2>&1';
|
||||||
|
//exec($retrieve.'&>'.$asterisk_conf['astlogdir'].'/freepbx-retrieve.log', $output, $exit_val);
|
||||||
|
exec($retrieve, $output, $exit_val);
|
||||||
|
|
||||||
|
|
||||||
|
if ($exit_val != 0) {
|
||||||
|
$return['status'] = false;
|
||||||
|
$return['message'] = sprintf(_('Reload failed because retrieve_conf encountered an error: %s'),$exit_val);
|
||||||
|
$return['num_errors']++;
|
||||||
|
$notify->add_critical('freepbx','RCONFFAIL', _("retrieve_conf failed, config not applied"), $return['message']);
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($astman) || !$astman) {
|
||||||
|
$return['status'] = false;
|
||||||
|
$return['message'] = _('Reload failed because FreePBX could not connect to the asterisk manager interface.');
|
||||||
|
$return['num_errors']++;
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//reload MOH to get around 'reload' not actually doing that.
|
||||||
|
$astman->send_request('Command', array('Command'=>'moh reload'));
|
||||||
|
|
||||||
|
//reload asterisk (>= 1.4)
|
||||||
|
$astman->send_request('Command', array('Command'=>'module reload'));
|
||||||
|
|
||||||
|
$return['status'] = true;
|
||||||
|
|
||||||
|
if ($amp_conf['FOPRUN'] && !$amp_conf['FOPDISABLE']) {
|
||||||
|
//bounce op_server.pl
|
||||||
|
$wOpBounce = $amp_conf['AMPBIN'].'/bounce_op.sh';
|
||||||
|
exec($wOpBounce.' &>'.$asterisk_conf['astlogdir'].'/freepbx-bounce_op.log', $output, $exit_val);
|
||||||
|
|
||||||
|
if ($exit_val != 0) {
|
||||||
|
$desc = _('Could not reload the FOP operator panel server using the bounce_op.sh script. Configuration changes may not be reflected in the panel display.');
|
||||||
|
$return['num_errors']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($amp_conf["POST_RELOAD"]) && !empty($amp_conf['POST_RELOAD'])) {
|
||||||
|
exec( $amp_conf["POST_RELOAD"], $output, $exit_val );
|
||||||
|
|
||||||
|
if ($exit_val != 0) {
|
||||||
|
$desc = sprintf(_("Exit code was %s and output was: %s"), $exit_val, "\n\n".implode("\n",$output));
|
||||||
|
$return['num_errors']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE ".FREEPBX_DATABASE.".admin SET value = 'false' WHERE variable = 'need_reload'";
|
||||||
|
|
||||||
|
$db->Execute($sql);
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function freepbx_need_reload()
|
function freepbx_need_reload()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ function create_limesurvey_questionnaire($title,$exittoend = true)
|
|||||||
. "'', '";
|
. "'', '";
|
||||||
|
|
||||||
if ($exittoend)
|
if ($exittoend)
|
||||||
$isquery .= QUEXS_URL . "rs_project_end.php')";
|
$isquery .= "{ENDINTERVIEWURL}')";
|
||||||
else
|
else
|
||||||
$isquery .= "{STARTINTERVIEWURL}')";
|
$isquery .= "{STARTINTERVIEWURL}')";
|
||||||
|
|
||||||
|
|||||||
@@ -232,6 +232,8 @@ if ((isset($move) && $move == "movesubmit") && (!isset($notanswered) || !$notan
|
|||||||
$quexs_url = get_start_interview_url();
|
$quexs_url = get_start_interview_url();
|
||||||
$url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url);
|
$url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url);
|
||||||
|
|
||||||
|
$end_url = get_end_interview_url();
|
||||||
|
$url = str_replace("{ENDINTERVIEWURL}", $end_url, $url);
|
||||||
|
|
||||||
|
|
||||||
header("Location: {$url}");
|
header("Location: {$url}");
|
||||||
|
|||||||
@@ -309,8 +309,10 @@ if ((isset($move) && $move == "movesubmit") && (!isset($notanswered) || !$notan
|
|||||||
include_once("quexs.php");
|
include_once("quexs.php");
|
||||||
$quexs_url = get_start_interview_url();
|
$quexs_url = get_start_interview_url();
|
||||||
$url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url);
|
$url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url);
|
||||||
|
$end_url = get_end_interview_url();
|
||||||
header("Location: {$url}");
|
$url = str_replace("{ENDINTERVIEWURL}", $end_url, $url);
|
||||||
|
|
||||||
|
header("Location: {$url}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//if($thissurvey['printanswers'] != 'Y' && $thissurvey['usecookie'] != 'Y' && $tokensexist !=1)
|
//if($thissurvey['printanswers'] != 'Y' && $thissurvey['usecookie'] != 'Y' && $tokensexist !=1)
|
||||||
|
|||||||
@@ -687,6 +687,16 @@ function get_respondent_selection_url()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the URL to end the interview
|
||||||
|
*
|
||||||
|
* @return string The URL to end the interview
|
||||||
|
*/
|
||||||
|
function get_end_interview_url()
|
||||||
|
{
|
||||||
|
return QUEXS_URL . "rs_project_end.php";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get start interviewer URL
|
* Get start interviewer URL
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -189,6 +189,9 @@ if ((isset($move) && $move == "movesubmit") && (!isset($notanswered) || !$notans
|
|||||||
$quexs_url = get_start_interview_url();
|
$quexs_url = get_start_interview_url();
|
||||||
$url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url);
|
$url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url);
|
||||||
|
|
||||||
|
$end_url = get_end_interview_url();
|
||||||
|
$url = str_replace("{ENDINTERVIEWURL}", $end_url, $url);
|
||||||
|
|
||||||
//Automatically redirect the page to the "url" setting for the survey
|
//Automatically redirect the page to the "url" setting for the survey
|
||||||
session_write_close();
|
session_write_close();
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ if ($operator_id)
|
|||||||
copy(realpath(dirname(__FILE__) . '/../voipclient'),"$zipdir/voipclient");
|
copy(realpath(dirname(__FILE__) . '/../voipclient'),"$zipdir/voipclient");
|
||||||
$f1 = "$zipdir/voipclient";
|
$f1 = "$zipdir/voipclient";
|
||||||
$f2 = "$zipdir/startvoip";
|
$f2 = "$zipdir/startvoip";
|
||||||
file_put_contents($f2, "./voipclient -i -u {$rs['ext']} -p {$rs['extension_password']} -h " . $_SERVER['SERVER_ADDR']);
|
file_put_contents($f2, "./voipclient -i -u {$rs['ext']} -p {$rs['extension_password']} -h " . $_SERVER['SERVER_NAME']);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -79,7 +79,7 @@ if ($operator_id)
|
|||||||
copy(realpath(dirname(__FILE__) . '/../voipclient.exe'),"$zipdir/voipclient.exe");
|
copy(realpath(dirname(__FILE__) . '/../voipclient.exe'),"$zipdir/voipclient.exe");
|
||||||
$f1 = "$zipdir/voipclient.exe";
|
$f1 = "$zipdir/voipclient.exe";
|
||||||
$f2 = "$zipdir/startvoip.bat";
|
$f2 = "$zipdir/startvoip.bat";
|
||||||
file_put_contents($f2, "voipclient.exe -i -u {$rs['ext']} -p {$rs['extension_password']} -h " . $_SERVER['SERVER_ADDR']);
|
file_put_contents($f2, "voipclient.exe -i -u {$rs['ext']} -p {$rs['extension_password']} -h " . $_SERVER['SERVER_NAME']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user