<?php

class Invite extends CI_Controller {
    private function is_valid_file($rel_path = '/', $file_html = 'home.html')
    {
        $abs_path = APPPATH.$rel_path.$file_html;
        if (file_exists($abs_path))
            return true;

        return false;
    }

    private function is_post_invalid()
    {
        return !$this->form_validation->run();
    }
    
	public function view($file_name = 'invite')
	{
        $file_html = $file_name.'.html';
        if ($this->is_valid_file('views/page/', $file_html))
        {
            $this->form_validation->set_rules('username', 'Username',
                'required|min_length[5]|max_length[12]|is_unique[users.username]',
                array(
                    'required' => 'You must provide a %s',
                    'min_length' => '%s must be more than 5 chars',
                    'max_length' => '%s must be less than 12 chars',
                    'is_unique' => 'This %s already exists'
                )
            );

            $this->form_validation->set_rules('password', 'Password', 'required',
                array('required' => 'You must provide a %s')
            );

            $this->form_validation->set_rules('passconf', 'Password Confirmation',
                'required|matches[password]',
                array(
                    'required' => 'You must provide a %s',
                    'matches' => 'Passowrd confirmation didn\'t match'
                )
            );

            $this->form_validation->set_rules('email', 'Email', 'required',
                array('required' => 'You must provide a %s')
            );

            if ($this->is_post_invalid())
            {
                /* Validation errors already set */
            }
            else
            {
                /* Add backticks on ientifiers */
                $this->db->protect_identifiers('users', TRUE);

                /* Always use query bindings as they are automatically escaped */
                $stmt = "INSERT INTO users (username, email, password) VALUES (?, ?, ?)";
                $data = $this->input->post(array('username', 'email'));
                $password = $this->input->post('password');

                $pepp = getenv('HOST_PEPPER');
                $pepp_password = hash_hmac("sha256", $password, $pepp);
                $hash_password = password_hash($pepp_password, PASSWORD_BCRYPT);

                $data['password'] = $hash_password;

                if (!$this->db->query($stmt, $data))
                {
                    /* Debug:
                     *
                     * $error = $this->db->error();
                     * var_dump($error);
                     */
                    $this->form_validation->set_message('submit_msg', 'Didn\'t work, :|');
                }
                else
                { 
                    $this->form_validation->set_string('Invite succesfully sent');
                }
            }

            $this->load->view('page/'.$file_html);
        }
        else 
        {
            redirect(base_url('index.html'));
        }
	}
}
