|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* ***************************************************************************** |
|
4
|
|
|
* Contributions to this work were made on behalf of the GÉANT project, a |
|
5
|
|
|
* project that has received funding from the European Union’s Framework |
|
6
|
|
|
* Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus), |
|
7
|
|
|
* Horizon 2020 research and innovation programme under Grant Agreements No. |
|
8
|
|
|
* 691567 (GN4-1) and No. 731122 (GN4-2). |
|
9
|
|
|
* On behalf of the aforementioned projects, GEANT Association is the sole owner |
|
10
|
|
|
* of the copyright in all material which was developed by a member of the GÉANT |
|
11
|
|
|
* project. GÉANT Vereniging (Association) is registered with the Chamber of |
|
12
|
|
|
* Commerce in Amsterdam with registration number 40535155 and operates in the |
|
13
|
|
|
* UK as a branch of GÉANT Vereniging. |
|
14
|
|
|
* |
|
15
|
|
|
* Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. |
|
16
|
|
|
* UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK |
|
17
|
|
|
* |
|
18
|
|
|
* License: see the web/copyright.inc.php file in the file structure or |
|
19
|
|
|
* <base_url>/copyright.php after deploying the software |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace web\lib\admin; |
|
23
|
|
|
|
|
24
|
|
|
class PageDecoration extends \core\common\Entity { |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* an instance of the InputValidation class |
|
28
|
|
|
* |
|
29
|
|
|
* @var \web\lib\common\InputValidation |
|
30
|
|
|
*/ |
|
31
|
|
|
private $validator; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* an instance of the UIElements class |
|
35
|
|
|
* |
|
36
|
|
|
* @var \web\lib\admin\UIElements |
|
37
|
|
|
*/ |
|
38
|
|
|
private $ui; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* an instance of the Language class |
|
42
|
|
|
* |
|
43
|
|
|
* @var \core\common\Language |
|
44
|
|
|
*/ |
|
45
|
|
|
private $langObject; |
|
46
|
|
|
|
|
47
|
|
|
private $start; |
|
48
|
|
|
|
|
49
|
|
|
private $end; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* construct the PageDecoration object |
|
53
|
|
|
*/ |
|
54
|
|
|
public function __construct() { |
|
55
|
|
|
parent::__construct(); |
|
56
|
|
|
$this->langObject = new \core\common\Language(); |
|
57
|
|
|
$this->langObject->setTextDomain("web_admin"); |
|
58
|
|
|
$this->validator = new \web\lib\common\InputValidation(); |
|
59
|
|
|
$this->ui = new UIElements(); |
|
60
|
|
|
$this->start = $this->langObject->rtl ? "right" : "left"; |
|
61
|
|
|
$this->end = $this->langObject->rtl ? "left" : "right"; |
|
62
|
|
|
|
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Our (very modest and light) sidebar. authenticated admins get more options, like logout |
|
67
|
|
|
* |
|
68
|
|
|
* @param boolean $advancedControls display the admin-side advanced controls? |
|
69
|
|
|
* @return string |
|
70
|
|
|
*/ |
|
71
|
|
|
private function sidebar($advancedControls) { |
|
72
|
|
|
\core\common\Entity::intoThePotatoes(); |
|
73
|
|
|
$retval = "<div class='sidebar'><p>"; |
|
74
|
|
|
|
|
75
|
|
|
if ($advancedControls) { |
|
76
|
|
|
$retval .= "<strong>" . _("You are:") . "</strong> ".$_SESSION['name'] |
|
77
|
|
|
."<br/> |
|
78
|
|
|
<br/> |
|
79
|
|
|
<a href='" . \core\CAT::getRootUrlPath() . "/admin/overview_user.php'>" . _("Go to your Profile page") . "</a> |
|
80
|
|
|
<a href='" . \core\CAT::getRootUrlPath() . "/admin/inc/logout.php'>" . _("Logout") . "</a> "; |
|
81
|
|
|
} |
|
82
|
|
|
$retval .= "<a href='" . \core\CAT::getRootUrlPath() . "/'>" . _("Start page") . "</a> |
|
83
|
|
|
</p> |
|
84
|
|
|
</div> <!-- sidebar -->"; |
|
85
|
|
|
\core\common\Entity::outOfThePotatoes(); |
|
86
|
|
|
return $retval; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* constructs a <div> called 'header' for use on the top of the page |
|
91
|
|
|
* |
|
92
|
|
|
* @param string $cap1 caption to display in this div |
|
93
|
|
|
* @param string $language current language (this one gets pre-set in the lang selector drop-down |
|
94
|
|
|
* @return string |
|
95
|
|
|
*/ |
|
96
|
|
|
private function headerDiv($cap1, $language) { |
|
97
|
|
|
\core\common\Entity::intoThePotatoes(); |
|
98
|
|
|
$place = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); |
|
99
|
|
|
|
|
100
|
|
|
$retval = "<div class='header'> |
|
101
|
|
|
<div id='header_toprow'> |
|
102
|
|
|
<div id='header_captions' style='display:inline-block; float:$this->start; min-width:400px;'> |
|
103
|
|
|
<h1>$cap1</h1> |
|
104
|
|
|
</div><!--header_captions--> |
|
105
|
|
|
<div id='langselection' style='padding-top:20px; padding-".$this->start.":10px;'> |
|
106
|
|
|
<form action='$place' method='GET' accept-charset='UTF-8'>" . _("View this page in") . " |
|
107
|
|
|
<select id='lang' name='lang' onchange='this.form.submit()'>"; |
|
108
|
|
|
|
|
109
|
|
|
foreach (\config\Master::LANGUAGES as $lang => $getValue) { |
|
110
|
|
|
$retval .= "<option value='$lang' " . (strtoupper($language) == strtoupper($lang) ? "selected" : "" ) . " >" . $getValue['display'] . "</option> "; |
|
111
|
|
|
} |
|
112
|
|
|
$retval .= "</select>"; |
|
113
|
|
|
|
|
114
|
|
|
foreach ($_GET as $getVar => $getValue) { |
|
115
|
|
|
$filterValue = filter_input(INPUT_GET, $getVar, FILTER_SANITIZE_STRING); |
|
116
|
|
|
if ($getVar != "lang" && $getValue != "") { |
|
117
|
|
|
$retval .= "<input type='hidden' name='" . htmlspecialchars($getVar) . "' value='" . htmlspecialchars($filterValue) . "'>"; |
|
118
|
|
|
} |
|
119
|
|
|
} |
|
120
|
|
|
$retval .= "</form> |
|
121
|
|
|
</div><!--langselection-->"; |
|
122
|
|
|
$logoUrl = \core\CAT::getRootUrlPath() . "/resources/images/consortium_logo.png"; |
|
123
|
|
|
$retval .= "<div class='consortium_logo'> |
|
124
|
|
|
<img id='test_locate' src='$logoUrl' alt='Consortium Logo'> |
|
125
|
|
|
</div> <!-- consortium_logo --> |
|
126
|
|
|
</div><!--header_toprow--> |
|
127
|
|
|
</div> <!-- header -->"; |
|
128
|
|
|
\core\common\Entity::outOfThePotatoes(); |
|
129
|
|
|
return $retval; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* This starts HTML in a default way. Most pages would call this. |
|
134
|
|
|
* Exception: if you need to add extra code in <head> or modify the <body> tag |
|
135
|
|
|
* (e.g. onload) then you should call defaultPagePrelude, close head, open body, |
|
136
|
|
|
* and then call productheader. |
|
137
|
|
|
* |
|
138
|
|
|
* @param string $pagetitle Title of the page to display |
|
139
|
|
|
* @param string $area the area in which this page is (displays some matching <h1>s) |
|
140
|
|
|
* @param boolean $authRequired is authentication required on this page? |
|
141
|
|
|
* @return string |
|
142
|
|
|
*/ |
|
143
|
|
|
public function pageheader($pagetitle, $area, $authRequired = TRUE) { |
|
144
|
|
|
$retval = ""; |
|
145
|
|
|
$retval .= $this->defaultPagePrelude($pagetitle, $authRequired); |
|
146
|
|
|
$retval .= "</head></body>"; |
|
147
|
|
|
$retval .= $this->productheader($area); |
|
148
|
|
|
return $retval; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* the entire top of the page (<body> part) |
|
153
|
|
|
* |
|
154
|
|
|
* @param string $area the area we are in |
|
155
|
|
|
* @return string |
|
156
|
|
|
*/ |
|
157
|
|
|
public function productheader($area) { |
|
158
|
|
|
\core\common\Entity::intoThePotatoes(); |
|
159
|
|
|
$language = $this->languageInstance->getLang(); |
|
160
|
|
|
// this <div is closing in footer, keep it in PHP for Netbeans syntax |
|
161
|
|
|
// highlighting to work |
|
162
|
|
|
$retval = "<div class='maincontent'>"; |
|
163
|
|
|
// default values which match almost every case; override where needed |
|
164
|
|
|
$cap1 = \config\Master::APPEARANCE['productname_long']; |
|
165
|
|
|
$advancedControls = TRUE; |
|
166
|
|
|
switch ($area) { |
|
167
|
|
|
case "ADMIN-PARTICIPANT": |
|
168
|
|
|
$cap2 = sprintf(_("Administrator Interface - %s"), $this->ui->nomenclatureParticipant); |
|
169
|
|
|
break; |
|
170
|
|
|
case "ADMIN-IDP": |
|
171
|
|
|
$cap2 = sprintf(_("Administrator Interface - %s"), $this->ui->nomenclatureIdP); |
|
172
|
|
|
break; |
|
173
|
|
|
case "ADMIN-SP": |
|
174
|
|
|
$cap2 = sprintf(_("Administrator Interface - %s"), $this->ui->nomenclatureHotspot); |
|
175
|
|
|
break; |
|
176
|
|
|
case "ADMIN-IDP-USERS": |
|
177
|
|
|
$cap2 = sprintf(_("Administrator Interface - %s User Management"), \core\ProfileSilverbullet::PRODUCTNAME); |
|
178
|
|
|
break; |
|
179
|
|
|
case "ADMIN": |
|
180
|
|
|
$cap2 = _("Administrator Interface"); |
|
181
|
|
|
break; |
|
182
|
|
|
case "USERMGMT": |
|
183
|
|
|
$cap2 = _("Management of User Details"); |
|
184
|
|
|
break; |
|
185
|
|
|
case "FEDERATION": |
|
186
|
|
|
$cap2 = sprintf(_("Administrator Interface - %s Management"), $this->ui->nomenclatureFed); |
|
187
|
|
|
break; |
|
188
|
|
|
case "USER": |
|
189
|
|
|
$cap1 = sprintf(_("Welcome to %s"), \config\Master::APPEARANCE['productname']); |
|
190
|
|
|
$cap2 = \config\Master::APPEARANCE['productname_long']; |
|
191
|
|
|
$advancedControls = FALSE; |
|
192
|
|
|
break; |
|
193
|
|
|
case "SUPERADMIN": |
|
194
|
|
|
$cap2 = _("CIC"); |
|
195
|
|
|
break; |
|
196
|
|
|
case "DIAG": |
|
197
|
|
|
$cap2 = _("Diagnostics"); |
|
198
|
|
|
break; |
|
199
|
|
|
default: |
|
200
|
|
|
$cap2 = "It is an error if you ever see this string."; |
|
201
|
|
|
$advancedControls = FALSE; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
$retval .= $this->headerDiv($cap1, $language); |
|
205
|
|
|
// content from here on will SCROLL instead of being fixed at the top |
|
206
|
|
|
$retval .= "<div class='pagecontent'>"; // closes in footer again |
|
207
|
|
|
$retval .= "<div class='trick'>"; // closes in footer again |
|
208
|
|
|
$retval .= "<div id='secondrow'> |
|
209
|
|
|
<div id='secondarycaptions' style='display:inline-block; float:left'> |
|
210
|
|
|
<h2 style='padding-".$this->start.":10px;'>$cap2</h2> |
|
211
|
|
|
</div><!--secondarycaptions-->"; |
|
212
|
|
|
|
|
213
|
|
|
if (isset(\config\Master::APPEARANCE['MOTD']) && \config\Master::APPEARANCE['MOTD'] != "") { |
|
214
|
|
|
$retval .= "<div id='header_MOTD' style='display:inline-block; padding-".$this->start.":20px;vertical-align:top;'> |
|
215
|
|
|
<p class='MOTD'>" . \config\Master::APPEARANCE['MOTD'] . "</p> |
|
216
|
|
|
</div><!--header_MOTD-->"; |
|
217
|
|
|
} |
|
218
|
|
|
$retval .= $this->sidebar($advancedControls); |
|
219
|
|
|
$retval .= "</div><!--secondrow--><div id='thirdrow'>"; |
|
220
|
|
|
\core\common\Entity::outOfThePotatoes(); |
|
221
|
|
|
return $retval; |
|
222
|
|
|
} |
|
223
|
|
|
|
|
224
|
|
|
/** |
|
225
|
|
|
* |
|
226
|
|
|
* @param string $pagetitle Title of the page to display |
|
227
|
|
|
* @param boolean $authRequired does the user need to be authenticated to access this page? |
|
228
|
|
|
* @return string |
|
229
|
|
|
*/ |
|
230
|
|
|
public function defaultPagePrelude($pagetitle, $authRequired = TRUE) { |
|
231
|
|
|
if ($authRequired === TRUE) { |
|
232
|
|
|
$auth = new \web\lib\admin\Authentication(); |
|
233
|
|
|
$auth->authenticate(); |
|
234
|
|
|
} |
|
235
|
|
|
$ourlocale = $this->langObject->getLang(); |
|
236
|
|
|
header("Content-Type:text/html;charset=utf-8"); |
|
237
|
|
|
$retval = "<!DOCTYPE html> |
|
238
|
|
|
<html xmlns='http://www.w3.org/1999/xhtml' lang='$ourlocale'".($this->langObject->rtl ? "dir='rtl'" : "")."> |
|
239
|
|
|
<head lang='$ourlocale'> |
|
240
|
|
|
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>"; |
|
241
|
|
|
$cssUrl = \core\CAT::getRootUrlPath() . "/resources/css/cat.css.php"; |
|
242
|
|
|
$retval .= "<link rel='stylesheet' type='text/css' href='$cssUrl' />"; |
|
243
|
|
|
$retval .= "<title>" . htmlspecialchars($pagetitle) . "</title>"; |
|
244
|
|
|
return $retval; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* HTML code for the EU attribution |
|
249
|
|
|
* |
|
250
|
|
|
* @return string HTML code with GEANT Org and EU attribution as required for FP7 / H2020 projects |
|
251
|
|
|
*/ |
|
252
|
|
|
public function attributionEurope() { |
|
253
|
|
|
if (\config\ConfAssistant::CONSORTIUM['name'] == "eduroam" && isset(\config\ConfAssistant::CONSORTIUM['deployment-voodoo']) && \config\ConfAssistant::CONSORTIUM['deployment-voodoo'] == "Operations Team") {// SW: APPROVED |
|
254
|
|
|
// we may need to jump up one dir if we are either in admin/ or accountstatus/ |
|
255
|
|
|
// (accountstatus courtesy of my good mood. It's userspace not admin space so |
|
256
|
|
|
// it shouldn't be using this function any more.) |
|
257
|
|
|
$logoBase = \core\CAT::getRootUrlPath() . "/resources/images"; |
|
258
|
|
|
return "<span id='logos'><img src='$logoBase/dante.png' alt='DANTE' style='height:23px;width:47px'/> |
|
259
|
|
|
<img src='$logoBase/eu.png' alt='EU' style='height:23px;width:27px;border-width:0px;'/></span> |
|
260
|
|
|
<span id='eu_text' style='text-align:right;'><a href='http://ec.europa.eu/dgs/connect/index_en.htm' style='text-decoration:none; vertical-align:top;'>European Commission Communications Networks, Content and Technology</a></span>"; |
|
261
|
|
|
} |
|
262
|
|
|
return " "; |
|
263
|
|
|
} |
|
264
|
|
|
|
|
265
|
|
|
/** |
|
266
|
|
|
* displays the admin area footer |
|
267
|
|
|
* |
|
268
|
|
|
* @return string |
|
269
|
|
|
*/ |
|
270
|
|
|
|
|
271
|
|
|
public function footer() { |
|
272
|
|
|
$cat = new \core\CAT(); |
|
273
|
|
|
\core\common\Entity::intoThePotatoes(); |
|
274
|
|
|
$retval = "</div><!-- thirdrow --></div><!-- trick --> |
|
275
|
|
|
</div><!-- pagecontent --> |
|
276
|
|
|
<div class='footer' id='footer'> |
|
277
|
|
|
<table> |
|
278
|
|
|
<tr> |
|
279
|
|
|
<td>" . |
|
280
|
|
|
$cat->catVersion |
|
281
|
|
|
." |
|
282
|
|
|
</td>"; |
|
283
|
|
|
|
|
284
|
|
|
if (!empty(\config\Master::APPEARANCE['privacy_notice_url'])) { |
|
285
|
|
|
$retval .= "<td>".$cat->catCopyrifhtAndLicense."<br><span id='privacy_notice_cons'>".\config\ConfAssistant::CONSORTIUM['display_name']."</span> <a href='".\config\Master::APPEARANCE['privacy_notice_url']."'>".sprintf(_("%s Privacy Notice"), '')."</a></td>"; |
|
286
|
|
|
} |
|
287
|
|
|
$retval .= "<td>"; |
|
288
|
|
|
if (\config\ConfAssistant::CONSORTIUM['name'] == "eduroam" && isset(\config\ConfAssistant::CONSORTIUM['deployment-voodoo']) && \config\ConfAssistant::CONSORTIUM['deployment-voodoo'] == "Operations Team") { |
|
289
|
|
|
$retval .= $this->attributionEurope(); |
|
290
|
|
|
} else { |
|
291
|
|
|
$retval .= " "; |
|
292
|
|
|
} |
|
293
|
|
|
|
|
294
|
|
|
$retval .= " |
|
295
|
|
|
</td> |
|
296
|
|
|
</tr> |
|
297
|
|
|
</table> |
|
298
|
|
|
</div><!-- footer --> |
|
299
|
|
|
</div><!-- maincontent --> |
|
300
|
|
|
</body> |
|
301
|
|
|
</html>"; |
|
302
|
|
|
\core\common\Entity::outOfThePotatoes(); |
|
303
|
|
|
return $retval; |
|
304
|
|
|
} |
|
305
|
|
|
|
|
306
|
|
|
} |
|
307
|
|
|
|