Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
81 lines (67 loc) · 2.17 KB

File metadata and controls

81 lines (67 loc) · 2.17 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* Show the form to edit an existing group.
*/
require_once 'bootstrap.php';
$active_nav = 'groups';
$page_title = __('Edit group', 'cftp_admin');
$page_id = 'group_form';
include_once ADMIN_VIEWS_DIR . DS . 'header.php';
/** Check if the id parameter is on the URI. */
if (!isset($_GET['id'])) {
exit_with_error_code(403);
}
$group_id = $_GET['id'];
if (!group_exists_id($group_id)) {
exit_with_error_code(403);
}
/** Create the object */
$edit_group = new \ProjectSend\Classes\Groups($group_id);
/** Check if user can edit this group */
if (!$edit_group->canUserEdit()) {
exit_with_error_code(403);
}
$group_arguments = $edit_group->getProperties();
if ($_POST) {
/**
* Clean the posted form values to be used on the groups actions,
* and again on the form if validation failed.
* Also, overwrites the values gotten from the database so if
* validation failed, the new unsaved values are shown to avoid
* having to type them again.
*/
$group_arguments = array(
'id' => $group_id,
'name' => $_POST['name'],
'description' => $_POST['description'],
'members' => (!empty($_POST["members"])) ? $_POST['members'] : null,
'public' => (isset($_POST["public"])) ? 1 : 0,
);
/** Validate the information from the posted form. */
$edit_group->set($group_arguments);
$edit_response = $edit_group->edit();
if ($edit_response['status'] === 'success') {
$flash->success($edit_response['message']);
} else {
$flash->error($edit_response['message']);
}
$location = BASE_URI . 'groups-edit.php?id=' . $group_id;
ps_redirect($location);
}
?>
<div class="row">
<div class="col-12 col-sm-12 col-lg-6">
<div class="white-box">
<div class="white-box-interior">
<?php
// If the form was submitted with errors, show them here.
echo $edit_group->getValidationErrors();
$groups_form_type = 'edit_group';
include_once FORMS_DIR . DS . 'groups.php';
?>
</div>
</div>
</div>
</div>
<?php
include_once ADMIN_VIEWS_DIR . DS . 'footer.php';
Morty Proxy This is a proxified and sanitized view of the page, visit original site.