Skip to content
Browse files

Allow the child class of Fitzgerald to be named freely and not forced…

… to be Application. Add success variable that works the same as the error variable, to allow success messages to be shown after a redirect

Signed-off-by: Jim Benton <jim@autonomousmachine.com>
  • Loading branch information...
1 parent 631abf8 commit 9991d3308bba71455df43775eaa33ab956a82468 Joakim Bodin committed with May 17, 2009
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/fitzgerald.php
View
10 lib/fitzgerald.php
@@ -170,6 +170,7 @@ protected function redirect($path) {
$host = (preg_match('%^http://|https://%', $path) > 0) ? '' : "$protocol://" . $_SERVER['HTTP_HOST'];
$uri = is_string($this->options->mountPoint) ? $this->options->mountPoint : '';
$this->session->error = $this->error;
+ $this->session->success = $this->success;
header("Location: $host$uri$path");
return false;
}
@@ -181,6 +182,9 @@ protected function render($fileName, $variableArray=array()) {
if(isset($this->error)) {
$variableArray['error'] = $this->error;
}
+ if(isset($this->success)) {
+ $variableArray['success'] = $this->success;
+ }
if (is_string($this->options->layout)) {
$contentTemplate = new Template($this->root(), $fileName); // create content template
@@ -223,8 +227,12 @@ private function execute($methodName, $params) {
$this->error = $this->session->error;
$this->session->error = null;
}
+ if ($this->session->success) {
+ $this->success = $this->session->success;
+ $this->session->success = null;
+ }
- $reflection = new ReflectionMethod('Application', $methodName);
+ $reflection = new ReflectionMethod(get_class($this), $methodName);
$args = array();
foreach ($reflection->getParameters() as $i => $param) {

0 comments on commit 9991d33

Please sign in to comment.
Something went wrong with that request. Please try again.