Passed
Push — master ( 442876...4ec1bc )
by Felipe
15:55 queued 10:33
created

IntroController   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 9
dl 0
loc 84
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 9 2
B doDefault() 0 60 7
1
<?php
2
0 ignored issues
show
Coding Style introduced by
You must use "/**" style comments for a file comment
Loading history...
3
/*
4
 * PHPPgAdmin v6.0.0-beta.30
5
 */
6
7
namespace PHPPgAdmin\Controller;
8
9
/**
10
 * Base controller class.
11
 */
5 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
12
class IntroController extends BaseController
13
{
14
    public $controller_name = 'IntroController';
15
16
    /**
17
     * Default method to render the controller according to the action parameter.
18
     */
19
    public function render()
20
    {
21
        if (null === $this->container->requestobj->getAttribute('route')) {
22
            echo $this->doDefault();
23
        } else {
24
            $body = $this->container->responseobj->getBody();
25
            $body->write($this->doDefault());
26
27
            return $this->container->responseobj;
28
        }
29
    }
30
31
    /**
32
     * Intro screen.
33
     *
34
     * $Id: intro.php,v 1.19 2007/07/12 19:26:22 xzilla Exp $
35
     */
36
    public function doDefault()
37
    {
38
        $intro_html = $this->printHeader('Intro', $this->scripts, false);
39
        $intro_html .= $this->printBody(false);
40
41
        $intro_html .= $this->printTrail('root', false);
42
43
        $intro_html .= $this->printTabs('root', 'intro', false);
44
45
        $intro_html .= '<h1>'.$this->appName.' '.$this->appVersion.' (PHP '.PHP_VERSION.')</h1>';
46
47
        $intro_html .= '<form method="get" action="intro.php">';
48
        $intro_html .= '<table>';
49
        $intro_html .= '<tr class="data1">';
50
        $intro_html .= '<th class="data">'.$this->lang['strlanguage'].'</th>';
51
        $intro_html .= '<td>';
52
        $intro_html .= '<select name="language" onchange="this.form.submit()">';
53
54
        $this->language = isset($_SESSION['webdbLanguage']) ? $_SESSION['webdbLanguage'] : 'english';
55
        foreach ($this->appLangFiles as $k => $v) {
56
            $selected = ($k == $this->language) ? ' selected="selected"' : '';
57
            $intro_html .= "\t<option value=\"{$k}\"".$selected.">{$v}</option>\n";
58
        }
59
60
        $intro_html .= '</select>';
61
        $intro_html .= '</td>';
62
        $intro_html .= '</tr>';
63
        $intro_html .= '<tr class="data2">';
64
        $intro_html .= '<th class="data">'.$this->lang['strtheme'].'</th>';
65
        $intro_html .= '<td>';
66
        $intro_html .= '<select name="theme" onchange="this.form.submit()">';
67
68
        foreach ($this->appThemes as $k => $v) {
69
            $selected = ($k == $this->conf['theme']) ? ' selected="selected"' : '';
70
            $intro_html .= "\t<option value=\"{$k}\"".$selected.">{$v}</option>\n";
71
        }
72
73
        $intro_html .= '</select>';
74
        $intro_html .= '</td>';
75
        $intro_html .= '</tr>';
76
        $intro_html .= '</table>';
77
        $intro_html .= '<noscript><p><input type="submit" value="'.$this->lang['stralter'].'" /></p></noscript>';
78
        $intro_html .= '</form>';
79
80
        $intro_html .= '<p>'.$this->lang['strintro'].'</p>';
81
82
        $intro_html .= '<ul class="intro">';
83
        $intro_html .= '	<li><a href="https://github.com/HuasoFoundries/phpPgAdmin6">'.$this->lang['strppahome'].'</a></li>';
84
        $intro_html .= '<li><a href="'.$this->lang['strpgsqlhome_url'].'">'.$this->lang['strpgsqlhome'].'</a></li>';
85
        $intro_html .= '<li><a href="https://github.com/HuasoFoundries/phpPgAdmin6/issues">'.$this->lang['strreportbug'].'</a></li>';
86
        //$intro_html .= '<li><a href="' . $this->lang['strviewfaq_url'] . '">' . $this->lang['strviewfaq'] . '</a></li>';
87
        $intro_html .= '</ul>';
88
89
        if ($this->container->requestobj->getQueryParam('language')) {
90
            $this->misc->setReloadBrowser(true);
91
        }
92
93
        $intro_html .= $this->printFooter(false);
94
95
        return $intro_html;
96
    }
97
}
98