Beispiel #1
0
 static function ls($path)
 {
     $ipath = implode("/", $path);
     $r = new ResultSet();
     $dImages = new Dir(self::ROOT);
     $dir = $dImages->getDir($ipath);
     $dirs = $dir->ls(null, DIR::LS_DIR);
     $r->f("#dirs")->count(count($dirs))->f("#parent > whyperlink")->href(array_merge(array_slice($path, 0, -1), array(null)));
     foreach ($dirs as $k => $d) {
         $l = substr($d, strlen($dImages));
         $r->f("#cd > whyperlink", $k)->href(explode('/', $l))->f("#ddel", $k)->additional_id($d->getName())->f("#cd wtext", $k)->text($d->getName());
     }
     $fc = 0;
     foreach ($dir->ls() as $k => $f) {
         $df = new MimeDecorator(new StatDecorator($f));
         //if(strpos($df->getMime(),"image") === false) continue;
         try {
             $df = new ImageDecorator($df);
         } catch (DecoratorException $e) {
             continue;
         }
         $stat = $df->stat();
         @$r->f("#fname", $k)->text($df->getName())->f("#fdel", $k)->additional_id($df->getName())->f("#stat", $k)->text($df->getWidth() . "×" . $df->getHeight() . " " . date("Y/m/d H:i", $stat['mtime']) . " " . sizeToString($stat['size']))->f("#preview", $k)->file($df)->f("#choose > whyperlink", $k)->href($df->getURL());
         $fc++;
     }
     $r->f("#files")->count($fc);
     return $r;
 }
Beispiel #2
0
 function FileUpadter()
 {
     FileSystemObject::setRoot(dirname(__FILE__));
     $d = new Dir('files');
     $fu = new FileUpdater($d->getDir('source/includes'), $d->getDir('target/includes'), $d->getDir('backup/includes'));
     $command = ArgsHolder::get()->shiftCommand();
     if ($command == 'cdo') {
         $fu->copyDo();
     } elseif ($command == 'cundo') {
         $fu->copyUndo();
     } elseif ($command == 'undo') {
         $fu->undo();
     } elseif ($command == 'do') {
         $fu->run();
     } else {
         io::out('command not found');
     }
 }