Пример #1
0
 public function submit()
 {
     $current = '/profile/' . $this->input->post('op');
     $data = $this->security($current);
     if ($data && !empty($data)) {
         $this->validation();
         $obj = $this->prepare($data);
         if ($this->form_validation->run()) {
             //if ($this->input->post('op') == "add_" ) {
             //$obj->password = uniqid();
             //$obj->modification_time = date("Y-m-d H:i:s");
             //}
             $obj = $this->users->save($obj);
             $user_dir = $this->config->item('upload_path') . $obj->id;
             if (!file_exists($user_dir)) {
                 mkdir($user_dir, 0777);
             }
             $config['upload_path'] = $user_dir . '/';
             $config['allowed_types'] = 'gif|jpg|png|jpeg';
             $config['overwrite'] = 'TRUE';
             $config['file_name'] = $this->config->item('default_upload_file');
             $config['max_size'] = '2000';
             $this->load->library('upload', $config);
             if (!$this->upload->do_upload('avatar')) {
                 echo $this->upload->display_errors();
             }
             if ($this->input->post('op') == "add_") {
                 $this->send_mail($obj->password, $this->input->post('email'));
             }
             if ($this->input->post('op') == "edit_my_") {
                 $obj = $this->users->get_by_id($obj->id);
                 $this->session->set_userdata('user', $obj);
             }
             $this->edit($obj->id, success_changes(), $this->input->post('op'));
         } else {
             if ($this->input->post('op') == "add_") {
                 $this->add();
             } else {
                 $this->edit();
             }
         }
     } else {
         redirect('login');
     }
 }
Пример #2
0
 public function submit()
 {
     $current = '/circle/' . $this->input->post('op');
     $data = $this->security($current);
     if ($data && !empty($data)) {
         $obj = $this->prepare();
         $this->validation();
         if ($this->form_validation->run()) {
             $obj = $this->circles->save($obj);
             $this->circles->addmemberuser($obj);
             $this->edit($obj->id, success_changes());
         } else {
             if ($this->input->post('op') == "add_") {
                 $this->add();
             } else {
                 $this->edit();
             }
         }
     } else {
         redirect('login');
     }
 }