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


PHP VBX_User类代码示例

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


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

示例1: reset

 public function reset()
 {
     $this->template->write('title', 'Reset Password');
     $data = array();
     $email = $this->input->post('email');
     if (empty($email)) {
         $data['error'] = $this->session->flashdata('error');
         return $this->respond('', 'reset', $data, 'login-wrapper', 'layout/login');
     }
     $user = VBX_User::get(array('email' => $this->input->post('email'), 'is_active' => 1));
     if (empty($user)) {
         $this->session->set_flashdata('error', 'No active account found.');
         return redirect('auth/reset');
     }
     if ($user->auth_type == 'google') {
         header('Location: http://www.google.com/support/accounts/bin/answer.py?answer=48598&hl=en&ctx=ch_Login&fpUrl=https%3A%2F%2Fwww.google.com%2Faccounts%2FForgotPasswd%3FfpOnly%3D1%26continue%3Dhttp%253A%252F%252Fwww.google.com%252F%26hl%3Den');
         return;
     } else {
         $user = new VBX_User($user);
         $emailSent = $user->send_reset_notification();
         if ($emailSent) {
             $this->session->set_flashdata('error', 'To complete the password reset, check your inbox.');
         } else {
             $this->session->set_flashdata('error', 'The email was not sent. Contact your admin.');
         }
         return redirect('auth/login');
     }
     return redirect('auth/reset');
 }
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:29,代码来源:reset.php

示例2: 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

示例3: client

 /**
  * Display the popup for making calls with Twilio Client
  *
  * @return void
  */
 public function client()
 {
     $caller_id = $this->input->get('callerid');
     if (empty($caller_id)) {
         // grab user's default device
         $user = VBX_User::get($this->session->userdata['user_id']);
         $devices = $this->vbx_device->get_by_user($this->user_id);
         if (!empty($devices)) {
             $caller_id = $devices[0]->value;
         }
     }
     $client_params = array('callerid' => normalize_phone_to_E164($caller_id), 'application_id' => 'client');
     if ($this->input->get('outgoing')) {
         // functionality for using the "dial" modal to initiate a call
         $to = normalize_phone_to_E164($this->input->get('to'));
         if (empty($to)) {
             $to = htmlspecialchars($this->input->get('to'));
         }
         $client_params = array_merge($client_params, array('to' => $to));
     } elseif ($this->input->get('incoming')) {
         $client_params = array_merge($client_params, array('incoming' => true));
     }
     $client_data = array('client_params' => json_encode($client_params));
     $javascript = $this->load->view('client_js', $client_data, true);
     $this->template->add_js($javascript, 'embed', true);
     $data = array('title' => 'dialer', 'client_params' => $client_params);
     $this->respond('Dialer', 'call', $data, '', 'layout/dialer');
 }
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:33,代码来源:message_call.php

示例4: login

 private function login($redirect)
 {
     try {
         $user = VBX_User::authenticate($this->input->post('email'), $this->input->post('pw'), $this->input->post('captcha'), $this->input->post('captcha_token'));
         if ($user) {
             $connect_auth = OpenVBX::connectAuthTenant($user->tenant_id);
             // we kick out non-admins, admins will have an opportunity to re-auth the account
             if (!$connect_auth && !$user->is_admin) {
                 $this->session->set_flashdata('error', 'Connect auth denied');
                 return redirect('auth/connect/account_deauthorized');
             }
             $userdata = array('email' => $user->email, 'user_id' => $user->id, 'is_admin' => $user->is_admin, 'loggedin' => TRUE, 'signature' => VBX_User::signature($user->id));
             $this->session->set_userdata($userdata);
             if (OpenVBX::schemaVersion() >= 24) {
                 return $this->after_login_completed($user, $redirect);
             }
             return $this->redirect($redirect);
         }
         $this->session->set_flashdata('error', 'Email address and/or password is incorrect');
         return redirect('auth/login?redirect=' . urlencode($redirect));
     } catch (GoogleCaptchaChallengeException $e) {
         $this->session->set_flashdata('error', $e->getMessage());
         $data['error'] = $e->getMessage();
         $data['captcha_url'] = $e->captcha_url;
         $data['captcha_token'] = $e->captcha_token;
     }
 }
开发者ID:ryanlarrabure,项目名称:OpenVBX,代码行数:27,代码来源:login.php

示例5: get

 /**
  * Get a DialList object try
  * Pass in a VBX_User or VBX_Group object to begin
  *
  * @param object users_or_group
  * @return object DialList
  */
 public static function get($users_or_group)
 {
     $users = array();
     $class = 'DialList';
     switch (true) {
         case is_array($users_or_group):
             if (current($users_or_group) instanceof VBX_User) {
                 // list of users, set as users list and continue
                 $users = $users_or_group;
             } else {
                 // list of user ids, populate list
                 $users = VBX_User::get_users($users_or_group);
             }
             break;
         case $users_or_group instanceof VBX_Group:
             if (!empty($users_or_group->users)) {
                 foreach ($users_or_group->users as $user) {
                     array_push($users, VBX_User::get($user->user_id));
                 }
             }
             break;
         case $users_or_group instanceof VBX_User:
             $class = 'DialListUser';
             // individual user, add to list and continue
             array_push($users, $users_or_group);
             break;
     }
     return new $class($users);
 }
开发者ID:rhyselsmore,项目名称:OpenVBX,代码行数:36,代码来源:DialList.php

示例6: __construct

 public function __construct()
 {
     parent::__construct();
     $this->user = VBX_User::get($this->session->userdata('user_id'));
     if (!$this->user->is_admin) {
         throw new SiteCachesException('Action not allowed to non-administrators');
     }
 }
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:8,代码来源:caches.php

示例7: usergroup

 function usergroup()
 {
     $data = array();
     $users = VBX_User::search(array('is_active' => 1));
     $groups = VBX_Group::search(array('is_active' => 1));
     $data['users_and_groups'] = array_merge($users, $groups);
     usort($data['users_and_groups'], "sortUsersAndGroupsByNameComparator");
     $this->respond('', 'dialog/usergroup', $data);
 }
开发者ID:tjoozey,项目名称:openvbx,代码行数:9,代码来源:dialog.php

示例8: who_called

 public function who_called($number)
 {
     if (preg_match('|^client:|', $number)) {
         $user_id = str_replace('client:', '', $number);
         $user = VBX_User::get(array('id' => $user_id));
         $ret = $user->first_name . ' ' . $user->last_name . ' (client)';
     } else {
         $ret = format_phone($number);
     }
     return $ret;
 }
开发者ID:HighTechTorres,项目名称:TwilioCookbook,代码行数:11,代码来源:call_log.php

示例9: get_users

 protected function get_users()
 {
     $users = VBX_User::search(array('is_active' => 1));
     $current_user = $this->session->userdata('user_id');
     foreach ($users as $k => $user) {
         if ($user->id == $current_user) {
             unset($users[$k]);
         }
     }
     return $users;
 }
开发者ID:wiserweb,项目名称:OpenVBX,代码行数:11,代码来源:iframe.php

示例10: testVoicemailUserSay

 public function testVoicemailUserSay()
 {
     ob_start();
     $this->CI->voice(1, 'f274cd');
     $out = ob_get_clean();
     $xml = simplexml_load_string($out);
     $this->assertInstanceOf('SimpleXMLElement', $xml);
     $user = VBX_User::get($this->user_id);
     // this regex match is cheap, need better reg-fu to match possible
     // language and voice attributes that could appear in any order
     $this->assertRegExp('|(<Say(.*?)>' . $user->voicemail . '</Say>)|', $out);
     $this->assertRegExp('|(<Record transcribeCallback="(.*?)"/>)|', $out);
 }
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:13,代码来源:voicemailUserSayTest.php

示例11: setUp

 public function setUp()
 {
     parent::setUp();
     // set the user's voicemail to be a recording
     $this->user = VBX_User::get($this->user_id);
     $this->user->voicemail = $this->upload_prefix . $this->filename;
     $this->user->save();
     $this->setFlow(array('id' => 1, 'user_id' => 1, 'created' => NULL, 'updated' => NULL, 'data' => '{"start":{"name":"Call Start","data":{"next":"start/59c7d7"},"id":"start","type":"standard---start"},"59c7d7":{"name":"Voicemail","data":{"prompt_say":"","prompt_play":"","prompt_mode":"","prompt_tag":"global","number":"","library":"","permissions_id":"' . $this->user_id . '","permissions_type":"user"},"id":"59c7d7","type":"standard---voicemail"}}', 'sms_data' => NULL, 'tenant_id' => 1));
     // set up our request
     $this->setPath('/twiml/applet/voice/1/59c7d7');
     $this->setRequestMethod('POST');
     // prepare the header token for request validation
     $this->setRequestToken();
 }
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:14,代码来源:voicemailUserPlayTest.php

示例12: render

 public function render($data = array())
 {
     $hasValue = empty($this->mode) ? false : true;
     $this->load =& load_class('Loader');
     $this->load->model('vbx_audio_file');
     $this->load->model('vbx_device');
     // Get a list of all previously recorded items so we can populate the library
     $ci =& get_instance();
     $ci->db->where('url IS NOT NULL');
     $ci->db->where('tag', $this->tag);
     $ci->db->where('tenant_id', $ci->tenant->id);
     $ci->db->from('audio_files');
     $ci->db->order_by('created DESC');
     $results = $ci->db->get()->result();
     foreach ($results as $i => $result) {
         $results[$i] = new VBX_Audio_File($result);
     }
     // Pre-fill the record text field with the the first device phone number we
     // find for the current user that is active.
     $ci =& get_instance();
     $user = VBX_User::get($ci->session->userdata('user_id'));
     $user_phone = '';
     if (count($user->devices)) {
         foreach ($user->devices as $device) {
             if ($device->is_active) {
                 $user_phone = format_phone($device->value);
                 break;
             }
         }
     }
     // set the caller id for recording via the phone
     $caller_id = '';
     $ci->load->model('vbx_incoming_numbers');
     try {
         $numbers = $ci->vbx_incoming_numbers->get_numbers(false);
         foreach ($numbers as $number) {
             // find the first number that has voice enabled
             // yes, this is a rather paranoid check
             if (isset($number->capabilities->voice) && $number->capabilities->voice > 0) {
                 $caller_id = normalize_phone_to_E164($number->phone);
                 break;
             }
         }
     } catch (VBX_IncomingNumberException $e) {
         // fail silently, for better or worse
         error_log($e->getMessage());
     }
     $data = array_merge(array('name' => $this->name, 'hasValue' => $hasValue, 'mode' => $this->mode, 'say' => $this->say_value, 'play' => $this->play_value, 'tag' => $this->tag, 'library' => $results, 'first_device_phone_number' => $user_phone, 'caller_id' => $caller_id), $data);
     return parent::render($data);
 }
开发者ID:ryanlarrabure,项目名称:OpenVBX,代码行数:50,代码来源:AudioSpeechPickerWidget.php

示例13: dialDevice

 /**
  * Add a device to the Dialer
  *
  * @param VBX_Device $device 
  * @return bool
  */
 public function dialDevice($device)
 {
     $dialed = false;
     if ($device->is_active) {
         $user = VBX_User::get($device->user_id);
         $call_opts = array('url' => site_url('twiml/whisper?name=' . urlencode($user->first_name)));
         $dial = new Dial(NULL, array('action' => current_url(), 'callerId' => $this->callerId));
         if (strpos($device->value, 'client:') !== false) {
             $dial->addClient(str_replace('client:', '', $device->value), $call_opts);
         } else {
             $dial->addNumber($device->value, $call_opts);
         }
         $this->response->append($dial);
         $dialed = true;
     }
     return $dialed;
 }
开发者ID:JeffaCubed,项目名称:OpenVBX,代码行数:23,代码来源:TwimlDial.php

示例14: login

 private function login($redirect)
 {
     try {
         $user = VBX_User::authenticate($this->input->post('email'), $this->input->post('pw'), $this->input->post('captcha'), $this->input->post('captcha_token'));
         if ($user) {
             $userdata = array('email' => $user->email, 'user_id' => $user->id, 'is_admin' => $user->is_admin, 'loggedin' => TRUE, 'signature' => VBX_User::signature($user->id));
             $this->session->set_userdata($userdata);
             if (OpenVBX::schemaVersion() >= 24) {
                 return $this->after_login_completed($user, $redirect);
             }
             return $this->redirect($redirect);
         }
         $this->session->set_flashdata('error', 'Email address and/or password is incorrect');
         return redirect('auth/login?redirect=' . urlencode($redirect));
     } catch (GoogleCaptchaChallengeException $e) {
         $this->session->set_flashdata('error', $e->getMessage());
         $data['error'] = $e->getMessage();
         $data['captcha_url'] = $e->captcha_url;
         $data['captcha_token'] = $e->captcha_token;
     }
 }
开发者ID:howethomas,项目名称:OpenVBX,代码行数:21,代码来源:login.php

示例15: testUserDialClient

 public function testUserDialClient()
 {
     $this->setFlowVar('data', '{"start":{"name":"Call Start","data":{"next":"start/4a7eed"},"id":"start","type":"standard---start"},"4a7eed":{"name":"Dial","data":{"dial-whom-selector":"user-or-group","dial-whom-user-or-group_id":"' . $this->dial_user_id . '","dial-whom-user-or-group_type":"user","dial-whom-number":"","callerId":"","no-answer-action":"voicemail","no-answer-group-voicemail_say":"","no-answer-group-voicemail_play":"","no-answer-group-voicemail_mode":"","no-answer-group-voicemail_tag":"global","no-answer-group-voicemail_caller_id":"+14158774003","number":"","library":"","no-answer-redirect":"","no-answer-redirect-number":"start/4a7eed/e18b35","version":"3"},"id":"4a7eed","type":"standard---dial"},"e18b35":{"name":"Hangup","data":{},"id":"e18b35","type":"standard---hangup"}}');
     $user = VBX_User::get($this->dial_user_id);
     $user->online = 1;
     $user->save();
     ob_start();
     $this->CI->voice('1', '4a7eed');
     $out = ob_get_clean();
     // test valid xml
     $xml = simplexml_load_string($out);
     $this->assertInstanceOf('SimpleXMLElement', $xml);
     // test valid user number item
     $user_name = $user->first_name;
     $user_phone = $user->devices[0]->value;
     $regexp = '|<Number url="(.*?)/twiml/whisper\\?name=' . $user_name . '">\\' . $user_phone . '</Number>|';
     $this->assertRegExp($regexp, $out);
     // test valid user client item
     $regexp2 = '|<Client url="(.*?)/twiml/whisper\\?name=' . $user_name . '">' . $user->id . '</Client>|';
     $this->assertRegExp($regexp2, $out);
 }
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:21,代码来源:dialUserTest.php


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