diff options
author | Cash Costello <cash.costello@gmail.com> | 2011-06-26 06:24:46 -0700 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2011-06-26 06:24:46 -0700 |
commit | 33f5c59d5318bc1e9a607215a31e48c6f7ab5b29 (patch) | |
tree | f519afd28b7d9c5d03d078c3afd1a3a77c5b45a4 /mod/file/actions | |
parent | f3240e1da73d4a89e379c0c34f8ce86f460e18dc (diff) | |
parent | 9ab2a7f6ea6650fcbbb20f9d0dd207de2d58b286 (diff) | |
download | elgg-33f5c59d5318bc1e9a607215a31e48c6f7ab5b29.tar.gz elgg-33f5c59d5318bc1e9a607215a31e48c6f7ab5b29.tar.bz2 |
Merge pull request #41 from cash/embed-lightbox
Fixes #3564 Embed rewrite using new lightbox
Diffstat (limited to 'mod/file/actions')
-rw-r--r-- | mod/file/actions/file/upload.php | 53 |
1 files changed, 10 insertions, 43 deletions
diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php index c5fe763cb..88a01745d 100644 --- a/mod/file/actions/file/upload.php +++ b/mod/file/actions/file/upload.php @@ -13,8 +13,6 @@ $container_guid = (int) get_input('container_guid', 0); $guid = (int) get_input('file_guid'); $tags = get_input("tags"); -$ajax = get_input('ajax', FALSE); - if ($container_guid == 0) { $container_guid = elgg_get_logged_in_user_guid(); } @@ -33,17 +31,8 @@ if ($new_file) { if (empty($_FILES['upload']['name'])) { $error = elgg_echo('file:nofile'); - - if ($ajax) { - echo json_encode(array( - 'status' => 'error', - 'message' => $error - )); - exit; - } else { - register_error($error); - forward(REFERER); - } + register_error($error); + forward(REFERER); } $file = new FilePluginFile(); @@ -159,44 +148,22 @@ elgg_clear_sticky_form('file'); // handle results differently for new files and file updates -// ajax is only for new files from embed right now. if ($new_file) { if ($guid) { $message = elgg_echo("file:saved"); - if ($ajax) { - echo json_encode(array( - 'status' => 'success', - 'message' => $message - )); - exit; - - } else { - system_message($message); - add_to_river('river/object/file/create', 'create', elgg_get_logged_in_user_guid(), $file->guid); - } + system_message($message); + add_to_river('river/object/file/create', 'create', elgg_get_logged_in_user_guid(), $file->guid); } else { // failed to save file object - nothing we can do about this $error = elgg_echo("file:uploadfailed"); - - if ($ajax) { - echo json_encode(array( - 'status' => 'error', - 'message' => $error - )); - exit; - - } else { - register_error($error); - } + register_error($error); } - if (!$ajax) { - $container = get_entity($container_guid); - if (elgg_instanceof($container, 'group')) { - forward("file/group/$container->guid/all"); - } else { - forward("file/owner/$container->username"); - } + $container = get_entity($container_guid); + if (elgg_instanceof($container, 'group')) { + forward("file/group/$container->guid/all"); + } else { + forward("file/owner/$container->username"); } } else { |