From b520bfece090aaa74ffafcd4a225e8812bc4855a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 28 Jul 2015 07:28:34 +0200 Subject: [PATCH] add method addDirSep() --- inc/inc.Utils.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index eabfe1787..daf1ea5c5 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -40,7 +40,7 @@ function getLongReadableDate($timestamp) { * @param $date string date in form Y-m-d H:i:s * @return integer/boolean unix timestamp or false in case of an error */ -function makeTsFromLongDate($date) { /* }}} */ +function makeTsFromLongDate($date) { /* {{{ */ $tmp = explode(' ', $date); if(count($tmp) != 2) return false; @@ -544,4 +544,17 @@ function get_extension($mimetype) { /* {{{ */ default: return false; } } /* }}} */ + +/** + * Adds a missing front slash to a string + * + * This function is used for making sure a directory name has a + * trailing directory separator + */ +function addDirSep($str) { /* {{{ */ + if(substr($str, -1, 1) != DIRECTORY_SEPARATOR) + return $str.DIRECTORY_SEPARATOR; + else + return $str; +} /* }}} */ ?>