From c0a2059ac86369bbf1234dc1dc44f638e725cc5d Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 10 May 2016 22:51:03 -0600 Subject: [PATCH 1/3] Update voicemail.php Use is_array with foreach in the voicemail php class. --- .../resources/classes/voicemail.php | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php index 664b5f7559..6953ea0c41 100644 --- a/app/voicemails/resources/classes/voicemail.php +++ b/app/voicemails/resources/classes/voicemail.php @@ -67,7 +67,7 @@ else { //ensure that the requested voicemail box is assigned to this user $found = false; - foreach($voicemail_uuids as $row) { + if (is_array($voicemail_uuids)) foreach($voicemail_uuids as $row) { if ($voicemail_uuid == $row['voicemail_uuid']) { $sql .= "and voicemail_uuid = '".$row['voicemail_uuid']."' "; $found = true; @@ -85,7 +85,7 @@ if (count($voicemail_ids) > 0) { //show only the assigned voicemail ids $sql .= "and ("; - foreach($voicemail_ids as $row) { + if (is_array($voicemail_ids)) foreach($voicemail_ids as $row) { if ($x == 0) { $sql .= "voicemail_id = '".$row['voicemail_id']."' "; } @@ -114,7 +114,7 @@ $voicemails = $this->voicemails(); //add the voicemail messages to the array - foreach ($voicemails as &$row) { + if (is_array($voicemails)) foreach ($voicemails as &$row) { //get the voicemail messages $this->voicemail_uuid = $row['voicemail_uuid']; $this->voicemail_id = $row['voicemail_id']; @@ -134,7 +134,7 @@ if (is_array($this->voicemail_id)) { $sql .= "and ("; $x = 0; - foreach($this->voicemail_id as $row) { + if (is_array($this->voicemail_id)) foreach($this->voicemail_id as $row) { if ($x > 0) { $sql .= "or "; } @@ -159,7 +159,7 @@ $result_count = count($result); unset ($prep_statement, $sql); if ($result_count > 0) { - foreach($result as &$row) { + if (is_array($result)) foreach($result as &$row) { //set the greeting directory $path = $_SESSION['switch']['voicemail']['dir'].'/default/'.$_SESSION['domain_name'].'/'.$row['voicemail_id']; if (file_exists($path.'/msg_'.$row['voicemail_message_uuid'].'.wav')) { @@ -192,7 +192,7 @@ //delete voicemail recordings folder (includes greetings) $file_path = $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$this->voicemail_id; - foreach (glob($file_path."/*.*") as $file_name) { + if (isset(glob($file_path."/*.*"))) foreach (glob($file_path."/*.*") as $file_name) { unlink($file_name); } @rmdir($file_path); @@ -266,7 +266,7 @@ $prep_statement = $this->db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { + if (is_array($result)) foreach ($result as &$row) { $this->voicemail_id = $row["voicemail_id"]; } unset ($prep_statement); @@ -275,13 +275,17 @@ //delete the recording $file_path = $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$this->voicemail_id; if ($this->voicemail_message_uuid != '') { - foreach ( - glob($file_path."/msg_".$this->voicemail_message_uuid.".*") as $file_name) { unlink($file_name); + if (is_array(glob($file_path."/msg_".$this->voicemail_message_uuid.".*"))) { + foreach (glob($file_path."/msg_".$this->voicemail_message_uuid.".*") as $file_name) { + unlink($file_name); + } } } else { - foreach ( - glob($file_path."/msg_*.*") as $file_name) { unlink($file_name); //remove all recordings + if (is_array(glob($file_path."/msg_*.*"))) { + foreach (glob($file_path."/msg_*.*") as $file_name) { + unlink($file_name); //remove all recordings + } } } @@ -309,7 +313,7 @@ $prep_statement = $this->db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { + if (is_array($result)) foreach ($result as &$row) { $this->voicemail_id = $row["voicemail_id"]; } unset ($prep_statement); @@ -382,7 +386,7 @@ $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); if (count($result) > 0) { - foreach($result as &$row) { + if (is_array($result)) foreach($result as &$row) { if ($row['message_base64'] != '') { $message_decoded = base64_decode($row['message_base64']); file_put_contents($path.'/msg_'.$this->voicemail_message_uuid.'.ext', $message_decoded); @@ -488,4 +492,4 @@ foreach ($_SESSION['user']['extension'] as $value) { } */ -?> \ No newline at end of file +?> From 0852d05788dc23fa5340562227431af7a5c1b1b8 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 10 May 2016 22:53:42 -0600 Subject: [PATCH 2/3] Update voicemail.php Don't use is_array with glob. --- app/voicemails/resources/classes/voicemail.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php index 6953ea0c41..ccce808ed2 100644 --- a/app/voicemails/resources/classes/voicemail.php +++ b/app/voicemails/resources/classes/voicemail.php @@ -192,7 +192,7 @@ //delete voicemail recordings folder (includes greetings) $file_path = $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$this->voicemail_id; - if (isset(glob($file_path."/*.*"))) foreach (glob($file_path."/*.*") as $file_name) { + foreach (glob($file_path."/*.*") as $file_name) { unlink($file_name); } @rmdir($file_path); @@ -275,17 +275,13 @@ //delete the recording $file_path = $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$this->voicemail_id; if ($this->voicemail_message_uuid != '') { - if (is_array(glob($file_path."/msg_".$this->voicemail_message_uuid.".*"))) { - foreach (glob($file_path."/msg_".$this->voicemail_message_uuid.".*") as $file_name) { - unlink($file_name); - } + foreach (glob($file_path."/msg_".$this->voicemail_message_uuid.".*") as $file_name) { + unlink($file_name); } } else { - if (is_array(glob($file_path."/msg_*.*"))) { - foreach (glob($file_path."/msg_*.*") as $file_name) { - unlink($file_name); //remove all recordings - } + foreach (glob($file_path."/msg_*.*") as $file_name) { + unlink($file_name); //remove all recordings } } From 71ab444034872a905642954c4bde6c06b4b1bccd Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 11 May 2016 16:44:03 +0300 Subject: [PATCH 3/3] Update escene config. --- .htaccess | 3 +- .../provision/escene/e3xx/timezones.txt | 119 +++++++++ .../provision/escene/e3xx/{$mac}.xml | 240 +++++++++++++++++- .../provision/escene/e3xx/{$mac}_extern.xml | 1 - 4 files changed, 354 insertions(+), 9 deletions(-) create mode 100644 resources/templates/provision/escene/e3xx/timezones.txt diff --git a/.htaccess b/.htaccess index 7e04cf3c3f..949272c8bb 100644 --- a/.htaccess +++ b/.htaccess @@ -32,6 +32,7 @@ RewriteRule ^.*/([A-Fa-f0-9]{12})-web.cfg$ app/provision/?mac=$1&file=w RewriteRule ^.*/([A-Fa-f0-9]{12})-directory.xml$ app/provision/?mac=$1&file=directory.xml [QSA] #Escene -RewriteRule ^.*/provision/([A-Fa-f0-9]+)_Extern.xml$ app/provision/?ext=$1&file={$mac}_extern.xml [QSA] +RewriteRule ^.*/provision/([0-9]{1,11})_Extern.xml$ app/provision/?ext=$1&file={$mac}_extern.xml [QSA] +RewriteRule ^.*/provision/([0-9]{1,11})_Phonebook.xml$ app/provision/?ext=$1&file={$mac}_phonebook.xml [QSA] Options -Indexes diff --git a/resources/templates/provision/escene/e3xx/timezones.txt b/resources/templates/provision/escene/e3xx/timezones.txt new file mode 100644 index 0000000000..19453de31b --- /dev/null +++ b/resources/templates/provision/escene/e3xx/timezones.txt @@ -0,0 +1,119 @@ +GMT Greenwich Mean Time - 12 +GMT+00:00 Denmark-Faroe Islands(Torshavn) - 67 +GMT+00:00 Greenland - 66 +GMT+00:00 Irelan(Dublin) - 68 +GMT+00:00 Morocco - 72 +GMT+00:00 Portugal(Lisboa, Porto, Funchal) - 69 +GMT+00:00 Spain-Canary Islands(Las Palmas) - 70 +GMT+00:00 United-Kingdom(London) - 71 +GMT+01:00 Albania(Tirane) - 73 +GMT+01:00 Austria(Vienna) - 74 +GMT+01:00 Belgium(Brussels) - 75 +GMT+01:00 Caicos - 76 +GMT+01:00 Chad - 77 +GMT+01:00 Croatia(Zagreb) - 79 +GMT+01:00 Czech Republic(Prague) - 80 +GMT+01:00 Denmark(Kopenhagen) - 81 +GMT+01:00 France(Paris) - 82 +GMT+01:00 Germany(Berlin) - 13 +GMT+01:00 Hungary(Budapest) - 83 +GMT+01:00 Italy(Rome) - 84 +GMT+01:00 Luxembourg(Luxembourg) - 85 +GMT+01:00 Macedonia(Skopje) - 86 +GMT+01:00 Namibia(Windhoek) - 88 +GMT+01:00 Netherlands(Amsterdam) - 87 +GMT+01:00 Spain(Madrid) - 78 +GMT+02:00 Egypt(Cairo) - 14 +GMT+02:00 Estonia(Tallinn) - 89 +GMT+02:00 Finland(Helsinki) - 90 +GMT+02:00 Gaza Strip(Gaza) - 91 +GMT+02:00 Greece(Athens) - 92 +GMT+02:00 Israel(Tel Aviv) - 45 +GMT+02:00 Jordan(Amman) - 93 +GMT+02:00 Latvia(Riga) - 94 +GMT+02:00 Lebanon(Beirut) - 95 +GMT+02:00 Moldova(Kishinev) - 96 +GMT+02:00 Romania(Bucharest) - 48 +GMT+02:00 Russia(Kaliningrad) - 97 +GMT+02:00 Syria(Damascus) - 98 +GMT+02:00 Turkey(Ankara) - 99 +GMT+02:00 Ukraine(Kyiv, Odessa) - 100 +GMT+03:00 Bahrain,Russia(Moscow) - 15 +GMT+03:00 East Africa Time - 101 +GMT+03:00 Iraq(Baghdad) - 102 +GMT+03:30 Iran(Teheran) - 47 +GMT+04:00 Armenia(Yerevan) - 103 +GMT+04:00 Azerbaijan(Baku) - 104 +GMT+04:00 Georgia(Tbilisi) - 105 +GMT+04:00 Kazakhstan(Aktau) - 106 +GMT+04:00 Muscat - 16 +GMT+04:00 Russia(Samara) - 107 +GMT+04:30 Afghanistan - 108 +GMT+05:00 Kazakhstan(Aqtobe) - 109 +GMT+05:00 Kyrgyzstan(Bishkek) - 110 +GMT+05:00 Pakistan(Islamabad) - 17 +GMT+05:00 Russia(Chelyabinsk) - 111 +GMT+05:30 India - 26 +GMT+06:00 Kazakhstan(Astana, Almaty) - 112 +GMT+06:00 Russia(Novosibirsk, Omsk) - 18 +GMT+06:30 Myanmar - 46 +GMT+07:00 Russia(Krasnoyarsk) - 113 +GMT+07:00 Thailand(Bangkok) - 19 +GMT+08:00 Australia(Perth) - 115 +GMT+08:00 China(Beijing) - 20 +GMT+08:00 Singapore(Singapore) - 114 +GMT+09:00 Japan(Tokyo) - 21 +GMT+09:00 Korea(Seoul) - 116 +GMT+09:30 Australia(Adelaide, Darwin) - 117 +GMT+09:30 Australia-Central - 44 +GMT+10:00 Russia(Vladivostok) - 118 +GMT+10:00 Sydney,Melbourne,Canberra,Brisbane,Hobart - 22 +GMT+10:30 Australia(Lord Howe Islands) - 119 +GMT+11:00 New Caledonia(Noumea) - 120 +GMT+11:00 Solomon Islands - 23 +GMT+12:00 New Zealand(Wellington, Auckland) - 24 +GMT+12:45 New Zealand(Chatham Islands) - 121 +GMT+13:00 Tonga(Nukualofa) - 25 +GMT-01:00 Arquipelago Dos Acores - 11 +GMT-01:00 Portugal(Azores) - 65 +GMT-02:00 UTC-02 - 10 +GMT-03:00 Argentina(Buenos Aires) - 64 +GMT-03:00 Brasil(Brasilia) - 9 +GMT-03:00 Denmark-Greenland(Nuuk) - 63 +GMT-03:30 Canada-Newfoundland(St. Johns) - 43 +GMT-04:00 Canada-Atlantic - 42 +GMT-04:00 Paraguay(Asuncion) - 59 +GMT-04:00 Santiago de Chile - 8 +GMT-04:00 Trinidad & Tobago - 62 +GMT-04:00 United kingdom(Falkland Islands) - 61 +GMT-04:00 United kingdom-Bermuda(Bermuda) - 60 +GMT-04:30 Venezuela(Caracas) - 58 +GMT-05:00 Bahamas(Nassau) - 55 +GMT-05:00 Canada(Montreal, Ottawa, Quebec) - 56 +GMT-05:00 Cuba(Havana) - 57 +GMT-05:00 Lima - 7 +GMT-05:00 US-East-Indiana - 38 +GMT-05:00 US-Eastern - 32 +GMT-05:00 US-Michigan - 34 +GMT-06:00 Canada-Manitoba(Winnipeg) - 53 +GMT-06:00 Chile(Easter Islands) - 54 +GMT-06:00 Mexico(Mexico City, Acapulco) - 6 +GMT-06:00 US-Central - 37 +GMT-06:00 US-Indiana-Starke - 39 +GMT-07:00 Canada(Edmonton, Calgary) - 51 +GMT-07:00 LaPaz - 5 +GMT-07:00 Mexico(Mazatlan, Chihuahua) - 52 +GMT-07:00 US-Arizona - 31 +GMT-07:00 US-Mountain - 40 +GMT-08:00 California - 4 +GMT-08:00 Canada(Vancouver, Whitehorse) - 49 +GMT-08:00 Mexico(Tijuana, Mexicali) - 50 +GMT-08:00 US-Pacific - 35 +GMT-09:00 US-Alaska - 30 +GMT-09:00 UTC-9 - 3 +GMT-10:00 US-Aleutian - 36 +GMT-10:00 US-Hawaii - 33 +GMT-10:00 UTC-10 - 2 +GMT-11:00 US-Samoa - 41 +GMT-11:00 UTC-11 - 1 +GMT-12:00 UTC-12 - 0 diff --git a/resources/templates/provision/escene/e3xx/{$mac}.xml b/resources/templates/provision/escene/e3xx/{$mac}.xml index 1d33bbdbb4..cf9428310d 100644 --- a/resources/templates/provision/escene/e3xx/{$mac}.xml +++ b/resources/templates/provision/escene/e3xx/{$mac}.xml @@ -1,4 +1,91 @@ + + + + + + - + + + + + + + + + + + + + + + {foreach $lines as $row} {if $row.line_number neq ""} @@ -79,8 +299,14 @@ SessionTimerRefresher="0" UserphoneEnable="0" UserSessionTimerRefresher="0" + ServerType="0" + ConferenceWay="0" + ConferenceNum="" + EPPOutcodeEnable="0" + EPPOutcode="" + EPPOutcodeLength="" /> {/if} {/foreach} - + \ No newline at end of file diff --git a/resources/templates/provision/escene/e3xx/{$mac}_extern.xml b/resources/templates/provision/escene/e3xx/{$mac}_extern.xml index b22577e9ba..3cc887be6b 100644 --- a/resources/templates/provision/escene/e3xx/{$mac}_extern.xml +++ b/resources/templates/provision/escene/e3xx/{$mac}_extern.xml @@ -1,4 +1,3 @@ - {$is_first_line='true'}