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

Commit

Permalink
Merge pull request #1111 from ci-bonfire/develop
Browse files Browse the repository at this point in the history
Release 0.7.3
  • Loading branch information
mwhitneysdsu committed May 8, 2015
2 parents 3727369 + d1e29c5 commit ce85f3c
Show file tree
Hide file tree
Showing 89 changed files with 5,428 additions and 4,839 deletions.
2 changes: 1 addition & 1 deletion application/config/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
| $autoload['libraries'] = array('user_agent' => 'ua');
*/

$autoload['libraries'] = array('database', 'session');
$autoload['libraries'] = array('database');


/*
Expand Down
2 changes: 1 addition & 1 deletion application/config/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
// Bonfire-specific Constants
// -----------------------------------------------------------------------------

define('BONFIRE_VERSION', 'v0.7.2');
define('BONFIRE_VERSION', 'v0.7.3');

// -----------------------------------------------------------------------------
// The 'App Area' allows you to specify the base folder used for all of the contexts
Expand Down
53 changes: 23 additions & 30 deletions application/core/Authenticated_Controller.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,38 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
<?php defined('BASEPATH') || exit('No direct script access allowed');

/**
* Authenticated Controller
*
* Provides a base class for all controllers that must check user login
* status.
* Provides a base class for all controllers that must check user login status.
*
* @package Bonfire\Core\Controllers
* @category Controllers
* @author Bonfire Dev Team
* @link http://guides.cibonfire.com/helpers/file_helpers.html
* @package Bonfire\Core\Controllers\Authenticated_Controller
* @category Controllers
* @author Bonfire Dev Team
* @link http://cibonfire.com/docs
*
*/
class Authenticated_Controller extends Base_Controller
{

protected $require_authentication = true;
protected $require_authentication = true;

//--------------------------------------------------------------------------

//--------------------------------------------------------------------
/**
* Class constructor setup login restriction and load various libraries
*
* @return void
*/
public function __construct()
{
$this->autoload['helpers'][] = 'form';
$this->autoload['libraries'][] = 'Template';
$this->autoload['libraries'][] = 'Assets';
$this->autoload['libraries'][] = 'form_validation';

/**
* Class constructor setup login restriction and load various libraries
*
*/
public function __construct()
{
$this->autoload['helpers'][] = 'form';
$this->autoload['libraries'][] = 'Template';
$this->autoload['libraries'][] = 'Assets';
$this->autoload['libraries'][] = 'form_validation';

parent::__construct();

$this->form_validation->set_error_delimiters('', '');

}//end construct()

//--------------------------------------------------------------------
parent::__construct();

$this->form_validation->CI =& $this;
$this->form_validation->set_error_delimiters('', '');
}
}

/* End of file Authenticated_Controller.php */
/* Location: ./application/core/Authenticated_Controller.php */
39 changes: 26 additions & 13 deletions application/hooks/App_hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* @package Bonfire
* @author Bonfire Dev Team
* @copyright Copyright (c) 2011 - 2014, Bonfire Dev Team
* @copyright Copyright (c) 2011 - 2015, Bonfire Dev Team
* @license http://opensource.org/licenses/MIT
* @link http://cibonfire.com
* @since Version 1.0
Expand All @@ -32,6 +32,8 @@ class App_hooks
'/users/logout',
);

protected $isInstalled = false;

/**
* @var object The CodeIgniter core object.
*/
Expand Down Expand Up @@ -60,6 +62,15 @@ class App_hooks
public function __construct()
{
$this->ci =& get_instance();

if (is_object($this->ci)) {
$this->isInstalled = $this->ci->config->item('bonfire.installed');
if (! $this->isInstalled) {
// Is Bonfire installed?
$this->ci->load->library('installer_lib');
$this->isInstalled = $this->ci->installer_lib->is_installed();
}
}
}

/**
Expand Down Expand Up @@ -144,14 +155,11 @@ public function checkSiteStatus()
public function prepRedirect()
{
if (! class_exists('CI_Session', false)) {
if (substr(CI_VERSION, 0, 1) == '2') {
$this->ci->load->library('session');
} else {
$this->ci->load->driver('session');
}
$this->ci->load->library('session');
}

if (! in_array($this->ci->uri->ruri_string(), $this->ignore_pages)) {
$ruriString = '/' . ltrim(str_replace($this->ci->router->directory, '', $this->ci->uri->ruri_string()), '/');
if (! in_array($ruriString, $this->ignore_pages)) {
$this->ci->session->set_userdata('previous_page', current_url());
}
}
Expand All @@ -166,18 +174,18 @@ public function prepRedirect()
*/
public function saveRequested()
{
if (! $this->isInstalled) {
return;
}

// If the CI_Session class is not loaded, this might be a controller that
// doesn't extend any of Bonfire's controllers. In that case, try to do
// this the old fashioned way and add it straight to the session.

if (! class_exists('CI_Session', false)) {
if (is_object(get_instance())) {
// If an instance is available, just load the session lib.
if (substr(CI_VERSION, 0, 1) == '2') {
$this->ci->load->library('session');
} else {
$this->ci->load->driver('session');
}
$this->ci->load->library('session');
} elseif (get_instance() === null) {
// If an instance is not available...

Expand Down Expand Up @@ -208,8 +216,13 @@ public function saveRequested()
// Either the session library was available all along or it has been loaded,
// so determine whether the current URL is in the ignore_pages array and,
// if it is not, set it as the requested page in the session.
//
// Output of uri->ruri_string() is considerably different in CI 3 when using
// the BF_Router, so the following normalizes the output for the comparison
// with $this->ignore_pages.

if (! in_array($this->ci->uri->ruri_string(), $this->ignore_pages)) {
$ruriString = '/' . ltrim(str_replace($this->ci->router->directory, '', $this->ci->uri->ruri_string()), '/');
if (! in_array($ruriString, $this->ignore_pages)) {
$this->ci->session->set_userdata('requested_page', current_url());
}
}
Expand Down
32 changes: 32 additions & 0 deletions application/language/english/bf_form_validation_lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php defined('BASEPATH') || exit('No direct script access allowed');
/**
* Bonfire
*
* An open source project to allow developers to jumpstart their development of
* CodeIgniter applications
*
* @package Bonfire
* @author Bonfire Dev Team
* @copyright Copyright (c) 2011 - 2015, Bonfire Dev Team
* @license http://opensource.org/licenses/MIT The MIT License
* @link http://cibonfire.com
* @since Version 1.0
*/

/**
* Bonfire Form Validation language file (English)
*
* Localization strings used by Bonfire
*
* @package Bonfire\Application\Language\bf_form_validation
* @author Bonfire Dev Team
* @link http://cibonfire.com/docs/developer
*/

$lang['form_validation_is_array'] = 'The {field} field must be an array.';

$lang['form_validation_bf_email'] = 'Email';
$lang['form_validation_bf_language'] = 'Language';
$lang['form_validation_bf_username'] = 'Username';
$lang['form_validation_bf_password'] = 'Password';
$lang['form_validation_bf_password_confirm'] = 'Password (again)';
2 changes: 1 addition & 1 deletion bonfire/codeigniter/core/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @var string
*
*/
define('CI_VERSION', '2.2.1');
define('CI_VERSION', '2.2.2');

/**
* CodeIgniter Branch (Core = TRUE, Reactor = FALSE)
Expand Down
6 changes: 4 additions & 2 deletions bonfire/codeigniter/core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ function __construct()
// Set the base_url automatically if none was provided
if ($this->config['base_url'] == '')
{
if (isset($_SERVER['HTTP_HOST']))
// The regular expression is only a basic validation for a valid "Host" header.
// It's not exhaustive, only checks for valid characters.
if (isset($_SERVER['HTTP_HOST']) && preg_match('/^((\[[0-9a-f:]+\])|(\d{1,3}(\.\d{1,3}){3})|[a-z0-9\-\.]+)(:\d+)?$/i', $_SERVER['HTTP_HOST']))
{
$base_url = (empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) === 'off') ? 'http' : 'https';
$base_url .= '://'. $_SERVER['HTTP_HOST'];
$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
$base_url .= substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME'])));
}

else
Expand Down
Loading

0 comments on commit ce85f3c

Please sign in to comment.