| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * @package Dolphin Core |
|---|
| 4 | * @copyright Copyright (c) BoonEx Pty Limited - http://www.boonex.com/ |
|---|
| 5 | * @license CC-BY - http://creativecommons.org/licenses/by/3.0/ |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | require_once('./inc/header.inc.php'); |
|---|
| 9 | |
|---|
| 10 | $sUploaderObject = bx_process_input(bx_get('uo')); |
|---|
| 11 | $sStorageObject = bx_process_input(bx_get('so')); |
|---|
| 12 | $sUniqId = bx_process_input(bx_get('uid')); |
|---|
| 13 | $isMultiple = bx_get('m') ? true : false; |
|---|
| 14 | |
|---|
| 15 | $sFormat = bx_process_input(bx_get('f')); |
|---|
| 16 | if ($sFormat != 'html' && $sFormat != 'json') |
|---|
| 17 | $sFormat = 'html'; |
|---|
| 18 | |
|---|
| 19 | $iContentId = bx_get('c'); |
|---|
| 20 | if (false === $iContentId || '' === $iContentId) |
|---|
| 21 | $iContentId = false; |
|---|
| 22 | else |
|---|
| 23 | $iContentId = bx_process_input($iContentId, BX_DATA_INT); |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | if (!$sUploaderObject || !$sStorageObject || !$sUniqId) |
|---|
| 27 | exit; |
|---|
| 28 | |
|---|
| 29 | bx_import('BxDolUploader'); |
|---|
| 30 | $oUploader = BxDolUploader::getObjectInstance($sUploaderObject, $sStorageObject, $sUniqId); |
|---|
| 31 | if (!$oUploader) { |
|---|
| 32 | // no such uploader available |
|---|
| 33 | exit; |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | $sAction = bx_process_input(bx_get('a')); |
|---|
| 37 | |
|---|
| 38 | switch ($sAction) { |
|---|
| 39 | |
|---|
| 40 | case 'show_uploader_form': |
|---|
| 41 | header('Content-type: text/html; charset=utf-8'); |
|---|
| 42 | |
|---|
| 43 | require_once(BX_DIRECTORY_PATH_INC . "params.inc.php"); |
|---|
| 44 | require_once(BX_DIRECTORY_PATH_INC . "design.inc.php"); |
|---|
| 45 | |
|---|
| 46 | bx_import('BxDolLanguages'); |
|---|
| 47 | |
|---|
| 48 | echo $oUploader->getUploaderForm($isMultiple, $iContentId); |
|---|
| 49 | break; |
|---|
| 50 | |
|---|
| 51 | case 'restore_ghosts': |
|---|
| 52 | header('Content-type: text/html; charset=utf-8'); |
|---|
| 53 | $sImagesTranscoder = bx_process_input(bx_get('img_trans')); |
|---|
| 54 | echo $oUploader->getGhosts(bx_get_logged_profile_id(), $sFormat, $sImagesTranscoder, $iContentId); |
|---|
| 55 | break; |
|---|
| 56 | |
|---|
| 57 | case 'delete': |
|---|
| 58 | header('Content-type: text/html; charset=utf-8'); |
|---|
| 59 | $iFileId = bx_process_input(bx_get('id'), BX_DATA_INT); |
|---|
| 60 | echo $oUploader->deleteGhost($iFileId, bx_get_logged_profile_id()); |
|---|
| 61 | break; |
|---|
| 62 | |
|---|
| 63 | case 'upload': |
|---|
| 64 | header('Content-type: text/html; charset=utf-8'); |
|---|
| 65 | |
|---|
| 66 | bx_import('BxDolLanguages'); |
|---|
| 67 | |
|---|
| 68 | $oUploader->handleUploads(isset($_FILES['f']) ? $_FILES['f'] : null, $isMultiple, $iContentId); |
|---|
| 69 | break; |
|---|
| 70 | |
|---|
| 71 | } |
|---|
| 72 | |
|---|