diff options
author | robocoder <anthon.pang@gmail.com> | 2012-03-07 20:59:34 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2012-03-07 20:59:34 +0400 |
commit | aa3b8619a9c8cb00495ba6054723e1308a74f962 (patch) | |
tree | 170b75ff1f4e5b9936b7ef7e2ea154a45195a51e /core/View | |
parent | 672512e47907a92f266da99372ca4a687866363d (diff) |
fixes #3021, refs #1331 - adds Piwik_View_OneClickDone
During a Piwik software update, there will be instances of old classes
loaded in memory. This is problematic as we will start to instantiate
new classes which may not be backward compatible. This class provides
a clean bridge/transition by forcing a new request.
This class needs to be self-contained, with no external dependencies.
git-svn-id: http://dev.piwik.org/svn/trunk@5991 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/View')
-rw-r--r-- | core/View/OneClickDone.php | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/core/View/OneClickDone.php b/core/View/OneClickDone.php new file mode 100644 index 0000000000..7e69c882d3 --- /dev/null +++ b/core/View/OneClickDone.php @@ -0,0 +1,90 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * @version $Id$ + * + * @category Piwik + * @package Piwik + */ + +/** + * Post-update view + * + * During a Piwik software update, there will be instances of old classes + * loaded in memory. This is problematic as we will start to instantiate + * new classes which may not be backward compatible. This class provides + * a clean bridge/transition by forcing a new request. + * + * This class needs to be self-contained, with no external dependencies. + * + * @package Piwik + */ +class Piwik_View_OneClickDone +{ + /** + * @var string + */ + private $tokenAuth; + + /** + * @var string + */ + public $coreError; + + /** + * @var array + */ + public $feedbackMessages; + + public function __construct($tokenAuth) + { + $this->tokenAuth = $tokenAuth; + } + + /** + * Outputs the data. + * + * @return string html + */ + public function render() + { + // set response headers + @header('Content-Type: text/html; charset=UTF-8'); + @header('Pragma: '); + @header('Expires: '); + @header('Cache-Control: must-revalidate'); + @header('X-Frame-Options: deny'); + + $error = htmlspecialchars($this->coreError, ENT_QUOTES, 'UTF-8'); + $messages = htmlspecialchars(serialize($this->feedbackMessages), ENT_QUOTES, 'UTF-8'); + $tokenAuth = $this->tokenAuth; + + // use a heredoc instead of an external file + echo <<<END_OF_TEMPLATE +<!DOCTYPE html> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta charset="utf-8" /> + <title></title> + </head> + <body> + <form name="myform" method="post" action="?module=CoreUpdater&action=oneClickResults"> + <input type="hidden" name="token_auth" value="$tokenAuth" /> + <input type="hidden" name="error" value="$error" /> + <input type="hidden" name="messages" value="$messages" /> + </form> + <script type="text/javascript"> + document.myform.submit(); + </script> + <noscript> + <button type="submit" value="Continue" /> + </noscript> + </body> +</html> +END_OF_TEMPLATE; + } +} |