From 3543c6de939c52517f590300b6d4289dc3a785ff Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 28 Nov 2011 20:29:39 +0100 Subject: deprecated 3rd parameter of cleanID() FS#2377 For some reason trailing/leading underscores were allowed when uploading files. But the rest of the code (eg. listing or downloading files) never supported this. This patch removes this special case for uploading files to streamline ID cleaning of pages and media files. --- inc/pageutils.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/pageutils.php') diff --git a/inc/pageutils.php b/inc/pageutils.php index 31b5f9ff9..151fa5987 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -92,7 +92,7 @@ function getID($param='id',$clean=true){ * @author Andreas Gohr * @param string $raw_id The pageid to clean * @param boolean $ascii Force ASCII - * @param boolean $media Allow leading or trailing _ for media files + * @param boolean $media DEPRECATED */ function cleanID($raw_id,$ascii=false,$media=false){ global $conf; @@ -132,7 +132,7 @@ function cleanID($raw_id,$ascii=false,$media=false){ //clean up $id = preg_replace($sepcharpat,$sepchar,$id); $id = preg_replace('#:+#',':',$id); - $id = ($media ? trim($id,':.-') : trim($id,':._-')); + $id = trim($id,':._-'); $id = preg_replace('#:[:\._\-]+#',':',$id); $id = preg_replace('#[:\._\-]+:#',':',$id); -- cgit v1.2.3 From 63703ba5bd81f50c43bc45f8bf79c514afa3ee49 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 16 Mar 2012 12:09:30 +0100 Subject: coding style updates --- inc/pageutils.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'inc/pageutils.php') diff --git a/inc/pageutils.php b/inc/pageutils.php index 151fa5987..db00258e2 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -213,9 +213,9 @@ function sectionID($title,&$check) { if(is_array($check)){ // make sure tiles are unique if (!array_key_exists ($title,$check)) { - $check[$title] = 0; + $check[$title] = 0; } else { - $title .= ++ $check[$title]; + $title .= ++ $check[$title]; } } @@ -347,8 +347,8 @@ function mediaFN($id, $rev=''){ if(empty($rev)){ $fn = $conf['mediadir'].'/'.utf8_encodeFN($id); }else{ - $ext = mimetype($id); - $name = substr($id,0, -1*strlen($ext[0])-1); + $ext = mimetype($id); + $name = substr($id,0, -1*strlen($ext[0])-1); $fn = $conf['mediaolddir'].'/'.utf8_encodeFN($name .'.'.( (int) $rev ).'.'.$ext[0]); } return $fn; -- cgit v1.2.3