diff --git a/emhttp/plugins/dynamix/NotificationAgents.page b/emhttp/plugins/dynamix/NotificationAgents.page index 2ec66f7e4..4855028d6 100644 --- a/emhttp/plugins/dynamix/NotificationAgents.page +++ b/emhttp/plugins/dynamix/NotificationAgents.page @@ -2,7 +2,7 @@ Menu="Notifications:3" Title="Notification Agents" Tag="rss-square" --- - + - + +Language) ) { - $guiLanguage = ($locale == "" ) ? "en_US" : $locale; - $acceptedLanguages = explode(" ",$xml->Language); - if ( ! in_array($guiLanguage,$acceptedLanguages) ) + $xml = @simplexml_load_file($xml_file); + if (! $xml) { continue; } - $name = str_replace(' ','_',$xml->Name); + + if (isset($xml->Language)) { + $guiLanguage = ($locale == "") ? "en_US" : $locale; + $acceptedLanguages = explode(" ", $xml->Language); + if (! in_array($guiLanguage, $acceptedLanguages)) { + continue; + } + } + $name = str_replace(' ', '_', $xml->Name); + $titleId = 'agent-' . strtolower($name); $enabledAgent = agent_fullname("$name.sh", "enabled"); $disabledAgent = agent_fullname("$name.sh", "disabled"); if (is_file($disabledAgent)) { - $file = $disabledAgent; - if (is_file($enabledAgent)) unlink($enabledAgent); + $file = $disabledAgent; + if (is_file($enabledAgent)) { + unlink($enabledAgent); + } } else { - $file = $enabledAgent; + $file = $enabledAgent; } $values = []; $script = ""; if (is_file($file)) { - preg_match("/[#]{6,100}([^#]*?)[#]{6,100}/si", file_get_contents($file), $match); - if (isset($match[1])) { - foreach (explode(PHP_EOL, $match[1]) as $line) { - if (strpos($line, "=")) { - [$k, $v] = my_explode("=",str_replace("\"", "", $line),2); - $values[$k] = $v; - } + preg_match("/[#]{6,100}([^#]*?)[#]{6,100}/si", file_get_contents($file), $match); + if (isset($match[1])) { + foreach (explode(PHP_EOL, $match[1]) as $line) { + if (strpos($line, "=")) { + [$k, $v] = my_explode("=", str_replace("\"", "", $line), 2); + $values[$k] = $v; + } + } } - } } - foreach (explode(PHP_EOL,(String) $xml->Script) as $line) if (trim($line)) $script .= trim($line)."{1}"; - echo '