[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/pholio/controller/ -> PholioInlineThumbController.php (source)

   1  <?php
   2  
   3  final class PholioInlineThumbController extends PholioController {
   4  
   5    private $imageid;
   6  
   7    public function shouldAllowPublic() {
   8      return true;
   9    }
  10  
  11    public function willProcessRequest(array $data) {
  12      $this->imageid = idx($data, 'imageid');
  13    }
  14  
  15    public function processRequest() {
  16      $request = $this->getRequest();
  17      $user = $request->getUser();
  18  
  19      $image = id(new PholioImage())->load($this->imageid);
  20  
  21      if ($image == null) {
  22        return new Aphront404Response();
  23      }
  24  
  25      $mock = id(new PholioMockQuery())
  26        ->setViewer($user)
  27        ->withIDs(array($image->getMockID()))
  28        ->executeOne();
  29  
  30      if (!$mock) {
  31        return new Aphront404Response();
  32      }
  33  
  34      $file = id(new PhabricatorFileQuery())
  35        ->setViewer($user)
  36        ->witHPHIDs(array($image->getFilePHID()))
  37        ->executeOne();
  38  
  39      if (!$file) {
  40        return new Aphront404Response();
  41      }
  42  
  43      return id(new AphrontRedirectResponse())->setURI($file->getThumb60x45URI());
  44    }
  45  
  46  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1