summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-05-01 15:20:42 +0200
committerandi <andi@splitbrain.org>2005-05-01 15:20:42 +0200
commit43dd051e45ee9e8f4ef8149d7f7baf9ccea0d1e6 (patch)
treef0c889d5ff5481d2339a6ab070ce7c97ceacd40c
parent265e3787e12edf6f10be9d7260d20ea1778428cb (diff)
downloadrpg-43dd051e45ee9e8f4ef8149d7f7baf9ccea0d1e6.tar.gz
rpg-43dd051e45ee9e8f4ef8149d7f7baf9ccea0d1e6.tar.bz2
fix for uploaded media permissions
darcs-hash:20050501132042-9977f-2ffb1d14c062dae92c1d491e99591698200f0b5b.gz
-rw-r--r--media.php6
1 files changed, 5 insertions, 1 deletions
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{