зеркало из https://github.com/mozilla/pjs.git
A whole lotta changin' goin' on...
- make configs consistant (app_url and app_path weren't making sense) - move includes out of /app since it's used by more than just /app - documentation on contrib classes needed - implement templating engine - fix spacing through all code - some css changes to improve our looks (slightly) - escape login variables - Custom Column Queries - Fix Pagination when using custom queries, or aggregate view - Only query for total records if we the data set is full (>= $_GET['show']). Pointless to figure how how many pages when we know we don't fill the first. - truncate all columns at 100 characters in query view so pages don't span to far - truncate all url's in report view over 100 chars in length - Statistics (initial landing) - Don't use cache-control to prevent slowness (bug 296670) - Slightly revised css theming - Add schema - Rename config to config-default
This commit is contained in:
Родитель
fa3568186a
Коммит
2751eca195
|
@ -37,151 +37,47 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
require_once('../config.inc.php');
|
||||
require_once($config['app_path'].'/includes/security.inc.php');
|
||||
require_once($config['app_path'].'/includes/iolib.inc.php');
|
||||
require_once($config['base_path'].'/includes/security.inc.php');
|
||||
require_once($config['base_path'].'/includes/iolib.inc.php');
|
||||
require_once($config['base_path'].'/includes/contrib/smarty/libs/Smarty.class.php');
|
||||
|
||||
// Start Session
|
||||
session_name('reportSessID');
|
||||
session_start();
|
||||
header("Cache-control: private"); //IE 6 Fix
|
||||
printheaders();
|
||||
|
||||
include($config['app_path'].'/includes/header.inc.php');
|
||||
include($config['app_path'].'/includes/message.inc.php');
|
||||
$content = initializeTemplate();
|
||||
$content->assign('report_description', $_GET['report_description']);
|
||||
$content->assign('report_useragent', $_GET['report_useragent']);
|
||||
$content->assign('report_gecko', $_GET['report_gecko']);
|
||||
$content->assign('report_language', $_GET['report_language']);
|
||||
$content->assign('report_platform', $_GET['report_platform']);
|
||||
$content->assign('report_oscpu', $_GET['report_oscpu']);
|
||||
$content->assign('report_product', $_GET['report_product']);
|
||||
$content->assign('report_file_date_start', $_GET['report_file_date_start']);
|
||||
$content->assign('report_file_date_end', $_GET['report_file_date_end']);
|
||||
$content->assign('show', $_GET['show']);
|
||||
$content->assign('count', $_GET['count']);
|
||||
$content->assign('host_hostname', $_GET['host_hostname']);
|
||||
$content->assign('report_problem_type', $_GET['report_problem_type']);
|
||||
$content->assign('report_behind_login', $_GET['report_behind_login']);
|
||||
$content->assign('products', $products);
|
||||
$content->assign('problem_types', $problemTypes);
|
||||
|
||||
// Remove fields that you can't manually select
|
||||
foreach ($config['unselectablefields'] as $unselectableChild){
|
||||
unset($config['fields'][$unselectableChild]);
|
||||
}
|
||||
|
||||
$content->assign('selected_options', $config['fields']);
|
||||
if ($_GET['selected']){
|
||||
$content->assign('selected', $_GET['selected']);
|
||||
}
|
||||
else {
|
||||
$content->assign('selected', array('report_id', 'host_hostname'));
|
||||
}
|
||||
|
||||
|
||||
displayPage($content, 'index.tpl');
|
||||
?>
|
||||
|
||||
<fieldset>
|
||||
<legend>Look up Report</legend>
|
||||
<form method="get" action ="<?php print $config['self']; ?>report/" ID="Form1">
|
||||
<label for="report_id">Report ID</label>
|
||||
<input type="text" id="report_id" name="report_id" />
|
||||
|
||||
<input type="submit" id="submit_reportID" name="submit_reportID" value="Lookup Report" />
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
<!-- Query -->
|
||||
<fieldset>
|
||||
<legend>Search for a Report</legend>
|
||||
<form method="get" action="<?php print $config['self']; ?>query/">
|
||||
<table id="queryTable">
|
||||
<tr>
|
||||
<td class="label"><label for="report_description">Description:</label></td>
|
||||
<td><input id="report_description" name="report_description" type="text" size="35" value="<?php print $_GET['report_description']; ?>"></td>
|
||||
<td rowspan="4">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="label"><label for="report_useragent">User Agent:</label></td>
|
||||
<td><input id="report_useragent" name="report_useragent" type="text" size="35" value="<?php print $_GET['report_useragent']; ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_gecko">Gecko Version:</label></td>
|
||||
<td><input id="report_gecko" name="report_gecko" type="text" value="<?php print $_GET['report_gecko']; ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_language">Language (ex. en-US):</label></td>
|
||||
<td><input id="report_language" name="report_language" type="text" value="<?php print $_GET['report_language']; ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_platform">Platform:</label></td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="report_platform" id="AllPlatforms" value="" <?php if ($_GET['report_platform'] == '') { ?>checked="true"<?php } ?>><label for="AllPlatforms">All</label><br>
|
||||
<input type="radio" name="report_platform" id="Win32" value="Win32" <?php if ($_GET['report_platform'] == 'Win32') { ?>checked="true"<?php } ?>><label for="Win32">Windows (32)</label><br>
|
||||
<input type="radio" name="report_platform" id="Windows" value="Windows" <?php if ($_GET['report_platform'] == 'Windows') { ?>checked="true"<?php } ?>><label for="Windows">Windows (64 Bit)</label><br>
|
||||
<input type="radio" name="report_platform" id="MacPPC" value="MacPPC" <?php if ($_GET['report_platform'] == 'MacPPC') { ?>checked="true"<?php } ?>><label for="MacPPC">MacOS X</label><br>
|
||||
<input type="radio" name="report_platform" id="X11" value="X11" <?php if ($_GET['report_platform'] == 'X11') { ?>checked="true"<?php } ?>><label for="X11">X11</label><br>
|
||||
</td><td>
|
||||
<input type="radio" name="report_platform" id="OS2" value="OS/2" <?php if ($_GET['report_platform'] == 'OS/2') { ?>checked="true"<?php } ?>><label for="OS2">OS/2</label><br>
|
||||
<input type="radio" name="report_platform" id="Photon" value="Photon" <?php if ($_GET['report_platform'] == 'Photon') { ?>checked="true"<?php } ?>><label for="Photon">Photon</label><br>
|
||||
<input type="radio" name="report_platform" id="BeOS" value="BeOS" <?php if ($_GET['report_platform'] == 'BeOS') { ?>checked="true"<?php } ?>><label for="BeOS">BeOS</label><br>
|
||||
<input type="radio" name="report_platform" id="unknown" value="?" <?php if ($_GET['report_platform'] == '?') { ?>checked="true"<?php } ?>><label for="unknown">unknown</label><br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_oscpu" title="oscpu">OS:</td>
|
||||
<td><input id="report_oscpu" name="report_oscpu" type="text" size="35" value="<?php print $_GET['report_oscpu']; ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_product">Product:</label></td>
|
||||
<td>
|
||||
<select name="report_product" id="report_product">
|
||||
<option value="-1">Any</option>
|
||||
<?php foreach ($config['products'] as $product){ ?>
|
||||
<option value="<?php print $product['id']; ?>" <?php if ($_GET['report_product'] == $product['id']) { ?>selected="true"<?php } ?>><?php print $product['title']; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_file_date_start">File Date starts:</label></td>
|
||||
<td><input id="report_file_date_start" name="report_file_date_start" value="<?php if ($_GET['report_file_date_start']){ print $_GET['report_file_date_start']; } else { ?>YYYY-MM-DD<?php } ?>" onfocus="if(this.value=='YYYY-MM-DD'){this.value=''}" type="text"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_file_date_end">ends:</label></td>
|
||||
<td><input id="report_file_date_end" name="report_file_date_end" value="<?php if ($_GET['report_file_date_end']){ print $_GET['report_file_date_end']; } else { ?>YYYY-MM-DD<?php } ?>" onfocus="if(this.value=='YYYY-MM-DD'){this.value=''}" type="text"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="show">Results Per Page:</label></td>
|
||||
<td><input id="show" name="show" value="<?php if ($_GET['show']){ print $_GET['show']; } else { ?>25<?php } ?>" onfocus="if(this.value=='YYYY-MM-DD'){this.value=''}" type="text"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="count">Get Aggregate:</label></td>
|
||||
<td><input type="checkbox" id="count" name="count" <?php if ($_GET['count']){ ?>checked="checked" <?PHP } ?>></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="host_hostname">Host:</td>
|
||||
<td><input id="host_hostname" name="host_hostname" type="text" size="35" value="<?php print $_GET['host_hostname']; ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_problem_type">Problem Type:</label></td>
|
||||
<td>
|
||||
<input type="radio" name="report_problem_type" id="0" value="0" <?php if (($_GET['report_problem_type'] == '0') || ($_GET['report_problem_type'] == '')) { ?>checked="true"<?php } ?>><label for="0">All types</label><br>
|
||||
<?php foreach($problemTypes as $key => $title){ ?>
|
||||
<input type="radio" name="report_problem_type" id="<?php print $key; ?>" value="<?php print $key; ?>" <?php if ($_GET['report_problem_type'] == $key) { ?>checked="true"<?php } ?>><label for="<?php print $key; ?>"><?php print $title; ?></label><br>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_behind_login">Site requires login:</label></td>
|
||||
<td>
|
||||
<input type="radio" name="report_behind_login" id="-1" value="-1" <?php if (($_GET['report_behind_login'] == '-1') || ($_GET['report_behind_login'] == '')) { ?>checked="true"<?php } ?>><label for="-1">Any</label>
|
||||
<input type="radio" name="report_behind_login" id="0" value="0" <?php if ($_GET['report_behind_login'] == '0') { ?>checked="true"<?php } ?>><label for="0">Yes</label>
|
||||
<input type="radio" name="report_behind_login" id="1" value="1" <?php if ($_GET['report_behind_login'] == '1') { ?>checked="true"<?php } ?>><label for="1">No</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="2">
|
||||
<input id="submit_query" name="submit_query" value="Search" type="submit">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
<div id="login">
|
||||
<?php if ($userlib->isLoggedIn()){ ?>
|
||||
Welcome <?php print $_SESSION['user_realname']; ?> | <a href="logout">Logout</a>
|
||||
<?php } else { ?>
|
||||
You are not <a href="login">logged in</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
|
||||
<br /><br />
|
||||
<div id="reporter_note">
|
||||
<h3>Wildcards</h3>
|
||||
<p><em>Description</em>, <em>Hostname</em>, <em>Useragent</em> support wildcards.</p>
|
||||
<p><code>%</code> will search for 0+ characters, <code>_</code> (underscore) is for a single character.</p>
|
||||
</div>
|
||||
|
||||
<?php include($config['app_path'].'/includes/footer.inc.php'); ?>
|
||||
|
|
|
@ -41,9 +41,11 @@ require_once($config['app_path'].'/includes/iolib.inc.php');
|
|||
require_once($config['app_path'].'/includes/security.inc.php');
|
||||
|
||||
// Start Session
|
||||
// start the session
|
||||
session_name('reportSessID');
|
||||
session_start();
|
||||
header("Cache-control: private"); //IE 6 Fix
|
||||
printheaders();
|
||||
|
||||
include($config['app_path'].'/includes/header.inc.php');
|
||||
include($config['app_path'].'/includes/message.inc.php');
|
||||
|
@ -114,4 +116,4 @@ if ($_SESSION['login'] != true){
|
|||
header("Location: ".$redirect);
|
||||
}
|
||||
include($config['app_path'].'/includes/footer.inc.php');
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -43,6 +43,7 @@ require_once($config['app_path'].'/includes/iolib.inc.php');
|
|||
session_name('reportSessID');
|
||||
session_start();
|
||||
header("Cache-control: private"); //IE 6 Fix
|
||||
printheaders();
|
||||
|
||||
$_SESSION = array();
|
||||
session_destroy();
|
||||
|
@ -59,4 +60,4 @@ if($_SESSION['username']){
|
|||
} else {
|
||||
header("Location: ".$redirect);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -37,45 +37,52 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
require_once('../../config.inc.php');
|
||||
require_once($config['app_path'].'/includes/adodb/adodb.inc.php');
|
||||
require_once($config['app_path'].'/includes/iolib.inc.php');
|
||||
require_once($config['base_path'].'/includes/iolib.inc.php');
|
||||
require_once($config['base_path'].'/includes/contrib/adodb/adodb.inc.php');
|
||||
require_once($config['base_path'].'/includes/contrib/smarty/libs/Smarty.class.php');
|
||||
require_once($config['base_path'].'/includes/security.inc.php');
|
||||
|
||||
// start the session
|
||||
session_name('reportSessID');
|
||||
session_start();
|
||||
header("Cache-control: private"); //IE 6 Fix
|
||||
printheaders();
|
||||
|
||||
$title = "Searching Results";
|
||||
include($config['app_path'].'/includes/header.inc.php');
|
||||
include($config['app_path'].'/includes/message.inc.php');
|
||||
$content = initializeTemplate();
|
||||
|
||||
// approved "selectable" fields
|
||||
$approved_fields = array('count' /*special */, 'host_id', 'host_hostname', 'report_id', 'report_url', 'report_host_id', 'report_problem_type', 'report_description', 'report_behind_login', 'report_useragent', 'report_platform', 'report_oscpu', 'report_language', 'report_gecko', 'report_buildconfig', 'report_product', 'report_email', 'report_ip', 'report_file_date');
|
||||
$approved_fields = array('count' /*special */, 'host_id', 'host_hostname', 'report_id', 'report_url', 'report_host_id', 'report_problem_type', 'report_description', 'report_behind_login', 'report_useragent', 'report_platform', 'report_oscpu', 'report_language', 'report_gecko', 'report_buildconfig', 'report_product', /* 'report_email', 'report_ip',*/ 'report_file_date');
|
||||
|
||||
|
||||
// Ascending or Descending
|
||||
if (strtolower($_GET['ascdesc']) == 'asc' || strtolower($_GET['ascdesc']) == 'asc'){
|
||||
$ascdesc = $_GET['ascdesc'];
|
||||
$ascdesc = $_GET['ascdesc'];
|
||||
} else {
|
||||
$ascdesc = 'desc';
|
||||
$ascdesc = 'desc';
|
||||
}
|
||||
|
||||
// order by
|
||||
if (!$_GET['orderby']){
|
||||
$orderby = 'report_file_date';
|
||||
$orderby = 'report_file_date';
|
||||
} else {
|
||||
$orderby = $_GET['orderby'];
|
||||
$orderby = $_GET['orderby'];
|
||||
}
|
||||
|
||||
if (!$_GET['show']){
|
||||
$_GET['show'] = $config['show'];
|
||||
$_GET['show'] = $config['show'];
|
||||
}
|
||||
// no more than 200 results per page
|
||||
if (!$_GET['show'] > 200){
|
||||
$_GET['show'] = 200;
|
||||
$_GET['show'] = 200;
|
||||
}
|
||||
|
||||
if (!$_GET['page']){
|
||||
$_GET['page'] = 1;
|
||||
$_GET['page'] = 1;
|
||||
}
|
||||
|
||||
if (isset($_GET['count']) && $_GET['count'] == null){
|
||||
$_GET['count'] = 'host_id';
|
||||
$_GET['count'] = 'host_id';
|
||||
}
|
||||
|
||||
// Open DB
|
||||
|
@ -84,229 +91,269 @@ if (!$db) die("Connection failed");
|
|||
$db->SetFetchMode(ADODB_FETCH_ASSOC);
|
||||
|
||||
// Initial selected array
|
||||
$selected = array('report_id' => 'Report ID', 'host_hostname' => 'Host');
|
||||
if ($_GET['selected'] && !isset($_GET['count'])){
|
||||
$selected = array();
|
||||
foreach($_GET['selected'] as $selectedChild){
|
||||
$selected[$selectedChild] = $config['fields'][$selectedChild];
|
||||
}
|
||||
} else {
|
||||
$selected = array('report_id' => 'Report ID', 'host_hostname' => 'Host');
|
||||
}
|
||||
|
||||
if (isset($_GET['count'])){
|
||||
$selected['count'] = 'Number';
|
||||
unset($selected['report_id']);
|
||||
$selected['count'] = 'Number';
|
||||
unset($selected['report_id']);
|
||||
|
||||
// Hardcode host_id
|
||||
$_GET['count'] = 'host_id'; // XXX we just hardcode this (just easier for now, and all people will be doing).
|
||||
// XX NOTE: We don't escape count below because 'host_id' != `host_id`.
|
||||
// Hardcode host_id
|
||||
$_GET['count'] = 'host_id'; // XXX we just hardcode this (just easier for now, and all people will be doing).
|
||||
// XX NOTE: We don't escape count below because 'host_id' != `host_id`.
|
||||
|
||||
//Sort by
|
||||
if ($orderby == 'report_file_date'){ //XXX this isn't ideal, but nobody will sort by date (pointless and not an option)
|
||||
$orderby = 'count';
|
||||
}
|
||||
//Sort by
|
||||
if ($orderby == 'report_file_date'){ //XXX this isn't ideal, but nobody will sort by date (pointless and not an option)
|
||||
$orderby = 'count';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$selected['report_file_date'] = "Date";
|
||||
$selected['report_file_date'] = "Date";
|
||||
}
|
||||
|
||||
// Build SELECT clause of SQL
|
||||
reset($selected);
|
||||
while (list($key, $title) = each($selected)) {
|
||||
if (in_array($key, $approved_fields)){
|
||||
// we don't $db->quote here since unless it's in our approved array (exactly), we drop it anyway. i.e. report_id is on our list, 'report_id' is not.
|
||||
// we sanitize on our own
|
||||
if ($key == 'count'){
|
||||
$sql_select .= 'COUNT( '.$_GET['count'].' ) AS count';
|
||||
} else {
|
||||
$sql_select .= $key;
|
||||
}
|
||||
$sql_select .= ',';
|
||||
}
|
||||
// silently drop those not in approved array
|
||||
if (in_array($key, $approved_fields)){
|
||||
// we don't $db->quote here since unless it's in our approved array (exactly), we drop it anyway. i.e. report_id is on our list, 'report_id' is not.
|
||||
// we sanitize on our own
|
||||
if ($key == 'count'){
|
||||
$sql_select .= 'COUNT( '.$_GET['count'].' ) AS count';
|
||||
} else {
|
||||
$sql_select .= $key;
|
||||
}
|
||||
$sql_select .= ',';
|
||||
} else {
|
||||
// silently drop those not in approved array
|
||||
unset($selected[$key]);
|
||||
}
|
||||
}
|
||||
$sql_select = substr($sql_select, 0, -1);
|
||||
|
||||
if (isset($_GET['count'])){
|
||||
$group_by = 'GROUP BY '.$_GET['count'];
|
||||
$group_by = 'GROUP BY '.$_GET['count'];
|
||||
}
|
||||
|
||||
// Build the Where clause of the SQL
|
||||
if (isset($_GET['submit_reportID'])){
|
||||
$sql_where = 'report_id = '.$db->quote($_GET['report_id']).' ';
|
||||
$sql_where .= 'AND host.host_id = report_host_id';
|
||||
$sql_where = 'report_id = '.$db->quote($_GET['report_id']).' ';
|
||||
$sql_where .= 'AND host.host_id = report_host_id';
|
||||
}
|
||||
else if ($_GET['submit_query']){
|
||||
reset($_GET);
|
||||
while (list($param, $val) = each($_GET)) {
|
||||
// To help prevent stupidity with params, we only add it to the WHERE statement if it's passes as a param we allow
|
||||
if (
|
||||
($param == 'report_description') ||
|
||||
($param == 'host_hostname') ||
|
||||
($param == 'report_problem_type') ||
|
||||
($param == 'report_behind_login') ||
|
||||
($param == 'report_useragent') ||
|
||||
($param == 'report_gecko') ||
|
||||
($param == 'report_language') ||
|
||||
($param == 'report_platform') ||
|
||||
($param == 'report_oscpu') ||
|
||||
($param == 'report_product')){
|
||||
// there sare our various ways of saying "no value"
|
||||
if (($val != -1) && ($val != null) && ($val != '0')){
|
||||
// if there's a wildcard (%,_) we should use 'LIKE', otherwise '='
|
||||
// XX-> strpos returns 0 if the first char is % or _, so we just pad it with a 'x' to force it to do so... harmless hack
|
||||
if ((strpos('x'.$val, "%") == false) && (strpos('x'.$val, "_") == false)){
|
||||
$operator = "=";
|
||||
} else {
|
||||
$operator = "LIKE";
|
||||
}
|
||||
// Add to query
|
||||
if (in_array($param, $approved_fields)){
|
||||
$sql_where .= $param." ".$operator." ".$db->quote($val)." AND ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// we do the datetime stuff outside the loop, so it doesn't get fubar
|
||||
reset($_GET);
|
||||
while (list($param, $val) = each($_GET)) {
|
||||
// To help prevent stupidity with params, we only add it to the WHERE statement if it's passes as a param we allow
|
||||
if (
|
||||
($param == 'report_description') ||
|
||||
($param == 'host_hostname') ||
|
||||
($param == 'report_problem_type') ||
|
||||
($param == 'report_behind_login') ||
|
||||
($param == 'report_useragent') ||
|
||||
($param == 'report_gecko') ||
|
||||
($param == 'report_language') ||
|
||||
($param == 'report_platform') ||
|
||||
($param == 'report_oscpu') ||
|
||||
($param == 'report_product')){
|
||||
// there sare our various ways of saying "no value"
|
||||
if (($val != -1) && ($val != null) && ($val != '0')){
|
||||
// if there's a wildcard (%,_) we should use 'LIKE', otherwise '='
|
||||
// XX-> strpos returns 0 if the first char is % or _, so we just pad it with a 'x' to force it to do so... harmless hack
|
||||
if ((strpos('x'.$val, "%") == false) && (strpos('x'.$val, "_") == false)){
|
||||
$operator = "=";
|
||||
} else {
|
||||
$operator = "LIKE";
|
||||
}
|
||||
// Add to query
|
||||
if (in_array($param, $approved_fields)){
|
||||
$sql_where .= $param." ".$operator." ".$db->quote($val)." AND ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// we do the datetime stuff outside the loop, so it doesn't get fubar
|
||||
|
||||
// if the user didn't delete the default YYYY-MM-DD mask, we do it for them
|
||||
if ($_GET['report_file_date_start'] == 'YYYY-MM-DD'){
|
||||
$_GET['report_file_date_start'] = null;
|
||||
}
|
||||
if ($_GET['report_file_date_end'] == 'YYYY-MM-DD'){
|
||||
$_GET['report_file_date_end'] = null;
|
||||
}
|
||||
if (($_GET['report_file_date_start'] != null) || ($_GET['report_file_date_end'] != null)){
|
||||
// if the user didn't delete the default YYYY-MM-DD mask, we do it for them
|
||||
if ($_GET['report_file_date_start'] == 'YYYY-MM-DD'){
|
||||
$_GET['report_file_date_start'] = null;
|
||||
}
|
||||
if ($_GET['report_file_date_end'] == 'YYYY-MM-DD'){
|
||||
$_GET['report_file_date_end'] = null;
|
||||
}
|
||||
if (($_GET['report_file_date_start'] != null) || ($_GET['report_file_date_end'] != null)){
|
||||
|
||||
// if we have both, we do a BETWEEN
|
||||
if ($_GET['report_file_date_start'] && $_GET['report_file_date_end']){
|
||||
$sql_where .= "(report_file_date BETWEEN ".$db->quote($_GET['report_file_date_start'])." and ".$db->quote($_GET['report_file_date_end']).") AND ";
|
||||
}
|
||||
// if we have both, we do a BETWEEN
|
||||
if ($_GET['report_file_date_start'] && $_GET['report_file_date_end']){
|
||||
$sql_where .= "(report_file_date BETWEEN ".$db->quote($_GET['report_file_date_start'])." and ".$db->quote($_GET['report_file_date_end']).") AND ";
|
||||
}
|
||||
|
||||
// if we have only a start, then we do a >
|
||||
else if ($_GET['report_file_date_start']){
|
||||
$sql_where .= "report_file_date > ".$db->quote($_GET['report_file_date_start'])." AND ";
|
||||
}
|
||||
// if we have only a start, then we do a >
|
||||
else if ($_GET['report_file_date_start']){
|
||||
$sql_where .= "report_file_date > ".$db->quote($_GET['report_file_date_start'])." AND ";
|
||||
}
|
||||
|
||||
// if we have only a end, we do a <
|
||||
else if ($_GET['report_file_date_end']){
|
||||
$sql_where .= "report_file_date < ".$db->quote($_GET['report_file_date_end'])." AND ";
|
||||
}
|
||||
}
|
||||
// if we have only a end, we do a <
|
||||
else if ($_GET['report_file_date_end']){
|
||||
$sql_where .= "report_file_date < ".$db->quote($_GET['report_file_date_end'])." AND ";
|
||||
}
|
||||
}
|
||||
|
||||
$sql_where .= 'host.host_id = report_host_id AND ';
|
||||
$sql_where = substr($sql_where, 0, -5);
|
||||
$sql_where .= 'host.host_id = report_host_id AND ';
|
||||
$sql_where = substr($sql_where, 0, -5);
|
||||
|
||||
if ($orderby != 'report_file_date'){
|
||||
$subOrder = ', report.report_file_date DESC';
|
||||
}
|
||||
if ($orderby != 'report_file_date'){
|
||||
$subOrder = ', report.report_file_date DESC';
|
||||
}
|
||||
} else {
|
||||
?><h1>No Query</h1><?php
|
||||
exit;
|
||||
$content->assign('error', 'No Query');
|
||||
displayPage($content, 'query.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Security note: we escapeSimple() $select as we generate it above (escape each $key), so it would be redundant to do so here.
|
||||
// Not to mention it would break things
|
||||
// Security note: we quote() $select as we generate it above (escape each $key), so it would be redundant to do so here.
|
||||
// Not to mention it would break things
|
||||
|
||||
/* SelectLimit isn't bad, but there's no documentation on getting it to use ASC rather than DESC... to investigate */
|
||||
|
||||
$start = ($_GET['page']-1)*$_GET['show'];
|
||||
|
||||
$sql = "SELECT $sql_select
|
||||
FROM `report`, `host`
|
||||
WHERE $sql_where
|
||||
$group_by
|
||||
ORDER BY ".$db->quote($orderby)." ".$ascdesc.$subOrder;
|
||||
FROM `report`, `host`
|
||||
WHERE $sql_where
|
||||
$group_by
|
||||
ORDER BY ".$db->quote($orderby)." ".$ascdesc.$subOrder;
|
||||
$query = $db->SelectLimit($sql,$_GET['show'],$start,$inputarr=false);
|
||||
$numresults = $query->RecordCount();
|
||||
|
||||
if (isset($_GET['count'])){
|
||||
$totalresults = $_GET['show'];
|
||||
// If we have a full page worth of results in our data set, count how many total
|
||||
// so we can paginate. Only do this if $page >= 1 as well.
|
||||
if ($numresults >= $_GET['show'] || $_GET['page'] >= 1){
|
||||
if (isset($_GET['count'])){
|
||||
// REASON WHY PAGINATION IS BROKE ON count queries
|
||||
$trq = $db->Execute("SELECT COUNT(*), $sql_select
|
||||
FROM `report`, `host`
|
||||
WHERE $sql_where
|
||||
$group_by");
|
||||
$totalresults = $trq->RecordCount();
|
||||
} else {
|
||||
$trq = $db->Execute("SELECT COUNT(*)
|
||||
FROM `report`, `host`
|
||||
WHERE $sql_where");
|
||||
$totalresults = $trq->fields['COUNT(*)'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$trq = $db->Execute("SELECT count(*)
|
||||
FROM `report`, `host`
|
||||
WHERE $sql_where");
|
||||
$totalresults = $trq->fields['count(*)'];
|
||||
|
||||
// Continuity params
|
||||
reset($_GET);
|
||||
while (list($param, $val) = each($_GET)) {
|
||||
if($param != 'page' && $param != 'ascdesc'){
|
||||
if (is_array($val)){
|
||||
$param_name = $param.'[]';
|
||||
foreach($val as $valChild){
|
||||
if (!is_numeric($valChild)){
|
||||
$valChild = rawurlencode($valChild);
|
||||
}
|
||||
$continuity_params .= $param_name.'='.$valChild.'&';
|
||||
}
|
||||
} else {
|
||||
if (!is_numeric($val)){
|
||||
$val = rawurlencode($val);
|
||||
}
|
||||
$continuity_params .= $param.'='.$val.'&';
|
||||
}
|
||||
}
|
||||
}
|
||||
?><table id="query_table">
|
||||
<?php /* RESULTS LIST HEADER */ ?>
|
||||
<tr>
|
||||
<?php
|
||||
// Continuity params
|
||||
reset($_GET);
|
||||
while (list($param, $val) = each($_GET)) {
|
||||
if (($param != 'orderby') && ($param != 'ascdesc'))
|
||||
$continuity_params .= $param.'='.rawurlencode($val).'&';
|
||||
}
|
||||
$continuity_page = $_GET['page'];
|
||||
$continuity_ascdesc = $_GET['ascdesc'];
|
||||
|
||||
reset($selected);
|
||||
while (list($key, $title) = each($selected)) { ?>
|
||||
<th>
|
||||
<?PHP if ($key != 'report_id'){ ?>
|
||||
<a href="<?php print $config['self']; ?>?orderby=<?php print $key; ?>&ascdesc=<?php
|
||||
if ($orderby == $key) {
|
||||
if ($ascdesc == 'asc'){
|
||||
print 'desc';
|
||||
}
|
||||
else if ($ascdesc == 'desc'){
|
||||
print 'asc';
|
||||
}
|
||||
} else {
|
||||
print $ascdesc;
|
||||
}
|
||||
// Always print continuity params:
|
||||
$continuity_params = substr($continuity_params, 0, -1);
|
||||
print '&'.$continuity_params;
|
||||
?>">
|
||||
<?PHP } ?>
|
||||
<?php print $title; ?><?PHP if ($key != 'report_id'){ ?></a><?PHP } ?></th>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php if ($numresults < 1){ ?>
|
||||
<tr><td colspan="<?php print sizeof($selected); ?>"><h3>No Results found</h3></td></tr>
|
||||
<?php } else { ?>
|
||||
<?php for ($i=0; !$query->EOF; $i++) { ?>
|
||||
<tr <?PHP if ($i % 2 == 1){ ?>class="alt" <?PHP } ?> >
|
||||
<?php reset($selected);
|
||||
while (list($key, $title) = each($selected)) { ?>
|
||||
<td><?php
|
||||
// For report_id we create a url, for anything else: just dump it to screen
|
||||
if ($key == 'report_id'){
|
||||
?><a href="<?php print $config['app_url'].'/report/?report_id='.$query->fields[$key] ?>">Report</a><?php
|
||||
}
|
||||
else if (substr($key, 0, 5) == "COUNT"){
|
||||
print $query->fields['count'];
|
||||
} else {
|
||||
if(($key == $_GET['count']) || ($key == 'host_hostname' && $_GET['count'] == 'host_id')){
|
||||
if ($key == 'host_hostname' && $_GET['count'] == 'host_id'){
|
||||
$subquery = 'host_hostname='.$query->fields['host_hostname'];
|
||||
}
|
||||
else {
|
||||
$subquery = $_GET['count'].'='.$query->fields[$key];
|
||||
}
|
||||
?><a href="<?php print $config['app_url']; ?>/query/?<?PHP print $subquery; ?>&submit_query=true">
|
||||
<?PHP print $query->fields[$key]; ?></a>
|
||||
<?PHP }
|
||||
else {
|
||||
print $query->fields[$key];
|
||||
}
|
||||
} ?>
|
||||
</td>
|
||||
<?php $count++;
|
||||
} ?>
|
||||
</tr>
|
||||
<?php $query->MoveNext();
|
||||
}
|
||||
}
|
||||
?>
|
||||
$continuity_params .= 'submit_query=Search';
|
||||
if(isset($_GET['count'])){
|
||||
$continuity_params .= '&count=on';
|
||||
}
|
||||
|
||||
<?php
|
||||
// disconnect database
|
||||
$db->Close();
|
||||
$column = array();
|
||||
reset($selected);
|
||||
$columnCount = 0;
|
||||
|
||||
/******************
|
||||
* Columns
|
||||
*****************/
|
||||
while (list($key, $title) = each($selected)) {
|
||||
$column[$columnCount]['title'] = $title;
|
||||
if ($key != 'report_id'){
|
||||
$column[$columnCount]['url'] = $config['self'].'?orderby='.$key.'&ascdesc=';
|
||||
if ($orderby == $key) {
|
||||
if ($ascdesc == 'asc'){
|
||||
$column[$columnCount]['url'] .= 'desc';
|
||||
}
|
||||
else if ($ascdesc == 'desc'){
|
||||
$column[$columnCount]['url'] .= 'asc';
|
||||
}
|
||||
} else {
|
||||
$column[$columnCount]['url'] .= $ascdesc;
|
||||
}
|
||||
$column[$columnCount]['url'] .= '&'.substr($continuity_params, 0, -1).'&page='.$continuity_page;
|
||||
}
|
||||
$columnCount++;
|
||||
}
|
||||
$content->assign('column', $column);
|
||||
|
||||
if ($numresults < 1){
|
||||
$content->assign('error', 'No Results found');
|
||||
displayPage($content, 'query.tpl');
|
||||
exit;
|
||||
} else {
|
||||
/******************
|
||||
* Rows
|
||||
*****************/
|
||||
$row = array();
|
||||
for ($i=0; !$query->EOF; $i++) {
|
||||
reset($selected);
|
||||
$col = 0;
|
||||
while (list($key, $title) = each($selected)) {
|
||||
// For report_id we create a url, for anything else: just dump it to screen
|
||||
if ($key == 'report_id'){
|
||||
$row[$i][$col]['url'] = '/report/?report_id='.$query->fields[$key];
|
||||
$row[$i][$col]['text'] = 'Report';
|
||||
}
|
||||
else if (substr($key, 0, 5) == "COUNT"){
|
||||
$row[$i][$col]['text'] = $query->fields['count'];
|
||||
} else {
|
||||
if(($key == $_GET['count']) || ($key == 'host_hostname' && $_GET['count'] == 'host_id')){
|
||||
if ($key == 'host_hostname' && $_GET['count'] == 'host_id'){
|
||||
$subquery = 'host_hostname='.$query->fields['host_hostname'];
|
||||
} else {
|
||||
$subquery = $_GET['count'].'='.$query->fields[$key];
|
||||
}
|
||||
$row[$i][$col]['url'] = '/query/?'.$subquery.'&submit_query=true';
|
||||
$row[$i][$col]['text'] = $query->fields[$key];
|
||||
} else {
|
||||
// report_problem_type and behind_login are special cases since we need to resolve them
|
||||
if($key == 'report_problem_type'){
|
||||
$row[$i][$col]['text'] = resolveProblemTypes($query->fields[$key]);
|
||||
}
|
||||
else if($key == 'report_behind_login'){
|
||||
$row[$i][$col]['text'] = resolveBehindLogin($query->fields[$key]);
|
||||
} else {
|
||||
$row[$i][$col]['text'] = $query->fields[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
$col++;
|
||||
}
|
||||
$query->MoveNext();
|
||||
}
|
||||
}
|
||||
$content->assign('row', $row);
|
||||
// disconnect database
|
||||
$db->Close();
|
||||
|
||||
$content->assign('navigation', navigation('?page=', '&'.$continuity_params.'&ascdesc='.$continuity_ascdesc.'&show='.$_GET['show'], $totalresults, $_GET['show'], $_GET['page']));
|
||||
|
||||
displayPage($content, 'query.tpl');
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
reset($_GET);
|
||||
while (list($param, $val) = each($_GET)) {
|
||||
if (($param != 'page') && ($param != 'show'))
|
||||
$paginate_params .= $param.'='.rawurlencode($val).'&';
|
||||
}
|
||||
$paginate_params = substr($paginate_params, 0, -5);
|
||||
?>
|
||||
<?php print navigation('?page=', '&'.$paginate_params.'&show='.$_GET['show'], $totalresults, $_GET['show'], $_GET['page']); ?>
|
||||
<p><a href="<?PHP print $config['app_url']; ?>/?<?PHP print $continuity_params; ?>">Edit Query</a> | <a href="<?PHP print $config['app_url']; ?>/">New Query</a></p>
|
||||
<?php include($config['app_path'].'/includes/footer.inc.php'); ?>
|
||||
|
|
|
@ -37,15 +37,16 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
require_once('../../config.inc.php');
|
||||
require_once($config['app_path'].'/includes/adodb/adodb.inc.php');
|
||||
require_once($config['app_path'].'/includes/iolib.inc.php');
|
||||
require_once($config['app_path'].'/includes/security.inc.php');
|
||||
require_once($config['base_path'].'/includes/iolib.inc.php');
|
||||
require_once($config['base_path'].'/includes/contrib/adodb/adodb.inc.php');
|
||||
require_once($config['base_path'].'/includes/contrib/smarty/libs/Smarty.class.php');
|
||||
require_once($config['base_path'].'/includes/security.inc.php');
|
||||
|
||||
// Start Session
|
||||
session_name('reportSessID');
|
||||
session_start();
|
||||
header("Cache-control: private"); //IE 6 Fix
|
||||
|
||||
printheaders();
|
||||
|
||||
// Open DB
|
||||
$db = NewADOConnection($config['db_dsn']);
|
||||
|
@ -53,93 +54,43 @@ if (!$db) die("Connection failed");
|
|||
$db->SetFetchMode(ADODB_FETCH_ASSOC);
|
||||
|
||||
$query =& $db->Execute("SELECT *
|
||||
FROM report, host
|
||||
WHERE report.report_id = ".$db->quote($_GET['report_id'])."
|
||||
AND host.host_id = report_host_id");
|
||||
FROM report, host
|
||||
WHERE report.report_id = ".$db->quote($_GET['report_id'])."
|
||||
AND host.host_id = report_host_id");
|
||||
|
||||
// disconnect database
|
||||
$db->Close();
|
||||
|
||||
$title = "Report for - ".$query->fields['host_hostname'];
|
||||
|
||||
include($config['app_path'].'/includes/header.inc.php');
|
||||
include($config['app_path'].'/includes/message.inc.php');
|
||||
$content = initializeTemplate();
|
||||
|
||||
if (!$query->fields){
|
||||
?><h1>No Report Found</h1><?php
|
||||
exit;
|
||||
$content->assign('error', 'No Report Found');
|
||||
displayPage($content, 'report.tpl', 'Mozilla Reporter - Error');
|
||||
exit;
|
||||
}
|
||||
|
||||
$content->assign('report_id', $query->fields['report_id']);
|
||||
$content->assign('report_url', $query->fields['report_url']);
|
||||
$content->assign('host_url', $config['base_url'].'/app/query/?host_hostname='.$query->fields['host_hostname'].'&submit_query=Query');
|
||||
$content->assign('host_hostname', $query->fields['host_hostname']);
|
||||
$content->assign('report_problem_type', resolveProblemTypes($query->fields['report_problem_type']));
|
||||
$content->assign('report_behind_login', resolveBehindLogin($query->fields['report_behind_login']));
|
||||
$content->assign('report_product', $query->fields['report_product']);
|
||||
$content->assign('report_gecko', $query->fields['report_gecko']);
|
||||
$content->assign('report_useragent', $query->fields['report_useragent']);
|
||||
$content->assign('report_buildconfig', $query->fields['report_buildconfig']);
|
||||
$content->assign('report_platform', $query->fields['report_platform']);
|
||||
$content->assign('report_oscpu', $query->fields['report_oscpu']);
|
||||
$content->assign('report_language', $query->fields['report_language']);
|
||||
$content->assign('report_file_date', $query->fields['report_file_date']);
|
||||
$content->assign('report_email', $query->fields['report_email']);
|
||||
$content->assign('report_ip', $query->fields['report_ip']);
|
||||
$content->assign('report_description', $query->fields['report_description']);
|
||||
|
||||
$title = 'Mozilla Reporter: '.$query->fields['report_id'];
|
||||
|
||||
displayPage($content, 'report.tpl', $title);
|
||||
?>
|
||||
|
||||
<table id="report_table">
|
||||
<tr>
|
||||
<th>Report ID:</th>
|
||||
<td><?php print $query->fields['report_id']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>URL:</th>
|
||||
<td><a href="<?php print $query->fields['report_url']; ?>" target="_blank" rel="nofollow"><?php print $query->fields['report_url']; ?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Host:</th>
|
||||
<td><a href="<?php print $config['app_url']; ?>/query/?host_hostname=<?php print $query->fields['host_hostname']; ?>&submit_query=Query">Reports For This Host</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Problem Type:</th>
|
||||
<td><?php print resolveProblemTypes($query->fields['report_problem_type']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Behind Login:</th>
|
||||
<td><?php print $boolTypes[$query->fields['report_behind_login']]; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Product:</th>
|
||||
<td><?php print $query->fields['report_product']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Gecko:</th>
|
||||
<td><?php print $query->fields['report_gecko']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Useragent:</th>
|
||||
<td><?php print $query->fields['report_useragent']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Build Config:</th>
|
||||
<td><?php print $query->fields['report_buildconfig']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Platform:</th>
|
||||
<td><?php print $query->fields['report_platform']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>OS:</th>
|
||||
<td><?php print $query->fields['report_oscpu']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Language:</th>
|
||||
<td><?php print $query->fields['report_language']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date Filed:</th>
|
||||
<td><?php print $query->fields['report_file_date']; ?></td>
|
||||
</tr>
|
||||
<?php if ($userlib->isLoggedIn()){ ?>
|
||||
<tr>
|
||||
<th>Email:</th>
|
||||
<td><a href="mailto:<?php print $query->fields['report_email']; ?>"><?php print $query->fields['report_email']; ?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>IP:</th>
|
||||
<td><a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php print $query->fields['report_ip']; ?>" target="_blank"><?php print $query->fields['report_ip']; ?></a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<th>Description:</th>
|
||||
<td><?php print str_replace("\n", "<br />", $query->fields['report_description']); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php include($config['app_path'].'/includes/footer.inc.php'); ?>
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
#reporter_note {
|
||||
border: 1px solid #ccc;
|
||||
background: #eee;
|
||||
padding: 5px 8px 5px 8px;
|
||||
}
|
||||
|
||||
#report_table, #query_table {
|
||||
border-spacing: 0px;
|
||||
width: 100%;
|
||||
}
|
||||
#report_table tr {
|
||||
width: 200px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#report_table td {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
||||
#query_table th {
|
||||
text-align: left;
|
||||
background-color: #999;
|
||||
color: #fff;
|
||||
padding: 2px 0 2px 0;
|
||||
}
|
||||
|
||||
#query_table th>a {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#query_table .alt {
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
#queryTable td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#queryTable label {
|
||||
-moz-user-select: none;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#queryTable td.label {
|
||||
vertical-align: top;
|
||||
text-align: right;
|
||||
padding-right: 7px;
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
#queryTable td.label label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#queryTable input[type="radio"] + label {
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
#queryTable input[type="radio"]:focus + label {
|
||||
border: 1px dotted black;
|
||||
}
|
||||
|
||||
#queryTable legend {
|
||||
font-weight: bold;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#message {
|
||||
padding: 4px;
|
||||
margin: 8px 3px 12px 3px;
|
||||
background: #FFD1D1;
|
||||
border: 1px solid #FF0000;
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
<?php
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (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.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Reporter (r.m.o).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Robert Accettura <robert@accettura.com>.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**************************************
|
||||
* I need to be renamed config.inc.php
|
||||
* once the below is correct
|
||||
**************************************/
|
||||
|
||||
// Debug
|
||||
$config['debug'] = false;
|
||||
|
||||
// Paths
|
||||
$config['base_url'] = 'http://reporter.server.tld'; // no trailing slash
|
||||
$config['base_path'] = '/path/to/reporter'; // no trailing slash
|
||||
|
||||
// Database
|
||||
$config['db_type'] = 'mysql';
|
||||
$config['db_server'] = 'SERVER';
|
||||
$config['db_user'] = 'USERNAME';
|
||||
$config['db_pass'] = 'PASSWORD';
|
||||
$config['db_database'] = 'DATABASE';
|
||||
$config['db_dsn'] = $config['db_type'].'://'.$config['db_user'].':'.$config['db_pass'].'@'.$config['db_server'].'/'.$config['db_database'];
|
||||
|
||||
// Smarty Configurations
|
||||
$config['smarty_template_directory'] = $config['base_path'].'/templates/';
|
||||
$config['smarty_compile_dir'] = '/tmp';
|
||||
$config['smarty_cache_dir'] = '';
|
||||
$config['smarty_compile_check'] = true;
|
||||
$config['smarty_debug'] = false;
|
||||
|
||||
// Service
|
||||
/**********************************************************
|
||||
* If using reporter in a corporate environment, you can
|
||||
* set reporter as a proxy, so that all reports that match
|
||||
* a regular exression are forwarded to your database, and
|
||||
* the rest go outwards to the main reporter.mozilla.org
|
||||
* instance
|
||||
***********************************************************/
|
||||
$config['proxy'] = false;
|
||||
/**********************************************************
|
||||
* if this statement evaluates to true, it uses the local
|
||||
* instance, otherwise it goes to reporter.mozilla.org.
|
||||
* You can have as many as you want (though less is better),
|
||||
* sequentially number the array $config['proxy_regex'][0],
|
||||
* $config['proxy_regex'][1], etc.
|
||||
************************************************************/
|
||||
$config['proxy_regex'][0] = '';
|
||||
|
||||
// should we gzip encode (more cpu, less bandwidth) XX-> Not implemented
|
||||
$config['gzip'] = false;
|
||||
|
||||
// minimum version to allow to contact the service
|
||||
$config['min_vers'] = '0.2';
|
||||
|
||||
|
||||
|
||||
// products to show in the pull down on the query page
|
||||
$config['products'][0]['id'] = 'Firefox/1.0';
|
||||
$config['products'][0]['title'] = 'Firefox 1.0';
|
||||
$config['products'][0]['id'] = 'Firefox/1.0+';
|
||||
$config['products'][0]['title'] = 'Firefox 1.0+';
|
||||
|
||||
|
||||
// How many items to show by default
|
||||
$config['show'] = 25;
|
||||
|
||||
// Field Names, and how they should appear in the UI
|
||||
$config['fields']['report_id'] = 'Report ID';
|
||||
$config['fields']['report_url'] = 'URL';
|
||||
$config['fields']['host_url'] = 'Host';
|
||||
$config['fields']['host_hostname'] = 'Hostname';
|
||||
$config['fields']['report_problem_type'] = 'Problem Type';
|
||||
$config['fields']['report_behind_login'] = 'Behind Login';
|
||||
$config['fields']['report_product'] = 'Product';
|
||||
$config['fields']['report_gecko'] = 'Gecko';
|
||||
$config['fields']['report_useragent'] = 'User Agent';
|
||||
$config['fields']['report_buildconfig'] = 'Build Config';
|
||||
$config['fields']['report_platform'] = 'Platform';
|
||||
$config['fields']['report_oscpu'] = 'OSCPU';
|
||||
$config['fields']['report_language'] = 'Language';
|
||||
$config['fields']['report_file_date'] = 'File Date';
|
||||
$config['fields']['report_email'] = 'Email';
|
||||
$config['fields']['report_ip'] = 'IP';
|
||||
$config['fields']['report_description'] = 'Description';
|
||||
|
||||
$config['unselectablefields'] = array('report_file_date', 'host_url', 'report_email', 'report_ip');
|
||||
|
||||
|
||||
/*****************************/
|
||||
// Shouldn't need to touch this
|
||||
/*****************************/
|
||||
$config['self'] = 'http://' . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')) . '/';
|
||||
|
||||
$boolTypes[-1] = '--';
|
||||
$boolTypes[0] = 'No';
|
||||
$boolTypes[1] = 'Yes';
|
||||
|
||||
//$problemTypes[0] = '--';
|
||||
$problemTypes[1] = 'Browser not supported';
|
||||
$problemTypes[2] = 'Can\'t log in';
|
||||
$problemTypes[3] = 'Plugin not shown';
|
||||
$problemTypes[4] = 'Other content missing';
|
||||
$problemTypes[5] = 'Behavior wrong';
|
||||
$problemTypes[6] = 'Appearance wrong';
|
||||
$problemTypes[7] = 'Other problem';
|
||||
|
||||
?>
|
|
@ -0,0 +1,25 @@
|
|||
Contributed Libraries should go here
|
||||
|
||||
Use the below listed "reference point's" to ensure that they are in the proper location.
|
||||
|
||||
===
|
||||
Smarty
|
||||
http://smarty.php.net
|
||||
|
||||
Reference point (check if this structure is valid):
|
||||
[base_path]/includes/contrib/smarty/libs/Smarty.class
|
||||
|
||||
===
|
||||
ADOdb
|
||||
http://adodb.sourceforge.net/
|
||||
|
||||
Reference point (check if this structure is valid):
|
||||
[base_path]/includes/contrib/adodb/adodb.inc
|
||||
|
||||
===
|
||||
NuSOAP
|
||||
http://sourceforge.net/projects/nusoap/
|
||||
|
||||
Reference point (check if this structure is valid):
|
||||
[base_path]/includes/contrib/nusoap/lib/nusoap.php
|
||||
|
|
@ -0,0 +1,344 @@
|
|||
<?php
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (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.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Reporter (r.m.o).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Robert Accettura <robert@accettura.com>.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function initializeTemplate(){
|
||||
global $config;
|
||||
|
||||
$object = new Smarty;
|
||||
$object->compile_check = $config['smarty_compile_check'];
|
||||
$object->debugging = $config['smarty_debug'];
|
||||
|
||||
if ($config['smarty_template_directory']){
|
||||
$object->template_dir = $config['smarty_template_directory'];
|
||||
}
|
||||
if ($config['smarty_compile_dir']){
|
||||
$object->compile_dir = $config['smarty_compile_dir'];
|
||||
}
|
||||
if ($config['smarty_cache_dir']){
|
||||
$object->cache_dir = $config['smarty_cache_dir'];
|
||||
}
|
||||
|
||||
// Add standard variables
|
||||
$object = templateStandardVars($object);
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
||||
function templateStandardVars($object){
|
||||
global $config, $userlib;
|
||||
|
||||
$object->assign('base_url', $config['base_url']);
|
||||
$object->assign('app_url', $config['base_url'].'/app');
|
||||
$object->assign('charset', 'utf-8');
|
||||
$object->assign('is_admin', $userlib->isLoggedIn());
|
||||
return $object;
|
||||
}
|
||||
|
||||
function displayPage($object, $objectTemplate, $title = 'Mozilla Reporter'){
|
||||
$page = initializeTemplate();
|
||||
$page->assign('content', $object->fetch($objectTemplate));
|
||||
$page->assign('title', $title);
|
||||
$page->display('layout.tpl');
|
||||
return;
|
||||
}
|
||||
function strMiddleReduceWordSensitive($string, $max = 50, $rep = '[...]') {
|
||||
$strlen = strlen($string);
|
||||
|
||||
if ($strlen <= $max)
|
||||
return $string;
|
||||
|
||||
$lengthtokeep = $max - strlen($rep);
|
||||
$start = 0;
|
||||
$end = 0;
|
||||
|
||||
if (($lengthtokeep % 2) == 0) {
|
||||
$start = $lengthtokeep / 2;
|
||||
$end = $start;
|
||||
} else {
|
||||
$start = intval($lengthtokeep / 2);
|
||||
$end = $start + 1;
|
||||
}
|
||||
|
||||
$i = $start;
|
||||
$tmp_string = $string;
|
||||
while ($i < $strlen) {
|
||||
if ($tmp_string[$i] == ' ') {
|
||||
$tmp_string = substr($tmp_string, 0, $i) . $rep;
|
||||
$return = $tmp_string;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$i = $end;
|
||||
$tmp_string = strrev ($string);
|
||||
while ($i < $strlen) {
|
||||
if ($tmp_string[$i] == ' ') {
|
||||
$tmp_string = substr($tmp_string, 0, $i);
|
||||
$return .= strrev ($tmp_string);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $return;
|
||||
return substr($string, 0, $start) . $rep . substr($string, - $end);
|
||||
}
|
||||
|
||||
function resolveProblemTypes($q){
|
||||
global $problemTypes;
|
||||
return $problemTypes[$q];
|
||||
}
|
||||
|
||||
function resolveBehindLogin($q){
|
||||
if ($q == 1){
|
||||
return "Yes";
|
||||
}
|
||||
return "No";
|
||||
}
|
||||
|
||||
function navigation($pre_href='?page=', $post_href='', $num_items=0, $items_per_page=25, $active=1, $nearby=5, $threshold=100){
|
||||
// Original From: http://www.phpbuilder.com/snippet/detail.php?type=snippet&id=866
|
||||
// License: GNU General Public License
|
||||
// Info: 1336 2.0.1 10/19/02 18:01 mp96brbj
|
||||
|
||||
/*
|
||||
The main function:
|
||||
Returns HTML string with a navigation bar, easily styled with CSS.
|
||||
Returns false if no navigation bar was necessary (if everything
|
||||
could fit on one page).
|
||||
|
||||
$pre_href = everyhing in the links' HREF before the active page's number.
|
||||
$post_href = everyhing *after* the active page's number.
|
||||
$num_items = total number of items available.
|
||||
$items_per_page = well, d'uh!
|
||||
$active = the active page's number.
|
||||
$nearby = minimum number of nearby pages to $active to display.
|
||||
$threshold = the smaller the number, the more restrictive the
|
||||
selection of links will be when $total is very high. This is to
|
||||
conserve space.
|
||||
|
||||
These default settings limit the number of links to a maximum
|
||||
of about 20.
|
||||
*/
|
||||
|
||||
// &//8230; is the ellipse character: "..."
|
||||
$space = '<span class="spacer"> … '."\n\t".'</span>';
|
||||
|
||||
// There's no point in printing this string if there are no items,
|
||||
// Or if they all fit on one page.
|
||||
if ($num_items > 0 && $num_items > $items_per_page)
|
||||
{
|
||||
// STEP 1:
|
||||
// Force variables into certain values.
|
||||
|
||||
// $items_per_page can't be smaller than 1!
|
||||
// Also, avoid division by zero later on.
|
||||
$items_per_page = max($items_per_page, 1);
|
||||
|
||||
// Calculate the number of listing pages.
|
||||
$total = ceil($num_items/$items_per_page);
|
||||
|
||||
// $active can't be higher than $total or smaller than 1!
|
||||
$active = max( min($active,$total), 1);
|
||||
|
||||
// STEP 2:
|
||||
// Do the rest.
|
||||
|
||||
// Get the sequence of pages to show links to.
|
||||
$pages = navigationSequence($total, $active, $nearby, $threshold);
|
||||
|
||||
// Print a descriptive string.
|
||||
$first = ($active-1)*$items_per_page + 1;
|
||||
$last = min($first+$items_per_page-1, $num_items);
|
||||
if ($first == $last)
|
||||
$listing = $first;
|
||||
else
|
||||
// &//8211; is the EN dash, the proper hyphen to use.
|
||||
$listing = $first.' - '.$last;
|
||||
$r = '<p class="navigation">'."\n\tShowing $listing of $num_items<br />\n";
|
||||
|
||||
// Initialize the list of links.
|
||||
$links = array();
|
||||
|
||||
// Add "previous" link.
|
||||
if ($active > 1 && $total > 1)
|
||||
$links[] = '<a href="'.$pre_href.($active-1).$post_href.
|
||||
'" class="prev" title="Previous">«</a>';
|
||||
|
||||
// Decide how the each link should be presented.
|
||||
for($i=0; $i<sizeof($pages); $i++)
|
||||
{
|
||||
// Current link.
|
||||
$curr = $pages[$i];
|
||||
|
||||
// See if we should any $spacer in connection to this link.
|
||||
if ($i>0 AND $i<sizeof($pages)-1)
|
||||
{
|
||||
$prev = $pages[$i-1];
|
||||
$next = $pages[$i+1];
|
||||
|
||||
// See if we should any $spacer *before* this link.
|
||||
// (Don't add one if the last link is already a spacer.)
|
||||
if ($prev < $curr-1 AND $links[sizeof($links)-1] != $space)
|
||||
$links[] = $space;
|
||||
}
|
||||
|
||||
// Add the link itself!
|
||||
// If the link is not the active page, link it.
|
||||
if ($curr != $active)
|
||||
$links[] = '<a href="'.$pre_href.$curr.$post_href.'">'.$curr.'</a>';
|
||||
// Else don't link it.
|
||||
else
|
||||
$links[] = '<strong class="active">'.$active.'</strong>';
|
||||
|
||||
if ($i>0 AND $i<sizeof($pages)-1)
|
||||
{
|
||||
// See if we should any $spacer *after* this link.
|
||||
// (Don't add one if the last link is already a spacer.)
|
||||
if ($next > $curr+1 AND $links[sizeof($links)-1] != $space)
|
||||
$links[] = $space;
|
||||
}
|
||||
}
|
||||
|
||||
// Add "next" link.
|
||||
if ($active < $total && $total > 1)
|
||||
$links[] = '<a href="'.$pre_href.($active+1).$post_href.
|
||||
'" class="next" title="Next">»</a>';
|
||||
|
||||
// Put it all together.
|
||||
$r .= "\t".implode($links, "\n\t")."\n</p>\n";
|
||||
$r = str_replace("\n\t".$space."\n\t", $space, $r);
|
||||
|
||||
return $r;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function navigationSequence($total=1, $active=1, $nearby=5, $threshold=100){
|
||||
// Original From: http://www.phpbuilder.com/snippet/detail.php?type=snippet&id=866
|
||||
// License: GNU General Public License
|
||||
// Info: 1336 2.0.1 10/19/02 18:01 mp96brbj
|
||||
// STEP 1:
|
||||
// Force minimum and maximum values.
|
||||
$total = (int)max($total, 1);
|
||||
$active = (int)min( max($active,1), $total);
|
||||
$nearby = (int)max($nearby, 2);
|
||||
$threshold = (int)max($threshold, 1);
|
||||
|
||||
// STEP 2:
|
||||
// Initialize $pages.
|
||||
|
||||
// Array where each key is a page.
|
||||
// That way we can easily overwrite duplicate keys, without
|
||||
// worrying about the order of elements.
|
||||
// Begin by adding the first, the active and the final page.
|
||||
$pages = array(1=>1, $active=>1, $total=>1);
|
||||
|
||||
// STEP 3:
|
||||
// Add nearby pages.
|
||||
for ($diff=1; $diff<$nearby+1; $diff++)
|
||||
{
|
||||
$pages[min( max($active-$diff,1), $total)] = 1;
|
||||
$pages[min( max($active+$diff,1), $total)] = 1;
|
||||
}
|
||||
|
||||
// STEP 4:
|
||||
// Add distant pages.
|
||||
|
||||
// What are the greatest and smallest distances between page 1
|
||||
// and active page, or between active page and final page?
|
||||
$biggest_diff = max($total-$active, $active);
|
||||
$smallest_diff = min($total-$active, $active);
|
||||
|
||||
// The lower $factor is, the bigger jumps (and ergo fewer pages)
|
||||
// there will be between the distant pages.
|
||||
$factor = 0.75;
|
||||
// If we think there will be too many distant pages to list,
|
||||
// reduce $factor.
|
||||
while(pow($total*max($smallest_diff,1), $factor) > $threshold)
|
||||
$factor *= 0.9;
|
||||
|
||||
// Add a page between $active and the farthest end (both upwards
|
||||
// and downwards). Then add a page between *that* page and
|
||||
// active. And so on, until we touch the nearby pages.
|
||||
for ($diff=round($biggest_diff*$factor); $diff>$nearby; $diff=round($diff*$factor))
|
||||
{
|
||||
// Calculate the numbers.
|
||||
$lower = $active-$diff;
|
||||
$higher = $active+$diff;
|
||||
|
||||
// Round them to significant digits (for readability):
|
||||
// Significant digits should be half or less than half of
|
||||
// the total number of digits, but at least 2.
|
||||
$lower = round($lower, -floor(max(strlen($lower),2)/2));
|
||||
$higher = round($higher, -floor(max(strlen($higher),2)/2));
|
||||
|
||||
// Maxe sure they're within the valid range.
|
||||
$lower = min(max($lower, 1),$total);
|
||||
$higher = min(max($higher, 1),$total);
|
||||
|
||||
// Add them.
|
||||
$pages[$lower] = 1;
|
||||
$pages[$higher] = 1;
|
||||
}
|
||||
|
||||
// STEP 5:
|
||||
// Convert the keys into values and sort them.
|
||||
$return = array_keys($pages);
|
||||
sort($return);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function printheaders(){
|
||||
|
||||
$now = date("D M j G:i:s Y T");
|
||||
header('Expires: ' . $now);
|
||||
header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('X-Powered-By: A Barrel of Monkey\'s ');
|
||||
}
|
||||
|
||||
function strip_all_tags($input){
|
||||
while($input != strip_tags($input)) {
|
||||
$input = strip_tags($input);
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (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.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Reporter (r.m.o).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Robert Accettura <robert@accettura.com>.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
class userlib {
|
||||
|
||||
function login($username, $password){
|
||||
global $db;
|
||||
|
||||
$data =& $db->getRow("SELECT user.user_id, user.user_username, user.user_password, user.user_realname, user.user_status
|
||||
FROM user
|
||||
WHERE user.user_username = ".$db->quote($username)." AND user.user_password = md5(".$db->quote($password).")", DB_FETCHMODE_ASSOC);
|
||||
if ($data['user_status'] == 1){
|
||||
$_SESSION['user_id'] = $data['user_id'];
|
||||
$_SESSION['user_realname'] = $data['user_realname'];
|
||||
$_SESSION['user_username'] = $data['user_username'];
|
||||
$_SESSION['login'] = true;
|
||||
return array(true, '');
|
||||
}
|
||||
return array(false, 'Bad Status');
|
||||
}
|
||||
|
||||
function isLoggedIn(){
|
||||
if ($_SESSION['user_username'] && $_SESSION['login'] == true){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// End Class
|
||||
}
|
||||
$userlib = new userlib;
|
||||
?>
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (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.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Reporter (r.m.o).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Robert Accettura <robert@accettura.com>.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
require_once('config.inc.php');
|
||||
require_once($config['app_path'].'/includes/iolib.inc.php');
|
||||
|
||||
printheaders();
|
||||
header("Location: app");
|
||||
|
||||
?>
|
|
@ -0,0 +1,95 @@
|
|||
--
|
||||
-- Database: `reporter`
|
||||
--
|
||||
CREATE DATABASE `reporter`;
|
||||
USE reporter;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `host`
|
||||
--
|
||||
|
||||
CREATE TABLE `host` (
|
||||
`host_id` varchar(32) NOT NULL default '',
|
||||
`host_hostname` varchar(255) NOT NULL default '',
|
||||
`host_date_added` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`host_user_added` varchar(60) NOT NULL default '',
|
||||
PRIMARY KEY (`host_id`),
|
||||
KEY `host_hostname` (`host_hostname`)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `product`
|
||||
--
|
||||
|
||||
CREATE TABLE `product` (
|
||||
`product_id` varchar(150) NOT NULL default '',
|
||||
`product_description` varchar(150) NOT NULL default ''
|
||||
) TYPE=MyISAM;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `report`
|
||||
--
|
||||
|
||||
CREATE TABLE `report` (
|
||||
`report_id` varchar(17) NOT NULL default '',
|
||||
`report_url` varchar(255) NOT NULL default '',
|
||||
`report_host_id` varchar(32) NOT NULL default '',
|
||||
`report_problem_type` varchar(5) NOT NULL default '0',
|
||||
`report_description` tinytext NOT NULL,
|
||||
`report_behind_login` int(11) NOT NULL default '0',
|
||||
`report_useragent` varchar(255) NOT NULL default '',
|
||||
`report_platform` varchar(20) NOT NULL default '',
|
||||
`report_oscpu` varchar(100) NOT NULL default '',
|
||||
`report_language` varchar(7) NOT NULL default '',
|
||||
`report_gecko` varchar(8) NOT NULL default '',
|
||||
`report_buildconfig` tinytext NOT NULL,
|
||||
`report_product` varchar(100) NOT NULL default '',
|
||||
`report_email` varchar(255) NOT NULL default '',
|
||||
`report_ip` varchar(15) NOT NULL default '',
|
||||
`report_file_date` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`report_sysid` varchar(10) NOT NULL default '',
|
||||
PRIMARY KEY (`report_id`),
|
||||
KEY `report_host_id` (`report_host_id`)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `sysid`
|
||||
--
|
||||
|
||||
CREATE TABLE `sysid` (
|
||||
`sysid_id` varchar(10) binary NOT NULL default '',
|
||||
`sysid_created` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`sysid_created_ip` varchar(15) binary NOT NULL default '',
|
||||
`sysid_language` varchar(7) binary NOT NULL default '',
|
||||
PRIMARY KEY (`sysid_id`)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `user`
|
||||
--
|
||||
|
||||
CREATE TABLE `user` (
|
||||
`user_id` int(11) NOT NULL default '0',
|
||||
`user_username` varchar(50) NOT NULL default '',
|
||||
`user_password` varchar(40) NOT NULL default '',
|
||||
`user_realname` varchar(25) NOT NULL default '',
|
||||
`user_email` varchar(255) NOT NULL default '',
|
||||
`user_added_by` tinytext NOT NULL,
|
||||
`user_added_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`user_last_login` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`user_last_ip_address` varchar(16) NOT NULL default '',
|
||||
`user_status` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`user_id`),
|
||||
KEY `user_password` (`user_password`),
|
||||
KEY `user_id` (`user_id`)
|
||||
) TYPE=MyISAM;
|
|
@ -0,0 +1,136 @@
|
|||
<fieldset>
|
||||
<legend>Look up Report</legend>
|
||||
<form method="get" action ="{$app_url}/report/" ID="Form1">
|
||||
<label for="report_id">Report ID</label>
|
||||
<input type="text" id="report_id" name="report_id" />
|
||||
<input type="submit" id="submit_reportID" name="submit_reportID" value="Lookup Report" />
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
<!-- Query -->
|
||||
<fieldset>
|
||||
<legend>Search for a Report</legend>
|
||||
<form method="get" action="{$app_url}/query/">
|
||||
<table id="queryTable">
|
||||
<tr>
|
||||
<td class="label"><label for="report_description">Description:</label></td>
|
||||
<td><input id="report_description" name="report_description" type="text" size="35" value="{$report_description}"></td>
|
||||
<td rowspan="4">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="label"><label for="report_useragent">User Agent:</label></td>
|
||||
<td><input id="report_useragent" name="report_useragent" type="text" size="35" value="{$report_useragent}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_gecko">Gecko Version:</label></td>
|
||||
<td><input id="report_gecko" name="report_gecko" type="text" value="{$report_gecko}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_language">Language (ex. en-US):</label></td>
|
||||
<td><input id="report_language" name="report_language" type="text" value="{$report_language}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_platform">Platform:</label></td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="report_platform" id="AllPlatforms" value=""><label for="AllPlatforms">All</label><br>
|
||||
<input type="radio" name="report_platform" id="Win32" value="Win32"><label for="Win32">Windows (32)</label><br>
|
||||
<input type="radio" name="report_platform" id="Windows" value="Windows"><label for="Windows">Windows (64 Bit)</label><br>
|
||||
<input type="radio" name="report_platform" id="MacPPC" value="MacPPC"><label for="MacPPC">MacOS X</label><br>
|
||||
<input type="radio" name="report_platform" id="X11" value="X11"><label for="X11">X11</label><br>
|
||||
</td><td>
|
||||
<input type="radio" name="report_platform" id="OS2" value="OS/2"><label for="OS2">OS/2</label><br>
|
||||
<input type="radio" name="report_platform" id="Photon" value="Photon"><label for="Photon">Photon</label><br>
|
||||
<input type="radio" name="report_platform" id="BeOS" value="BeOS"><label for="BeOS">BeOS</label><br>
|
||||
<input type="radio" name="report_platform" id="unknown" value="?"><label for="unknown">unknown</label><br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_oscpu" title="oscpu">OS:</td>
|
||||
<td><input id="report_oscpu" name="report_oscpu" type="text" size="35" value="{$report_oscpu}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_product">Product:</label></td>
|
||||
<td>
|
||||
<select name="report_product" id="report_product">
|
||||
<option value="-1">Any</option>
|
||||
<option value="$product['id']">$product['title']</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_file_date_start">File Date starts:</label></td>
|
||||
<td><input id="report_file_date_start" name="report_file_date_start" value="{if $report_file_date_start != null}{$report_file_date_start}{else}YYYY-MM-DD{/if}" {literal}onfocus="if(this.value=='YYYY-MM-DD'){this.value=''}"{/literal} type="text"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_file_date_end">ends:</label></td>
|
||||
<td><input id="report_file_date_end" name="report_file_date_end" value="{if $report_file_date_end != null}{$report_file_date_end}{else}YYYY-MM-DD{/if}" {literal}onfocus="if(this.value=='YYYY-MM-DD'){this.value=''}"{/literal} type="text"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="show">Results Per Page:</label></td>
|
||||
<td><input id="show" name="show" value="{if $show != null}{$show}{else}25{/if}" type="text"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="count">Get Aggregate:</label></td>
|
||||
<td><input type="checkbox" id="count" name="count"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="host_hostname">Host:</td>
|
||||
<td><input id="host_hostname" name="host_hostname" type="text" size="35" value="{$host_hostname}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_problem_type">Problem Type:</label></td>
|
||||
<td>
|
||||
<input type="radio" name="report_problem_type" id="0" value="0" {if $report_problem_type == '0' || $report_problem_type == null}checked="true"{/if}><label for="0">All types</label><br>
|
||||
{html_radios name="report_problem_type" options=$problem_types selected=$report_problem_type separator="<br />"}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="report_behind_login">Site requires login:</label></td>
|
||||
<td>
|
||||
<input type="radio" name="report_behind_login" id="-1" value="-1" {if $report_behind_login == '-1' || $report_behind_login == ''}checked="true"{/if}><label for="-1">Any</label>
|
||||
<input type="radio" name="report_behind_login" id="0" value="0" {if $report_behind_login == '0'}checked="true"{/if}><label for="0">Yes</label>
|
||||
<input type="radio" name="report_behind_login" id="1" value="1" {if $report_behind_login == '1'}checked="true"{/if}><label for="1">No</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="selected[]">View:</label></td>
|
||||
<td>
|
||||
<select name="selected[]" id="selected[]" multiple="multiple" size="5">
|
||||
{html_options options=$selected_options selected=$selected}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="2">
|
||||
<input id="submit_query" name="submit_query" value="Search" type="submit">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</fieldset>
|
||||
{*
|
||||
<div id="login">
|
||||
<?php if ($userlib->isLoggedIn()){ ?>
|
||||
Welcome <?php print $_SESSION['user_realname']; ?> | <a href="logout">Logout</a>
|
||||
<?php } else { ?>
|
||||
You are not <a href="login">logged in</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
*}
|
||||
<br /><br />
|
||||
<div id="reporter_note">
|
||||
<h3>Wildcards</h3>
|
||||
<p><em>Description</em>, <em>Hostname</em>, <em>Useragent</em> support wildcards.</p>
|
||||
<p><code>%</code> will search for 0+ characters, <code>_</code> (underscore) is for a single character.</p>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>{$title}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="http://mozilla.org/css/print.css" media="print">
|
||||
<link rel="stylesheet" type="text/css" href="http://mozilla.org/css/base/content.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="http://mozilla.org/css/cavendish/content.css" title="Cavendish" media="all">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="http://mozilla.org/css/base/template.css" media="screen">
|
||||
<link rel="stylesheet" type="text/css" href="http://mozilla.org/css/cavendish/template.css" title="Cavendish" media="screen">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{$base_url}/app/style.css" media="all">
|
||||
|
||||
<link rel="icon" href="images/mozilla-16.png" type="image/png">
|
||||
|
||||
<link rel="home" title="Home" href="http://www.mozilla.org/">
|
||||
</head>
|
||||
|
||||
<body id="www-mozilla-org" class="homepage">
|
||||
<div id="container">
|
||||
|
||||
<p class="skipLink"><a href="#firefox-feature" accesskey="2">Skip to main content</a></p>
|
||||
|
||||
<div id="header">
|
||||
<h1><a href="/" title="Return to home page" accesskey="1">Mozilla</a></h1>
|
||||
<ul>
|
||||
<li id="login"><a href="{$base_url}/app/login" title="Admin Login">Login</a></li>
|
||||
<li id="stats"><a href="{$base_url}/app/stats/" title="View Statistics">Stats</a></li>
|
||||
<li id="top_25"><a href="{$base_url}/app/query/?show=25&count=on&&submit_query=Search" title="Top 25 Hosts">Top 25</a></li>
|
||||
<li id="query"><a href="{$base_url}/app" title="Create a new Query">Query</a></li>
|
||||
</ul>
|
||||
<form id="search" method="get" action="{$base_url}/app/report/" title="Get Report">
|
||||
<div>
|
||||
|
||||
<label for="report_id" title="Pull up report number">get report:</label>
|
||||
<input type="text" id="report_id" name="report_id" accesskey="g" size="30">
|
||||
<input type="submit" id="submit" value="Lookup">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<!-- closes #header-->
|
||||
<h1>Mozilla Reporter</h1>
|
||||
<!--
|
||||
reporter.mozilla.org by:
|
||||
Robert "DIGITALgimpus" Accettura <http://robert.accettura.com>
|
||||
-->
|
||||
{$content}
|
||||
<hr class="hide">
|
||||
<div id="footer">
|
||||
<ul id="bn">
|
||||
<li><a href="http://planet.mozilla.org">Community Blogs</a></li>
|
||||
<li><a href="http://www.mozilla.org/sitemap.html">Site Map</a></li>
|
||||
<li><a href="http://www.mozilla.org/security/">Security Updates</a></li>
|
||||
|
||||
<li><a href="http://www.mozilla.org/contact/">Contact Us</a></li>
|
||||
<li><a href="http://www.mozilla.org/foundation/donate.html">Donate</a></li>
|
||||
</ul>
|
||||
<p>International Affiliates: <a href="http://www.mozilla-europe.org/">Mozilla Europe</a> - <a href="http://www.mozilla-japan.org/">Mozilla Japan</a></p>
|
||||
<p>Copyright © 1998-<?php print date("Y"); ?> The Mozilla Organization</p>
|
||||
|
||||
</div>
|
||||
<!-- closes #footer-->
|
||||
|
||||
</div>
|
||||
<!-- closes #container -->
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,18 @@
|
|||
{if $error != ''}<h3 class="rmo_error">Error: {$error}</h3>{/if}
|
||||
{if !$error}
|
||||
<table id="query_table">
|
||||
<tr class="header">
|
||||
{section name=mysec loop=$column}
|
||||
<th>{if $column[mysec].url != null}<a href="{$column[mysec].url}">{/if}{$column[mysec].title}{if $column[mysec].url != null}</a>{/if}</th>
|
||||
{/section}
|
||||
</tr>
|
||||
{section name=mysec2 loop=$row}
|
||||
<tr>
|
||||
{section name=col loop=$row[mysec2]}
|
||||
<td>{if $row[mysec2][col].url != null}<a href="{$base_url}/app{$row[mysec2][col].url}">{/if}{$row[mysec2][col].text|truncate:100}{if $row[mysec2][col].url != null}</a>{/if}</td>
|
||||
{/section}
|
||||
</tr>
|
||||
{/section}
|
||||
</table>
|
||||
<div class="navigation">{$navigation}</div>
|
||||
{/if}
|
|
@ -0,0 +1,66 @@
|
|||
{if $error != ''}<h3 class="rmo_error">Error: {$error}</h3>{else}
|
||||
<table id="report_table">
|
||||
<tr>
|
||||
<th>Report ID:</th>
|
||||
<td>{$report_id}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>URL:</th>
|
||||
<td><a href="{$report_url}" rel="nofollow external" title="Visit the page">{$report_url|truncate:60}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Host:</th>
|
||||
<td><a href="{$host_url}" title="see all reports for {$host_hostname}">Reports for {$host_hostname}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Problem Type:</th>
|
||||
<td>{$report_problem_type}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Behind Login:</th>
|
||||
<td>{$report_behind_login}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Product:</th>
|
||||
<td>{$report_product}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Gecko Version:</th>
|
||||
<td>{$report_gecko}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Platform:</th>
|
||||
<td>{$report_platform}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>OS/CPU:</th>
|
||||
<td>{$report_oscpu}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Language:</th>
|
||||
<td>{$report_language}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>User Agent:</th>
|
||||
<td>{$report_useragent}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Build Config:</th>
|
||||
<td>{$report_buildconfig}</td>
|
||||
</tr>
|
||||
{if $is_admin == true}
|
||||
<tr>
|
||||
<th>Email:</th>
|
||||
<td>{$report_email}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>IP Address:</th>
|
||||
<td><a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput={$report_ip}" rel="external" target="_blank" title="Lookup IP: {$report_ip}">{$report_ip}</a></td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<th>Description:</th>
|
||||
<td>{$report_description}</td>
|
||||
</tr>
|
||||
</table>{/if}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<h4>Unique Users</h4>
|
||||
<p>{$users_quant}</p>
|
||||
|
||||
<h4>Total Reports</h4>
|
||||
<p>{$reports_quant}</p>
|
||||
|
||||
<h4>Reports Per User</h4>
|
||||
<p>{$avgRepPerUsr}</p>
|
||||
|
||||
<h4>Hostnames found in the system</h4>
|
||||
<p>{$hosts_quant}</p>
|
||||
|
||||
<h4>Reports in the last 24 hours</h4>
|
||||
<p>{$reports24}</p>
|
||||
|
||||
<h4>Reports in the last 7 days</h4>
|
||||
<p>{$last7days}</p>
|
Загрузка…
Ссылка в новой задаче