Helper/FileSystem.php
public function secureDir($chunkDir, $credentials)
    {
        $dir = $this->getDir() . $chunkDir;

        if ($credentials['method'] == 'none') {
            return array();
        } elseif ($credentials['method'] == 'user') {
            return array(
                'login' => $credentials['login'],
                'password' => $credentials['password'],
            );
        }

        $user = 'yc';
        $password = substr(md5(microtime()), 0, 10);

        $this->filesystem->dumpFile(
            $dir . '.htpasswd',
            sprintf('%s:%s', $user, crypt($password, md5($password)))
        );

        return array(
            'login' => $user,
            'password' => $password,
        );
    }
public function secureDir($chunkDir, $credentials)
    {
        $dir = $this->getDir() . $chunkDir;

        if ($credentials['method'] == 'none') {
            return array();
        } elseif ($credentials['method'] == 'user') {
            return array(
                'login' => $credentials['login'],
                'password' => $credentials['password'],
            );
        }

        $user = 'yc';
        $password = substr(md5(microtime()), 0, 10);

        $this->filesystem->dumpFile(
            $dir . '.htpasswd',
            sprintf('%s:%s', $user, crypt($password, md5($password)))
        );

        return array(
            'login' => $user,
            'password' => $password,
        );
    }
public function secureDir ( $ chunkDir , $ credentials ) { $ dir = $ this -> getDir ( ) . $ chunkDir ; if ( $ credentials [ 'method' ] == 'none' ) { return array ( ) ; } elseif ( $ credentials [ 'method' ] == 'user' ) { return array ( 'login' => $ credentials [ 'login' ] , 'password' => $ credentials [ 'password' ] , ) ; } $ user = 'yc' ; $ password = substr ( md5 ( microtime ( ) ) , 0 , 10 ) ; $ this -> filesystem -> dumpFile ( $ dir . '.htpasswd' , sprintf ( '%s:%s' , $ user , crypt ( $ password , md5 ( $ password ) ) ) ) ; return array ( 'login' => $ user , 'password' => $ password , ) ; }
Securing the directory regarding the authentication method.

@param string $chunkDir
@param array $credentials

@return array
Securing the directory regarding the authentication method .