当前位置: 首页>>代码示例>>PHP>>正文


PHP VBX_User::setting_set方法代码示例

本文整理汇总了PHP中VBX_User::setting_set方法的典型用法代码示例。如果您正苦于以下问题:PHP VBX_User::setting_set方法的具体用法?PHP VBX_User::setting_set怎么用?PHP VBX_User::setting_set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VBX_User的用法示例。


在下文中一共展示了VBX_User::setting_set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: runUpdate_68_update_users

function runUpdate_68_update_users()
{
    $ci =& get_instance();
    $users = $ci->db->from('users')->get()->result();
    if (!empty($users)) {
        foreach ($users as $user) {
            $_user = new VBX_User($user);
            foreach (array('online', 'last_seen', 'last_login') as $setting) {
                if (!is_null($user->{$setting})) {
                    $_user->setting_set($setting, $user->{$setting});
                }
            }
        }
    }
}
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:15,代码来源:68.php

示例2: login_google

 /**
  * @param VBX_User $user
  * @param string $email
  * @param string $password
  * @param string $captcha
  * @param string $captcha_token
  * @return bool
  * @throws GoogleCaptchaChallengeException
  */
 protected function login_google($user, $email, $password, $captcha, $captcha_token)
 {
     $this->load->library('GoogleDomain');
     try {
         $auth_response = GoogleDomain::authenticate($email, $password, $captcha, $captcha_token);
         if (OpenVBX::schemaVersion() >= 24) {
             // Login succeeded
             try {
                 $user->setting_set('last_login', new MY_ModelLiteral('UTC_TIMESTAMP()'));
             } catch (VBX_UserException $e) {
                 $this->error_message('login', $e->getMessage());
                 return FALSE;
             }
         }
     } catch (GoogleDomainException $e) {
         $this->error_message('login', $e->getMessage());
         return FALSE;
     }
     return $user;
 }
开发者ID:wiserweb,项目名称:OpenVBX,代码行数:29,代码来源:vbx_user.php

示例3: setup_user

 private function setup_user($user)
 {
     $this->load->database();
     $this->config->load('openvbx');
     $this->load->model('vbx_user');
     $admin = new VBX_User();
     $admin->email = $user['email'];
     $admin->password = VBX_User::salt_encrypt($user['password']);
     $admin->first_name = $user['firstname'];
     $admin->last_name = $user['lastname'];
     $admin->tenant_id = $user['tenant_id'];
     $admin->is_admin = true;
     $admin->voicemail = 'Please leave a message after the beep.';
     try {
         $admin->save();
         $admin->setting_set('online', 9);
     } catch (Exception $e) {
         throw new InstallException($e->getMessage(), 4);
     }
 }
开发者ID:wiserweb,项目名称:OpenVBX,代码行数:20,代码来源:install.php

示例4: save_user

 private function save_user()
 {
     $errors = array();
     $user = false;
     $id = intval($this->input->post('id'));
     $auth_type = $this->input->post('auth_type');
     $error = false;
     $message = "Failed to save user for unknown reason.";
     $shouldGenerateNewPassword = false;
     $device_id_str = trim($this->input->post('device_id'));
     $device_number = trim($this->input->post('device_number'));
     $shouldSendWelcome = false;
     try {
         PhoneNumber::validatePhoneNumber($device_number);
     } catch (PhoneNumberException $e) {
         $data['json'] = array('error' => true, 'message' => $e->getMessage());
         return $this->respond('', 'accounts', $data);
     }
     if (!empty($auth_type)) {
         $auth_type = $this->vbx_user->get_auth_type($auth_type);
     }
     if ($id > 0) {
         $user = VBX_User::get($id);
     } else {
         $user = VBX_User::get(array('email' => $this->input->post('email')));
         if (!empty($user) && $user->is_active == 1) {
             $error = true;
             $message = 'Email address is already in use.';
         } elseif (!empty($user) && $user->is_active == 0) {
             // It's an old account that was made inactive.  By re-adding it, we're
             // assuming the user wants to re-instate the old account.
             $shouldSendWelcome = true;
         } else {
             // It's a new user
             $user = new VBX_User();
             $shouldSendWelcome = true;
         }
     }
     if (!$error) {
         $fields = array('first_name', 'last_name', 'email', 'is_admin');
         foreach ($fields as $field) {
             $user->{$field} = $this->input->post($field);
         }
         $user->is_active = TRUE;
         $user->auth_type = isset($auth_type->id) ? $auth_type->id : 1;
         try {
             $user->save();
             if ($shouldSendWelcome) {
                 $user->setting_set('online', 9);
                 $user->send_new_user_notification();
             }
         } catch (VBX_UserException $e) {
             $error = true;
             $message = $e->getMessage();
             log_message('error', 'Unable to send new user notification: ' . $message);
         }
         if (!$error) {
             if (strlen($device_number) > 0) {
                 // We're adding or modifying an existing device
                 if (strlen($device_id_str) > 0) {
                     // We're updating an existing record
                     $device_id = intval($device_id_str);
                     $device = VBX_Device::get($device_id);
                     $device->value = normalize_phone_to_E164($device_number);
                     try {
                         $device->save();
                     } catch (VBX_DeviceException $e) {
                         $error = true;
                         $message = 'Failed to update device: ' . $e->getMessage();
                     }
                 } else {
                     // We're creating a new device record
                     $number = array("name" => "Primary Device", "value" => normalize_phone_to_E164($device_number), "user_id" => $user->id, "sms" => 1);
                     try {
                         $new_device_id = $this->vbx_device->add($number);
                     } catch (VBX_DeviceException $e) {
                         $error = true;
                         $message = "Failed to add device: " . $e->getMessage();
                     }
                 }
             } else {
                 if (strlen($device_number) == 0 && strlen($device_id_str) > 0) {
                     // We're deleting a device
                     try {
                         $this->vbx_device->delete(intval($device_id_str), $user->id);
                     } catch (VBX_DeviceException $e) {
                         $error = true;
                         $message = "Unable to delete device entry: " . $e->getMessage();
                     }
                 }
             }
         }
     }
     if ($error) {
         $json = array('error' => $error, 'message' => $message);
     } else {
         $json = array('id' => $user->id, 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'is_active' => $user->is_active, 'is_admin' => $user->is_admin, 'notification' => $user->notification, 'auth_type' => isset($auth_type->description) ? $auth_type->description : 'openvbx', 'email' => $user->email, 'error' => false, 'message' => '', 'online' => $user->setting('online'));
     }
     $data['json'] = $json;
     $this->respond('', 'accounts', $data);
//.........这里部分代码省略.........
开发者ID:wiserweb,项目名称:OpenVBX,代码行数:101,代码来源:accounts.php


注:本文中的VBX_User::setting_set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。