本文整理汇总了PHP中VBX_User类的典型用法代码示例。如果您正苦于以下问题:PHP VBX_User类的具体用法?PHP VBX_User怎么用?PHP VBX_User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VBX_User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: refresh_dialer
/**
* Refresh the user's devices list in the dialer
*
* @return json
*/
public function refresh_dialer()
{
$user = VBX_User::get(array('id' => $this->session->userdata('user_id')));
$browserphone = array('call_using_options' => array());
if (count($user->devices)) {
foreach ($user->devices as $device) {
if (strpos($device->value, 'client:') !== false) {
continue;
}
$browserphone['call_using_options']['device:' . $device->id] = array('title' => 'Device: ' . $device->name, 'data' => (object) array('number' => format_phone($device->value), 'name' => $device->name));
}
}
$data = array('browserphone' => $browserphone);
$html = $this->load->view('dialer/devices', $data, true);
$response['json'] = array('error' => false, 'html' => $html);
$this->respond('', 'dialer/devices', $response);
}
开发者ID:rhyselsmore,项目名称:OpenVBX,代码行数:22,代码来源:devices.php
示例17: save_greeting
private function save_greeting()
{
$data['json'] = array('error' => false, 'message' => '');
$user = VBX_User::get($this->user_id);
$user->voicemail = $this->input->post('voicemail');
try {
$user->save();
} catch (VBX_UserException $e) {
$data['json'] = array('error' => true, 'message' => $e->getMessage());
}
return $data;
}
开发者ID:JeffaCubed,项目名称:OpenVBX,代码行数:12,代码来源:voicemail.php
示例18: 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();
} catch (Exception $e) {
throw new InstallException($e->getMessage(), 4);
}
}
开发者ID:joshgomez,项目名称:OpenVBX,代码行数:19,代码来源:install.php
示例19: getUsers
public static function getUsers($options = array(), $limit = -1, $offset = 0)
{
return VBX_User::search($options, $limit, $offset);
}
开发者ID:AsaadQ,项目名称:OpenVBX,代码行数:4,代码来源:OpenVBX.php
示例20: add_tenant
private function add_tenant()
{
$tenant = $this->input->post('tenant');
if (!empty($tenant)) {
try {
$data['id'] = $this->settings->tenant($tenant['url_prefix'], urlencode($tenant['url_prefix']), '');
$this->db->trans_start();
$user = new VBX_User();
$user->fields[] = 'tenant_id';
// monkey patching to override tenant_id
$user->first_name = '';
$user->last_name = '';
$user->password = '';
$user->values['tenant_id'] = $data['id'];
// hidden field not in ORM
$user->email = $tenant['admin_email'];
$user->is_active = TRUE;
$user->is_admin = TRUE;
$user->auth_type = 1;
try {
$user->save();
$user->send_new_user_notification();
} catch (VBX_UserException $e) {
throw new VBX_SettingsException($e->getMessage());
}
foreach ($this->settings->setting_options as $param) {
$this->settings->add($param, '', $data['id']);
}
$this->settings->set('from_email', $tenant['admin_email'], $data['id']);
try {
$twilio = new TwilioRestClient($this->twilio_sid, $this->twilio_token, $this->twilio_endpoint);
$friendlyName = $tenant['url_prefix'] . ' - ' . $tenant['admin_email'];
$friendlyName = substr($friendlyName, 0, 32);
$response = $twilio->request("Accounts", 'POST', array('FriendlyName' => $friendlyName));
if ($response && $response->IsError != true) {
$account = $response->ResponseXml;
$tenant_sid = (string) $account->Account->Sid;
$tenant_token = (string) $account->Account->AuthToken;
$this->settings->add('twilio_sid', $tenant_sid, $data['id']);
$this->settings->add('twilio_token', $tenant_token, $data['id']);
} else {
$message = 'Failed to create new subaccount';
if ($response && $response->ErrorMessage) {
$message = $response->ErrorMessage;
}
throw new VBX_SettingsException($message);
}
$appSid = $this->create_application_for_subaccount($data['id'], $tenant['url_prefix'], $tenant_sid);
$this->settings->add('application_sid', $appSid, $data['id']);
} catch (Exception $e) {
throw new VBX_SettingsException($e->getMessage());
}
$this->db->trans_complete();
$this->session->set_flashdata('error', 'Added new tenant');
if (isset($data['id'])) {
return redirect('settings/site/tenant/' . $data['id']);
}
} catch (VBX_SettingsException $e) {
error_log($e->getMessage());
$this->db->trans_rollback();
// TODO: rollback in twilio.
$this->session->set_flashdata('error', $e->getMessage());
$data['error'] = true;
$data['message'] = $e->getMessage();
}
}
if ($this->response_type == 'html') {
redirect('settings/site');
}
$this->respond('', 'settings/site', $data);
}
开发者ID:JeffaCubed,项目名称:OpenVBX,代码行数:71,代码来源:site.php
注:本文中的VBX_User类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论