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