저자: Benjamin Georgeault (benjamin@wedgesama.fr)
예제 #1
0
 public function testAllowedUpload()
 {
     $app = $this->getApp();
     $fp = new FilePermissions($app);
     $hiddenFile = ".bashrc";
     $this->assertFalse($fp->allowedUpload($hiddenFile));
     $badExtension = "evil.exe";
     $this->assertFalse($fp->allowedUpload($badExtension));
     $okFile = "mycoolimage.jpg";
     $this->assertTrue($fp->allowedUpload($okFile));
 }
예제 #2
0
 public function testAllowedUpload()
 {
     $app = $this->getApp();
     $fp = new FilePermissions($app['config']);
     $hiddenFile = '.bashrc';
     $this->assertFalse($fp->allowedUpload($hiddenFile));
     $badExtension = 'evil.exe';
     $this->assertFalse($fp->allowedUpload($badExtension));
     $okFile = 'mycoolimage.jpg';
     $this->assertTrue($fp->allowedUpload($okFile));
 }
예제 #3
0
 public function testAllowedUpload()
 {
     $app = $this->getApp();
     $fp = new FilePermissions($app['config']);
     $hiddenFile = '.bashrc';
     $this->assertFalse($fp->allowedUpload($hiddenFile));
     $badExtension = 'evil.exe';
     $this->assertFalse($fp->allowedUpload($badExtension));
     $okFile = 'mycoolimage.jpg';
     if (ini_set('file_uploads', '0') !== false) {
         try {
             $fp->allowedUpload($okFile);
         } catch (IOException $e) {
             $this->assertEquals($e->getMessage(), 'File uploads are not allowed, check the file_uploads ini directive.');
         }
         ini_set('file_uploads', '1');
     }
     $this->assertTrue($fp->allowedUpload($okFile));
 }
예제 #4
0
파일: Authorized.php 프로젝트: bolt/bolt
 /**
  * Returns whether you are authorized to do something with a file or directory.
  *
  * @param string $path
  *
  * @return bool
  */
 public function handle($path)
 {
     $file = $this->filesystem->getFile($path);
     return $this->filePermissions->authorized($file->getMountPoint(), $file->getPath());
 }