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 (421)

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.

phpmyfaq/admin/group.php (9 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
 * Displays the group management frontend.
4
 *
5
 *
6
 *
7
 * This Source Code Form is subject to the terms of the Mozilla Public License,
8
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
9
 * obtain one at http://mozilla.org/MPL/2.0/.
10
 *
11
 * @package phpMyFAQ
12
 * @author Lars Tiedemann <[email protected]>
13
 * @author Thorsten Rinne <[email protected]>
14
 * @copyright 2005-2019 phpMyFAQ Team
15
 * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
16
 * @link https://www.phpmyfaq.de
17
 * @since 2005-12-15
18
 */
19
20
use phpMyFAQ\Filter;
21
use phpMyFAQ\User;
22
use phpMyFAQ\User\CurrentUser;
23
24 View Code Duplication
if (!defined('IS_VALID_PHPMYFAQ')) {
25
    $protocol = 'http';
26
    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
27
        $protocol = 'https';
28
    }
29
    header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']));
30
    exit();
31
}
32
33
if (!$user->perm->checkRight($user->getUserId(), 'editgroup') &&
34
    !$user->perm->checkRight($user->getUserId(), 'delgroup') &&
35
    !$user->perm->checkRight($user->getUserId(), 'addgroup')) {
36
    exit();
37
}
38
39
// set some parameters
40
$groupSelectSize = 10;
41
$memberSelectSize = 7;
42
$descriptionRows = 3;
43
$descriptionCols = 15;
44
$defaultGroupAction = 'list';
45
$groupActionList = [
46
    'update_members',
47
    'update_rights',
48
    'update_data',
49
    'delete_confirm',
50
    'delete',
51
    'addsave',
52
    'add',
53
    'list'
54
];
55
56
// what shall we do?
57
// actions defined by url: group_action=
58
$groupAction = Filter::filterInput(INPUT_GET, 'group_action', FILTER_SANITIZE_STRING, $defaultGroupAction);
59
60
// actions defined by submit button
61
if (isset($_POST['group_action_deleteConfirm'])) {
62
    $groupAction = 'delete_confirm';
63
}
64
if (isset($_POST['cancel'])) {
65
    $groupAction = $defaultGroupAction;
66
}
67
68
if (!in_array($groupAction, $groupActionList)) {
69
    // @Todo: implement Error message
70
}
71
72
// update group members
73 View Code Duplication
if ($groupAction == 'update_members' && $user->perm->checkRight($user->getUserId(), 'editgroup')) {
74
    $message = '';
75
    $groupAction = $defaultGroupAction;
76
    $groupId = Filter::filterInput(INPUT_POST, 'group_id', FILTER_VALIDATE_INT, 0);
77
    $groupMembers = isset($_POST['group_members']) ? $_POST['group_members'] : [];
78
79
    if ($groupId == 0) {
80
        $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_noId']);
81
    } else {
82
        $user = new User($faqConfig);
83
        $perm = $user->perm;
84
        if (!$perm->removeAllUsersFromGroup($groupId)) {
0 ignored issues
show
The method removeAllUsersFromGroup does only exist in phpMyFAQ\Permission\MediumPermission, but not in phpMyFAQ\Permission\BasicPermission.

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...
85
            $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_msg_mysqlerr']);
86
        }
87
        foreach ($groupMembers as $memberId) {
88
            $perm->addToGroup((int)$memberId, $groupId);
0 ignored issues
show
The method addToGroup does only exist in phpMyFAQ\Permission\MediumPermission, but not in phpMyFAQ\Permission\BasicPermission.

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...
89
        }
90
        $message .= sprintf('<p class="alert alert-success">%s <strong>%s</strong> %s</p>',
91
            $PMF_LANG['ad_msg_savedsuc_1'],
92
            $perm->getGroupName($groupId),
0 ignored issues
show
The method getGroupName does only exist in phpMyFAQ\Permission\MediumPermission, but not in phpMyFAQ\Permission\BasicPermission.

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...
93
            $PMF_LANG['ad_msg_savedsuc_2']);
94
    }
95
}
96
97
// update group rights
98 View Code Duplication
if ($groupAction == 'update_rights' && $user->perm->checkRight($user->getUserId(), 'editgroup')) {
99
    $message = '';
100
    $groupAction = $defaultGroupAction;
101
    $groupId = Filter::filterInput(INPUT_POST, 'group_id', FILTER_VALIDATE_INT, 0);
102
    if ($groupId == 0) {
103
        $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_noId']);
104
    } else {
105
        $user = new User($faqConfig);
106
        $perm = $user->perm;
107
        $groupRights = isset($_POST['group_rights']) ? $_POST['group_rights'] : [];
108
        if (!$perm->refuseAllGroupRights($groupId)) {
0 ignored issues
show
The method refuseAllGroupRights does only exist in phpMyFAQ\Permission\MediumPermission, but not in phpMyFAQ\Permission\BasicPermission.

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...
109
            $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_msg_mysqlerr']);
110
        }
111
        foreach ($groupRights as $rightId) {
112
            $perm->grantGroupRight($groupId, (int)$rightId);
0 ignored issues
show
The method grantGroupRight does only exist in phpMyFAQ\Permission\MediumPermission, but not in phpMyFAQ\Permission\BasicPermission.

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...
113
        }
114
        $message .= sprintf('<p class="alert alert-success">%s <strong>%s</strong> %s</p>',
115
            $PMF_LANG['ad_msg_savedsuc_1'],
116
            $perm->getGroupName($groupId),
117
            $PMF_LANG['ad_msg_savedsuc_2']);
118
    }
119
}
120
121
// update group data
122 View Code Duplication
if ($groupAction == 'update_data' && $user->perm->checkRight($user->getUserId(), 'editgroup')) {
123
    $message = '';
124
    $groupAction = $defaultGroupAction;
125
    $groupId = Filter::filterInput(INPUT_POST, 'group_id', FILTER_VALIDATE_INT, 0);
126
    if ($groupId == 0) {
127
        $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_noId']);
128
    } else {
129
        $groupData = [];
130
        $dataFields = array('name', 'description', 'auto_join');
131
        foreach ($dataFields as $field) {
132
            $groupData[$field] = Filter::filterInput(INPUT_POST, $field, FILTER_SANITIZE_STRING, '');
133
        }
134
        $user = new User($faqConfig);
135
        $perm = $user->perm;
136
        if (!$perm->changeGroup($groupId, $groupData)) {
0 ignored issues
show
The method changeGroup does only exist in phpMyFAQ\Permission\MediumPermission, but not in phpMyFAQ\Permission\BasicPermission.

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...
137
            $message .= sprintf(
138
            '<p class="alert alert-danger">%s<br>%s</p>',
139
            $PMF_LANG['ad_msg_mysqlerr'],
140
            $db->error()
141
            );
142
        } else {
143
            $message .= sprintf('<p class="alert alert-success">%s <strong>%s</strong> %s</p>',
144
                $PMF_LANG['ad_msg_savedsuc_1'],
145
                $perm->getGroupName($groupId),
146
                $PMF_LANG['ad_msg_savedsuc_2']);
147
        }
148
    }
149
}
150
151
// delete group confirmation
152 View Code Duplication
if ($groupAction == 'delete_confirm' && $user->perm->checkRight($user->getUserId(), 'delgroup')) {
153
    $message = '';
154
    $user = new CurrentUser($faqConfig);
155
    $perm = $user->perm;
156
    $groupId = Filter::filterInput(INPUT_POST, 'group_list_select', FILTER_VALIDATE_INT, 0);
157
    if ($groupId <= 0) {
158
        $message    .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_noId']);
159
        $groupAction = $defaultGroupAction;
160
    } else {
161
        $groupData = $perm->getGroupData($groupId);
0 ignored issues
show
The method getGroupData does only exist in phpMyFAQ\Permission\MediumPermission, but not in phpMyFAQ\Permission\BasicPermission.

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...
162
        ?>
163
        <header class="row">
164
            <div class="col-lg-12">
165
                <h2 class="page-header">
166
                    <i aria-hidden="true" class="fas fa-users fa-fw"></i>
167
                    <?= $PMF_LANG['ad_group_deleteGroup'] ?> "<?= $groupData['name'] ?>"
168
                </h2>
169
            </div>
170
        </header>
171
172
        <div class="row">
173
            <div class="col-lg-12">
174
                <p><?= $PMF_LANG['ad_group_deleteQuestion'] ?></p>
175
                <form action ="?action=group&amp;group_action=delete" method="post">
176
                    <input type="hidden" name="group_id" value="<?= $groupId ?>">
177
                    <input type="hidden" name="csrf" value="<?= $user->getCsrfTokenFromSession()?>">
178
                    <p>
179
                        <button class="btn btn-inverse" type="submit" name="cancel">
180
                            <?= $PMF_LANG['ad_gen_cancel'] ?>
181
                        </button>
182
                        <button class="btn btn-primary" type="submit">
183
                            <?= $PMF_LANG['ad_gen_save'] ?>
184
                        </button>
185
                    </p>
186
                </form>
187
            </div>
188
        </div>
189
<?php
190
191
    }
192
}
193
194 View Code Duplication
if ($groupAction == 'delete' && $user->perm->checkRight($user->getUserId(), 'delgroup')) {
195
    $message = '';
196
    $user = new User($faqConfig);
197
    $groupId = Filter::filterInput(INPUT_POST, 'group_id', FILTER_VALIDATE_INT, 0);
198
    $csrfOkay = true;
199
    $csrfToken = Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING);
200
    if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) {
201
        $csrfOkay = false;
202
    }
203
    $groupAction = $defaultGroupAction;
204
    if ($groupId <= 0) {
205
        $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_noId']);
206
    } else {
207
        if (!$user->perm->deleteGroup($groupId) && !$csrfOkay) {
0 ignored issues
show
The method deleteGroup does only exist in phpMyFAQ\Permission\MediumPermission, but not in phpMyFAQ\Permission\BasicPermission.

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...
208
            $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_group_error_delete']);
209
        } else {
210
            $message .= sprintf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_group_deleted']);
211
        }
212
        $userError = $user->error();
213
        if ($userError != '') {
214
            $message .= sprintf('<p class="alert alert-danger">%s</p>', $userError);
215
        }
216
    }
217
}
218
219
if ($groupAction == 'addsave' && $user->perm->checkRight($user->getUserId(), 'addgroup')) {
220
    $user = new User($faqConfig);
221
    $message = '';
222
    $messages = [];
223
    $groupName = Filter::filterInput(INPUT_POST, 'group_name', FILTER_SANITIZE_STRING, '');
224
    $groupDescription = Filter::filterInput(INPUT_POST, 'group_description', FILTER_SANITIZE_STRING, '');
225
    $groupAutoJoin = Filter::filterInput(INPUT_POST, 'group_auto_join', FILTER_SANITIZE_STRING, '');
226
    $csrfOkay = true;
227
    $csrfToken = Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING);
228
229
    if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) {
230
        $csrfOkay = false;
231
    }
232
    // check group name
233
    if ($groupName == '') {
234
        $messages[] = $PMF_LANG['ad_group_error_noName'];
235
    }
236
    // ok, let's go
237
    if (count($messages) == 0 && $csrfOkay) {
238
        // create group
239
        $groupData = array(
240
            'name' => $groupName,
241
            'description' => $groupDescription,
242
            'auto_join' => $groupAutoJoin,
243
        );
244
245
        if ($user->perm->addGroup($groupData) <= 0) {
0 ignored issues
show
The method addGroup does only exist in phpMyFAQ\Permission\MediumPermission, but not in phpMyFAQ\Permission\BasicPermission.

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...
246
            $messages[] = $PMF_LANG['ad_adus_dberr'];
247
        }
248
    }
249
    // no errors, show list
250 View Code Duplication
    if (count($messages) == 0) {
251
        $groupAction = $defaultGroupAction;
252
        $message = sprintf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_group_suc']);
253
    // display error messages and show form again
254
    } else {
255
        $groupAction = 'add';
256
        $message = '<p class="alert alert-danger">';
257
        foreach ($messages as $err) {
258
            $message .= $err.'<br>';
259
        }
260
        $message .= '</p>';
261
    }
262
}
263
264
if (!isset($message)) {
265
    $message = '';
266
}
267
268
// show new group form
269
if ($groupAction == 'add' && $user->perm->checkRight($user->getUserId(), 'addgroup')) {
270
    $user = new CurrentUser($faqConfig);
271
    ?>
272
273
        <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
274
          <h1 class="h2">
275
            <i aria-hidden="true" class="fas fa-users"></i>
276
              <?= $PMF_LANG['ad_group_add'] ?>
277
          </h1>
278
        </div>
279
280
        <div class="row">
281
            <div class="col-lg-12">
282
                <div id="user_message"><?= $message ?></div>
283
                <form  name="group_create" action="?action=group&amp;group_action=addsave" method="post">
284
                    <input type="hidden" name="csrf" value="<?= $user->getCsrfTokenFromSession() ?>">
285
286
                    <div class="form-group row">
287
                        <label class="col-lg-2 col-form-label" for="group_name"><?= $PMF_LANG['ad_group_name'] ?></label>
288
                        <div class="col-lg-3">
289
                            <input type="text" name="group_name" id="group_name" autofocus class="form-control"
290
                                   value="<?=(isset($groupName) ? $groupName : '') ?>" tabindex="1">
291
                        </div>
292
                    </div>
293
294
                    <div class="form-group row">
295
                        <label class="col-lg-2 col-form-label" for="group_description"><?= $PMF_LANG['ad_group_description'] ?></label>
296
                        <div class="col-lg-3">
297
                            <textarea name="group_description" id="group_description" cols="<?= $descriptionCols ?>"
298
                                      rows="<?= $descriptionRows ?>" tabindex="2"  class="form-control"
299
                                ><?=(isset($groupDescription) ? $groupDescription : '') ?></textarea>
300
                        </div>
301
                    </div>
302
303
                    <div class="form-group row">
304
                        <label class="col-lg-2 col-form-label" for="group_auto_join"><?= $PMF_LANG['ad_group_autoJoin'] ?></label>
305
                        <div class="col-lg-3">
306
                            <div class="checkbox">
307
                                <label>
308
                                    <input type="checkbox" name="group_auto_join" id="group_auto_join" value="1" tabindex="3"
309
                                    <?=((isset($groupAutoJoin) && $groupAutoJoin) ? ' checked' : '') ?>>
310
                                </label>
311
                            </div>
312
                        </div>
313
                    </div>
314
315
                    <div class="form-group row">
316
                        <div class="offset-lg-2 col-lg-3">
317
                            <button class="btn btn-primary" type="submit">
318
                                <?= $PMF_LANG['ad_gen_save'] ?>
319
                            </button>
320
                            <button class="btn btn-info" type="reset" name="cancel">
321
                                <?= $PMF_LANG['ad_gen_cancel'] ?>
322
                            </button>
323
                        </div>
324
                    </div>
325
                </form>
326
            </div>
327
        </div>
328
<?php
329
330
} // end if ($groupAction == 'add')
331
332
// show list of users
333
if ('list' === $groupAction) {
334
    ?>
335
        <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
336
          <h1 class="h2">
337
            <i aria-hidden="true" class="fas fa-users"></i>
338
              <?= $PMF_LANG['ad_menu_group_administration'] ?>
339
          </h1>
340
          <div class="btn-toolbar mb-2 mb-md-0">
341
            <div class="btn-group mr-2">
342
              <a class="btn btn-sm btn-outline-success" href="?action=group&amp;group_action=add">
343
                  <?= $PMF_LANG['ad_group_add_link'] ?>
344
              </a>
345
            </div>
346
          </div>
347
        </div>
348
349
        <script src="assets/js/user.js"></script>
350
        <script src="assets/js/groups.js"></script>
351
352
  <div id="user_message"><?= $message ?></div>
353
354
  <div class="row">
355
356
    <div class="col-lg-4" id="group_list">
357
      <div class="card">
358
        <form id="group_select" name="group_select" action="?action=group&amp;group_action=delete_confirm"
359
              method="post">
360
          <div class="card-header">
361
              <?= $PMF_LANG['ad_groups'] ?>
362
          </div>
363
          <div class="card-body">
364
            <select name="group_list_select" id="group_list_select" class="form-control"
365
                    size="<?= $groupSelectSize ?>" tabindex="1">
366
            </select>
367
          </div>
368
          <div class="card-footer">
369
            <div class="card-button text-right">
370
              <button class="btn btn-danger" type="submit">
371
                  <?= $PMF_LANG['ad_gen_delete'] ?>
372
              </button>
373
            </div>
374
          </div>
375
        </form>
376
      </div>
377
378
      <div id="group_data" class="card">
379
        <div class="card-header">
380
            <?= $PMF_LANG['ad_group_details'] ?>
381
        </div>
382
        <form action="?action=group&group_action=update_data" method="post">
383
          <input id="update_group_id" type="hidden" name="group_id" value="0">
384
          <div class="card-body">
385
            <div class="form-group row">
386
              <label class="col-lg-3 col-form-label" for="update_group_name">
387
                  <?= $PMF_LANG['ad_group_name'] ?>
388
              </label>
389
              <div class="col-lg-9">
390
                <input id="update_group_name" type="text" name="name" class="form-control"
391
                       tabindex="1" value="<?= (isset($groupName) ? $groupName : '') ?>">
392
              </div>
393
            </div>
394
            <div class="form-group row">
395
              <label class="col-lg-3 col-form-label" for="update_group_description">
396
                  <?= $PMF_LANG['ad_group_description'] ?>
397
              </label>
398
              <div class="col-lg-9">
399
                                    <textarea id="update_group_description" name="description" class="form-control"
400
                                              rows="<?= $descriptionRows ?>"
401
                                              tabindex="2"><?php
402
                                        echo(isset($groupDescription) ? $groupDescription : '') ?></textarea>
403
              </div>
404
            </div>
405
            <div class="form-group row">
406
              <div class="col-lg-offset-3 col-lg-9">
407
                <div class="checkbox">
408
                  <label>
409
                    <input id="update_group_auto_join" type="checkbox" name="auto_join" value="1"
410
                           tabindex="3"<?php
411
                    echo((isset($groupAutoJoin) && $groupAutoJoin) ? ' checked' : '') ?>>
412
                      <?= $PMF_LANG['ad_group_autoJoin'] ?>
413
                  </label>
414
                </div>
415
              </div>
416
            </div>
417
          </div>
418
          <div class="card-footer">
419
            <div class="card-button text-right">
420
              <button class="btn btn-primary" type="submit">
421
                  <?= $PMF_LANG['ad_gen_save'] ?>
422
              </button>
423
            </div>
424
          </div>
425
        </form>
426
      </div>
427
    </div>
428
429
    <div class="col-lg-4" id="groupMemberships">
430
      <form id="group_membership" name="group_membership" method="post"
431
            action="?action=group&amp;group_action=update_members">
432
        <input id="update_member_group_id" type="hidden" name="group_id" value="0">
433
        <div class="card">
434
          <div class="card-header">
435
              <?= $PMF_LANG['ad_group_membership'] ?>
436
          </div>
437
          <div class="card-body">
438
            <div class="form-group row">
439
              <div class="text-right">
440
                                <span class="select_all">
441
                                    <a class="btn btn-primary btn-sm"
442
                                       href="javascript:selectSelectAll('group_user_list')">
443
                                        <i aria-hidden="true" class="fas fa-user-plus"></i>
444
                                    </a>
445
                                </span>
446
                <span class="unselect_all">
447
                                    <a class="btn btn-primary btn-sm"
448
                                       href="javascript:selectUnselectAll('group_user_list')">
449
                                        <i aria-hidden="true" class="fas fa-user-minus"></i>
450
                                    </a>
451
                                </span>
452
              </div>
453
            </div>
454
455
            <div class="form-group row">
456
              <select id="group_user_list" class="form-control" size="<?= $memberSelectSize ?>"
457
                      multiple>
458
                <option value="0">...user list...</option>
459
              </select>
460
            </div>
461
462
            <div class="form-group row">
463
              <div class="text-center">
464
                <input class="btn btn-success pmf-add-member" type="button"
465
                       value="<?= $PMF_LANG['ad_group_addMember'] ?>">
466
                <input class="btn btn-danger pmf-remove-member" type="button"
467
                       value="<?= $PMF_LANG['ad_group_removeMember'] ?>">
468
              </div>
469
            </div>
470
        </div>
471
472
        <ul class="list-group list-group-flush">
473
            <li class="list-group-item"><?= $PMF_LANG['ad_group_members']; ?></li>
474
        </ul>
475
476
        <div class="card-body">
477
            <div class="form-group row">
478
              <div class="float-right">
479
                <span class="select_all">
480
                    <a class="btn btn-primary btn-sm"
481
                       href="javascript:selectSelectAll('group_member_list')">
482
                        <i aria-hidden="true" class="fas fa-user-plus"></i>
483
                    </a>
484
                </span>
485
                <span class="unselect_all">
486
                  <a class="btn btn-primary btn-sm"
487
                     href="javascript:selectUnselectAll('group_member_list')">
488
                      <i aria-hidden="true" class="fas fa-user-minus"></i>
489
                  </a>
490
                </span>
491
              </div>
492
            </div>
493
494
            <div class="form-group row">
495
              <select id="group_member_list" name="group_members[]" class="form-control" multiple
496
                      size="<?= $memberSelectSize ?>">
497
                <option value="0">...member list...</option>
498
              </select>
499
            </div>
500
          </div>
501
          <div class="card-footer">
502
            <div class="card-button text-right">
503
              <button class="btn btn-primary" onclick="javascript:selectSelectAll('group_member_list')" type="submit">
504
                  <?= $PMF_LANG['ad_gen_save'] ?>
505
              </button>
506
            </div>
507
          </div>
508
        </div>
509
      </form>
510
    </div>
511
512
    <div class="col-lg-4" id="groupDetails">
513
514
      <div id="groupRights" class="card">
515
        <form id="rightsForm" action="?action=group&amp;group_action=update_rights" method="post">
516
          <input id="rights_group_id" type="hidden" name="group_id" value="0">
517
          <div class="card-header" id="user_rights_legend">
518
            <i aria-hidden="true" class="fas fa-lock"></i> <?= $PMF_LANG['ad_group_rights'] ?>
519
            <span class="float-right">
520
              <a class="btn btn-primary btn-sm" href="#" id="checkAll">
521
                <?= $PMF_LANG['ad_user_checkall'] ?> / <?= $PMF_LANG['ad_user_uncheckall'] ?>
522
              </a>
523
            </span>
524
          </div>
525
526
          <div class="card-body">
527 View Code Duplication
            <?php foreach ($user->perm->getAllRightsData() as $right): ?>
528
              <div class="form-check">
529
                <input id="group_right_<?= $right['right_id'] ?>" type="checkbox"
530
                       name="group_rights[]" value="<?= $right['right_id'] ?>"
531
                       class="form-check-input permission">
532
                <label class="form-check-label">
533
                    <?php
534
                    if (isset($PMF_LANG['rightsLanguage'][$right['name']])) {
535
                        echo $PMF_LANG['rightsLanguage'][$right['name']];
536
                    } else {
537
                        echo $right['description'];
538
                    }
539
                    ?>
540
                </label>
541
              </div>
542
            <?php endforeach; ?>
543
          </div>
544
          <div class="card-footer">
545
            <div class="card-button text-right">
546
              <button class="btn btn-primary" type="submit">
547
                  <?= $PMF_LANG['ad_gen_save'] ?>
548
              </button>
549
            </div>
550
          </div>
551
      </div>
552
      </form>
553
    </div>
554
  </div>
555
  </div>
556
<?php
557
558
}
559