Passed
Push — master ( 5c87ed...e4bb53 )
by Stefan
04:05
created

Gui::defaultPagePrelude()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 9
nc 1
nop 1
1
<?php
2
3
/*
4
 * ******************************************************************************
5
 * Copyright 2011-2017 DANTE Ltd. and GÉANT on behalf of the GN3, GN3+, GN4-1 
6
 * and GN4-2 consortia
7
 *
8
 * License: see the web/copyright.php file in the file structure
9
 * ******************************************************************************
10
 */
11
12
namespace web\lib\user;
13
14
class Gui extends \core\UserAPI {
15
16
    /**
17
     * various pre-translated UI texts
18
     * 
19
     * @var TextTemplates
20
     */
21
    public $textTemplates;
22
23
    public function __construct() {
24
        $validator = new \web\lib\common\InputValidation();
25
        parent::__construct();
26
        if (!empty($_REQUEST['idp'])) { // determine skin to use based on NROs preference
27
            $idp = $validator->IdP($_REQUEST['idp']);
28
            $fed = $validator->Federation($idp->federation);
29
            $fedskin = $fed->getAttributes("fed:desired_skin");
30
        }
31
        $this->skinObject = new \web\lib\user\Skinjob($_REQUEST['skin'] ?? $_SESSION['skin'] ?? $fedskin[0] ?? CONFIG['APPEARANCE']['skins'][0]);
0 ignored issues
show
Bug introduced by
The constant web\lib\user\CONFIG was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
32
        $this->langObject = new \core\common\Language();
33
        $this->textTemplates = new TextTemplates($this);
34
        $this->operatingSystem = $this->detectOS();
35
        $this->loggerInstance->debug(4, $this->operatingSystem);
36
    }
37
38
    public function defaultPagePrelude($pagetitle = CONFIG['APPEARANCE']['productname_long']) {
0 ignored issues
show
Bug introduced by
The constant web\lib\user\CONFIG was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
39
        $ourlocale = $this->langObject->getLang();
40
        header("Content-Type:text/html;charset=utf-8");
41
        echo "<!DOCTYPE html>
42
          <html xmlns='http://www.w3.org/1999/xhtml' lang='" . $ourlocale . "'>
43
          <head lang='" . $ourlocale . "'>
44
          <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>";
45
        $cssUrl = $this->skinObject->findResourceUrl("CSS", "cat.css.php");
46
        echo "<link rel='stylesheet' media='screen' type='text/css' href='$cssUrl' />";
47
        echo "<title>" . htmlspecialchars($pagetitle) . "</title>";
48
        echo '<script type="text/javascript">ie_version = 0;</script>
49
<!--[if IE]>
50
<script type="text/javascript">ie_version=1;</script>
51
<![endif]-->
52
<!--[if IE 7]>
53
<script type="text/javascript">ie_version=7;</script>
54
<![endif]-->
55
<!--[if IE 8]>
56
<script type="text/javascript">ie_version=8;</script>
57
<![endif]-->
58
<!--[if IE 9]>
59
<script type="text/javascript">ie_version=9;</script>
60
<![endif]-->
61
<!--[if IE 10]>
62
<script type="text/javascript">ie_version=10;</script>
63
<![endif]-->
64
';
65
    }
66
67
    public $loggerInstance;
68
    public $skinObject;
69
    public $langObject;
70
    public $operatingSystem;
71
72
}
73