Issues (2473)

Branch: master

Security Analysis    no vulnerabilities found

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.

mod/gccollab_theme/start.php (2 issues)

Labels
Severity

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
/**
4
 * start.php
5
 *
6
 * GCcollab theme - includes all GCTools branding, links and language.
7
 * 
8
 * @author Government of Canada
9
 */
10
11
elgg_register_event_handler('init', 'system', 'gccollab_theme_init');
12
13
function gccollab_theme_init() {
14
    elgg_register_page_handler('hello', 'gccollab_theme_page_handler');
15
    elgg_register_plugin_hook_handler('register', 'menu:site', 'career_menu_hander');
16
    
17
    //jobs.gc.ca menu link
18
    elgg_register_menu_item('subSite', array(
19
        'name' => 'jobs',
20
        'text' => elgg_echo('wet:jobs:link'),
21
        'href' => elgg_echo('wet:jobs:href'),
22
        'target' => '_blank',
23
    ));
24
    
25
    //menu item for Jobs Marketplace
26
    elgg_register_menu_item('subSite', array(
27
        'name' => 'Jobs Marketplace',
28
        'text' => elgg_echo('wet:marketplace:link'),
29
        'href' => elgg_echo('wet:marketplace:href'),
30
    ));
31
    
32
    //menu item for career dropdown
33
    elgg_register_menu_item('site', array(
34
		'name' => 'career',
35
		'href' => '#career_menu',
36
		'text' => elgg_echo('career') . '<span class="expicon glyphicon glyphicon-chevron-down"></span>'
37
    ));
38
39
    elgg_register_page_handler('about', 'expages_collab_page_handler');        
40
    elgg_register_page_handler('a_propos', 'expages_collab_page_handler');
41
42
    elgg_register_page_handler('terms', 'expages_collab_page_handler');
43
    elgg_register_page_handler('termes', 'expages_collab_page_handler');   
44
45
    elgg_register_page_handler('privacy', 'expages_collab_page_handler');
46
    elgg_register_page_handler('confidentialite', 'expages_collab_page_handler');
47
48
    elgg_register_page_handler('faq', 'expages_collab_page_handler');
49
    elgg_register_page_handler('qfp', 'expages_collab_page_handler');
50
51
    elgg_register_page_handler('participating_organizations', 'expages_collab_page_handler');
52
    elgg_register_page_handler('organismes_participants', 'expages_collab_page_handler');
53
54
    elgg_register_page_handler('partners', 'expages_collab_page_handler');
55
    elgg_register_page_handler('partenaires', 'expages_collab_page_handler');
56
57
    // Register public external pages
58
    elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'expages_collab_public');
59
60
    elgg_register_plugin_hook_handler('register', 'menu:expages', 'expages_collab_menu_register_hook');
61
62
    // add footer links
63
    expages_collab_setup_footer_menu();
64
65
    elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'collab_menu_block_handler');
66
67
    elgg_register_plugin_hook_handler('members:list', 'type', "members_list_type");
68
    elgg_register_plugin_hook_handler('members:config', 'tabs', "members_nav_type");
69
70
    elgg_register_widget_type('poll',elgg_echo('polls:my_widget_title'),elgg_echo('polls:my_widget_description'), array("profile", "dashboard", "index", "groups"), true);
71
    elgg_register_widget_type('poll_individual',elgg_echo('polls:individual'),elgg_echo('poll_individual_group:widget:description'), array("profile", "dashboard", "index", "groups"), true);   
72
}
73
74
/**
75
 * Extend the public pages range
76
 *
77
 */
78
function expages_collab_public($hook, $handler, $return, $params){
79
    $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants', 'help/knowledgebase', 'help/embed');     // GCChange change - Ilia: Bilingual page url
80
    return array_merge($pages, $return);
81
}
82
83
/**
84
 * Setup the links to site pages
85
 */
86
function expages_collab_setup_footer_menu() {
87
    $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants', 'help/knowledgebase');     // GCChange change - Ilia: Bilingual page url
88
    
89 View Code Duplication
    foreach ($pages as $page) {
90
        $url = "$page";
91
        $wg_item = new ElggMenuItem($page, elgg_echo("expages:$page"), $url);
92
        elgg_register_menu_item('walled_garden', $wg_item);
93
94
        $footer_item = clone $wg_item;
95
        elgg_register_menu_item('footer', $footer_item);
96
    }
97
}
98
99
/**
100
 * External pages page handler
101
 *
102
 * @param array  $page    URL segements
103
 * @param string $handler Handler identifier
104
 * @return bool
105
 */
106 View Code Duplication
function expages_collab_page_handler($page, $handler) {
107
    if ($handler == 'expages') {
108
        expages_url_forwarder($page[1]);
109
    }
110
    $type = strtolower($handler);
111
112
    $title = elgg_echo("expages:$type");
113
    $header = elgg_view_title($title);
114
115
    $object = elgg_get_entities(array(
116
        'type' => 'object',
117
        'subtype' => $type,
118
        'limit' => 1,
119
    ));
120
    if ($object) {
121
        $content .= elgg_view('output/longtext', array('value' => $object[0]->description));
0 ignored issues
show
The variable $content seems only to be defined at a later point. Did you maybe move this code here without moving the variable definition?

This error can happen if you refactor code and forget to move the variable initialization.

Let’s take a look at a simple example:

function someFunction() {
    $x = 5;
    echo $x;
}

The above code is perfectly fine. Now imagine that we re-order the statements:

function someFunction() {
    echo $x;
    $x = 5;
}

In that case, $x would be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.

Loading history...
122
    } else {
123
        $content .= elgg_echo("expages:notset");
0 ignored issues
show
The variable $content seems only to be defined at a later point. Did you maybe move this code here without moving the variable definition?

This error can happen if you refactor code and forget to move the variable initialization.

Let’s take a look at a simple example:

function someFunction() {
    $x = 5;
    echo $x;
}

The above code is perfectly fine. Now imagine that we re-order the statements:

function someFunction() {
    echo $x;
    $x = 5;
}

In that case, $x would be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.

Loading history...
124
    }
125
    $content = elgg_view('expages/wrapper', array('content' => $content));
126
    
127
    if (elgg_is_admin_logged_in()) {
128
        elgg_register_menu_item('title', array(
129
            'name' => 'edit',
130
            'text' => elgg_echo('edit'),
131
            'href' => "admin/appearance/expages?type=$type",
132
            'link_class' => 'elgg-button elgg-button-action',
133
        ));
134
    }
135
136
    if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) {
137
        $body = elgg_view_layout('one_column', array('title' => $title, 'content' => $content));
138
        echo elgg_view_page($title, $body);
139
    } else {
140
        elgg_load_css('elgg.walled_garden');
141
        $body = elgg_view_layout('walled_garden', array('content' => $header . $content));
142
        echo elgg_view_page($title, $body, 'walled_garden');
143
    }
144
    return true;
145
}
146
147
/**
148
 * Adds menu items to the expages edit form
149
 *
150
 * @param string $hook   'register'
151
 * @param string $type   'menu:expages'
152
 * @param array  $return current menu items
153
 * @param array  $params parameters
154
 * 
155
 * @return array
156
 */
157
function expages_collab_menu_register_hook($hook, $type, $return, $params) {
158
    $type = elgg_extract('type', $params);
159
        
160
    $pages = array('about', 'a_propos', 'terms', 'termes', 'privacy', 'confidentialite', 'faq', 'qfp', 'participating_organizations', 'organismes_participants', 'partners', 'partenaires');
161 View Code Duplication
    foreach ($pages as $page) {
162
        $return[] = ElggMenuItem::factory(array(
163
            'name' => $page,
164
            'text' => elgg_echo("expages:$page"),
165
            'href' => "admin/appearance/expages?type=$page",
166
            'selected' => $page === $type,
167
        ));
168
    }
169
    return $return;
170
}
171
172
// function that handles moving jobs marketplace and micro missions into drop down menu
173
function career_menu_hander($hook, $type, $menu, $params){
174 View Code Duplication
    foreach ($menu as $key => $item){
175
176
        switch ($item->getName()) {
177
            case 'career':
178
                //$item->addChild(elgg_get_menu_item('subSite', 'Jobs Marketplace'));
179
                
180
                if(elgg_is_active_plugin('missions')){
181
                    $item->addChild(elgg_get_menu_item('site', 'mission_main'));
182
                }
183
                /*if(elgg_is_active_plugin('gcforums')){
184
                    $item->addChild(elgg_get_menu_item('subSite', 'Forum'));
185
                }*/
186
187
                $item->addChild(elgg_get_menu_item('subSite', 'jobs'));
188
                $item->setLinkClass('item');
189
                break;
190
        }
191
    }
192
}
193
194
function collab_menu_block_handler($hook, $type, $menu, $params){
195
    //rearrange menu items
196 View Code Duplication
    if(elgg_get_context() == 'groupSubPage' || elgg_in_context('group_profile')){
197
198
        elgg_unregister_menu_item('owner_block', 'activity');
199
200
        //turn owner_block  menu into tabs
201
        foreach ($menu as $key => $item){
202
            switch ($item->getName()) {
203
                case 'discussion':
204
                    $item->setText(elgg_echo('gprofile:discussion'));
205
                    $item->setPriority('1');
206
                    break;
207
                case 'gcforums':
208
                    $item->setPriority('1');
209
                    $item->setLinkClass('forums');
210
                    break;
211
                case 'file':
212
                    $item->setText(elgg_echo('gprofile:files'));
213
                    $item->setPriority('2');
214
                    break;
215
                case 'blog':
216
                    $item->setText(elgg_echo('gprofile:blogs'));
217
                    $item->setPriority('3');
218
                    break;
219
                case 'event_calendar':
220
                    $item->setText(elgg_echo('gprofile:events'));
221
                    $item->setPriority('4');
222
                    break;
223
                case 'etherpad':
224
                    $item->setPriority('5');
225
                    break;
226
                case 'pages':
227
                    $item->setText(elgg_echo('gprofile:pages'));
228
                    $item->setPriority('6');
229
                    break;
230
                case 'bookmarks':
231
                    $item->setText(elgg_echo('gprofile:bookmarks'));
232
                    $item->setPriority('7');
233
                    break;
234
                case 'activity':
235
                    $item->setText(elgg_echo('activity'));
236
                    $item->setPriority('8');
237
                    $item->addItemClass('removeMe');
238
                    break;
239
                case 'questions':
240
                    $item->setText(elgg_echo('widget:questions:title'));
241
                    $item->setPriority('9');
242
                    break;
243
                case 'polls':
244
                    $item->setText(elgg_echo('gprofile:polls'));
245
                    $item->setPriority('10');
246
                    break;
247
                case 'tasks':
248
                    $item->setText(elgg_echo('gprofile:tasks'));
249
                    $item->setPriority('11');
250
                    break;
251
                case 'photos':
252
                    $item->setText(elgg_echo('gprofile:photos'));
253
                    $item->addItemClass('removeMe');
254
                    $item->setPriority('12');
255
                    break;
256
                case 'photo_albums':
257
                    $item->setText(elgg_echo('gprofile:albumsCatch'));
258
                    $item->setPriority('13');
259
                    break;
260
                case 'ideas':
261
                    $item->setText(elgg_echo('gprofile:ideas'));
262
                    $item->setPriority('14');
263
                    break;
264
                case 'related_groups':
265
                    $item->setPriority('15');
266
                    break;
267
            }
268
        }
269
    }
270
271
    if(elgg_get_context() == 'profile'){
272
273
        elgg_unregister_menu_item('owner_block', 'activity');
274
275
        //turn owner_block  menu into tabs
276
        foreach ($menu as $key => $item){
277
            switch ($item->getName()) {
278
                case 'discussion':
279
                    $item->setText(elgg_echo('gprofile:discussion'));
280
                    $item->setPriority('1');
281
                    break;
282
                case 'file':
283
                    $item->setText(elgg_echo('gprofile:files'));
284
                    $item->setHref('#file');
285
                    $item->setPriority('2');
286
                    break;
287
                case 'blog':
288
                    $item->setText(elgg_echo('gprofile:blogs'));
289
                    $item->setHref('#blog');
290
                    $item->setPriority('3');
291
                    break;
292
                case 'event_calendar':
293
                    $item->setText(elgg_echo('gprofile:events'));
294
                    $item->setHref('#events');
295
                    $item->setPriority('4');
296
                    break;
297
                case 'thewire':
298
                    //$item->setText(elgg_echo('The Wire'));
299
                    $item->setHref('#thewire');
300
                    $item->setPriority('5');
301
                    break;
302
                case 'etherpad':
303
                    $item->setHref('#etherpad');
304
                    $item->setPriority('6');
305
                    break;
306
                case 'pages':
307
                    $item->setText(elgg_echo('gprofile:pages'));
308
                    $item->setHref('#page_top');
309
                    $item->setPriority('7');
310
                    break;
311
                case 'questions':
312
                    $item->setText(elgg_echo('widget:questions:title'));
313
                    $item->setHref('#question');
314
                    $item->setPriority('8');
315
                    break;
316
                case 'bookmarks':
317
                    $item->setText(elgg_echo('gprofile:bookmarks'));
318
                    $item->setHref('#bookmarks');
319
                    $item->setPriority('9');
320
                    break;
321
                case 'polls':
322
                    $item->setText(elgg_echo('gprofile:polls'));
323
                    $item->setHref('#poll');
324
                    $item->setPriority('10');
325
                    break;
326
                case 'tasks':
327
                    $item->setText(elgg_echo('gprofile:tasks'));
328
                    $item->setHref('#task_top');
329
                    $item->setPriority('11');
330
                    break;
331
                case 'photos':
332
                    $item->setText(elgg_echo('gprofile:photos'));
333
                    $item->addItemClass('removeMe');
334
                    $item->setPriority('12');
335
                    break;
336
                case 'photo_albums':
337
                    $item->setText(elgg_echo('gprofile:albumsCatch'));
338
                    $item->setHref('#album');
339
                    $item->setPriority('13');
340
                    break;
341
                case 'ideas':
342
                    $item->setText(elgg_echo('gprofile:ideas'));
343
                    $item->addItemClass('removeMe');
344
                    $item->setPriority('14');
345
                    break;
346
                case 'orgs':
347
                    $item->setPriority('15');
348
                    break;
349
                case 'activity':
350
                    $item->setText(elgg_echo('activity'));
351
                    $item->setPriority('16');
352
                    $item->addItemClass('removeMe');
353
                    break;
354
                case 'user_invite_from_profile':
355
                    $item->setPriority('17');
356
                    break;
357
            }
358
        }
359
    }
360
}
361
362
/**
363
 * Returns content for the "type" page
364
 *
365
 * @param string      $hook        "members:list"
366
 * @param string      $type        "type"
367
 * @param string|null $returnvalue list content (null if not set)
368
 * @param array       $params      array with key "options"
369
 * @return string
370
 */
371
function members_list_type($hook, $type, $returnvalue, $params) {
372
    if ($returnvalue !== null) {
373
        return;
374
    }
375
376
    $type = get_input('type');
377
378
    $user_types = array('' => elgg_echo('gcRegister:make_selection'), 'academic' => elgg_echo('gcRegister:occupation:academic'), 'student' => elgg_echo('gcRegister:occupation:student'), 'federal' => elgg_echo('gcRegister:occupation:federal'), 'provincial' => elgg_echo('gcRegister:occupation:provincial'), 'first_nations' => elgg_echo('gcRegister:occupation:first_nations'), 'municipal' => elgg_echo('gcRegister:occupation:municipal'), 'international' => elgg_echo('gcRegister:occupation:international'), 'ngo' => elgg_echo('gcRegister:occupation:ngo'), 'community' => elgg_echo('gcRegister:occupation:community'), 'business' => elgg_echo('gcRegister:occupation:business'), 'media' => elgg_echo('gcRegister:occupation:media'), 'retired' => elgg_echo('gcRegister:occupation:retired'), 'other' => elgg_echo('gcRegister:occupation:other'));
379
    
380
    $data = "<label class='mtm' for='by_type'>" . elgg_echo('gcRegister:membertype') . "</label>" . elgg_view('input/dropdown', array('id' => 'by_type', 'class' => 'mbm', 'name' => 'by_type', 'options_values' => $user_types, 'value' => $type));
381
382
    $data .= '<script>$(function() {
383
            $("#by_type").on("change", function() {
384
                if( $(this).val() !== "" ){
385
                    window.location.href = window.location.href.replace(/[\?#].*|$/, "?type=" + $(this).val());
386
                }
387
            });
388
        });</script>';
389
390
    $data .= elgg_list_entities_from_metadata(array(
391
        'type' => 'user', 
392
        'metadata_name' => 'user_type', 
393
        'metadata_value' => $type, 
394
        'pagination' => true,
395
        'limit' => 10
396
    ));
397
398
    return $data;
399
}
400
401
/**
402
 * Appends "type" tab to the navigation
403
 *
404
 * @param string $hook        "members:config"
405
 * @param string $type        "tabs"
406
 * @param array  $returnvalue array that build navigation tabs
407
 * @param array  $params      unused
408
 * @return array
409
 */
410
function members_nav_type($hook, $type, $returnvalue, $params) {
411
    $returnvalue['type'] = array(
412
        'title' => elgg_echo('members:label:type'),
413
        'url' => "members/type",
414
    );
415
    return $returnvalue;
416
}
417