Issues (4714)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Intraface/Page.php (28 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Page
4
 *
5
 * @author Sune Jensen <[email protected]>
6
 * @author Lars Olesen <[email protected]>
7
 *
8
 */
9
class Intraface_Page
10
{
11
    public $kernel;
12
    public $db;
13
    public $theme;
14
    public $usermenu;
15
    public $submenu;
16
    public $menu;
17
    public $javascript_path = array();
18
    public $primary_module;
19
20
    function __construct(Intraface_Kernel $object_kernel, MDB2_Driver_Common $db = null)
21
    {
22
        $this->kernel = $object_kernel;
23
        if ($this->db == null) {
24
            $this->db = MDB2::singleton(DB_DSN);
25
        } else {
26
            $this->db = $db;
27
        }
28
    }
29
30
    function start($title = '')
31
    {
32
        $this->primary_module = $this->kernel->getPrimaryModule();
33
        $name = '';
0 ignored issues
show
$name is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
34
        if (is_object($this->primary_module)) {
35
            $name = $this->primary_module->getName();
0 ignored issues
show
$name is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
36
        }
37
38
        /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
39
        // brugermenuen
40
        // Unforntunately the usermenuen has to be before the cache as it is printed in bottom.php.
41
        $this->usermenu = array();
42
        $this->usermenu[0]['name'] = $this->t('logout', 'common');
43
        $this->usermenu[0]['url'] = url('/core/logout');
44
        if (method_exists('getIntranetList', $this->kernel->user)) {
45
        if (count($this->kernel->user->getIntranetList()) > 1) {
46
            $this->usermenu[1]['name'] = $this->t('change intranet', 'common');
47
            $this->usermenu[1]['url'] = url('/main/change_intranet.php');
48
        }
49
        }
50
        $this->usermenu[2]['name'] = $this->t('control panel', 'common');;
51
        $this->usermenu[2]['url'] = url('/core/restricted/module/controlpanel/');
52
		*/
53
/*
0 ignored issues
show
Unused Code Comprehensibility introduced by
42% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
54
        if (!is_dir(PATH_CACHE)) {
55
            if (!mkdir(PATH_CACHE)) {
56
                throw new Exception('Unable to create dir "'.PATH_CACHE.'" from constant PATH_CACHE');
57
                exit;
58
            }
59
            chmod(PATH_CACHE, 644);
60
        }
61
62
        $options = array(
63
            'cacheDir' => PATH_CACHE,
64
            'lifeTime' => 3600
65
        );
66
        $cache = new Cache_Lite_Output($options);
67
68
        // unfortunately cache has to be deactivated (true or) as there is problems with titel and javascript. solution: only caching of menu and nothing else.
69
        // If you activate again remeber to activate $cache->end() in the end of this method
70
        if (true or defined('USE_CACHE') AND !USE_CACHE OR !($cache->start('page_' . $this->kernel->user->get('id') . '_' . $name))) {
71
            if (!is_object($this->kernel->translation)) $this->kernel->getTranslation();
72
*/
73
            $intranet_name = $this->kernel->intranet->get('name');
0 ignored issues
show
The method get does only exist in FakeDebtorIntranet and Intraface_Intranet, but not in FakeKernelIntranet and F...nelIntranetWithNoAccess.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
74
75
        if (empty($title)) {
76
            $title = $intranet_name;
0 ignored issues
show
$title is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
77
        }
78
79
            // temaet
80
            $themes = self::themes();
0 ignored issues
show
$themes is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
81
            $this->theme_key = $this->kernel->setting->get('user', 'theme');
0 ignored issues
show
The property theme_key does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
82
83
            // fontsize
84
            $this->fontsize = $this->kernel->setting->get('user', 'ptextsize');
0 ignored issues
show
The property fontsize does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
85
86
87
            // menuen
88
            $this->menu = array();
89
            $i = 0;
90
            $this->menu[$i]['name'] = $this->t('dashboard', 'dashboard');
91
        ;
92
            $this->menu[$i]['url'] = url('/core/restricted/');
93
            $i++;
94
            $res = $this->db->query("SELECT name, menu_label, name FROM module WHERE active = 1 AND show_menu = 1 ORDER BY menu_index");
95
        foreach ($res->fetchAll() as $row) {
96
            if ($this->kernel->user->hasModuleAccess($row['name'])) {
0 ignored issues
show
The call to FakeKernelIntranetWithNoAccess::hasModuleAccess() has too many arguments starting with $row['name'].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
The call to FakeKernelIntranet::hasModuleAccess() has too many arguments starting with $row['name'].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
The call to FakeDebtorUser::hasModuleAccess() has too many arguments starting with $row['name'].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
97
                $this->menu[$i]['name'] = $this->t($row['name'], $row['name']);
98
                $this->menu[$i]['url'] = url('/core/restricted/module/' . $row["name"]);
99
                $i++;
100
            }
101
        }
102
103
            $submenu = array();
0 ignored issues
show
$submenu is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
104
        if (is_object($this->primary_module)) {
105
            $all_submenu = $this->primary_module->getSubmenu();
106
            if (count($all_submenu) > 0) { // added to avoid error messages
107
                $j = 0;
108
                for ($i = 0, $max = count($all_submenu); $i < $max; $i++) {
109
                    $access = false;
110
111 View Code Duplication
                    if ($all_submenu[$i]['sub_access'] != '') {
112
                        $sub = explode(":", $all_submenu[$i]['sub_access']);
113
114
                        switch ($sub[0]) {
115
                            case 'sub_access':
116
                                if ($this->kernel->user->hasSubAccess($this->primary_module->module_name, $sub[1])) {
0 ignored issues
show
The method hasSubAccess does only exist in Intraface_User, but not in FakeDebtorUser and FakeK...nelIntranetWithNoAccess.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
117
                                    $access = true;
118
                                }
119
                                break;
120
121
                            case 'module':
122
                                if ($this->kernel->user->hasModuleAccess($sub[1])) {
0 ignored issues
show
The call to FakeKernelIntranetWithNoAccess::hasModuleAccess() has too many arguments starting with $sub[1].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
The call to FakeKernelIntranet::hasModuleAccess() has too many arguments starting with $sub[1].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
The call to FakeDebtorUser::hasModuleAccess() has too many arguments starting with $sub[1].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
123
                                    $access = true;
124
                                }
125
                                break;
126
127
                            default:
128
                                throw new Exception('Der er ikke angivet om submenu skal tjekke efter sub_access eller module adgang, for undermenupunktet i Page->start();');
129
                                break;
0 ignored issues
show
break; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
130
                        }
131
                    } else {
132
                        $access = true;
133
                    }
134
135 View Code Duplication
                    if ($access) {
136
                        $this->submenu[$j]['name'] = $this->t($all_submenu[$i]['label'], $this->primary_module->getName());
137
                        $this->submenu[$j]['url'] = $this->primary_module->getPath(). $all_submenu[$i]['url'];
138
                        $j++;
139
                    }
140
                }
141
            }
142
        }
143
144
            $javascript = '';
145
        if (!empty($this->javascript_path) and count($this->javascript_path) > 0) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
Using logical operators such as and instead of && is generally not recommended.

PHP has two types of connecting operators (logical operators, and boolean operators):

  Logical Operators Boolean Operator
AND - meaning and &&
OR - meaning or ||

The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like &&, or ||.

Let’s take a look at a few examples:

// Logical operators have lower precedence:
$f = false or true;

// is executed like this:
($f = false) or true;


// Boolean operators have higher precedence:
$f = false || true;

// is executed like this:
$f = (false || true);

Logical Operators are used for Control-Flow

One case where you explicitly want to use logical operators is for control-flow such as this:

$x === 5
    or die('$x must be 5.');

// Instead of
if ($x !== 5) {
    die('$x must be 5.');
}

Since die introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined with throw at this point:

// The following is currently a parse error.
$x === 5
    or throw new RuntimeException('$x must be 5.');

These limitations lead to logical operators rarely being of use in current PHP code.

Loading history...
146
            for ($i = 0, $max = count($this->javascript_path); $i < $max; $i++) {
147
                $javascript .= '<script type="text/javascript" src="'.$this->javascript_path[$i].'"></script>' . "\n";
148
            }
149
        }
150
            /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
151
            $systemdisturbance = new SystemDisturbance($this->kernel);
152
            $now = $systemdisturbance->getActual();
153
154
            if (!empty($now) AND count($now) > 0 && $now['important'] == 1) {
155
                $system_message = $now['description'];
156
            }
157
            */
158
159
160
            //header('Vary: Accept');
161
            // setting headers to prevent browser to cache page
162
            // jf. http://dk.php.net/header/
163
164
            //header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
165
            //header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
0 ignored issues
show
Unused Code Comprehensibility introduced by
48% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
166
167
            // HTTP/1.1
168
            //header('Cache-Control: no-store, no-cache, must-revalidate');
169
            //header('Cache-Control: post-check=0, pre-check=0', false);
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
170
171
            // HTTP/1.0
172
            //header('Pragma: no-cache');
173
174
            /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
49% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
175
            if (defined('OB_START') AND OB_START == 'use') {
176
                ob_start(); // OB_HANDLER
177
            }
178
            */
179
180
            //contentNegotiation(CONTENTNEGOTIATION);
181
182
            //include(PATH_INCLUDE_IHTML.'/intraface/top.php');
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
183
184
            // $cache->end();
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
185
        //}
186
    }
187
188
    function end()
189
    {
190
        $this->usermenu = array();
191
        $this->usermenu[0]['name'] = $this->t('logout', 'common');
192
        $this->usermenu[0]['url'] = url('/core/logout');
193
194
        if (method_exists($this->kernel->user, 'getIntranetList')) {
195 View Code Duplication
            if (count($this->kernel->user->getIntranetList()) > 1) {
0 ignored issues
show
The method getIntranetList does only exist in Intraface_User, but not in FakeDebtorUser and FakeK...nelIntranetWithNoAccess.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
196
                $this->usermenu[1]['name'] = $this->t('change intranet', 'common');
197
                $this->usermenu[1]['url'] = url('/core/restricted/switchintranet');
198
            }
199
        }
200
        $this->usermenu[2]['name'] = $this->t('control panel', 'common');
201
        ;
202
        $this->usermenu[2]['url'] = url('/core/restricted/module/controlpanel');
203
204
        //include(PATH_INCLUDE_IHTML.'/intraface/bottom.php');
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
205
    }
206
207
    function includeJavascript($scope, $filename)
208
    {
209
        if (!in_array($scope, array('global', 'module'), true)) {
210
            throw new Exception("F�rste parameter er ikke enten 'global' eller 'module' i Page->includeJavascript");
211
        }
212
213
        if ($scope == 'global') {
214
            $this->javascript_path[] = url('/javascript/'.$filename);
215
        } else {
216
            $this->javascript_path[] = 'javascript/'.$filename;
217
        }
218
    }
219
220
    function addJavascript($url)
221
    {
222
        $this->javascript_path[] = $url;
223
    }
224
225
    public static function themes()
226
    {
227
        return array(
228
            1 => array(
229
              'label' => 'system',
230
              'dir' => '/system/',
231
                    'name' => 'Web 2.0',
232
                    'description' => 'Spr�lsk, vildt og pastel.'
233
            ),
234
            2 => array(
235
              'label' => 'newsystem',
236
              'dir' => '/newsystem/',
237
                    'name' => 'Standard',
238
                    'description' => 'Standard.'
239
            ),
240
            3 => array(
241
              'label' => 'black',
242
              'dir' => '/black/',
243
                    'name' => 'Den sorte ridder',
244
                    'description' => 'Det gamle tema. Nydeligt og kedeligt.'
245
            )
246
        );
247
    }
248
249
    function t($phrase, $page_id = null)
250
    {
251
        return $this->kernel->translation->get($phrase, $page_id);
252
    }
253
}
254