コード例 #1
0
 public function index()
 {
     if ($this->ion_auth->logged_in()) {
         //gdy zalogowany
         redirect($this->config->item('base_url') . 'browse/images/', 'refresh');
     }
     $this->load->model('browse_model');
     $this->load->helper(array('common', 'urlslug'));
     $this->data['thumbs_mini'] = $this->browse_model->get_thumb_images(0, 0, 'dd', 0, 1, 14);
     $this->data['thumbs_small_gallery'] = $this->browse_model->get_thumb_galleries(0, 0, 'dd', 0, 1, 7);
     foreach ($this->data['thumbs_small_gallery'] as &$thumb) {
         $thumb['gallery_thumb_images'] = $this->browse_model->get_imgs_filename_to_gallery_thumb($thumb['id'], 5);
     }
     if ($this->ion_auth->logged_in()) {
         $this->data['logged_in_user'] = $this->ion_auth->user()->row();
     }
     $this->data['adult_user'] = $this->adult_user;
     $this->data['thumb_mini_config'] = $this->config->item('thumb_mini', 'digallery');
     $this->data['message'] = array('type' => $this->session->flashdata('type'), 'msg' => $this->session->flashdata('msg'));
     $this->data['csrf'] = get_csrf_nonce();
     $this->data['js'][] = 'jquery.placeholder.min.js';
     $this->data['js'][] = 'start_page.js';
     $this->data['no_container_class'] = TRUE;
     $this->render();
 }
コード例 #2
0
 /**
  * rejestracja nowego użytkownika ajax (strona startowa)
  */
 public function register_ajax()
 {
     if ($this->input->is_ajax_request()) {
         $this->load->helper('common');
         if ($this->ion_auth->logged_in()) {
             $this->output->set_content_type('application/json')->set_output(json_encode(array("status" => "1")));
         } else {
             if (reverse_valid_csrf_nonce()) {
                 //reguły walidacji formularza logowania
                 $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
                 $this->form_validation->set_rules('password', 'Hasło', 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
                 $this->form_validation->set_rules('password_confirm', 'Powtórzenie hasła', 'required');
                 //walidacja danych formularza rejestracji nowego uzytkownika
                 if ($this->form_validation->run()) {
                     //walidacja przeszła pomyślnie
                     $username = strtolower($this->input->post('email'));
                     $email = $this->input->post('email');
                     $password = $this->input->post('password');
                 }
                 //próba rejestracji nowego użytkownika
                 if ($this->form_validation->run() && $this->ion_auth->register($username, $password, $email)) {
                     //rejestracja powiodła się
                     $this->session->set_flashdata(array('type' => 'info', 'msg' => 'Konto zostało utworzone. Link aktywacyjny został wysłany na podany adres email.'));
                     $this->output->set_content_type('application/json')->set_output(json_encode(array("status" => "1")));
                 } else {
                     $this->output->set_content_type('application/json')->set_output(json_encode(array("status" => "0", "error_type" => $this->ion_auth->errors() ? 'register' : 'valid', "msg" => $this->ion_auth->errors() ? $this->ion_auth->errors() : validation_errors('', '<br />'), "csrf_key" => get_csrf_nonce())));
                 }
             } else {
                 show_404();
             }
         }
     } else {
     }
 }
コード例 #3
0
ファイル: pre.php プロジェクト: jaksmid/website
<?php

$this->code = $this->input->get('code');
$this->user = $this->ion_auth->forgotten_password_check($this->code);
if ($this->user == false) {
    $this->session->set_flashdata('message', $this->ion_auth->errors());
    redirect('password_forgot', 'refresh');
}
$this->active = 'profile';
$this->message = validation_errors() ? validation_errors() : $this->session->flashdata('message');
$min_password_length = $this->config->item('min_password_length', 'ion_auth');
$this->new_password = array('name' => 'new', 'id' => 'new', 'type' => 'password', 'pattern' => '^.{' . $min_password_length . '}.*$');
$this->new_password_confirm = array('name' => 'new_confirm', 'id' => 'new_confirm', 'type' => 'password', 'pattern' => '^.{' . $min_password_length . '}.*$');
$this->user_id = array('name' => 'user_id', 'id' => 'user_id', 'type' => 'hidden', 'value' => $this->user->id);
$this->csrf = get_csrf_nonce();