|
@@ -85,7 +85,7 @@ if (!class_exists('domains')) {
|
|
|
$d = 0;
|
|
|
foreach ($records as $record) {
|
|
|
//add to the array
|
|
|
- if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
|
|
+ if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
|
|
//set the uuid
|
|
|
$id = $record['uuid'];
|
|
|
|
|
@@ -202,38 +202,44 @@ if (!class_exists('domains')) {
|
|
|
}
|
|
|
|
|
|
//delete the gateways
|
|
|
- if($dh = opendir($_SESSION['switch']['sip_profiles']['dir'])) {
|
|
|
- $files = Array();
|
|
|
- while($file = readdir($dh)) {
|
|
|
- if($file != "." && $file != ".." && $file[0] != '.') {
|
|
|
- if(is_dir($dir . "/" . $file)) {
|
|
|
- //this is a directory do nothing
|
|
|
- } else {
|
|
|
- //check if file extension is xml
|
|
|
- if (strpos($file, $v_needle) !== false && substr($file,-4) == '.xml') {
|
|
|
- @unlink($_SESSION['switch']['sip_profiles']['dir']."/".$file);
|
|
|
+ if (!empty($_SESSION['switch']['sip_profiles']['dir'])) {
|
|
|
+ if ($dh = opendir($_SESSION['switch']['sip_profiles']['dir'])) {
|
|
|
+ $files = Array();
|
|
|
+ while ($file = readdir($dh)) {
|
|
|
+ if ($file != "." && $file != ".." && $file[0] != '.') {
|
|
|
+ if (is_dir($dir . "/" . $file)) {
|
|
|
+ //this is a directory do nothing
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //check if file extension is xml
|
|
|
+ if (strpos($file, $v_needle) !== false && substr($file,-4) == '.xml') {
|
|
|
+ @unlink($_SESSION['switch']['sip_profiles']['dir']."/".$file);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ closedir($dh);
|
|
|
}
|
|
|
- closedir($dh);
|
|
|
}
|
|
|
|
|
|
//delete the ivr menu
|
|
|
- if($dh = opendir($_SESSION['switch']['conf']['dir']."/ivr_menus")) {
|
|
|
- $files = Array();
|
|
|
- while($file = readdir($dh)) {
|
|
|
- if($file != "." && $file != ".." && $file[0] != '.') {
|
|
|
- if(is_dir($dir . "/" . $file)) {
|
|
|
- //this is a directory
|
|
|
- } else {
|
|
|
- if (strpos($file, $v_needle) !== false && substr($file,-4) == '.xml') {
|
|
|
- @unlink($_SESSION['switch']['conf']['dir']."/ivr_menus/".$file);
|
|
|
+ if (!empty($_SESSION['switch']['conf']['dir'])) {
|
|
|
+ if ($dh = opendir($_SESSION['switch']['conf']['dir']."/ivr_menus")) {
|
|
|
+ $files = Array();
|
|
|
+ while ($file = readdir($dh)) {
|
|
|
+ if ($file != "." && $file != ".." && $file[0] != '.') {
|
|
|
+ if (!empty($dir) && !empty($file) && is_dir($dir."/".$file)) {
|
|
|
+ //this is a directory
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (strpos($file, $v_needle) !== false && substr($file,-4) == '.xml') {
|
|
|
+ @unlink($_SESSION['switch']['conf']['dir']."/ivr_menus/".$file);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ closedir($dh);
|
|
|
}
|
|
|
- closedir($dh);
|
|
|
}
|
|
|
|
|
|
//delete the recordings
|
|
@@ -302,7 +308,7 @@ if (!class_exists('domains')) {
|
|
|
if (is_array($records) && @sizeof($records) != 0) {
|
|
|
//get current toggle state
|
|
|
foreach($records as $record) {
|
|
|
- if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
|
|
+ if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
|
|
$uuids[] = "'".$record['uuid']."'";
|
|
|
}
|
|
|
}
|
|
@@ -310,7 +316,7 @@ if (!class_exists('domains')) {
|
|
|
$sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
|
|
|
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
|
|
|
$database = new database;
|
|
|
- $rows = $database->select($sql, $parameters, 'all');
|
|
|
+ $rows = $database->select($sql, $parameters ?? null, 'all');
|
|
|
if (is_array($rows) && @sizeof($rows) != 0) {
|
|
|
foreach ($rows as $row) {
|
|
|
$states[$row['uuid']] = $row['toggle'];
|
|
@@ -370,7 +376,7 @@ if (!class_exists('domains')) {
|
|
|
|
|
|
//get checked records
|
|
|
foreach($records as $record) {
|
|
|
- if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
|
|
+ if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
|
|
$uuids[] = "'".$record['uuid']."'";
|
|
|
}
|
|
|
}
|