if (isset($_GET['dropbox_direction'])) { $sort_params[] = 'dropbox_direction=' . $_GET['dropbox_direction']; } $sort_params = Security::remove_XSS(implode('&', $sort_params)); $action = isset($_GET['action']) ? $_GET['action'] : null; // Display the form for adding a new dropbox item. if ($action == 'add') { if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } display_add_form($dropbox_unid, $viewReceivedCategory, $viewSentCategory, $view); } if (isset($_POST['submitWork'])) { $check = Security::check_token(); if ($check) { store_add_dropbox(); } } // Display the form for adding a category if ($action == 'addreceivedcategory' || $action == 'addsentcategory') { if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } display_addcategory_form($categoryName, '', $_GET['action']); } // Editing a category: displaying the form if ($action == 'editcategory' && isset($_GET['id'])) { if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } if (!$_POST) {
$sort_params[] = 'dropbox_direction=' . $_GET['dropbox_direction']; } $sort_params = Security::remove_XSS(implode('&', $sort_params)); $action = isset($_GET['action']) ? $_GET['action'] : null; /* ACTIONS: add a dropbox file, add a dropbox category. */ // Display the form for adding a new dropbox item. if ($action == 'add') { if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } display_add_form($dropbox_unid, $viewReceivedCategory, $viewSentCategory, $view); } if (isset($_POST['submitWork'])) { $check = Security::check_token(); if ($check) { $message = store_add_dropbox(); if (!empty($message)) { Display::display_confirmation_message($message); } } } // Display the form for adding a category if ($action == 'addreceivedcategory' or $action == 'addsentcategory') { if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } display_addcategory_form($_POST['category_name'], '', $_GET['action']); } // Editing a category: displaying the form if ($action == 'editcategory' and isset($_GET['id'])) { if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
if (!empty($_FILES)) { $files = $_FILES['files']; $fileList = []; foreach ($files as $name => $array) { $counter = 0; foreach ($array as $data) { $fileList[$counter][$name] = $data; $counter++; } } $resultList = []; foreach ($fileList as $file) { $globalFile = []; $globalFile['files'] = $file; /** @var Dropbox_SentWork $result */ $result = store_add_dropbox($file); $json = array(); if (!empty($result)) { $json['name'] = Display::url(api_htmlentities($result->title), api_htmlentities(api_get_path(WEB_CODE_PATH) . 'dropbox/index.php?' . api_get_cidreq()), array('target' => '_blank')); $json['url'] = api_get_path(WEB_CODE_PATH) . 'dropbox/index.php?' . api_get_cidreq(); $json['size'] = format_file_size($result->filesize); $json['type'] = api_htmlentities($file['type']); $json['result'] = Display::return_icon('accept.png', get_lang('Uploaded')); } else { $json['result'] = Display::return_icon('exclamation.png', get_lang('Error')); } $resultList[] = $json; } echo json_encode(['files' => $resultList]); } exit;