blob: 0ec9ea92eb55a55cc4762a4c557b9ffab53fe111 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\View;
use Piwik\Common;
/**
* 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.
*
*/
class OneClickDone
{
/**
* @var string
*/
private $tokenAuth;
/**
* @var string
*/
public $error;
/**
* @var array
*/
public $feedbackMessages;
/**
* Did the download over HTTPS fail?
*
* @var bool
*/
public $httpsFail = false;
public function __construct($tokenAuth)
{
$this->tokenAuth = $tokenAuth;
}
/**
* Outputs the data.
*
* @return string html
*/
public function render()
{
// set response headers
@Common::stripHeader('Pragma');
@Common::stripHeader('Expires');
@Common::sendHeader('Content-Type: text/html; charset=UTF-8');
@Common::sendHeader('Cache-Control: must-revalidate');
@Common::sendHeader('X-Frame-Options: deny');
$error = htmlspecialchars($this->error, ENT_QUOTES, 'UTF-8');
$messages = htmlspecialchars(serialize($this->feedbackMessages), ENT_QUOTES, 'UTF-8');
$tokenAuth = $this->tokenAuth;
$httpsFail = (int) $this->httpsFail;
// use a heredoc instead of an external file
echo <<<END_OF_TEMPLATE
<!DOCTYPE html>
<html>
<head>
<meta name="robots" content="noindex,nofollow">
<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" />
<input type="hidden" name="httpsFail" value="$httpsFail" />
<noscript>
<button type="submit">Continue</button>
</noscript>
</form>
<script type="text/javascript">
document.myform.submit();
</script>
</body>
</html>
END_OF_TEMPLATE;
}
}
|