Commit 577323fa by Scott

Merge branch 'pr/522' into 1.8

parents 2b444785 ee21db69
...@@ -1206,7 +1206,7 @@ function qa_html_page_links($request, $start, $pagesize, $count, $prevnext, $par ...@@ -1206,7 +1206,7 @@ function qa_html_page_links($request, $start, $pagesize, $count, $prevnext, $par
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$thispage = 1 + floor($start / $pagesize); $thispage = 1 + floor($start / $pagesize);
$lastpage = ceil(min($count, 1 + QA_MAX_LIMIT_START) / $pagesize); $lastpage = ceil(min((int)$count, 1 + QA_MAX_LIMIT_START) / $pagesize);
if ($thispage > 1 || $lastpage > $thispage) { if ($thispage > 1 || $lastpage > $thispage) {
$links = array('label' => qa_lang_html('main/page_label'), 'items' => array()); $links = array('label' => qa_lang_html('main/page_label'), 'items' => array());
......
...@@ -98,7 +98,7 @@ function qa_upload_file($localfilename, $sourcefilename, $maxfilesize = null, $o ...@@ -98,7 +98,7 @@ function qa_upload_file($localfilename, $sourcefilename, $maxfilesize = null, $o
$maxfilesize = qa_get_max_upload_size(); $maxfilesize = qa_get_max_upload_size();
if ($filesize <= 0 || $filesize > $maxfilesize) { // if file was too big for PHP, $filesize will be zero if ($filesize <= 0 || $filesize > $maxfilesize) { // if file was too big for PHP, $filesize will be zero
$result['error'] = qa_lang_sub('main/max_upload_size_x', qa_format_number($maxfilesize / 1048576, 1) . 'MB'); $result['error'] = qa_lang_sub('main/max_upload_size_x', qa_format_number($maxfilesize / pow(1024, 2), 1) . 'MB');
return $result; return $result;
} }
......
...@@ -1284,11 +1284,13 @@ function qa_post_limit_exceeded() ...@@ -1284,11 +1284,13 @@ function qa_post_limit_exceeded()
*/ */
function convert_to_bytes($unit, $value) function convert_to_bytes($unit, $value)
{ {
$value = (int) $value;
switch (strtolower($unit)) { switch (strtolower($unit)) {
case 'g': case 'g':
return $value * 1073741824; return $value * pow(1024, 3);
case 'm': case 'm':
return $value * 1048576; return $value * pow(1024, 2);
case 'k': case 'k':
return $value * 1024; return $value * 1024;
default: default:
......
...@@ -113,9 +113,9 @@ class qa_wysiwyg_editor ...@@ -113,9 +113,9 @@ class qa_wysiwyg_editor
array( array(
'id' => 'wysiwyg_editor_upload_max_size_display', 'id' => 'wysiwyg_editor_upload_max_size_display',
'label' => 'Maximum size of uploads:', 'label' => 'Maximum size of uploads:',
'suffix' => 'MB (max '.qa_html(qa_format_number($this->bytes_to_mega(qa_get_max_upload_size()))).')', 'suffix' => 'MB (max '.qa_html(number_format($this->bytes_to_mega(qa_get_max_upload_size()), 1)).')',
'type' => 'number', 'type' => 'number',
'value' => qa_html(number_format($this->bytes_to_mega(qa_opt('wysiwyg_editor_upload_max_size')))), 'value' => qa_html(number_format($this->bytes_to_mega(qa_opt('wysiwyg_editor_upload_max_size')), 1)),
'tags' => 'name="wysiwyg_editor_upload_max_size_field"', 'tags' => 'name="wysiwyg_editor_upload_max_size_field"',
), ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment