Merge branch 'master' into no_default_domain

Conflicts:
	app/hot_desking/extension_edit.php
This commit is contained in:
Alexey Melnichuk
2015-07-21 11:24:59 +04:00
80 changed files with 1168 additions and 1485 deletions

View File

@@ -317,9 +317,7 @@ function event_socket_request($fp, $cmd) {
}
fputs($fp, "\n"); //second line feed to end the headers
usleep(100); //allow time for reponse
$response = "";
$response = '';
$i = 0;
$content_length = 0;
while (!feof($fp)) {
@@ -337,17 +335,16 @@ function event_socket_request($fp, $cmd) {
}
}
usleep(50); //allow time for reponse
//prevent an endless loop //optional because of script timeout
if ($i > 30000) { break; }
if ($content_length > 0) { //is content_length set
//stop reading if all content has been read.
if (strlen($response) >= $content_length) {
break;
}
}
else {
//prevent an endless loop
if ($i > 300000) { break; }
}
$i++;
}
@@ -359,6 +356,8 @@ function event_socket_request($fp, $cmd) {
}
function event_socket_request_cmd($cmd) {
global $db, $domain_uuid, $host;
@@ -2537,12 +2536,15 @@ if (!function_exists('save_sip_profile_xml')) {
return;
}
// make profile dir if needed
$profile_dir = $_SESSION['switch']['conf']['dir']."/sip_profiles";
if (!is_readable($profile_dir)) { mkdir($profile_dir,0775,true); }
//get the global variables
global $db, $domain_uuid;
//get the sip profiles from the database
$sql = "select * from v_sip_profiles ";
$sql .= "where sip_profile_enabled = 'true' ";
$sql = "select * from v_sip_profiles";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll();
@@ -2550,8 +2552,17 @@ if (!function_exists('save_sip_profile_xml')) {
unset ($prep_statement, $sql);
if ($result_count > 0) {
foreach($result as $row) {
$sip_profile_uuid = $row['sip_profile_uuid'];
$sip_profile_name = $row['sip_profile_name'];
$sip_profile_uuid = $row['sip_profile_uuid'];
$sip_profile_name = $row['sip_profile_name'];
$sip_profile_enabled = $row['sip_profile_enabled'];
if ($sip_profile_enabled == 'false') {
$fout = fopen($profile_dir.'/'.$sip_profile_name.".xml","w");
if ($fout) {
fclose($fout);
}
continue;
}
//get the xml sip profile template
if ($sip_profile_name == "internal" || $sip_profile_name == "external" || $sip_profile_name == "internal-ipv6") {
@@ -2579,14 +2590,14 @@ if (!function_exists('save_sip_profile_xml')) {
$file_contents = str_replace("{v_sip_profile_settings}", $sip_profile_settings, $file_contents);
//write the XML config file
if (is_readable($_SESSION['switch']['conf']['dir']."/sip_profiles/")) {
$fout = fopen($_SESSION['switch']['conf']['dir']."/sip_profiles/".$sip_profile_name.".xml","w");
if (is_readable($profile_dir.'/')) {
$fout = fopen($profile_dir.'/'.$sip_profile_name.".xml","w");
fwrite($fout, $file_contents);
fclose($fout);
}
//if the directory does not exist then create it
if (!is_readable($_SESSION['switch']['conf']['dir']."/sip_profiles/".$sip_profile_name)) { mkdir($_SESSION['switch']['conf']['dir']."/sip_profiles/".$sip_profile_name,0775,true); }
if (!is_readable($profile_dir.'/'.$sip_profile_name)) { mkdir($profile_dir.'/'.$sip_profile_name,0775,true); }
} //end foreach
unset($sql, $result, $row_count);