예제 #1
0
 public function editpirep()
 {
     if (!Auth::LoggedIn()) {
         $this->set('message', 'You must be logged in to access this feature!');
         $this->render('core_error.tpl');
         return;
     }
     if (!isset($this->get->id)) {
         $this->set('message', 'No PIREP specified');
         $this->render('core_error.tpl');
         return;
     }
     $pirep = PIREPData::GetReportDetails($this->get->id);
     if (!$pirep) {
         $this->set('message', 'Invalid PIREP');
         $this->render('core_error.tpl');
         return;
     }
     # Make sure pilot ID's match
     if ($pirep->pilotid != Auth::$userinfo->pilotid) {
         $this->set('message', 'You cannot add a comment to a PIREP that is not yours!');
         $this->render('core_error.tpl');
         return;
     }
     if (PIREPData::PIREPUnderAge($pirep->pirepid, Config::Get('PIREP_CUSTOM_FIELD_EDIT')) == false) {
         $this->set('message', 'You cannot edit a PIREP after the cutoff time of ' . Config::Get('PIREP_CUSTOM_FIELD_EDIT') . ' hours');
         $this->render('core_error.tpl');
         return;
     }
     $this->set('pirep', $pirep);
     $this->set('pirepfields', PIREPData::GetAllFields());
     $this->render('pirep_editform.tpl');
 }