summaryrefslogtreecommitdiff
path: root/lib/exe
diff options
context:
space:
mode:
authorKate Arzamastseva <pshns@ukr.net>2011-08-15 14:22:19 +0300
committerKate Arzamastseva <pshns@ukr.net>2011-08-15 14:22:19 +0300
commit873cd06e1bda38e0decce16d6ec7d3bdaece612e (patch)
treebeb03cae1bcb2b924fd6b44f6293839f14ebeafd /lib/exe
parente9eba4b18be81444014e59c83ee6c5cf004a7ad7 (diff)
downloadrpg-873cd06e1bda38e0decce16d6ec7d3bdaece612e.tar.gz
rpg-873cd06e1bda38e0decce16d6ec7d3bdaece612e.tar.bz2
issue #50 styling the new uploader
Diffstat (limited to 'lib/exe')
-rw-r--r--lib/exe/ajax.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php
index aa07fe7b0..52131d864 100644
--- a/lib/exe/ajax.php
+++ b/lib/exe/ajax.php
@@ -256,16 +256,25 @@ function ajax_mediaupload(){
if($AUTH >= AUTH_UPLOAD) { io_createNamespace("$NS:xxx", 'media'); }
if ($_FILES['qqfile']['error']) unset($_FILES['qqfile']);
- if ($_FILES['qqfile']['tmp_name']) $res = media_upload($NS, $AUTH, $_FILES['qqfile']);
- if (isset($_GET['qqfile'])) $res = media_upload_xhr($NS, $AUTH);
- if ($res) $result = array('success'=>true);
+
+ if ($_FILES['qqfile']['tmp_name']) {
+ $res = media_upload($NS, $AUTH, $_FILES['qqfile']);
+ $id = ((empty($_POST['mediaid'])) ? $_FILES['qqfile']['name'] : $_POST['mediaid']);
+ }
+ if (isset($_GET['qqfile'])) {
+ $res = media_upload_xhr($NS, $AUTH);
+ $id = $_GET['qqfile'];
+ }
+
+ if ($res) $result = array('success' => true,
+ 'link' => media_managerURL(array('ns' => getNS($id), 'image' => $id), '&'));
if (!$result) {
$error = '';
if (isset($MSG)) {
foreach($MSG as $msg) $error .= $msg['msg'];
}
- $result = array('error'=> $msg['msg']);
+ $result = array('error' => $msg['msg']);
}
echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
}