X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=addon%2Fjs_upload%2Fjs_upload.php;h=331548f8803258d2a221397a2be7165a754d0838;hb=40092c83a5568a9896c05f7ccdd8da4649f5271a;hp=dc2dc37dcb8c64bf2b8ebb2f4348af6b1870b532;hpb=33037754d80dce07e6d806b6cee6df56311bb954;p=friendica.git
diff --git a/addon/js_upload/js_upload.php b/addon/js_upload/js_upload.php
index dc2dc37dcb..331548f880 100644
--- a/addon/js_upload/js_upload.php
+++ b/addon/js_upload/js_upload.php
@@ -1,5 +1,12 @@
+ */
+
/**
*
* JavaScript Photo/Image Uploader
@@ -7,9 +14,6 @@
* Uses Valum 'qq' Uploader.
* Module Author: Chris Case
*
- * Prior to enabling, ensure that you have a directory 'uploads'
- * which is writable by the web server.
- *
*/
@@ -36,6 +40,11 @@ function js_upload_form(&$a,&$b) {
$b['addon_text'] .= '';
$b['addon_text'] .= '';
+ $upload_msg = t('Upload a file');
+ $drop_msg = t('Drop files here to upload');
+ $cancel = t('Cancel');
+ $failed = t('Failed');
+
$b['addon_text'] .= <<< EOT
@@ -65,17 +74,43 @@ function createUploader() {
uploader = new qq.FileUploader({
element: document.getElementById('file-uploader-demo1'),
action: '{$b['post_url']}',
+
+ template: '
' +
+ '
$drop_msg
' +
+ '
$upload_msg
' +
+ '
' +
+ '
',
+
+ // template for one item in file list
+ fileTemplate: '
' +
+ '' +
+ '' +
+ '' +
+ '$cancel' +
+ '$failed' +
+ '',
+
debug: true,
onSubmit: function(id,filename) {
-
- uploader.setParams( {
- newalbum : document.getElementById('photos-upload-newalbum').value,
- album : document.getElementById('photos-upload-album-select').value,
- group_allow : getSelected(document.getElementById('group_allow')).join(','),
- contact_allow : getSelected(document.getElementById('contact_allow')).join(','),
- group_deny : getSelected(document.getElementById('group_deny')).join(','),
- contact_deny : getSelected(document.getElementById('contact_deny')).join(',')
- });
+ if (typeof acl!="undefined"){
+ uploader.setParams( {
+ newalbum : document.getElementById('photos-upload-newalbum').value,
+ album : document.getElementById('photos-upload-album-select').value,
+ group_allow : acl.allow_gid.join(','),
+ contact_allow : acl.allow_cid.join(','),
+ group_deny : acl.deny_gid.join(','),
+ contact_deny : acl.deny_cid.join(',')
+ });
+ } else {
+ uploader.setParams( {
+ newalbum : document.getElementById('photos-upload-newalbum').value,
+ album : document.getElementById('photos-upload-album-select').value,
+ group_allow : getSelected(document.getElementById('group_allow')).join(','),
+ contact_allow : getSelected(document.getElementById('contact_allow')).join(','),
+ group_deny : getSelected(document.getElementById('group_deny')).join(','),
+ contact_deny : getSelected(document.getElementById('contact_deny')).join(',')
+ });
+ }
}
});
}
@@ -101,7 +136,7 @@ function js_upload_post_init(&$a,&$b) {
// max file size in bytes
- $sizeLimit = 6 * 1024 * 1024;
+ $sizeLimit = get_config('system','maximagesize'); //6 * 1024 * 1024;
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
@@ -113,6 +148,7 @@ function js_upload_post_init(&$a,&$b) {
if(isset($result['error'])) {
logger('mod/photos.php: photos_post(): error uploading photo: ' . $result['error'] , 'LOGGER_DEBUG');
+ echo json_encode($result);
killme();
}
@@ -225,8 +261,6 @@ class qqFileUploader {
$this->allowedExtensions = $allowedExtensions;
$this->sizeLimit = $sizeLimit;
- $this->checkServerSettings();
-
if (isset($_GET['qqfile'])) {
$this->file = new qqUploadedFileXhr();
} elseif (isset($_FILES['qqfile'])) {
@@ -237,15 +271,6 @@ class qqFileUploader {
}
- private function checkServerSettings(){
- $postSize = $this->toBytes(ini_get('post_max_size'));
- $uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
- logger('mod/photos.php: qqFileUploader(): upload_max_filesize=' . $uploadSize , 'LOGGER_DEBUG');
- if ($postSize < $this->sizeLimit || $uploadSize < $this->sizeLimit){
- $size = max(1, $this->sizeLimit / 1024 / 1024) . 'M';
- die("{'error':'increase post_max_size and upload_max_filesize to $size'}");
- }
- }
private function toBytes($str){
$val = trim($str);