| @@ 122-149 (lines=28) @@ | ||
| 119 | } |
|
| 120 | ||
| 121 | // update group data |
|
| 122 | 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)) { |
|
| 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 | if ($groupAction == 'delete_confirm' && $user->perm->checkRight($user->getUserId(), 'delgroup')) { |
|
| @@ 96-123 (lines=28) @@ | ||
| 93 | } |
|
| 94 | ||
| 95 | // update section data |
|
| 96 | if ($sectionAction == 'update_data' && $user->perm->checkRight($user->getUserId(), 'edit_section')) { |
|
| 97 | $message = ''; |
|
| 98 | $sectionAction = $defaultSectionAction; |
|
| 99 | $sectionId = Filter::filterInput(INPUT_POST, 'section_id', FILTER_VALIDATE_INT, 0); |
|
| 100 | if ($sectionId == 0) { |
|
| 101 | $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_noId']); |
|
| 102 | } else { |
|
| 103 | $sectionData = []; |
|
| 104 | $dataFields = ['name', 'description']; |
|
| 105 | foreach ($dataFields as $field) { |
|
| 106 | $sectionData[$field] = Filter::filterInput(INPUT_POST, $field, FILTER_SANITIZE_STRING, ''); |
|
| 107 | } |
|
| 108 | $user = new User($faqConfig); |
|
| 109 | $perm = $user->perm; |
|
| 110 | if (!$perm->changeSection($sectionId, $sectionData)) { |
|
| 111 | $message .= sprintf( |
|
| 112 | '<p class="alert alert-danger">%s<br>%s</p>', |
|
| 113 | $PMF_LANG['ad_msg_mysqlerr'], |
|
| 114 | $db->error() |
|
| 115 | ); |
|
| 116 | } else { |
|
| 117 | $message .= sprintf('<p class="alert alert-success">%s <strong>%s</strong> %s</p>', |
|
| 118 | $PMF_LANG['ad_msg_savedsuc_1'], |
|
| 119 | $perm->getSectionName($sectionId), |
|
| 120 | $PMF_LANG['ad_msg_savedsuc_2']); |
|
| 121 | } |
|
| 122 | } |
|
| 123 | } |
|
| 124 | ||
| 125 | // delete section confirmation |
|
| 126 | if ($sectionAction == 'delete_confirm' && $user->perm->checkRight($user->getUserId(), 'delete_section')) { |
|