Skip to content

Commit

Permalink
Fixed issues on defined constants
Browse files Browse the repository at this point in the history
  • Loading branch information
rougin committed Sep 18, 2015
1 parent 252a330 commit d21a5d8
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions src/Instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,17 @@ public function __construct()

$slash = DIRECTORY_SEPARATOR;

foreach ($iterator as $path) {
$core = 'core' . $slash . 'CodeIgniter.php';
if ( ! defined('BASEPATH')) {
foreach ($iterator as $path) {
$core = 'core' . $slash . 'CodeIgniter.php';

if (strpos($path->__toString(), $core) !== FALSE) {
$basepath = str_replace($core, '', $path->__toString());

if (strpos($path->__toString(), $core) !== FALSE) {
$basepath = str_replace($core, '', $path->__toString());
define('BASEPATH', $basepath);
define('BASEPATH', $basepath);

break;
break;
}
}
}

Expand All @@ -83,16 +86,23 @@ public function __construct()

// Load the Common and Base Controller class
require BASEPATH . 'core/Common.php';
require BASEPATH . 'core/Controller.php';

if ( ! class_exists('CI_Controller')) {
require BASEPATH . 'core/Controller.php';
}

/**
* Load the framework constants
*/

if (file_exists(APPPATH . 'config/' . ENVIRONMENT . '/constants.php')) {
require APPPATH . 'config/' . ENVIRONMENT . '/constants.php';
} else {
require APPPATH . 'config/constants.php';
if ( ! defined('FILE_READ_MODE')) {
$constants = APPPATH . 'config/' . ENVIRONMENT . '/constants.php';

if (file_exists($constants)) {
require $constants;
} else {
require APPPATH . 'config/constants.php';
}
}

// Important charset-related stuff
Expand Down

0 comments on commit d21a5d8

Please sign in to comment.