|
10 | 10 | switch ($action) { |
11 | 11 | case 'get_dir_size': |
12 | 12 | api_protect_course_script(true); |
13 | | - $path = isset($_GET['path']) ? $_GET['path'] : ''; |
| 13 | + $path = $_GET['path'] ?? ''; |
14 | 14 | $isAllowedToEdit = api_is_allowed_to_edit(); |
15 | 15 | $size = DocumentManager::getTotalFolderSize($path, $isAllowedToEdit); |
16 | 16 | echo format_file_size($size); |
17 | 17 | break; |
18 | 18 | case 'get_dirs_size': |
19 | 19 | api_protect_course_script(true); |
20 | | - $requests = isset($_GET['requests']) ? $_GET['requests'] : ''; |
| 20 | + $requests = $_GET['requests'] ?? ''; |
21 | 21 | $isAllowedToEdit = api_is_allowed_to_edit(); |
22 | 22 | $response = []; |
23 | 23 | $requests = explode(',', $requests); |
|
27 | 27 | 'id' => $request, |
28 | 28 | 'size' => format_file_size($fileSize), |
29 | 29 | ]; |
30 | | - array_push($response, $data); |
| 30 | + $response[] = $data; |
31 | 31 | } |
32 | 32 | echo json_encode($response); |
33 | 33 | break; |
|
114 | 114 | $directoryParentId = isset($_POST['directory_parent_id']) ? (int) $_POST['directory_parent_id'] : 0; |
115 | 115 | $currentDirectory = ''; |
116 | 116 | if (empty($directoryParentId)) { |
117 | | - $currentDirectory = isset($_REQUEST['curdirpath']) ? $_REQUEST['curdirpath'] : ''; |
| 117 | + $currentDirectory = $_REQUEST['curdirpath'] ?? ''; |
118 | 118 | } else { |
119 | 119 | $documentData = DocumentManager::get_document_data_by_id($directoryParentId, api_get_course_id()); |
120 | 120 | if ($documentData) { |
|
124 | 124 | if (empty($currentDirectory)) { |
125 | 125 | $currentDirectory = DIRECTORY_SEPARATOR; |
126 | 126 | } |
127 | | - $ifExists = isset($_POST['if_exists']) ? $_POST['if_exists'] : ''; |
| 127 | + $ifExists = $_POST['if_exists'] ?? ''; |
128 | 128 | $unzip = isset($_POST['unzip']) ? 1 : 0; |
129 | 129 |
|
130 | 130 | if (empty($ifExists)) { |
|
189 | 189 | get_lang('Uploaded') |
190 | 190 | ); |
191 | 191 | } else { |
192 | | - $json['name'] = isset($file['name']) ? $file['name'] : get_lang('Unknown'); |
| 192 | + $json['name'] = $file['name'] ?? get_lang('Unknown'); |
193 | 193 | $json['url'] = ''; |
194 | 194 | $json['error'] = get_lang('Error'); |
195 | 195 | } |
|
275 | 275 | break; |
276 | 276 | case 'document_destination': |
277 | 277 | //obtained the bootstrap-select selected value via ajax |
278 | | - $dirValue = isset($_POST['dirValue']) ? $_POST['dirValue'] : null; |
| 278 | + $dirValue = $_POST['dirValue'] ?? null; |
279 | 279 | echo Security::remove_XSS($dirValue); |
280 | 280 | break; |
281 | 281 | } |
|
0 commit comments