mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
mlanthaler: The introduction of the HTTPResponse object broke some of my code. It's fixed now.
There was also a bug in the Director class: Director::redirectBack() didn't work because it stopped the script before outputting the headers. (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42092 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
3cacc11986
commit
e9d323b0d8
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user