Ejemplo n.º 1
0
 protected function add_rank_post()
 {
     if ($this->post->minhours == '' || $this->post->rank == '') {
         $this->set('message', 'Hours and Rank must be blank');
         $this->render('core_error.tpl');
         return;
     }
     if (!is_numeric($this->post->minhours)) {
         $this->set('message', 'The hours must be a number');
         $this->render('core_error.tpl');
         return;
     }
     $this->post->payrate = abs($this->post->payrate);
     $ret = RanksData::AddRank($this->post->rank, $this->post->minhours, $this->post->imageurl, $this->post->payrate);
     if (DB::errno() != 0) {
         $this->set('message', 'Error adding the rank: ' . DB::error());
         $this->render('core_error.tpl');
         return;
     }
     $this->set('message', 'Rank Added!');
     $this->render('core_success.tpl');
     LogData::addLog(Auth::$userinfo->pilotid, 'Added the rank "' . $this->post->rank . '"');
 }