diff --git a/src/Model/Table/UserSettingsTable.php b/src/Model/Table/UserSettingsTable.php index cc4b5db..81cec2c 100644 --- a/src/Model/Table/UserSettingsTable.php +++ b/src/Model/Table/UserSettingsTable.php @@ -144,9 +144,13 @@ class UserSettingsTable extends AppTable */ public function validURI(String $uri): bool { - $parsed = parse_url($uri); - $isLocalPath = empty($parsed['scheme']) && empty($parsed['domain']) && !empty($parsed['path']); - $isValidURL = !empty($parsed['scheme']) && in_array($parsed['scheme'], ['http', 'https']) && filter_var($uri, FILTER_SANITIZE_URL); + try { + $parsed = parse_url($uri); + $isLocalPath = empty($parsed['scheme']) && empty($parsed['domain']) && !empty($parsed['path']); + $isValidURL = !empty($parsed['scheme']) && in_array($parsed['scheme'], ['http', 'https']) && filter_var($uri, FILTER_SANITIZE_URL); + } catch (\Exception $e) { + return false; + } return $isLocalPath || $isValidURL; } } diff --git a/templates/Instance/home.php b/templates/Instance/home.php index 814e294..aa5c845 100644 --- a/templates/Instance/home.php +++ b/templates/Instance/home.php @@ -18,16 +18,16 @@ $this->userSettingsTable = TableRegistry::getTableLocator()->get('UserSettings')