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

Commit

Permalink
Merge branch 'release/1.2.20'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gipetto committed Feb 23, 2016
2 parents 408bb36 + 209ddbd commit 7ed912a
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 64 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# OpenVBX Change Log

## OpenVBX 1.2.20

- Udpated ReadMe with SSL Certificate requirements.
- Fixed `$cache` variable visibility in `install.php`. (Thanks @gegere)


## OpenVBX 1.2.19

- Fix highlighting of plugin generated pages in sidebar menu. (Thanks @jpwalters)
Expand Down
2 changes: 1 addition & 1 deletion OpenVBX/config/version.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$config['version'] = '1.2.19';
$config['version'] = '1.2.20';
108 changes: 54 additions & 54 deletions OpenVBX/controllers/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Install extends Controller {
private $account;
protected $min_php_version = MIN_PHP_VERSION;

protected $cache;
public $cache;

public function __construct()
{
Expand All @@ -52,15 +52,15 @@ public function __construct()
$this->config->load('openvbx');
}

if(file_exists(APPPATH . 'config/database.php')
AND version_compare(PHP_VERSION, $this->min_php_version, '>='))
if(file_exists(APPPATH . 'config/database.php')
AND version_compare(PHP_VERSION, $this->min_php_version, '>='))
{
$this->load->database();
redirect('');
}
// cache is evil when not handled properly, assume the
// possibility that we're being reinstalled so lets clear

// cache is evil when not handled properly, assume the
// possibility that we're being reinstalled so lets clear
// any possibly lingering cache artifacts
$this->cache = OpenVBX_Cache_Abstract::load();
$this->cache->enabled(true);
Expand All @@ -84,7 +84,7 @@ private function input_args()

$this->openvbx_settings = array();
$this->openvbx = array();

$this->openvbx_settings['twilio_sid'] = trim($this->input->post('twilio_sid'));
$this->openvbx_settings['twilio_token'] = trim($this->input->post('twilio_token'));
$this->openvbx_settings['connect_application_sid'] = trim($this->input->post('connect_application_sid'));
Expand Down Expand Up @@ -145,7 +145,7 @@ private function run_tests()
'supported',
'missing, but optional',
false);

$this->add_test(extension_loaded('memcache'),
'Memcache',
'supported',
Expand All @@ -168,7 +168,7 @@ private function run_tests()
'Config Dir',
'writable',
'permission denied: '.APPPATH.'config');

$this->add_test(is_writable(APPPATH.'../audio-uploads'),
'Upload Dir',
'writable',
Expand Down Expand Up @@ -203,7 +203,7 @@ private function add_test($pass, $name, $pass_text, $fail_text, $required = true
'message' => ($pass ? $pass_text : $fail_text)
);

if($required)
if($required)
{
$this->pass = $this->pass && $pass;
}
Expand Down Expand Up @@ -260,26 +260,26 @@ public function setup()
}

// test for mysqli compat
if (function_exists('mysqli_connect'))
if (function_exists('mysqli_connect'))
{
// server info won't work without first selecting a table
mysql_select_db($database['default']['database']);
$server_version = mysql_get_server_info($dbh);
if (!empty($server_version)) {
if (version_compare($server_version, '4.1.13', '>=')
&& version_compare($server_version, '5', '<'))
if (version_compare($server_version, '4.1.13', '>=')
&& version_compare($server_version, '5', '<'))
{
$database['default']['dbdriver'] = 'mysqli';
}
elseif (version_compare($server_version, '5.0.7', '>='))
elseif (version_compare($server_version, '5.0.7', '>='))
{
$database['default']['dbdriver'] = 'mysqli';
}
}
}

$this->setup_database($database, $dbh);
$this->setup_config($database, $openvbx);
$this->setup_config($database, $openvbx);
$this->setup_openvbx_settings($openvbx_settings);
$this->setup_user($user);

Expand All @@ -301,21 +301,21 @@ public function setup()

$this->json_return($json);
}
private function setup_connect_app($settings)

private function setup_connect_app($settings)
{
try {
$account = OpenVBX::getAccount($settings['twilio_sid'], $settings['twilio_token']);
$connect_application = $account->connect_apps->get($settings['connect_application_sid']);

if ($connect_application->sid == $settings['connect_application_sid'])
{
$site_url = site_url();
if ($settings['rewrite_enabled'])
if ($settings['rewrite_enabled'])
{
$site_url = str_replace('/index.php', '', $site_url);
}

$required_settings = array(
'HomepageUrl' => $site_url,
'AuthorizeRedirectUrl' => $site_url.'/auth/connect',
Expand All @@ -325,19 +325,19 @@ private function setup_connect_app($settings)
'post-all'
)
);

$updated = false;
foreach ($required_settings as $key => $setting)
foreach ($required_settings as $key => $setting)
{
$app_key = Services_Twilio::decamelize($key);
if ($connect_application->$app_key != $setting)
if ($connect_application->$app_key != $setting)
{
$connect_application->$app_key = $setting;
$updated = true;
}
}

if ($updated)
if ($updated)
{
$connect_application->update(array(
'FriendlyName' => $connect_application->friendly_name,
Expand Down Expand Up @@ -375,7 +375,7 @@ private function setup_database($database, $dbh)

if(!mysql_query($sql, $dbh))
{
throw new InstallException( "Failed to run sql: ".$sql. " :: ".
throw new InstallException( "Failed to run sql: ".$sql. " :: ".
mysql_error($dbh), 2);
}
}
Expand Down Expand Up @@ -512,38 +512,38 @@ private function setup_openvbx_settings($settings)
* Create one if necessary
*
* @throws InstallException
* @param array $settings
* @param array $settings
* @return string Application Sid
*/
private function get_application($settings)
private function get_application($settings)
{
try
{
$app_token = md5($_SERVER['REQUEST_URI']);
$app_name = "OpenVBX - {$app_token}";

if (empty($this->account))
if (empty($this->account))
{
$this->account = OpenVBX::getAccount($settings['twilio_sid'], $settings['twilio_token']);
}
$applications = $this->account->applications->getIterator(0, 10, array(
'FriendlyName' => $app_name
));

$application = false;

/** @var Services_Twilio_Rest_Application $_application */
foreach ($applications as $_application)
{
if ($_application->friendly_name == $app_name)
if ($_application->friendly_name == $app_name)
{
$application = $_application;
break;
}
}

$site_url = site_url();
if ($settings['rewrite_enabled'])
if ($settings['rewrite_enabled'])
{
$site_url = str_replace('/index.php', '', $site_url);
}
Expand All @@ -562,7 +562,7 @@ private function get_application($settings)
{
$application->update($params);
}
else
else
{
$application = $this->account->applications->create($app_name, $params);
}
Expand All @@ -581,8 +581,8 @@ function validate()
$json = array(
'success' => true
);
if($step == 1)

if($step == 1)
{
$this->json_return($json);
}
Expand Down Expand Up @@ -612,9 +612,9 @@ function validate()
function validate_step2()
{
$json = array(
'success' => true,
'step' => 2,
'message' =>
'success' => true,
'step' => 2,
'message' =>
'success'
);

Expand Down Expand Up @@ -661,10 +661,10 @@ function validate_step2()
function validate_step3()
{
$this->load->model('vbx_settings');

$json = array(
'success' => true,
'step' => 3,
'success' => true,
'step' => 3,
'message' => 'success'
);
$twilio_sid = $this->openvbx_settings['twilio_sid'];
Expand All @@ -681,20 +681,20 @@ function validate_step3()
* confident of success.
*/
$status = $account->type;
if (empty($status))
if (empty($status))
{
throw new InstallException('Unable to access Twilio Account');
}

// check the connect app if a sid is provided
if (!empty($connect_app))
if (!empty($connect_app))
{
try {
$connect_application = $account->connect_apps->get($connect_app);
$friendly_name = $connect_application->friendly_name;
}
catch (Exception $e) {
switch ($e->getCode())
switch ($e->getCode())
{
case 0:
// return a better message than "resource not found"
Expand All @@ -711,7 +711,7 @@ function validate_step3()
{
$json['success'] = false;

switch ($e->getCode())
switch ($e->getCode())
{
case '20003':
$json['message'] = 'Authentication Failed. Invalid Twilio SID or Token.';
Expand All @@ -729,8 +729,8 @@ function validate_step3()
function validate_step4()
{
$json = array(
'success' => true,
'step' => 4,
'success' => true,
'step' => 4,
'message' => 'success'
);
$this->openvbx_settings['from_email'] = trim($this->input->post('from_email'));
Expand All @@ -742,7 +742,7 @@ function validate_step4()
throw new InstallException('Email address is invalid. Please check the '.
'address and try again.');
}

$required_fields = array(
'from_email' => 'Notification Sender Email Address'
);
Expand All @@ -767,8 +767,8 @@ function validate_step5()
$ci =& get_instance();
$ci->load->model('vbx_user');
$json = array(
'success' => true,
'step' => 5,
'success' => true,
'step' => 5,
'message' => 'success'
);

Expand All @@ -784,17 +784,17 @@ function validate_step5()
{
throw new InstallException('Your administrative password was not typed correctly.');
}

if (strlen($this->user['password']) < VBX_User::MIN_PASSWORD_LENGTH)
{
throw new InstallException('Password must be at least '.VBX_User::MIN_PASSWORD_LENGTH.' characters.');
}

if (!filter_var($this->user['email'], FILTER_VALIDATE_EMAIL))
{
throw new InstallException('Email address is invalid. Please check the address and try again.');
}

$required_fields = array(
'email' => 'Email Address',
'password' => 'Password',
Expand All @@ -815,9 +815,9 @@ function validate_step5()
}
return $json;
}

/**
* If .htaccess file doesn't exist try to preemptively
* If .htaccess file doesn't exist try to preemptively
* create one from the htaccess_dist file. Nothing special,
* just try to make a copy of the file. If it doesn't
* work it doesn't work.
Expand Down
Loading

3 comments on commit 7ed912a

@kaburkett
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the version number contradict [http://blog.openvbx.org/](the blog) - which is still indexed by Google. Should probably delete the blog or do something to avoid confusion since it looks like 1.2.5 was released in Feb 2012 and 1.2.20 is released Feb 2016.

Sorry, that's all I have to add. Hopefully this cache change will fix some of the issues our install was having.

@Gipetto
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blog used to announce releases. There's no bandwidth here for that any more. You can always see the latest version number at http://www.openvbx.org/download/

@kaburkett
Copy link

@kaburkett kaburkett commented on 7ed912a Apr 1, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.