示例#1
0
function showReport($tab)
{
    echo '<div id="report_' . $tab[id] . '" class="report">' . "\n";
    echo "<h1>Report #" . $tab[id] . "</h1>\n";
    echo '<div id="summary_' . $tab[id] . '" class="summary">';
    echo '<table>';
    summaryLine("Report #", $tab[id]);
    $added = '';
    if (intval($tab[added_date]) > 0) {
        $added = date('d/M/Y G:i:s', intval($tab[added_date]));
    } else {
        $added = "Date unknown";
    }
    summaryLine("Added", $added);
    $status = "";
    if (intval($tab['status']) == STATE_FIXED) {
        $status = 'fixed';
    } else {
        $status = 'new';
    }
    summaryLine("Status", $status);
    summaryLine("Report ID", $tab['report_id']);
    summaryLine("Issue ID", $tab['issue_id']);
    $device = $tab['brand'] . ' ' . $tab['phone_model'] . ' (' . $tab['product'] . ')' . " Running Android " . $tab['android_version'];
    summaryLine("Device", $device);
    summaryLine("Package", $tab['package_name']);
    $version = $tab['app_version_name'] . ' (' . $tab['app_version_code'] . ')';
    summaryLine("Version", $version);
    summaryLine("File Path", $tab['file_path']);
    summaryLine("Total Mem", intval(intval($tab['total_mem_size']) / 1024 / 1024) . "M");
    summaryLine("Available Mem", intval(intval($tab['available_mem_size']) / 1024 / 1024) . "M");
    summaryLine("User App Start Date", $tab['user_app_start_date']);
    summaryLine("User Crash Date", $tab['user_crash_date']);
    summaryLine("Is Silent", $tab['is_silent']);
    summaryLine("Device Id", $tab['device_id']);
    summaryLine("Installation Id", $tab['installation_id']);
    summaryLine("User Email", $tab['user_email']);
    echo '</table>';
    echo "</div>";
    echo "<div id='details_" . $tab['id'] . "' style='float:right; width:70%'>";
    echo '<div class="tab-container ui-tabs" id="details_header_"' . $tab['id'] . "'>";
    echo '<ul class="nav ui-tabs-nav">';
    detailsLink($tab, 'stack_trace', 'Overview', 'overview');
    detailsLink($tab, 'stack_trace', 'Stack Trace');
    detailsLink($tab, 'custom_data', 'Custom Data');
    detailsLink($tab, 'build', 'Build');
    detailsLink($tab, 'initial_configuration', 'Initial Config');
    detailsLink($tab, 'crash_config', 'Crash Config');
    detailsLink($tab, 'display', 'Display');
    detailsLink($tab, 'user_comment', 'User Comment');
    detailsLink($tab, 'dumpsys_meminfo', 'Dumpsys Meminfo');
    detailsLink($tab, 'dropbox', 'Dropbox');
    detailsLink($tab, 'logcat', 'Logcat');
    detailsLink($tab, 'eventslog', 'Events Log');
    detailsLink($tab, 'radiolog', 'Radio Log');
    detailsLink($tab, 'device_features', 'Device Features');
    detailsLink($tab, 'environment', 'Environment');
    detailsLink($tab, 'settings_system', 'System Settings');
    detailsLink($tab, 'settings_secure', 'Secure Settings');
    detailsLink($tab, 'shared_preferences', 'Shared Preferences');
    echo '</ul>';
    echo "</div>";
    echo "<div id='details_content_" . $tab['id'] . "'><pre>";
    echo str_replace("<li></li>", "", "<ul><li>" . str_replace("<br />", "</li><li>", bicou_stack_trace_overview($tab[stack_trace], null)) . "</li></ul>");
    echo "</pre></div>";
    echo "</div>\n";
    echo "</div>\n";
}
示例#2
0
 * Copyright 2013 Benoit Duffez
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
include "crashes.php";
include "mysql.php";
$field = $_GET[field] == 'overview' ? "stack_trace" : $_GET[field];
// Display reports
$sql = bicou_mysql_select(array($field), "crashes", "id = ?", array($_GET[id]), null, null, "0, 100");
$res = mysql_query($sql);
if (!$res) {
    bicou_log("Unable to query: {$sql}");
    echo "<p>Server error.</p>\n";
    return;
}
$tab = mysql_fetch_assoc($res);
if ($_GET[field] == 'overview') {
    $tab[$field] = "<ul><li>" . str_replace("<br />", "</li><li>", bicou_stack_trace_overview($tab[$field], null)) . "</li></ul>";
    $tab[$field] = str_replace("<li></li>", "", $tab[$field]);
}
echo '<pre>' . $tab[$field] . '</pre>';
示例#3
0
function display_crashes($status)
{
    global $_GET;
    $columns = array();
    $columns[] = 'MAX(added_date) as last_seen';
    $columns[] = 'COUNT(issue_id) as nb_errors';
    $columns[] = issue_id;
    if (!$_GET['v']) {
        $columns[] = 'MAX(app_version_code) as version_code';
    }
    $columns[] = 'MAX(app_version_name) as version_name';
    $columns[] = 'package_name';
    $columns[] = 'phone_model';
    $columns[] = 'android_version';
    $columns[] = 'stack_trace';
    $sel = "status = ?";
    $selA = array($status);
    // Filter by package
    if (!empty($_GET['package'])) {
        $sel .= " AND package_name LIKE ?";
        $selA[] = $_GET['package'];
    }
    // Filter by app version code
    if (!empty($_GET['v'])) {
        $sel .= " AND app_version_code = ?";
        $selA[] = mysql_real_escape_string($_GET['v']);
    }
    // Search
    if ($_GET[q] != '') {
        $args = explode(" ", $_GET[q]);
        foreach ($args as $arg) {
            if ($arg[0] == "-") {
                $sel .= " AND phone_model NOT LIKE '%?%'";
                $selA[] = substr($arg, 1);
            } else {
                $sel .= " AND phone_model LIKE '%?%'";
                $selA[] = $arg;
            }
        }
    }
    $order = array();
    if ($_GET['v']) {
        $order[] = "nb_errors DESC";
    }
    if ($_GET['start']) {
        $start = $_GET['start'];
    } else {
        $start = 0;
    }
    if (!$_GET['v']) {
        $order[] = "version_code DESC";
    }
    $order[] = "last_seen DESC";
    $tables = "crashes";
    $sql = bicou_mysql_select($columns, $tables, $sel, $selA, implode(", ", $order), "issue_id", "{$start}, 50");
    $res = mysql_query($sql);
    if (!$res) {
        bicou_log("Unable to query: {$sql}");
        echo "<p>Server error: " . mysql_error() . "</p>\n";
        echo "<p>SQL: {$sql}</p>";
        return;
    } else {
        if (mysql_num_rows($res) == 0) {
            echo "<p>No result for this query.</p>\n";
            return;
        }
    }
    echo "<h1>" . status_name($status) . " reports (" . mysql_num_rows($res) . ")</h1>\n";
    if ($_GET[q] != '') {
        echo "<p>Filtered with phone_model matching '{$_GET['q']}'</p>\n";
    }
    $first = 1;
    echo "<table class=\"crashes\">\n";
    while ($tab = mysql_fetch_assoc($res)) {
        // Display table header
        if ($first == 1) {
            echo "<thead>\n<tr><th>&nbsp;</th>\n";
            foreach ($tab as $k => $v) {
                if ($k == "stack_trace") {
                    $k = "exception";
                } else {
                    if ($k == "issue_id") {
                        continue;
                    }
                }
                echo "<th>{$k}</th>\n";
            }
            $first = 0;
            echo "</tr>\n</thead>\n<tbody>\n";
        }
        // Display table contents
        echo "<tr id=\"id_" . $tab['id'] . "\">\n<td><a href=\"" . APP_PACKAGE_URI . "/issue/" . $tab['issue_id'] . "\">VIEW</a></td>\n";
        foreach ($tab as $k => $v) {
            if ($k == "stack_trace") {
                $errors = "<pre><ul><li>" . str_replace("<br />", "</li><li>", bicou_stack_trace_overview($v, $_GET['package'])) . "</li></ul></pre>\n";
                $value = str_replace("<li></li>", "", $errors);
            } else {
                if ($k == "last_seen") {
                    $value = date("d/M/Y G:i:s", $v);
                } else {
                    if ($k == "status") {
                        $value = status_name($tab['status']);
                    } else {
                        if ($k == "version_code") {
                            if ($_GET['v']) {
                                $value = "N/A";
                            } else {
                                $c = array('app_version_code', 'count(app_version_code) as nb');
                                $sl = "issue_id = '?'";
                                $slA = array($tab['issue_id']);
                                $s = bicou_mysql_select($c, "crashes", $sl, $slA, 'nb DESC', 'app_version_code');
                                $r = mysql_query($s);
                                $js = "\$(document).ready(function(){\n" . "\tvar data = [\t";
                                $value = "";
                                while ($t = mysql_fetch_assoc($r)) {
                                    if (strlen($value)) {
                                        $js .= ", ";
                                    }
                                    $js .= "['V: " . $t['app_version_code'] . "', " . $t[nb] . "]";
                                    $value .= '<b title="' . $t[nb] . ' occurrences">' . $t['app_version_code'] . "</b> (" . sprintf("%.1f%%", 100.0 * $t[nb] / $tab[nb_errors]) . ")<br />";
                                }
                                $js .= "\t ];\n" . "\tvar plot_" . $tab['issue_id'] . " = jQuery.jqplot ('chartdiv_" . $tab['issue_id'] . "', [data], \n" . "\t      { \n" . "\t\tseriesDefaults: {\n" . "\t\t      renderer: jQuery.jqplot.PieRenderer, \n" . "\t\t      rendererOptions: {\n" . "\t\t\tshowDataLabels: true\n" . "\t\t      }\n" . "\t\t}, \n" . "\t      }\n" . "\t);\n" . "      });\n";
                                $value .= '<div id="chartdiv_' . $tab['issue_id'] . '" style="height:200px;width:200px; "></div>';
                                $value .= '<script>' . $js . '</script>';
                            }
                        } else {
                            if ($k == "TODO") {
                            } else {
                                if ($k == "issue_id") {
                                    continue;
                                } else {
                                    $value = $v;
                                }
                            }
                        }
                    }
                }
            }
            $style = $k != "stack_trace" ? ' style="text-align: center;"' : "";
            // Display the row
            if (0 && strstr($value, "\n") !== FALSE) {
                $value = "<textarea>{$value}</textarea>";
            }
            echo "<td{$style}>{$value}</td>\n";
        }
        echo "</tr>\n";
    }
    echo "</tbody></table>\n";
}