TheProjecter / osfilemanager

Automatically exported from code.google.com/p/osfilemanager
0 stars 0 forks source link

New folders dont have default permissions #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Log in and create a new folder
2.
3.

What is the expected output? What do you see instead?

Expect folder to have default permissions set in the index.php file but instead 
it has 1411

What version of the product are you using? On what operating system? On
what web host?

version 2.2 on Centos %

Please provide any additional information below.

Line which says:

        if(mkdir($userdir.$d.$nfname, $default_perm)) $ok = "Your directory, '".$dis.$d.$ndir.$nfname."', was succesfully created.\n";

SHOULD say:

        if(mkdir($userdir.$d.$nfname, intval($default_perm,8))) $ok = "Your directory, '".$dis.$d.$ndir.$nfname."', was succesfully created.\n";

Original issue reported on code.google.com by pelli...@googlemail.com on 28 Jul 2010 at 9:14

GoogleCodeExporter commented 9 years ago
The default mask may prevent mkdir() from setting the desired permissions. (see 
PHP: umask)

My solution was to replace the line:
        if(mkdir($userdir.$d.$nfname, $default_perm)) $ok = "Your directory, '".$dis.$d.$ndir.$nfname."', was succesfully created.\n";
with:
        if(mkdir($userdir.$d.$nfname, $default_perm)) {
            $ok = "Your directory, '".$dis.$d.$ndir.$nfname."', was succesfully created.\n";
        @chmod($userdir.$d.$nfname, intval($default_perm,8));
    }

Original comment by TStephen...@gmail.com on 13 Aug 2011 at 5:22