コード例 #1
0
 public function executeShow()
 {
     $id = $this->getRequestParameter('id');
     $this->forward404Unless($id);
     // for backward compability will be corrected.
     $this->cod = SnippetPeer::retrieveByPK(1);
     if (myUtils::is_int_val($id) && $id > 0 && $id < 31) {
         $this->code = SnippetPeer::retrieveByPK($id);
     } else {
         $this->code = sfPropelFriendlyUrl::retrieveByFriendlyUrl('Snippet', $id);
     }
     $this->forward404Unless($this->code);
     if ($this->code->getDraft() && (!$this->getUser()->isAuthenticated() || !myUtils::isUserRecord('SnippetPeer', $this->code->getId(), $this->getUser()->getId()))) {
         $this->forward404();
     }
 }
コード例 #2
0
 public function executeShowImage($request)
 {
     $id = $request->getParameter('id');
     ReportPeer::retrieveByPK(1);
     $report = sfPropelFriendlyUrl::retrieveByFriendlyUrl('Report', $id);
     $this->forward404Unless($report->getPublicRecord());
     $decorator = new PermanentChartDecorator();
     $chart = ReportPeer::getReportChartt($report, $decorator);
     $response = $this->getResponse();
     $response->clearHttpHeaders();
     $response->setContentType('image/png');
     $response->setContent(file_get_contents(sfConfig::get('app_web_images') . '/' . $chart->__toString()));
     $response->send();
 }