Exemplo n.º 1
0
 /**
  * Creates form validation.
  * 
  * @return array $result
  */
 public function index($data)
 {
     $result = array('data' => $data, 'select' => array($this->lang->contact->subject, $this->lang->contact->support, $this->lang->contact->report), 'nav_contact' => true);
     $vars = new Vars();
     if ($vars->isPost()) {
         $form = new FormValidate($data);
         $validate = $form->checkFields($this->validate);
         if (isset($validate['failed'])) {
             $result['validate'] = $validate;
         } else {
             // Code for email sending
             $result['success'] = true;
         }
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Adds a new user row.
  * 
  * @return array $result
  */
 public function add($data)
 {
     $result = array('data' => $data, 'select' => array($this->lang->mysql->disable, $this->lang->mysql->enable), 'nav_mysql' => true);
     $vars = new Vars();
     if ($vars->isPost()) {
         $form = new FormValidate($data);
         $validate = $form->checkFields($this->validate);
         if (isset($validate['failed'])) {
             $result['validate'] = $validate;
         } else {
             $query = "INSERT INTO user SET username=?, email=?, active=?";
             $params = array($vars->post('username'), $vars->post('email'), $vars->post('status'));
             $data = $this->db->run($query, $params);
             $router = new Router();
             $router->redirect('mysql');
         }
     }
     return $result;
 }