From 43dd051e45ee9e8f4ef8149d7f7baf9ccea0d1e6 Mon Sep 17 00:00:00 2001 From: andi Date: Sun, 1 May 2005 15:20:42 +0200 Subject: fix for uploaded media permissions darcs-hash:20050501132042-9977f-2ffb1d14c062dae92c1d491e99591698200f0b5b.gz --- media.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/media.php b/media.php index e10161abe..7f2101449 100644 --- a/media.php +++ b/media.php @@ -45,6 +45,7 @@ function media_upload($NS){ require_once(DOKU_INC.'inc/confutils.php'); global $lang; + global $conf; // get file $id = $_POST['id']; @@ -60,12 +61,15 @@ function media_upload($NS){ $types = array_map(create_function('$q','return preg_quote($q,"/");'),$types); $regex = join('|',$types); - + // we set the umask here but this doesn't really help + // because a temp file was created already umask($conf['umask']); if(preg_match('/\.('.$regex.')$/i',$fn)){ // prepare directory io_makeFileDir($fn); if (move_uploaded_file($file['tmp_name'], $fn)) { + // set the correct permission here + chmod($fn, 0777 - $conf['umask']); msg($lang['uploadsucc'],1); return true; }else{ -- cgit v1.2.3