diff --git a/core/control/Director.php b/core/control/Director.php index 2b1daf93d..8748314b6 100644 --- a/core/control/Director.php +++ b/core/control/Director.php @@ -54,7 +54,10 @@ class Director { // Save the updated session back $_SESSION = $controllerObj->getSession()->inst_getAll(); + + if(isset($_GET['debug_profile'])) Profiler::mark("Outputting to browser"); $response->output(); + if(isset($_GET['debug_profile'])) Profiler::unmark("Outputting to browser"); } if(isset($_GET['debug_profile'])) Profiler::unmark("Director","direct"); @@ -336,35 +339,42 @@ class Director { static $siteMode; - static protected $mode_additions; /** * Sets the site mode (if it is the public site or the cms), * and runs registered modules. */ + static protected $mode_additions; + + /** + * Sets the site mode (if it is the public site or the cms), + * and runs registered modules. + */ static function set_site_mode($mode) { Director::$siteMode = $mode; - if(isset(self::$mode_additions[$mode])) - foreach(self::$mode_additions[$mode] as $extension) { - call_user_func($extension); + if(isset(self::$mode_additions[$mode])) { + foreach(self::$mode_additions[$mode] as $extension) { + call_user_func($extension); + } } } static function get_site_mode() { return Director::$siteMode; } - - /** - * Allows a module to register with the director to be run once - * the controller is instantiated. The optional 'mode' parameter - * can be either 'site' or 'cms', as those are the two values currently - * set by controllers. The callback function will be run at the - * initialization of the relavant controller. - */ - static function extend_site($function, $mode='site') { - self::$mode_additions[$mode][] = $function; - } - + + /** + * Allows a module to register with the director to be run once + * the controller is instantiated. The optional 'mode' parameter + * can be either 'site' or 'cms', as those are the two values currently + * set by controllers. The callback function will be run at the + * initialization of the relavant controller. + */ + static function extendSite($function, $mode='site') { + self::$mode_additions[$mode][] = $function; + } + + static protected $environment_type; /** diff --git a/security/OpenID/OpenIDAuthenticator.php b/security/OpenID/OpenIDAuthenticator.php index 288d4613d..03a75a71a 100644 --- a/security/OpenID/OpenIDAuthenticator.php +++ b/security/OpenID/OpenIDAuthenticator.php @@ -128,6 +128,7 @@ class OpenIDAuthenticator extends Authenticator { $redirect_url->message); } else { Director::redirect($redirect_url); + return false; } } else { @@ -203,6 +204,9 @@ class OpenIDAuthenticator_Controller extends Controller { * @param array $requestParams Passed request parameters */ function run($requestParams) { + Controller::$currentController = $this; + $this->response = new HTTPResponse(); + parent::init(); if(isset($_GET['debug_profile'])) @@ -281,6 +285,8 @@ class OpenIDAuthenticator_Controller extends Controller { } } } + + return $this->response; } diff --git a/security/Security.php b/security/Security.php index c75ad8b8f..ceebb957c 100644 --- a/security/Security.php +++ b/security/Security.php @@ -372,7 +372,7 @@ class Security extends Controller { } else { self::permissionFailure($this, 'You must be logged in in order to change your password!'); - die(); + return; } } @@ -423,7 +423,7 @@ class Security extends Controller { */ static function findAnAdministrator($username = 'admin', $password = 'password') { $permission = DataObject::get_one("Permission", "`Code` = 'ADMIN'", true, "ID"); - + $adminGroup = null; if($permission) $adminGroup = DataObject::get_one("Group", "`ID` = '{$permission->GroupID}'", true, "ID");