|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* ***************************************************************************** |
|
5
|
|
|
* Contributions to this work were made on behalf of the GÉANT project, a |
|
6
|
|
|
* project that has received funding from the European Union’s Framework |
|
7
|
|
|
* Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus), |
|
8
|
|
|
* Horizon 2020 research and innovation programme under Grant Agreements No. |
|
9
|
|
|
* 691567 (GN4-1) and No. 731122 (GN4-2). |
|
10
|
|
|
* On behalf of the aforementioned projects, GEANT Association is the sole owner |
|
11
|
|
|
* of the copyright in all material which was developed by a member of the GÉANT |
|
12
|
|
|
* project. GÉANT Vereniging (Association) is registered with the Chamber of |
|
13
|
|
|
* Commerce in Amsterdam with registration number 40535155 and operates in the |
|
14
|
|
|
* UK as a branch of GÉANT Vereniging. |
|
15
|
|
|
* |
|
16
|
|
|
* Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. |
|
17
|
|
|
* UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK |
|
18
|
|
|
* |
|
19
|
|
|
* License: see the web/copyright.inc.php file in the file structure or |
|
20
|
|
|
* <base_url>/copyright.php after deploying the software |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
namespace web\lib\user; |
|
24
|
|
|
|
|
25
|
|
|
class Gui extends \core\UserAPI { |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* various pre-translated UI texts |
|
29
|
|
|
* |
|
30
|
|
|
* @var TextTemplates |
|
31
|
|
|
*/ |
|
32
|
|
|
public $textTemplates; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* constructs a new Gui object |
|
36
|
|
|
*/ |
|
37
|
|
|
public function __construct() { |
|
38
|
|
|
$validator = new \web\lib\common\InputValidation(); |
|
39
|
|
|
parent::__construct(); |
|
40
|
|
|
if (!empty($_REQUEST['idp'])) { // determine skin to use based on NROs preference |
|
41
|
|
|
$idp = $validator->existingIdP($_REQUEST['idp']); |
|
42
|
|
|
$fed = $validator->existingFederation($idp->federation); |
|
43
|
|
|
$fedskin = $fed->getAttributes("fed:desired_skin"); |
|
44
|
|
|
} |
|
45
|
|
|
$this->skinObject = new \web\lib\user\Skinjob($_REQUEST['skin'] ?? $_SESSION['skin'] ?? $fedskin[0] ?? \config\Master::APPEARANCE['skins'][0]); |
|
46
|
|
|
$this->languageInstance->setTextDomain("web_user"); |
|
47
|
|
|
$this->textTemplates = new TextTemplates(); |
|
48
|
|
|
$this->operatingSystem = $this->detectOS(); |
|
49
|
|
|
$this->loggerInstance->debug(4, $this->operatingSystem); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* header which is needed by most front-end files |
|
54
|
|
|
* |
|
55
|
|
|
* @param string $pagetitle content for the <title> element |
|
56
|
|
|
* @return void writes directly to output |
|
57
|
|
|
*/ |
|
58
|
|
|
public function defaultPagePrelude($pagetitle = \config\Master::APPEARANCE['productname_long']) { |
|
59
|
|
|
$ourlocale = $this->languageInstance->getLang(); |
|
60
|
|
|
header("Content-Type:text/html;charset=utf-8"); |
|
61
|
|
|
echo "<!DOCTYPE html> |
|
62
|
|
|
<html xmlns='http://www.w3.org/1999/xhtml' lang='" . $ourlocale . "'> |
|
63
|
|
|
<head lang='" . $ourlocale . "'> |
|
64
|
|
|
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>"; |
|
65
|
|
|
echo "<title>" . htmlspecialchars($pagetitle) . "</title>"; |
|
66
|
|
|
echo '<script type="text/javascript">ie_version = 0;</script> |
|
67
|
|
|
<!--[if IE]> |
|
68
|
|
|
<script type="text/javascript">ie_version=1;</script> |
|
69
|
|
|
<![endif]--> |
|
70
|
|
|
<!--[if IE 7]> |
|
71
|
|
|
<script type="text/javascript">ie_version=7;</script> |
|
72
|
|
|
<![endif]--> |
|
73
|
|
|
<!--[if IE 8]> |
|
74
|
|
|
<script type="text/javascript">ie_version=8;</script> |
|
75
|
|
|
<![endif]--> |
|
76
|
|
|
<!--[if IE 9]> |
|
77
|
|
|
<script type="text/javascript">ie_version=9;</script> |
|
78
|
|
|
<![endif]--> |
|
79
|
|
|
<!--[if IE 10]> |
|
80
|
|
|
<script type="text/javascript">ie_version=10;</script> |
|
81
|
|
|
<![endif]--> |
|
82
|
|
|
'; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* outputs a string, replacing unsafe JavaScript quotation marks with HTML |
|
87
|
|
|
* entity |
|
88
|
|
|
* |
|
89
|
|
|
* @param string $s the string to escape |
|
90
|
|
|
* @return void |
|
91
|
|
|
*/ |
|
92
|
|
|
public function javaScriptEscapedEcho($s) { |
|
93
|
|
|
echo preg_replace('/"/', '"', $s); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* the instance of the skin factory to use |
|
98
|
|
|
* |
|
99
|
|
|
* @var \web\lib\user\Skinjob |
|
100
|
|
|
*/ |
|
101
|
|
|
public $skinObject; |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* the detected operating system |
|
105
|
|
|
* |
|
106
|
|
|
* @var array|boolean |
|
107
|
|
|
*/ |
|
108
|
|
|
public $operatingSystem; |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* redeclaring as public so that web front-end can access it |
|
112
|
|
|
* |
|
113
|
|
|
* @var \core\common\Logging |
|
114
|
|
|
*/ |
|
115
|
|
|
public $loggerInstance; |
|
116
|
|
|
|
|
117
|
|
|
} |
|
118
|
|
|
|