jDownloads Support Forum

Older Versions => jDownloads 3.2 (Support ended) => Bugs => Topic started by: ColinM on 20.06.2016 18:59:28

Title: Control Panel Status is incorrect for large numbers - [Fixed in 3.2.45]
Post by: ColinM on 20.06.2016 18:59:28
There is also a small problem with the number of Downloads reported in a status panel when there are a high number of downloads.  For example if there are say 26,143 it reports just 26.  The (int) cast, which is used in the code, will terminate at the comma so 26,143 will be returned as 26.  The intval() function gives the same problem.

See http://www.jdownloads.com/forum/index.php?topic=8953.0 for example

File \com_jdownloads\admin\views\jdownloads\tmpl\default.php has code in lines 161 to 183 such as
  <?php echo (int)$stats_data['files_public'];?>
This could be replaced with code such as
<?php $temp str_replace',''',$stats_data['files_public']);
  echo (int)
$temp;?>

If there is a possibility of multiple characters due to language differences then
  <?php $temp str_replace(array('.'','), '',$stats_data['files_public']);
  echo (int)
$temp;?>

 
  Each of the above could be combined into a one line statement.
I have not tested the above as I have insufficient downloads!!
Title: Re: Control Panel Status is incorrect for large numbers
Post by: Arno on 03.07.2016 13:32:12
Colin,
thanks for this info. Maybe could help also floatval(). I will check and fix it.
Title: Re: Control Panel Status is incorrect for large numbers
Post by: ColinM on 03.07.2016 16:36:47
Arno
Just discovered a php function numfmt_parse which might also be worth checking out. See
http://man.hubwiz.com/docset/PHP.docset/Contents/Resources/Documents/php.net/manual/en/numberformatter.parse.html
Useage is to set up format using the language code and then it sorts it out.
Colin
PS there is also a currency based one numfmt_parse_currency
Title: Re: Control Panel Status is incorrect for large numbers
Post by: Arno on 04.07.2016 10:44:15
Hi Colin,
thanks for the link but i have this bug already fixed.
I have removed the compute parts in the default.php and also the (int).  ;)