function add() { DB::escapePost(); if ($_POST) { Codes::addCodesType(); $this->redirect('/codes/'); } else { $data['fromdate'] = date('d.m.Y H:i'); $data['todate'] = date('d.m.Y H:i', strtotime('+1 year')); View::plugin('add', $data); } }