Example #1
0
/**
 * Returns a string representing the number of kilobytes in a human-readable format.
 * @param int $kb The number of kilobytes.
 * @param int $precision The number of values after the decimal.
 * @return string The number of kilobytes in a human-readable format.
 */
function human_readable_kb($kb, $precision = 0)
{
    return human_readable_bytes(intval($kb) * 1000, $precision);
}
Example #2
0
                    // now iterate and show the files in this release....
                    for ($f = 0; $f < $num_files; $f++) {
                        $file_release = db_fetch_array($res_file);
                        $cell_data = array();
                        $cell_data[] = array('<dd>
						' . util_make_link('/frs/download.php/' . $file_release['file_id'] . '/' . $file_release['filename'], $file_release['filename']), 'colspan=3');
                        $cell_data[] = array(human_readable_bytes($file_release['file_size']), 'align="right"');
                        $cell_data[] = array($file_release['downloads'] ? number_format($file_release['downloads'], 0) : '0', 'align="right"');
                        $cell_data[] = array($file_release['processor']);
                        $cell_data[] = array($file_release['type']);
                        if ($release_id) {
                            if ($release_id == $package_release['release_id']) {
                                print $GLOBALS['HTML']->multiTableRow($bgstyle, $cell_data, FALSE);
                            }
                        } else {
                            print $GLOBALS['HTML']->multiTableRow($bgstyle, $cell_data, FALSE);
                        }
                        $proj_stats['size'] += $file_release['file_size'];
                        @($proj_stats['downloads'] += $file_release['downloads']);
                    }
                }
            }
        }
    }
    if ($proj_stats['size']) {
        print '<tr><td colspan="8">&nbsp;</tr>' . "\n";
        print '<tr><td><strong>' . _('Project totals') . '</strong></td>' . '<td align="right"><strong><em>' . $proj_stats['releases'] . '</em></strong></td>' . '<td align="right"><strong><em>' . $proj_stats['files'] . '</em></strong></td>' . '<td align="right"><strong><em>' . human_readable_bytes($proj_stats['size']) . '</em></strong></td>' . '<td align="right"><strong><em>' . $proj_stats['downloads'] . '</em></strong></td>' . '<td colspan="3">&nbsp;</td></tr>' . "\n";
    }
    print "</table>\n\n";
}
frs_footer();