From c5b2d657a559a93a189beb758f9ee1d025c0ac9a Mon Sep 17 00:00:00 2001 From: Bob Mottram <bob@freedombone.net> Date: Fri, 31 Aug 2018 16:57:50 +0100 Subject: [PATCH] Endswith function --- webadmin/backuprestore.php | 10 ++++++++++ webadmin/systemmonitor.php | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/webadmin/backuprestore.php b/webadmin/backuprestore.php index a52e4c77c..59c2cb8c8 100755 --- a/webadmin/backuprestore.php +++ b/webadmin/backuprestore.php @@ -1,5 +1,15 @@ <?php +function endsWith($haystack, $needle) +{ + $length = strlen($needle); + if ($length == 0) { + return true; + } + + return (substr($haystack, -$length) === $needle); +} + // Backup password screen for getting the password // prior to backup or restore diff --git a/webadmin/systemmonitor.php b/webadmin/systemmonitor.php index f154e03c9..a37a32e79 100755 --- a/webadmin/systemmonitor.php +++ b/webadmin/systemmonitor.php @@ -1,5 +1,15 @@ <?php +function endsWith($haystack, $needle) +{ + $length = strlen($needle); + if ($length == 0) { + return true; + } + + return (substr($haystack, -$length) === $needle); +} + // Updates values for the system monitor screen $output_filename = "settings.html"; -- GitLab