Skip to content
This repository was archived by the owner on Mar 4, 2021. It is now read-only.

Commit 408bb36

Browse files
committed
Merge branch 'release/1.2.19'
2 parents 759eb6a + 53fcd77 commit 408bb36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+456
-97
lines changed

CHANGELOG.markdown

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# OpenVBX Change Log
22

3+
## OpenVBX 1.2.19
4+
5+
- Fix highlighting of plugin generated pages in sidebar menu. (Thanks @jpwalters)
6+
- Allow Administrator users to "promote" other users to Administrator. (Thanks @jpwalters)
7+
- Allow conferences to be recorded. (Thanks @jpwalters)
8+
- Add programmatic underpinnings to allow for easy recording of dialed calls. (Thanks @jpwalters)
9+
- Doc updates to assist static analysis tools.
10+
- Load Twilio JS via protocol relative url. (Thanks @trenton42)
11+
12+
313
## OpenVBX 1.2.18
414

515
- Fix implementation of several methods by making them static.

OpenVBX/config/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
22

3-
$config['version'] = '1.2.18';
3+
$config['version'] = '1.2.19';

OpenVBX/controllers/account.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class Account extends User_Controller {
3535
private $editable_fields = array('first_name',
3636
'last_name',
3737
'email',
38+
'is_admin',
3839
'pin',
3940
'notification');
4041
protected $user_id;
@@ -140,9 +141,16 @@ public function edit($user_id = null)
140141
$val = $this->input->post($field);
141142
if (in_array($field, $user->admin_fields))
142143
{
143-
if (($val || $val === '0') && $is_admin)
144+
if($user->id != $this->session->userdata('user_id') && $is_admin)
144145
{
145-
$user->$field = $val;
146+
if (($val || $val === '0'))
147+
{
148+
$user->$field = $val;
149+
}
150+
else
151+
{
152+
$user->$field = '0';
153+
}
146154
}
147155
}
148156
else

OpenVBX/controllers/accounts.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
* Contributor(s):
2020
**/
2121

22+
/**
23+
* Class Accounts
24+
* @property VBX_User $vbx_user
25+
* @property VBX_Group $vbx_group
26+
* @property VBX_Device $vbx_device
27+
*/
2228
class Accounts extends User_Controller {
2329

2430
function __construct()

OpenVBX/controllers/client.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
**/
2121

2222
class ClientException extends Exception {}
23-
/*
24-
Client handles all public access information for determining version, theming, i18n.
23+
24+
/**
25+
* Client handles all public access information for determining version, theming, i18n.
26+
* @property VBX_Theme $vbx_theme
2527
*/
2628
class Client extends MY_Controller
2729
{

OpenVBX/controllers/flows.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
require_once(APPPATH.'libraries/twilio.php');
2323

24+
/**
25+
* Class Flows
26+
* @property MY_Pagination $pagination
27+
*/
2428
class Flows extends User_Controller {
2529

2630
private $flows_per_page = '50';

OpenVBX/controllers/iframe.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ class Iframe extends User_Controller {
2929
function index() {
3030
$data = $this->init_view_data();
3131

32-
$twilio_js = sprintf('%s://static.twilio.com/libs/twiliojs/%s/twilio%s.js',
33-
'http'.(is_ssl() ? 's' : ''),
32+
$twilio_js = sprintf('//static.twilio.com/libs/twiliojs/%s/twilio%s.js',
3433
$this->twilio_js_version,
3534
($this->config->item('use_unminimized_js') ? '' : '.min')
3635
);

OpenVBX/controllers/install.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,29 @@
2121

2222
class InstallException extends Exception {}
2323

24+
/**
25+
* Class Install
26+
* @property CI_Loader $load
27+
* @property CI_Config $config
28+
* @property CI_Input $input
29+
*/
2430
class Install extends Controller {
2531

2632
public $tenant;
2733

2834
public $tests;
2935
public $pass;
30-
36+
37+
protected $user = array();
38+
protected $database = array();
39+
protected $openvbx_settings = array();
40+
protected $openvbx = array();
41+
3142
private $account;
3243
protected $min_php_version = MIN_PHP_VERSION;
3344

45+
protected $cache;
46+
3447
public function __construct()
3548
{
3649
parent::Controller();

OpenVBX/controllers/iphone.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?php
22

3+
/**
4+
* Class iPhone
5+
* @property VBX_Message $vbx_message
6+
*/
37
class iPhone extends MY_Controller {
48

59
public function install() {

OpenVBX/controllers/messages/details.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323

2424
class DetailsException extends Exception {}
2525

26+
/**
27+
* Class Details
28+
* @property VBX_Call $vbx_call
29+
*/
2630
class Details extends User_Controller
2731
{
2832
const PAGE_SIZE = 20;

OpenVBX/controllers/messages/inbox.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
class InboxException extends Exception {}
2323

24+
/**
25+
* Class Inbox
26+
* @property MY_Pagination $pagination
27+
*/
2428
class Inbox extends User_Controller {
2529

2630
const PAGE_SIZE = 20;

OpenVBX/controllers/messages/message_call.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
class Message_CallException extends Exception {}
2323

24+
/**
25+
* Class Message_Call
26+
* @property VBX_Call $vbx_call
27+
*/
2428
class Message_Call extends User_Controller
2529
{
2630
function __construct()

OpenVBX/controllers/messages/message_text.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121

2222
class Message_TextException extends Exception {}
2323

24+
/**
25+
* Class Message_Text
26+
* @property VBX_SMS_Message $vbx_sms_message
27+
* @property VBX_Device $device
28+
*/
2429
class Message_Text extends User_Controller
2530
{
2631
function __construct()

OpenVBX/controllers/numbers.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,20 @@
2121

2222
class NumbersException extends Exception {}
2323

24+
/**
25+
* Class Numbers
26+
* @property MY_Pagination $pagination
27+
*/
2428
class Numbers extends User_Controller
2529
{
30+
protected $flows;
31+
2632
private $error_message = FALSE;
27-
private $new_number = null;
33+
34+
/**
35+
* @var stdClass
36+
*/
37+
private $new_number;
2838

2939
private $numbers_per_page = 50;
3040

OpenVBX/controllers/settings/site.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323

2424
class SiteException extends Exception {}
2525

26+
/**
27+
* Class Site
28+
* @property CI_DB_Driver|CI_DB_mysql_driver $db
29+
* @property VBX_Theme $vbx_theme
30+
*/
2631
class Site extends User_Controller
2732
{
2833
const MODE_MULTI = 1;
@@ -429,6 +434,7 @@ private function update_application($app_sid)
429434
foreach ($update_app as $app)
430435
{
431436
try {
437+
/** @var Services_Twilio_Rest_Application $application */
432438
$application = $account->applications->get($app['app_sid']);
433439
$application->update(array_merge($app['params'], array(
434440
'FriendlyName' => $application->friendly_name
@@ -448,6 +454,7 @@ private function update_connect_app($connect_app_sid)
448454
if (!empty($connect_app_sid) && $this->tenant->id == VBX_PARENT_TENANT)
449455
{
450456
$account = OpenVBX::getAccount();
457+
/** @var Services_Twilio_Rest_ConnectApp $connect_app */
451458
$connect_app = $account->connect_apps->get($connect_app_sid);
452459

453460
$required_settings = array(
@@ -492,12 +499,14 @@ private function create_application_for_subaccount($tenant_id, $name, $accountSi
492499

493500
$application = false;
494501
try {
502+
/** @var Services_Twilio_Rest_Accounts $accounts */
495503
$accounts = OpenVBX::getAccounts();
496504
$sub_account = $accounts->get($accountSid);
497505
foreach ($sub_account->applications as $_application)
498506
{
499-
if ($application->friendly_name == $appName)
507+
if ($_application->friendly_name == $appName)
500508
{
509+
/** @var Services_Twilio_Rest_Application $application */
501510
$application = $_application;
502511
}
503512
}
@@ -603,6 +612,7 @@ private function add_tenant()
603612
if ($auth_type === VBX_Settings::AUTH_TYPE_SUBACCOUNT)
604613
{
605614
try {
615+
/** @var Services_Twilio_Rest_Accounts $accounts */
606616
$accounts = OpenVBX::getAccounts();
607617

608618
// default, sub-account

OpenVBX/controllers/support.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<?php
22

33
class Support extends Controller {
4-
public function __construct()
5-
{
6-
parent::__construct();
7-
}
8-
94
public function rewrite()
105
{
116
header('status: 201');

OpenVBX/controllers/twiml.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323

2424
class TwimlException extends Exception {}
2525

26-
/* This controller handles incomming calls from Twilio and outputs response
27-
*/
26+
/**
27+
* This controller handles incomming calls from Twilio and outputs response
28+
* @property VBX_Message $vbx_message
29+
*/
2830
class Twiml extends MY_Controller {
2931

3032
protected $response;
@@ -188,14 +190,14 @@ private function applet($flow_id, $inst_id, $type = 'voice')
188190
$sms_data = $flow->sms_data;
189191
if(!empty($sms_data))
190192
{
193+
/** @var stdClass $flow_data */
191194
$flow_data = get_object_vars(json_decode($sms_data));
195+
/** @var stdClass $instance */
192196
$instance = isset($flow_data[$inst_id])? $flow_data[$inst_id] : null;
193197
}
194198

195199
if(!is_null($instance))
196200
{
197-
$plugin_dir_name = '';
198-
$applet_dir_name = '';
199201
list($plugin_dir_name, $applet_dir_name) = explode('---', $instance->type);
200202

201203
$applet = Applet::get($plugin_dir_name,
@@ -222,14 +224,14 @@ private function applet($flow_id, $inst_id, $type = 'voice')
222224
$voice_data = $flow->data;
223225
if(!empty($voice_data))
224226
{
227+
/** @var stdClass $flow_data */
225228
$flow_data = get_object_vars(json_decode($voice_data));
229+
/** @var stdClass $instance */
226230
$instance = isset($flow_data[$inst_id])? $flow_data[$inst_id] : null;
227231
}
228232

229233
if(!is_null($instance))
230234
{
231-
$plugin_dir_name = '';
232-
$applet_dir_name = '';
233235
list($plugin_dir_name, $applet_dir_name) = explode('---', $instance->type);
234236

235237
$applet = Applet::get($plugin_dir_name,
@@ -321,6 +323,7 @@ public function dial()
321323
$rest_access = $this->input->get_post('rest_access');
322324
$to = $this->input->get_post('to');
323325
$callerid = $this->input->get_post('callerid');
326+
$record = $this->input->get_post('record');
324327

325328
if(!$this->session->userdata('loggedin')
326329
&& !$this->login_call($rest_access))
@@ -352,6 +355,11 @@ public function dial()
352355
'timeout' => $this->vbx_settings->get('dial_timeout', $this->tenant->id)
353356
);
354357

358+
if($record !== false)
359+
{
360+
$options['record'] = $record;
361+
}
362+
355363
if (filter_var($this->input->get_post('to'), FILTER_VALIDATE_EMAIL))
356364
{
357365
$this->dial_user_by_email($this->input->get_post('to'), $options);
@@ -381,7 +389,7 @@ public function dial()
381389
*
382390
* @todo not implemented
383391
* @param string $client_id
384-
* @param arrray $options
392+
* @param array $options
385393
* @return void
386394
*/
387395
protected function dial_user_by_client_id($client_id, $options)
@@ -552,7 +560,11 @@ private function set_flow_id($id)
552560
return $id;
553561
}
554562

555-
// fetch the current flow and set up shared objects if necessary
563+
/**
564+
* fetch the current flow and set up shared objects if necessary
565+
* @param int $flow_id
566+
* @return VBX_Flow
567+
*/
556568
private function get_flow($flow_id = 0)
557569
{
558570
if($flow_id < 1)

OpenVBX/controllers/welcome.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function finish() {
6363

6464
try {
6565
$account = OpenVBX::getAccount();
66+
/** @var Services_Twilio_Rest_Application[] $applications */
6667
$applications = $account->applications->getIterator(0, 10, array('FriendlyName' => $app_name));
6768

6869
$application = false;

0 commit comments

Comments
 (0)