diff --git a/emhttp/plugins/dynamix/include/DefaultPageLayout.php b/emhttp/plugins/dynamix/include/DefaultPageLayout.php
index de7a79f3e..24bd8d870 100644
--- a/emhttp/plugins/dynamix/include/DefaultPageLayout.php
+++ b/emhttp/plugins/dynamix/include/DefaultPageLayout.php
@@ -1112,40 +1112,65 @@ $(function() {
$('form').append($('').attr({type:'hidden', name:'csrf_token', value:csrf_token}));
});
+var gui_pages_available = [];
+
+ $gui_pages = glob("/usr/local/emhttp/plugins/*/*.page");
+ array_walk($gui_pages,function($value,$key){ ?>
+ gui_pages_available.push('=basename($value,".page")?>');
+ });
+?>
+
+function isValidURL(url) {
+ try {
+ new URL(url);
+ return true;
+ } catch (err) {
+ return false;
+ }
+}
+
$('body').on("click","a", function(e) {
href = $(this).attr("href").trim();
target = $(this).attr("target");
-
if ( href ) {
- if ( href.indexOf("/") == 0 ) { // all internal links start with "/"
+ if ( href.match('https://[^\.]*.(my)?unraid.net/') || href.indexOf("https://unraid.net/") == 0 || href == "https://unraid.net" || href.indexOf("http://lime-technology.com") == 0) {
return;
- }
- if ( href.match('https://[^\.]*.(my)?unraid.net/') || href.indexOf("https://unraid.net/") == 0 || href == "https://unraid.net" || href.indexOf("http://lime-technology.com/") == 0) {
- return;
- } else {
- if (href !== "#" && href.indexOf("javascript") !== 0) {
- e.preventDefault();
- swal({
- title: "=_('External Link')?>",
- text: "=_('Clicking OK will take you to a 3rd party website not associated with Limetech')?>
"+href,
- html: true,
- type: 'warning',
- showCancelButton: true,
- showConfirmButton: true,
- cancelButtonText: "=_('Cancel')?>",
- confirmButtonText: "=_('OK')?>"
- },function(isConfirm) {
- if (isConfirm) {
- var popupOpen = window.open(href,target);
- if ( !popupOpen || popupOpen.closed || typeof popupOpen == "undefined" ) {
- var popupWarning = addBannerWarning("=_('Popup Blocked.');?>");
- setTimeout(function() {
- removeBannerWarning(popupWarning);}
- ,10000);
- }
- }
- });
+ }
+
+ if (href !== "#" && href.indexOf("javascript") !== 0) {
+ if ( ! isValidURL(href) ) {
+ if ( href.indexOf("/") == 0 ) { // all internal links start with "/"
+ return;
}
+ var baseURLpage = href.split("/");
+ if ( gui_pages_available.includes(baseURLpage[0]) ) {
+ return;
+ }
+ }
+ if ( $(this).hasClass("localURL") ) {
+ return;
+ }
+ e.preventDefault();
+ swal({
+ title: "=_('External Link')?>",
+ text: "=_('Clicking OK will take you to a 3rd party website not associated with Limetech')?>
"+href+"",
+ html: true,
+ type: 'warning',
+ showCancelButton: true,
+ showConfirmButton: true,
+ cancelButtonText: "=_('Cancel')?>",
+ confirmButtonText: "=_('OK')?>"
+ },function(isConfirm) {
+ if (isConfirm) {
+ var popupOpen = window.open(href,target);
+ if ( !popupOpen || popupOpen.closed || typeof popupOpen == "undefined" ) {
+ var popupWarning = addBannerWarning("=_('Popup Blocked.');?>");
+ setTimeout(function() {
+ removeBannerWarning(popupWarning);}
+ ,10000);
+ }
+ }
+ });
}
}
});