GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (4873)

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.

include/PluginsAdministrationViews.class.php (7 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
 * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
4
 * Copyright (c) Enalean, 2015. All Rights Reserved.
5
 *
6
 * This file is a part of Tuleap.
7
 *
8
 * Tuleap is free software; you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation; either version 2 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * Tuleap is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
/*
23
 * PluginsAdministrationViews
24
 */
25
26
require_once('bootstrap.php');
27
28
class PluginsAdministrationViews extends Views {
29
30
    /** @var PluginManager */
31
    private $plugin_manager;
32
33
    /** @var PluginDependencySolver */
34
    private $dependency_solver;
35
36
    /** @var TemplateRendererFactory */
37
    private $renderer;
38
39
    function PluginsAdministrationViews(&$controler, $view=null) {
40
        $this->View($controler, $view);
41
        $this->plugin_manager    = PluginManager::instance();
42
        $this->dependency_solver = new PluginDependencySolver($this->plugin_manager);
43
        $this->renderer          = TemplateRendererFactory::build()->getRenderer(
44
            PLUGINSADMINISTRATION_TEMPLATE_DIR
45
        );
46
    }
47
48
    public function header() {
49
        $title = $GLOBALS['Language']->getText('plugin_pluginsadministration','title');
50
        $GLOBALS['HTML']->header(array('title'=>$title, 'selected_top_tab' => 'admin'));
51
    }
52
53
    function footer() {
54
        $GLOBALS['HTML']->footer(array());
55
    }
56
57
    function display($view='') {
58
        switch ($view) {
59
        case 'ajax_projects':
60
            $this->$view();
61
            break;
62
63
        case 'browse':
64
            $this->_searchPlugins();
65
        default:
66
            parent::display($view);
67
        }
68
    }
69
    // {{{ Views
70
    function browse() {
71
        $output = '';
72
        $output .= $this->_installedPlugins();
73
        $output .= $this->_notYetInstalledPlugins();
74
        echo $output;
75
    }
76
77
    function postInstall() {
78
        $request =& HTTPRequest::instance();
79
        $name = $request->get('name');
80
        if ($name) {
81
            $plugin_manager = $this->plugin_manager;
82
            $p =& $plugin_manager->getPluginByName($name);
83
            if ($p) {
84
                echo '<h2>Congratulations!</h2>';
85
                echo '<p>You\'ve just installed '.$name.'</p>';
86
                $pi = $plugin_manager->getPostInstall($name);
87
                if ($pi) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $pi of type string|false is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== false instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
88
                    echo '<p>Please read the following:</p>';
89
                    echo '<pre style="border:1px solid black;">'. $pi .'</pre>';
90
                }
91
                echo '<a href="?">&lt;&lt; Go back to Plugins Administration</a>';
92
            }
93
        }
94
    }
95
96
    function confirmInstall() {
97
        $name = HTTPRequest::instance()->get('name');
98
        if ($this->isPluginAlreadyInstalled($name)) {
99
            $this->browse();
100
            return;
101
        }
102
103
        $dependencies = $this->dependency_solver->getUnmetInstalledDependencies($name);
104
        if ($dependencies) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $dependencies of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
105
            $error_msg = $GLOBALS['Language']->getText('plugin_pluginsadministration', 'error_install_dependency');
106
            $this->displayDependencyError($dependencies, $error_msg);
107
            $this->displayInstallReadme($name);
108
            return;
109
        }
110
111
        echo '<p>You\'re about to install '. $name .'.</p>';
112
        $this->displayInstallReadme($name);
113
        $this->displayConfirmationInstallForm($name);
114
    }
115
116
    private function isPluginAlreadyInstalled($name) {
117
        if ($this->plugin_manager->getPluginByName($name)) {
118
            return true;
119
        }
120
        return false;
121
    }
122
123
    private function displayInstallReadme($name) {
124
        $readme_content = $this->getFormattedReadme($name);
125
        if ($readme_content) {
126
            echo $readme_content;
127
        }
128
    }
129
130
    private function getFormattedReadme($name) {
131
        $readme_file    = $this->plugin_manager->getInstallReadme($name);
132
        $readme_content = $this->plugin_manager->fetchFormattedReadme($readme_file);
133
        return $readme_content;
134
    }
135
136
    private function displayConfirmationInstallForm($name) {
137
        echo '<form action="?" method="GET">';
138
        echo '<input type="hidden" name="action" value="install" />';
139
        echo '<input type="hidden" name="name" value="'. $name .'" />';
140
        echo '<input type="submit" name="cancel" value="No, I do not want to install this plugin" />';
141
        echo '<input type="submit" name="confirm" value="Yes, I am sure !" />';
142
        echo '</form>';
143
    }
144
145
    private function displayDependencyError($dependencies, $error_message) {
146
        $dependencies = implode('</em>, <em>', $dependencies);
147
        $return_msg   = $GLOBALS['Language']->getText('plugin_pluginsadministration_properties','return');
148
149
        echo '<p class="feedback_error">'. $error_message .' <em>'. $dependencies .'</em></p>';
150
        echo '<p><a href="/plugins/pluginsadministration/">'. $return_msg .'</a></p>';
151
    }
152
153
    function confirmUninstall() {
154
        $request =& HTTPRequest::instance();
155
        if (! $request->exist('plugin_id')) {
156
            $this->browse();
157
            return;
158
        }
159
160
        $plugin_manager = $this->plugin_manager;
161
        $plugin = $plugin_manager->getPluginById((int)$request->get('plugin_id'));
162
        if (! $plugin) {
163
            $this->browse();
164
            return;
165
        }
166
167
        $dependencies = $this->dependency_solver->getInstalledDependencies($plugin);
168
        if ($dependencies) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $dependencies of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
169
            $error_msg = $GLOBALS['Language']->getText('plugin_pluginsadministration', 'error_uninstall_dependency', $plugin->getName());
170
            $this->displayDependencyError($dependencies, $error_msg);
171
            return;
172
        }
173
174
        $this->displayUninstallationConfirmScreen($plugin);
175
    }
176
177
    private function displayUninstallationConfirmScreen(Plugin $plugin) {
178
        $plug_info  =& $plugin->getPluginInfo();
179
        $descriptor =& $plug_info->getPluginDescriptor();
180
        $name = $descriptor->getFullName();
181
        if (strlen(trim($name)) === 0) {
182
            $name = get_class($plugin);
183
        }
184
        $output = sprintf(file_get_contents($GLOBALS['Language']->getContent('confirm_uninstall', null, 'pluginsadministration')),
185
                                        $name,
186
                                        $plugin->getId());
187
        echo $output;
188
    }
189
190
    function ajax_projects() {
191
        $request =& HTTPRequest::instance();
192
        $p = $request->get('gen_prop');
193
        if ($p && isset($p['allowed_project'])) {
194
            $value = db_escape_string($p['allowed_project']);
195
            $sql = db_query("SELECT group_id, unix_group_name FROM groups WHERE group_id LIKE '%$value%' OR unix_group_name LIKE '%$value%'");
196
            if (db_numrows($sql)) {
197
                echo '<ul>';
198
                while($row = db_fetch_array($sql)) {
199
                    echo '<li>'. $row[0] .' ('. $row[1] .')</li>';
200
                }
201
                echo '</ul>';
202
            }
203
        }
204
    }
205
    function properties() {
206
        $pm = ProjectManager::instance();
207
        $link_to_plugins = dirname($_SERVER['REQUEST_URI']).'/';
208
        $request =& HTTPRequest::instance();
209
        if ($request->exist('plugin_id')) {
210
            $plugin_manager = $this->plugin_manager;
211
            $plugin_factory =& PluginFactory::instance();
212
            $plugin =& $plugin_factory->getPluginById($request->get('plugin_id'));
213
            if(!$plugin) {
214
                $GLOBALS['HTML']->redirect('/plugins/pluginsadministration/');
215
            } else {
216
                $plug_info  =& $plugin->getPluginInfo();
217
                $descriptor =& $plug_info->getPluginDescriptor();
218
219
                $available = $plugin_manager->isPluginAvailable($plugin);
220
                $name = $descriptor->getFullName();
221
                if (strlen(trim($name)) === 0) {
222
                    $name = get_class($plugin);
223
                }
224
225
                $col_hooks =& $plugin->getHooks();
226
                $hooks =& $col_hooks->iterator();
227
                $the_hooks = array();
228
                while($hooks->valid()) {
229
                    $hook =& $hooks->current();
230
                    $the_hooks[] = $hook;
231
                    $hooks->next();
232
                }
233
                natcasesort($the_hooks);
234
                $link_to_hooks = implode(', ', $the_hooks);
235
236
                //PropertyDescriptor
237
                $descs = $plug_info->getPropertyDescriptors();
238
                $keys  = $descs->getKeys();
239
                $iter  = $keys->iterator();
240
                $props = '';
241
                while($iter->valid()) {
242
                    $key   = $iter->current();
243
                    $desc  = $descs->get($key);
244
                    $prop_name = $desc->getName();
245
                    $props .= '<tr><td class="pluginsadministration_label">'. $prop_name .'</td><td>';
246
                    if (is_bool($desc->getValue())) {
247
                        $props .= '<input type="hidden"   name="properties['. $prop_name .']" value="0" />';
248
                        $props .= '<input type="checkbox" name="properties['. $prop_name .']" value="1" '. ($desc->getValue() ? 'checked="checked"' : '') .'/>';
249
                    } else {
250
                        $props .= sprintf('<input type="text" size="%d" name="properties[%s]" value="%s" />', strlen($desc->getValue()), $prop_name, $desc->getValue());
251
                    }
252
                    $props .= '</td></tr>';
253
                    $iter->next();
254
                }
255
256
                $output  = '<h3>'.$GLOBALS['Language']->getText('plugin_pluginsadministration_properties','properties_plugin', array($name)).'</h3>';
257
                $output .= '<form action="'. $_SERVER['REQUEST_URI'] .'" method="POST"><div><input type="hidden" name="plugin_id" value="'.$request->get('plugin_id').'" /></div>';
258
                $output .= '<table border="0" cellpadding="0" cellspacing="2" class="pluginsadministration_plugin_properties table table-striped table-bordered table-condensed">';
259
                $output .= '<tbody>';
260
                $output .=   '<tr>';
261
                $output .=     '<td class="pluginsadministration_label">'.$GLOBALS['Language']->getText('plugin_pluginsadministration_properties','properties_name:').' </td>';
262
                $output .=     '<td>'.$descriptor->getFullName().'</td>';
263
                $output .=   '</tr>';
264
                $output .=   '<tr>';
265
                $output .=     '<td class="pluginsadministration_label">'.$GLOBALS['Language']->getText('plugin_pluginsadministration_properties','properties_version:').' </td>';
266
                $output .=     '<td>'.$descriptor->getVersion().'</td>';
267
                $output .=   '</tr>';
268
                $output .=   '<tr>';
269
                $output .=     '<td class="pluginsadministration_label">'.$GLOBALS['Language']->getText('plugin_pluginsadministration_properties','properties_description:').' </td>';
270
                $output .=     '<td>'.$descriptor->getDescription().'</td>';
271
                $output .=   '</tr>';
272
                $output .=   '<tr>';
273
                $output .=     '<td class="pluginsadministration_label">'.$GLOBALS['Language']->getText('plugin_pluginsadministration_properties','properties_scope:').' </td>';
274
                $output .=     '<td>'.$GLOBALS['Language']->getText('plugin_pluginsadministration', 'scope_'.$plugin->getScope()).'</td>';
275
                $output .=   '</tr>';
276
277
                $dependencies = implode(', ', $plugin->getDependencies());
278
                if (! $dependencies) {
279
                    $dependencies = '–';
280
                }
281
                $output .=   '<tr>';
282
                $output .=     '<td class="pluginsadministration_label">'.$GLOBALS['Language']->getText('plugin_pluginsadministration_properties','properties_dependencies:').' </td>';
283
                $output .=     '<td>'. $dependencies .'</td>';
284
                $output .=   '</tr>';
285
286
                $output .=   '<tr>';
287
                $output .=     '<td class="pluginsadministration_label">'.$GLOBALS['Language']->getText('plugin_pluginsadministration_properties','properties_hooks:').' </td>';
288
                $output .=     '<td>'.$link_to_hooks.'</td>';
289
                $output .=   '</tr>';
290
                if ($props !== '') {
291
                    $output .=   $props;
292
                }
293
                if(($props !== '') || ($plugin->getScope() == Plugin::SCOPE_PROJECT)) {
294
                    $output .=   '<tr><td>&nbsp;</td><td><input type="hidden" name="action" value="change_plugin_properties" /><input type="submit" class="btn btn-primary" value="Change Properties" /></td></tr>';
295
                }
296
                $output .= '</tbody>';
297
                $output .= '</table>';
298
                $output .= '</form>';
299
300
                $output .= $plugin->getAdministrationOptions();
301
302
                $readme = $this->getFormattedReadme($plugin->getName());
303
                if ($readme) {
304
                    $output .= '<h3>Readme</h3>';
305
                    $output .= $readme;
306
                }
307
308
                $output .= '<div><a href="'.$link_to_plugins.'">'.$GLOBALS['Language']->getText('plugin_pluginsadministration_properties','return').'</a></div>';
309
                echo $output;
310
            }
311
        }
312
    }
313
    // }}}
314
315
    public function restrict() {
316
        $request                    = HTTPRequest::instance();
317
        $plugin_factory             = PluginFactory::instance();
318
        $plugin_resource_restrictor = $this->getPluginResourceRestrictor();
319
        $plugin                     = $plugin_factory->getPluginById($request->get('plugin_id'));
320
321
        if ($plugin->getScope() !== Plugin::SCOPE_PROJECT) {
322
            $GLOBALS['Response']->addFeedback(Feedback::ERROR, 'This project cannot be restricted.');
323
            $GLOBALS['Response']->redirect('/plugins/pluginsadministration/');
324
            die();
0 ignored issues
show
Coding Style Compatibility introduced by
The method restrict() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
325
        }
326
327
        $presenter = new PluginsAdministration_ManageAllowedProjectsPresenter(
328
            $plugin,
329
            $plugin_resource_restrictor->searchAllowedProjectsOnPlugin($plugin),
330
            $plugin_resource_restrictor->isPluginRestricted($plugin)
331
        );
332
333
        $renderer = TemplateRendererFactory::build()->getRenderer(ForgeConfig::get('codendi_dir') . '/src/templates/resource_restrictor');
334
        $renderer->renderToPage(PluginsAdministration_ManageAllowedProjectsPresenter::TEMPLATE, $presenter);
335
    }
336
337
    private function getPluginResourceRestrictor() {
338
        return new PluginResourceRestrictor(
339
            new RestrictedPluginDao()
340
        );
341
    }
342
343
    var $_plugins;
344
345
    function _emphasis($name, $enable) {
346
        if (!$enable) {
347
            $name = '<span class="pluginsadministration_unavailable">'.$name.'</span>';
348
        }
349
        return $name;
350
    }
351
352
    function _getHelp($section = '') {
353
        if (trim($section) !== '' && $section{0} !== '#') {
354
            $section = '#'.$section;
355
        }
356
        return '<a href="javascript:help_window(\''.get_server_url().'/plugins/pluginsadministration/documentation/'.UserManager::instance()->getCurrentUser()->getLocale().'/'.$section.'\');">[?]</a>';
357
    }
358
359
    function _searchPlugins() {
360
        if (!$this->_plugins) {
361
            $this->_plugins    = array();
362
363
            $plugin_manager               = $this->plugin_manager;
364
            try {
365
                $forgeUpgradeConfig = new ForgeUpgradeConfig(new System_Command());
366
                $forgeUpgradeConfig->loadDefaults();
367
                $noFUConfig = array();
368
            } catch (Exception $e) {
369
                $GLOBALS['Response']->addFeedback('warning', $e->getMessage());
370
            }
371
372
            $plugins = $plugin_manager->getAllPlugins();
373
            foreach($plugins as $plugin) {
374
                $plug_info  =& $plugin->getPluginInfo();
375
                $descriptor =& $plug_info->getPluginDescriptor();
376
                $available = $plugin_manager->isPluginAvailable($plugin);
377
                $name = $descriptor->getFullName();
378
                if (strlen(trim($name)) === 0) {
379
                    $name = get_class($plugin);
380
                }
381
                $dont_touch    = (strcasecmp(get_class($plugin), 'PluginsAdministrationPlugin') === 0);
382
                $dont_restrict = $plugin->getScope() !== Plugin::SCOPE_PROJECT;
383
384
                $this->_plugins[] = array(
385
                    'plugin_id'     => $plugin->getId(),
386
                    'name'          => $name,
387
                    'description'   => $descriptor->getDescription(),
388
                    'version'       => $descriptor->getVersion(),
389
                    'available'     => $available,
390
                    'scope'         => $plugin->getScope(),
391
                    'dont_touch'    => $dont_touch,
392
                    'dont_restrict' => $dont_restrict);
393
394
                if (isset($noFUConfig) && !$forgeUpgradeConfig->existsInPath($plugin->getFilesystemPath())) {
395
                    $noFUConfig[] = array('name' => $name, 'plugin' => $plugin);
396
                }
397
            }
398
399
            // ForgeUpgrade configuration warning
400
            if (isset($noFUConfig) && count($noFUConfig) && isset($GLOBALS['forgeupgrade_file'])) {
401
                $txt = 'Some plugins are not referenced in ForgeUpgrade configuration, please add the following in <code>'.$GLOBALS['forgeupgrade_file'].'.</code><br/>';
402
                foreach ($noFUConfig as $plugInfo) {
403
                    $txt .= '<code>path[]="'.$plugInfo['plugin']->getFilesystemPath().'"</code><br/>';
404
                }
405
                $GLOBALS['Response']->addFeedback('warning', $txt, CODENDI_PURIFIER_DISABLED);
406
            }
407
        }
408
    }
409
410
    function _installedPlugins() {
411
        usort($this->_plugins, create_function('$a, $b', 'return strcasecmp($a["name"] , $b["name"]);'));
412
413
        $i       = 0;
414
        $plugins = array();
415
        foreach ($this->_plugins as $plugin) {
416
            $plugins[] = array(
417
                'color'         => util_get_alt_row_color($i),
418
                'available'     => $plugin['available']? '': 'pluginsadministration_unavailable',
419
                'name'          => $plugin['name'],
420
                'version'       => $plugin['version'],
421
                'description'   => $plugin['description'],
422
                'flags'         => $this->getPluginAvailableFlags($plugin),
423
                'scope'         => $GLOBALS['Language']->getText(
424
                    'plugin_pluginsadministration',
425
                    'scope_'.$plugin['scope']
426
                ),
427
                'plugin_id'     => $plugin['plugin_id'],
428
                'dont_touch'    => $plugin['dont_touch'],
429
                'dont_restrict' => $plugin['dont_restrict'],
430
            );
431
432
            $i++;
433
        }
434
435
        $presenter = new PluginsAdministration_Presenter_InstalledPluginsPresenter(
436
            $this->_getHelp('manage'),
437
            $plugins
438
        );
439
440
        return $this->renderer->renderToString(
441
            'installed-plugins',
442
            $presenter
443
        );
444
    }
445
446
    private function getPluginAvailableFlags(array $plugin_data) {
447
        $unavailable_flag = $this->getFlag($plugin_data['plugin_id'], 'unavailable', ! $plugin_data['available'], $plugin_data['dont_touch']);
448
        $available_flag   = $this->getFlag($plugin_data['plugin_id'], 'available', $plugin_data['available'], $plugin_data['dont_touch']);
449
450
        return $unavailable_flag .' '. $available_flag;
451
    }
452
453
    private function getFlag($plugin_id, $state, $is_active, $dont_touch) {
454
        $style  = '';
455
        $badge  = '';
456
        $output = '';
457
        $content = $GLOBALS['Language']->getText('plugin_pluginsadministration', $state);
458
        if ($is_active) {
459
            $badge = 'badge badge-'. ($state == 'available' ? 'success' : 'important');
460
        } else if ($dont_touch) {
461
            $style = 'style="visibility:hidden;"';
462
        } else {
463
            $title   = $GLOBALS['Language']->getText('plugin_pluginsadministration','change_to_'. $state);
464
            $content = '<a href="?action='. $state .'&plugin_id='. $plugin_id .'" title="'.$title.'">'. $content .'</a>';
465
        }
466
        $output .= '<span class="'. $badge .'" '. $style .'>'. $content .'</span>';
467
        return $output;
468
    }
469
470
    function _notYetInstalledPlugins() {
471
        $plugin_manager = $this->plugin_manager;
472
        $Language       =& $GLOBALS['Language'];
473
        $output = '';
474
        $not_yet_installed =& $plugin_manager->getNotYetInstalledPlugins();
475
        if ($not_yet_installed && count($not_yet_installed) > 0) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $not_yet_installed of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
476
            $output .= '<fieldset class="pluginsadministration"><legend>'.$Language->getText('plugin_pluginsadministration','not_yet_installed').'&nbsp;'.$this->_getHelp('install').'</legend>';
477
            $output .= '<div>'.$GLOBALS['Language']->getText('plugin_pluginsadministration','select_install').'</div>';
478
            $prefixe = '<a href="?action=install&name=';
479
            $middle  = '" title="'.$Language->getText('plugin_pluginsadministration','install_plugin').'">';
480
            $suffixe = '</a>';
481
            sort($not_yet_installed);
482
            reset($not_yet_installed);
483
            list($key,$value) = each($not_yet_installed);
0 ignored issues
show
The assignment to $key is unused. Consider omitting it like so list($first,,$third).

This checks looks for assignemnts to variables using the list(...) function, where not all assigned variables are subsequently used.

Consider the following code example.

<?php

function returnThreeValues() {
    return array('a', 'b', 'c');
}

list($a, $b, $c) = returnThreeValues();

print $a . " - " . $c;

Only the variables $a and $c are used. There was no need to assign $b.

Instead, the list call could have been.

list($a,, $c) = returnThreeValues();
Loading history...
484
            $output .= $prefixe.urlencode($value).$middle.$value.$suffixe;
485
            while(list($key,$value) = each($not_yet_installed)) {
0 ignored issues
show
The assignment to $key is unused. Consider omitting it like so list($first,,$third).

This checks looks for assignemnts to variables using the list(...) function, where not all assigned variables are subsequently used.

Consider the following code example.

<?php

function returnThreeValues() {
    return array('a', 'b', 'c');
}

list($a, $b, $c) = returnThreeValues();

print $a . " - " . $c;

Only the variables $a and $c are used. There was no need to assign $b.

Instead, the list call could have been.

list($a,, $c) = returnThreeValues();
Loading history...
486
                $output .= ', '.$prefixe.$value.$middle.$value.$suffixe;
487
            }
488
            $output .= '</fieldset>';
489
        }
490
        return $output;
491
    }
492
}
493