All pastes #444957 Raw Edit

Stuff

public text v1 · immutable
·published 2007-04-17 16:47 UTC
rendered paste body
  public function executeShow()
  {
    $this->setLayout(false);
    $c = new Criteria();
    $c->add(PhotosPeer::PHOTO,$this->getRequestParameter('photo'));
    $photo = PhotosPeer::doSelectOne($c);
    // Check if the person requesting the image actually owns the image
    if($this->getUser()->getAttribute('ultn') != $photo->getUltn())
    {
      $this->foward404();
    }
    // They do, send the file
    $imageName = $this->getRequestParameter('photo');
    $fileToSend = "/idPhotos/pending/original/".$imageName;
    // Format the file to send
    $sf_request->getContext()->getResponse()->setHttpHeader('Cache-Control','no-store, no-cache, must-revalidate');
    $sf_request->getContext()->getResponse()->setHttpHeader('Cache-Control','post-check=0, pre-check=0');
    $sf_request->getContext()->getResponse()->setHttpHeader('Pragma','no-cache');
    $sf_request->getContext()->getResponse()->setHttpHeader('Content-Disposition', 'attachment; filename="'.$imageName.'"');
    $sf_request->getContext()->getResponse()->setContent(@readfile($fileToSend));
    $sf_request->getContext()->getResponse()->sendHttpHeaders();
    $sf_request->getContext()->getResponse()->sendContent();
  }