Advertisement
mogaj

Find

May 28th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. public function guestAction()
  2.     {
  3.         $parts = explode('_', $_GET['id']);
  4.         $GuestMapper = new Application_Model_GuestMapper();
  5.         $guest = $GuestMapper->find($parts[0]);
  6.        
  7.         $this->disableView();
  8.         if (isset($parts[1]) && in_array($parts[1], array(1, 2, 3))) {
  9.             $image = 'image' . $parts[1];
  10.             if ($guest && $guest->$image) {
  11.                 $content_type = $guest->contentType($parts[1]);
  12.                 $path = $guest->imagePath($parts[1]);
  13.             }
  14.             else {
  15.                 $content_type = 'image/jpeg';
  16.                 $path = Application_Model_Property::noImagePath();
  17.             }
  18.         }
  19.         else {
  20.             $content_type = 'image/jpeg';
  21.             $path = Application_Model_Property::noImagePath();
  22.         }
  23.  
  24.         $this->getResponse()->setHeader('Content-Type', $content_type);
  25.         readfile($path);
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement