diff --git a/app/bridges/bridge_edit.php b/app/bridges/bridge_edit.php
index 4621b2e51e..2dbfd4be27 100644
--- a/app/bridges/bridge_edit.php
+++ b/app/bridges/bridge_edit.php
@@ -234,21 +234,27 @@
//get the variables from inside the { and } brackets
preg_match('/^\{([^}]+)\}/', $bridge_destination, $matches);
- //create a variables array from the comma delimitted string
- $variables = explode(",", $matches[1]);
+ if (!empty($matches) && is_array($matches) && @sizeof($matches) != 0) {
- //strip the variables from the $bridge_destination variable
- $bridge_destination = str_replace("{$matches[0]}", '', $bridge_destination);
+ //create a variables array from the comma delimitted string
+ $variables = explode(",", $matches[1]);
+
+ //strip the variables from the $bridge_destination variable
+ $bridge_destination = str_replace("{$matches[0]}", '', $bridge_destination);
+
+ }
//build a bridge variables data set
$x = 0;
- foreach($variables as $variable) {
- $pairs = explode("=", $variable);
- $database_variables[$x]['name'] = $pairs[0];
- $database_variables[$x]['value'] = $pairs[1];
- $database_variables[$x]['label'] = ucwords(str_replace('_', ' ', $pairs[0]));
- $database_variables[$x]['label'] = str_replace('Effective Caller Id', 'Caller ID', $database_variables[$x]['label']);
- $x++;
+ if (!empty($variables) && is_array($variables)) {
+ foreach($variables as $variable) {
+ $pairs = explode("=", $variable);
+ $database_variables[$x]['name'] = $pairs[0];
+ $database_variables[$x]['value'] = $pairs[1];
+ $database_variables[$x]['label'] = ucwords(str_replace('_', ' ', $pairs[0]));
+ $database_variables[$x]['label'] = str_replace('Effective Caller Id', 'Caller ID', $database_variables[$x]['label']);
+ $x++;
+ }
}
}
@@ -310,9 +316,9 @@
//get the gateways
$actions = explode(',', $bridge_destination);
- foreach($actions as $action) {
+ foreach ($actions as $action) {
$action_array = explode('/',$action);
- if ($action_array[1] == 'gateway') {
+ if (!empty($action_array) && is_array($action_array) && !empty($action_array[1]) && $action_array[1] == 'gateway') {
$bridge_gateways[] = $action_array[2];
$destination_number = $action_array[3];
}
@@ -385,9 +391,11 @@
echo " ";
echo " }\n";
echo "\n";
- echo " window.onload = function() {\n";
- echo " action_control('".$bridge_action."');\n";
- echo " };\n";
+ if (!empty($bridge_action)) {
+ echo " window.onload = function() {\n";
+ echo " action_control('".$bridge_action."');\n";
+ echo " };\n";
+ }
echo "\n";
//show the content
@@ -431,7 +439,7 @@
echo " \n";
$i = 0;
foreach($bridge_actions as $row) {
- echo " \n";
+ echo " \n";
}
echo " \n";
echo "
\n";
@@ -465,7 +473,7 @@
echo "