Beispiel #1
0
 public function validatePath($path, $values)
 {
     $virtual = Curry_Backend_FileBrowser::publicToVirtual($path);
     if (!$virtual) {
         return false;
     }
     $physical = Curry_Backend_FileBrowser::virtualToPhysical($virtual);
     if (!$physical) {
         return false;
     }
     if ($values['write'] && !Curry_Backend_FileBrowser::isPhysicalWritable($physical)) {
         return false;
     }
     return true;
 }
 public function getPaths($selected)
 {
     $paths = parent::getPaths($selected);
     $managedfileCache = $this->getManagedfilesFromCache();
     foreach ($paths as &$path) {
         foreach ($path['files'] as $delta => $file) {
             $vp = $file['Path'];
             // this is a virtual path
             $pp = self::virtualToPublic($vp);
             if ($file['IsFolder']) {
                 $pp .= DIRECTORY_SEPARATOR;
             }
             // check whether this entity is managed and show based on read permission.
             $mf = $managedfileCache[$pp];
             $path['files'][$delta]['IsManaged'] = null !== $mf;
             if ($mf) {
                 if ($mf->isReadable()) {
                     $path['files'][$delta]['ManagedPerm'] = $mf->isWritable() ? 'w' : 'r';
                 } else {
                     // do not show this entity if logged in user does not have read permission.
                     unset($path['files'][$delta]);
                 }
             }
             //trace($path['files'][$delta]); //MARK
         }
     }
     return $paths;
 }