$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();
}
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();
// 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 {
$container_guid = elgg_get_logged_in_user_guid();
}
$guid = elgg_extract('guid', $vars, null);
-$ajax = elgg_extract('ajax', $vars, FALSE);
if ($guid) {
$file_label = elgg_echo("file:replace");
echo elgg_view('input/hidden', array('name' => 'container_guid', 'value' => $container_guid));
-//@todo this should not be necessary in 1.8... -- ajax actions can be auto-detected
-if ($ajax) {
- echo elgg_view('input/hidden', array('name' => 'ajax', 'value' => 1));
-}
-
if ($guid) {
echo elgg_view('input/hidden', array('name' => 'file_guid', 'value' => $guid));
}