From 16a71e4ea47f890ca76fb1ef71fdbd670f37c598 Mon Sep 17 00:00:00 2001 From: zone Date: Mon, 25 Jun 2001 01:25:47 +0000 Subject: [PATCH] Added ord_match (), removed bad_chars_file (), modified bad_chars () to be much less picky --- filemanager/inc/main.inc.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/filemanager/inc/main.inc.php b/filemanager/inc/main.inc.php index 2f3594ab8c..69115632fb 100755 --- a/filemanager/inc/main.inc.php +++ b/filemanager/inc/main.inc.php @@ -87,22 +87,29 @@ function borkb ($size, $enclosed = NULL, $return = 0) function bad_chars ($string, $return = 0) { - if (preg_match("-([\\\|/|\||\?|\`|\@|\#|\$|%|\&|\*|\(|\)|\[|\{|\]|\}|\;|\:|\"|\'|\<|\>|\,|\ ])-", $string, $badchars)) + if (preg_match("-([\\\|/|<|>|\"])-", $string, $badchars)) $rstring = $badchars[1]; return trim ((eor ($rstring, $return))); } ### -# Check for and return the first character that can't be used in a file or directory name +# Match character in string using ord (). ### -function bad_chars_file ($string, $return = 0) +function ord_match ($string, $charnum) { - if (preg_match ("-([\\\|\/|\&|\(|\)])-", $string, $badchars)) - $rstring = $badchars[1]; + for ($i = 0; $i < strlen ($string); $i++) + { + $character = ord (substr ($string, $i, 1)); - return trim ((eor ($rstring, $return))); + if ($character == $charnum) + { + return True; + } + } + + return False; } ###