HtmlEmailFooterView.php
6 years ago
HtmlReportEmailHeaderView.php
6 years ago
OneClickDone.php
6 years ago
RenderTokenParser.php
6 years ago
UIControl.php
6 years ago
ViewInterface.php
6 years ago
OneClickDone.php
100 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Piwik - free/libre analytics platform |
| 4 | * |
| 5 | * @link https://matomo.org |
| 6 | * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 7 | * |
| 8 | */ |
| 9 | |
| 10 | namespace Piwik\View; |
| 11 | |
| 12 | use Piwik\Common; |
| 13 | |
| 14 | /** |
| 15 | * Post-update view |
| 16 | * |
| 17 | * During a Piwik software update, there will be instances of old classes |
| 18 | * loaded in memory. This is problematic as we will start to instantiate |
| 19 | * new classes which may not be backward compatible. This class provides |
| 20 | * a clean bridge/transition by forcing a new request. |
| 21 | * |
| 22 | * This class needs to be self-contained, with no external dependencies. |
| 23 | * |
| 24 | */ |
| 25 | class OneClickDone |
| 26 | { |
| 27 | /** |
| 28 | * @var string |
| 29 | */ |
| 30 | private $tokenAuth; |
| 31 | |
| 32 | /** |
| 33 | * @var string |
| 34 | */ |
| 35 | public $error; |
| 36 | |
| 37 | /** |
| 38 | * @var array |
| 39 | */ |
| 40 | public $feedbackMessages; |
| 41 | |
| 42 | /** |
| 43 | * Did the download over HTTPS fail? |
| 44 | * |
| 45 | * @var bool |
| 46 | */ |
| 47 | public $httpsFail = false; |
| 48 | |
| 49 | public function __construct($tokenAuth) |
| 50 | { |
| 51 | $this->tokenAuth = $tokenAuth; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Outputs the data. |
| 56 | * |
| 57 | * @return string html |
| 58 | */ |
| 59 | public function render() |
| 60 | { |
| 61 | // set response headers |
| 62 | @Common::stripHeader('Pragma'); |
| 63 | @Common::stripHeader('Expires'); |
| 64 | @Common::sendHeader('Content-Type: text/html; charset=UTF-8'); |
| 65 | @Common::sendHeader('Cache-Control: must-revalidate'); |
| 66 | @Common::sendHeader('X-Frame-Options: deny'); |
| 67 | |
| 68 | $error = htmlspecialchars($this->error, ENT_QUOTES, 'UTF-8'); |
| 69 | $messages = htmlspecialchars(serialize($this->feedbackMessages), ENT_QUOTES, 'UTF-8'); |
| 70 | $tokenAuth = $this->tokenAuth; |
| 71 | $httpsFail = (int) $this->httpsFail; |
| 72 | |
| 73 | // use a heredoc instead of an external file |
| 74 | echo <<<END_OF_TEMPLATE |
| 75 | <!DOCTYPE html> |
| 76 | <html> |
| 77 | <head> |
| 78 | <meta name="robots" content="noindex,nofollow"> |
| 79 | <meta charset="utf-8"> |
| 80 | <title></title> |
| 81 | </head> |
| 82 | <body> |
| 83 | <form name="myform" method="post" action="?module=CoreUpdater&action=oneClickResults"> |
| 84 | <input type="hidden" name="token_auth" value="$tokenAuth" /> |
| 85 | <input type="hidden" name="error" value="$error" /> |
| 86 | <input type="hidden" name="messages" value="$messages" /> |
| 87 | <input type="hidden" name="httpsFail" value="$httpsFail" /> |
| 88 | <noscript> |
| 89 | <button type="submit">Continue</button> |
| 90 | </noscript> |
| 91 | </form> |
| 92 | <script type="text/javascript"> |
| 93 | document.myform.submit(); |
| 94 | </script> |
| 95 | </body> |
| 96 | </html> |
| 97 | END_OF_TEMPLATE; |
| 98 | } |
| 99 | } |
| 100 |