fix getting bytes from shorthand in php
This commit is contained in:
parent
721c065a44
commit
39f7660a1d
|
@ -1141,9 +1141,7 @@ function photos_content(App $a)
|
|||
'$qcomment' => $qcomment,
|
||||
'$rand_num' => Crypto::randomDigits(12),
|
||||
// Dropzone
|
||||
//'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
// Strings::getBytresFromShorthand not working, so just workaround in template and serve the bare value
|
||||
'$max_imagesize' => DI::config()->get('system', 'maximagesize'),
|
||||
'$max_imagesize' => floor(Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')) / 1000000),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -1200,9 +1198,7 @@ function photos_content(App $a)
|
|||
'$qcomment' => $qcomment,
|
||||
'$rand_num' => Crypto::randomDigits(12),
|
||||
// Dropzone
|
||||
//'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
// Strings::getBytresFromShorthand not working, so just workaround in template and serve the bare value
|
||||
'$max_imagesize' => DI::config()->get('system', 'maximagesize'),
|
||||
'$max_imagesize' => floor(Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')) / 1000000),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -1278,9 +1274,7 @@ function photos_content(App $a)
|
|||
'$qcomment' => $qcomment,
|
||||
'$rand_num' => Crypto::randomDigits(12),
|
||||
// Dropzone
|
||||
//'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
// Strings::getBytresFromShorthand not working, so just workaround in template and serve the bare value
|
||||
'$max_imagesize' => DI::config()->get('system', 'maximagesize'),
|
||||
'$max_imagesize' => floor(Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')) / 1000000),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -411,9 +411,7 @@ class Conversation
|
|||
'$always_open_compose' => $this->pConfig->get($this->session->getLocalUserId(), 'frio', 'always_open_compose', false),
|
||||
|
||||
// Dropzone
|
||||
//'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
// Strings::getBytresFromShorthand not working, so just workaround in template and serve the bare value
|
||||
'$max_imagesize' => DI::config()->get('system', 'maximagesize'),
|
||||
'$max_imagesize' => floor(\Friendica\Util\Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')) / 1000000),
|
||||
|
||||
]);
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ class Compose extends BaseModule
|
|||
]),
|
||||
|
||||
// Dropzone
|
||||
'$max_imagesize' => DI::config()->get('system', 'maximagesize')
|
||||
'$max_imagesize' => floor(Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')) / 1000000),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,13 +184,10 @@ class Edit extends BaseModule
|
|||
'$shortpermset' => $this->t('Permissions'),
|
||||
|
||||
'$compose_link_title' => $this->t('Open Compose page'),
|
||||
// Dropzone
|
||||
//'$max_imagesize' => \Friendica\\Util\\Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
//'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
// both not working, so just workaround in template and serve the bare value
|
||||
'$max_imagesize' => DI::config()->get('system', 'maximagesize'),
|
||||
]);
|
||||
|
||||
// Dropzone
|
||||
'$max_imagesize' => floor(Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')) / 1000000),
|
||||
]);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
@ -1070,9 +1070,7 @@ class Post
|
|||
'$indent' => $indent,
|
||||
'$rand_num' => Crypto::randomDigits(12),
|
||||
// Dropzone
|
||||
//'$max_imagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
// Strings::getBytresFromShorthand not working, so just workaround in template and serve the bare value
|
||||
'$max_imagesize' => DI::config()->get('system', 'maximagesize'),
|
||||
'$max_imagesize' => floor(\Friendica\Util\Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')) / 1000000),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,29 +96,27 @@
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// getMByte() is from view/theme/frio/js/dropzone-frio.js
|
||||
// to workaround dysfunctional php Strings:getBytesFromShorthand
|
||||
Dropzone.autoDiscover = false;
|
||||
var dropzoneCompose = new Dropzone( '#dropzone-{{$id}}', {
|
||||
paramName: "userfile", // The name that will be used to transfer the file
|
||||
maxFilesize: getMBytes('{{$max_imagesize}}'), // MB
|
||||
url: "/media/photo/upload?response=url&album=",
|
||||
paramName: 'userfile', // The name that will be used to transfer the file
|
||||
maxFilesize: {{$max_imagesize}}, // MB
|
||||
url: '/media/photo/upload?response=url&album=',
|
||||
accept: function(file, done) {
|
||||
done();
|
||||
},
|
||||
init: function() {
|
||||
this.on("success", function(file, serverResponse) {
|
||||
this.on('success', function(file, serverResponse) {
|
||||
var target = $('#comment-edit-text-{{$id}}')
|
||||
var resp = $(serverResponse).find('div#content').text()
|
||||
if (target.setRangeText) {
|
||||
//if setRangeText function is supported by current browser
|
||||
target.setRangeText(" " + $.trim(resp) + " ")
|
||||
target.setRangeText(' ' + $.trim(resp) + ' ')
|
||||
} else {
|
||||
target.focus()
|
||||
document.execCommand('insertText', false /*no UI*/, $.trim(resp));
|
||||
}
|
||||
});
|
||||
this.on("complete", function(file) {
|
||||
this.on('complete', function(file) {
|
||||
// Remove just uploaded file from dropzone, makes interface more clear.
|
||||
// Image can be seen in posting-preview
|
||||
// We need preview to get optical feedback about upload-progress.
|
||||
|
|
|
@ -294,25 +294,25 @@ function editpost(url) {
|
|||
// To make dropzone fileupload work on editing a comment, we need to
|
||||
// attach a new dropzone to modal
|
||||
dropzoneJotEdit = new Dropzone( '#jot-text-wrap', {
|
||||
paramName: "userfile", // The name that will be used to transfer the file
|
||||
maxFilesize: getMBytes('{{$max_imagesize}}'), // MB
|
||||
url: "/media/photo/upload?response=url&album=",
|
||||
paramName: 'userfile', // The name that will be used to transfer the file
|
||||
maxFilesize: '{{$max_imagesize}}', // MB
|
||||
url: '/media/photo/upload?response=url&album=',
|
||||
accept: function(file, done) {
|
||||
done();
|
||||
},
|
||||
init: function() {
|
||||
this.on("success", function(file, serverResponse) {
|
||||
this.on('success', function(file, serverResponse) {
|
||||
var target = $('#profile-jot-text')
|
||||
var resp = $(serverResponse).find('div#content').text()
|
||||
if (target.setRangeText) {
|
||||
//if setRangeText function is supported by current browser
|
||||
target.setRangeText(" " + $.trim(resp) + " ")
|
||||
target.setRangeText(' ' + $.trim(resp) + ' ')
|
||||
} else {
|
||||
target.focus()
|
||||
document.execCommand('insertText', false /*no UI*/, " " + $.trim(resp) + " ");
|
||||
document.execCommand('insertText', false /*no UI*/, ' ' + $.trim(resp) + ' ');
|
||||
}
|
||||
});
|
||||
this.on("complete", function(file) {
|
||||
this.on('complete', function(file) {
|
||||
// Remove just uploaded file from dropzone, makes interface more clear.
|
||||
// Image can be seen in posting-preview
|
||||
// We need preview to get optical feedback about upload-progress.
|
||||
|
|
|
@ -66,29 +66,27 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
// getMByte() is from view/theme/frio/js/dropzone-frio.js
|
||||
// to workaround dysfunctional php Strings:getBytesFromShorthand
|
||||
Dropzone.autoDiscover = false;
|
||||
var dropzone{{$id}} = new Dropzone( '#dropzone-{{$id}}', {
|
||||
paramName: "userfile", // The name that will be used to transfer the file
|
||||
maxFilesize: getMBytes('{{$max_imagesize}}'), // MB
|
||||
url: "/media/photo/upload?response=url&album=",
|
||||
paramName: 'userfile', // The name that will be used to transfer the file
|
||||
maxFilesize: {{$max_imagesize}}, // MB
|
||||
url: '/media/photo/upload?response=url&album=',
|
||||
accept: function(file, done) {
|
||||
done();
|
||||
},
|
||||
init: function() {
|
||||
this.on("success", function(file, serverResponse) {
|
||||
this.on('success', function(file, serverResponse) {
|
||||
var target = $('#comment-edit-text-{{$id}}')
|
||||
var resp = $(serverResponse).find('div#content').text()
|
||||
if (target.setRangeText) {
|
||||
//if setRangeText function is supported by current browser
|
||||
target.setRangeText(" " + $.trim(resp) + " ")
|
||||
target.setRangeText(' ' + $.trim(resp) + ' ')
|
||||
} else {
|
||||
target.focus()
|
||||
document.execCommand('insertText', false /*no UI*/, " " + $.trim(resp) + " ");
|
||||
document.execCommand('insertText', false /*no UI*/, ' ' + $.trim(resp) + ' ');
|
||||
}
|
||||
});
|
||||
this.on("complete", function(file) {
|
||||
this.on('complete', function(file) {
|
||||
// Remove just uploaded file from dropzone, makes interface more clear.
|
||||
// Image can be seen in posting-preview
|
||||
// We need preview to get optical feedback about upload-progress.
|
||||
|
|
|
@ -140,7 +140,6 @@
|
|||
{{/if}}
|
||||
<script type="text/javascript" src="view/theme/frio/js/textedit.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
|
||||
<script type="text/javascript" src="vendor/enyo/dropzone/dist/min/dropzone.min.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
|
||||
<script type="text/javascript" src="view/theme/frio/js/dropzone-frio.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
|
||||
|
||||
{{* Include the strings which are needed for some js functions (e.g. translation)
|
||||
They are loaded into the html <head> so that js functions can use them *}}
|
||||
|
|
|
@ -182,29 +182,27 @@ can load different content into the jot modal (e.g. the item edit jot)
|
|||
</script>
|
||||
|
||||
<script>
|
||||
// getMByte() is from view/theme/frio/js/dropzone-frio.js
|
||||
// to workaround dysfunctional php Strings:getBytesFromShorthand
|
||||
Dropzone.autoDiscover = false;
|
||||
var dropzoneJot = new Dropzone( '#jot-text-wrap', {
|
||||
paramName: "userfile", // The name that will be used to transfer the file
|
||||
maxFilesize: getMBytes('{{$max_imagesize}}'), // MB
|
||||
url: "/media/photo/upload?response=url&album=",
|
||||
paramName: 'userfile', // The name that will be used to transfer the file
|
||||
maxFilesize: {{$max_imagesize}}, // MB
|
||||
url: '/media/photo/upload?response=url&album=',
|
||||
accept: function(file, done) {
|
||||
done();
|
||||
},
|
||||
init: function() {
|
||||
this.on("success", function(file, serverResponse) {
|
||||
this.on('success', function(file, serverResponse) {
|
||||
var target = $('#profile-jot-text')
|
||||
var resp = $(serverResponse).find('div#content').text()
|
||||
if (target.setRangeText) {
|
||||
//if setRangeText function is supported by current browser
|
||||
target.setRangeText(" " + $.trim(resp) + " ")
|
||||
target.setRangeText(' ' + $.trim(resp) + ' ')
|
||||
} else {
|
||||
target.focus()
|
||||
document.execCommand('insertText', false /*no UI*/, " " + $.trim(resp) + " ");
|
||||
document.execCommand('insertText', false /*no UI*/, ' ' + $.trim(resp) + ' ');
|
||||
}
|
||||
});
|
||||
this.on("complete", function(file) {
|
||||
this.on('complete', function(file) {
|
||||
// Remove just uploaded file from dropzone, makes interface more clear.
|
||||
// Image can be seen in posting-preview
|
||||
// We need preview to get optical feedback about upload-progress.
|
||||
|
|
Loading…
Reference in a new issue