diff --git a/functions.php b/functions.php index 7c74dea4..b8cd56b4 100644 --- a/functions.php +++ b/functions.php @@ -199,7 +199,7 @@ function truncate($text, $chars) { function formatPhoneNumber($phoneNumber, $country_code = '', $show_country_code = false) { // Remove all non-digit characters - $digits = preg_replace('/\D/', '', $phoneNumber); + $digits = preg_replace('/\D/', '', $phoneNumber ?? ''); $formatted = ''; // If no digits at all, fallback early @@ -1659,7 +1659,7 @@ function display_folder_options($parent_folder_id, $client_id, $folder_location function sanitize_url($url) { $allowed = ['http', 'https', 'file', 'ftp', 'ftps', 'sftp', 'dav', 'webdav', 'caldav', 'carddav', 'ssh', 'telnet', 'smb', 'rdp', 'vnc', 'rustdesk', 'anydesk', 'connectwise', 'splashtop', 'sip', 'sips', 'ldap', 'ldaps']; - $parts = parse_url($url); + $parts = parse_url($url ?? ''); if (isset($parts['scheme']) && !in_array(strtolower($parts['scheme']), $allowed)) { // Remove the scheme and colon $pos = strpos($url, ':'); @@ -1673,5 +1673,5 @@ function sanitize_url($url) { } // Safe schemes: return escaped original URL - return htmlspecialchars($url, ENT_QUOTES, 'UTF-8'); + return htmlspecialchars($url ?? '', ENT_QUOTES, 'UTF-8'); } \ No newline at end of file diff --git a/modals/asset_import_modal.php b/modals/asset_import_modal.php index 25dc0deb..d5aa4f51 100644 --- a/modals/asset_import_modal.php +++ b/modals/asset_import_modal.php @@ -14,13 +14,14 @@