コード例 #1
0
ファイル: user_model.php プロジェクト: nignjatov/TaxiDev
 public function updateProfile($userID)
 {
     $this->db->trans_start();
     $newUserEntity = new stdClass();
     $newUserEntity->email_id = $this->input->post('email_id');
     $newUserEntity->first_name = $this->input->post('first_name');
     $newUserEntity->last_name = $this->input->post('last_name');
     //        $newUserEntity->is_active = $this->input->post('is_active');
     //        $newUserEntity->password = $this->input->post('password');
     //        $newUserEntity->subscription_id = $this->input->post('subscription_id');
     //        $newUserEntity->user_name = $this->input->post('user_name');
     //        $newUserEntity->user_type = $this->input->post('user_type');
     $this->db->where("ID", $userID, false);
     if ($this->db->update("wp_server_users", $newUserEntity)) {
         UserEntity::setUserValues($newUserEntity);
         if ($this->updateUserDetail($userID)) {
             $user_type = $this->getUserType($userID);
             if ($user_type && strcmp($user_type, 'operator') == 0) {
                 $this->load->model("Operator_model");
                 if ($this->Operator_model->addOperator($userID)) {
                     return parent::returnData(true);
                 }
             } else {
                 $this->load->model("Driver_model");
                 if ($this->Driver_model->addDriver($userID)) {
                     return parent::returnData(true);
                 }
             }
         }
     }
     $this->db->trans_complete();
     if ($this->db->trans_status() === FALSE) {
         return parent::returnData(false, ConstExceptionCode::DATA_NOT_SAVED);
     }
     return parent::returnData(false, ConstExceptionCode::UNKNOWN_ERROR_CODE);
 }
コード例 #2
0
ファイル: User.php プロジェクト: nignjatov/TaxiDev
 public function userLogin()
 {
     log_message('info', 'The purpose of some variable is to provide some value.');
     $user_name = $this->input->post('user_name');
     $user_password = $this->input->post('user_password');
     if (!empty($user_name) && !empty($user_password)) {
         $this->userID = $this->User_model->getUserID($user_name, md5($user_password));
         if ($this->userID) {
             if (isset($_REQUEST['rememberMe']) && strcmp($_REQUEST['rememberMe'], 'remember-me') == 0) {
                 $this->session->sess_expiration = config_item('remember_session_expiry_time');
             } else {
                 $this->session->sess_expiration = config_item('session_expiry_time');
             }
             $user_detail = $this->User_model->getUserDetail($this->userID);
             if ($user_detail->result->is_active != 1) {
                 $this->userID = null;
                 $this->sendActivationMail($user_detail->result->email_id, $user_detail->result->ID);
                 $this->session->sess_destroy();
                 UserEntity::setDefault();
                 self::returnData(true, ConstExceptionCode::NOT_ACTIVATED_ACCOUNT);
             } else {
                 $userEntity = new stdClass();
                 $userEntity->first_name = $user_detail->result->first_name;
                 $userEntity->last_name = $user_detail->result->last_name;
                 $userEntity->email_id = $user_detail->result->email_id;
                 $userEntity->is_active = $user_detail->result->is_active;
                 $userEntity->password = $user_detail->result->password;
                 $userEntity->subscription_id = $user_detail->result->subscription_id;
                 $userEntity->user_name = $user_detail->result->user_name;
                 $userEntity->user_type = $user_detail->result->user_type;
                 UserEntity::setUserValues($userEntity);
                 $this->subscriptionID = $userEntity->subscription_id;
                 $array = array('user_id' => $this->userID, 'user_name' => $user_name, 'user_pass' => md5($user_password));
                 $this->session->set_userdata($array);
                 self::returnData(true);
             }
             /*else {
                   $this->chooseSubscription();
               }*/
         } else {
             self::returnData(false, ConstExceptionCode::INVALID_USER_ERROR);
         }
     } else {
         self::returnData(false, ConstExceptionCode::DATA_NOT_FOUND);
     }
 }