'Closed',
'Open' => 'Open',
'Critical' => 'Crit',
'Verified' => 'Verified',
'Analyzed' => 'Analyzed',
'Assigned' => 'Assigned',
'Feedback' => 'Fdbk',
'No Feedback' => 'No Fdbk',
'Suspended' => 'Susp',
'Not a bug' => 'Not a bug',
'Duplicate' => 'Dupe',
'Wont fix' => 'Wont Fix',
];
$rev = isset($_GET['rev']) ? $_GET['rev'] : 1;
$sort_by = isset($_GET['sort_by']) ? $_GET['sort_by'] : 'Open';
$total = 0;
$row = [];
$pkg = [];
$pkg_tmp = [];
$pkg_total = [];
$pkg_names = [];
$all = [];
$pseudo = true;
if (!array_key_exists($sort_by, $titles)) {
$sort_by = 'Open';
}
$bug_type = $_GET['bug_type'] ?? 'All';
$bugRepository = $container->get(BugRepository::class);
foreach ($bugRepository->findAllByBugType($bug_type) as $row) {
$pkg_tmp[$row['status']][$row['package_name']] = $row['quant'];
@$pkg_total[$row['package_name']] += $row['quant'];
@$all[$row['status']] += $row['quant'];
@$total += $row['quant'];
$pkg_names[$row['package_name']] = 0;
}
if (count($pkg_tmp)) {
foreach ($titles as $key => $val) {
if (isset($pkg_tmp[$key]) && is_array($pkg_tmp[$key])) {
$pkg[$key] = array_merge($pkg_names, $pkg_tmp[$key]);
} else {
$pkg[$key] = $pkg_names;
}
}
}
if ($total > 0) {
if ($rev == 1) {
arsort($pkg[$sort_by]);
} else {
asort($pkg[$sort_by]);
}
}
?>
' . "\n";
response_footer();
exit;
}
echo display_stat_header($total, true);
echo <<< OUTPUT
All |
{$total} |
OUTPUT;
$i = 1;
foreach ($titles as $key => $val) {
echo ' ';
echo bugstats($key, 'all') , " | \n";
}
echo "
\n";
$stat_row = 1;
foreach ($pkg[$sort_by] as $name => $value) {
if ($name != 'all') {
// Output a new header row every 40 lines
if (($stat_row++ % 40) == 0) {
echo display_stat_header($total, false);
}
echo <<< OUTPUT
{$name} |
{$pkg_total[$name]} |
OUTPUT;
$i = 1;
foreach ($titles as $key => $val) {
echo ' ';
echo bugstats($key, $name), " | \n";
}
echo "
\n";
}
}
echo "\n
\nPHP Versions for recent bug reports:
";
echo '';
$last_date = null;
foreach ($bugRepository->findPhpVersions($bug_type) as $row) {
if ($row['d'] != $last_date) {
if ($last_date !== null) {
echo "\n\n";
}
echo "
\n".
"\n";
$last_date = $row['d'];
}
$version = htmlentities($row["formatted_version"], ENT_QUOTES, 'UTF-8');
echo "{$version} | {$row["quant"]} |
\n";
}
if ($last_date) {
echo "
\n";
}
echo "
\n";
response_footer();
// Helper functions
function bugstats($status, $name)
{
global $pkg, $all, $bug_type;
if ($name == 'all') {
if (isset($all[$status])) {
return '' .
$all[$status] . "\n";
}
} else {
if (empty($pkg[$status][$name])) {
return ' ';
} else {
return '' .
$pkg[$status][$name] . "\n";
}
}
}
function sort_url($name)
{
global $sort_by, $rev, $titles;
if ($name == $sort_by) {
$reve = (int) !$rev;
} else {
$reve = 1;
}
if ($sort_by != $name) {
$attr = 'class="bug_stats"';
} else {
$attr = 'class="bug_stats_choosen"';
}
return '' .
$titles[$name] . '';
}
function display_stat_header($total, $grandtotal = true)
{
global $titles;
$stat_head = " ' . "\n";
return $stat_head;
}