Permalink
Browse files

Added HTTPResponse object, to encapsulate Controller responses for ai…

…d testing and other 'quirky' uses of Controllers

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@40390 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 56a65ab commit 1c2f30978a91201ecf9fb38e4aa817aa8aa24701 @sminnee sminnee committed Aug 17, 2007
Showing with 6 additions and 6 deletions.
  1. +2 −2 code/LeftAndMain.php
  2. +3 −2 code/StaticExporter.php
  3. +1 −2 code/sitefeatures/PageCommentInterface.php
View
@@ -21,7 +21,7 @@ function init() {
$menu = $this->MainMenu();
if(($first = $menu->First()) && $first->Link) {
Director::redirect($first->Link);
- exit();
+ return;
}
}
@@ -33,7 +33,7 @@ function init() {
);
Security::permissionFailure($this, $messageSet);
- exit;
+ return;
}
Requirements::javascript("jsparty/prototype.js");
View
@@ -16,7 +16,6 @@ function init() {
);
Security::permissionFailure($this, $messageSet);
- exit;
}
}
@@ -67,7 +66,9 @@ function export() {
$controllerClass = "{$page->class}_Controller";
if(class_exists($controllerClass)) {
$controller = new $controllerClass($page);
- $pageContent = $controller->run( array() );
+
+ $response = $controller->run( array() );
+ $pageContent = $response->getBody();
// Write to file
if($fh = fopen($contentfile, 'w')) {
@@ -148,9 +148,8 @@ function __construct() {
}
function newspamquestion() {
- if(Director::is_ajax()) {
+ if(Director::is_ajax()) {
echo Convert::raw2xml("Spam protection question: ".MathSpamProtection::getMathQuestion());
- exit;
}
}
}

0 comments on commit 1c2f309

Please sign in to comment.