From d4e36ce758902b06ea4a2d18f93f88be7591f515 Mon Sep 17 00:00:00 2001 From: "robert%accettura.com" Date: Fri, 10 Jun 2005 03:58:46 +0000 Subject: [PATCH] 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 git-svn-id: svn://10.0.0.236/trunk@174399 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/tools/reporter/app/index.php | 178 ++----- mozilla/tools/reporter/app/login/index.php | 4 +- mozilla/tools/reporter/app/logout/index.php | 3 +- mozilla/tools/reporter/app/query/index.php | 437 ++++++++++-------- mozilla/tools/reporter/app/report/index.php | 117 ++--- mozilla/tools/reporter/app/style.css | 63 +-- mozilla/tools/reporter/config-default.inc.php | 142 ++++++ .../reporter/includes/contrib/README.txt | 25 + mozilla/tools/reporter/includes/iolib.inc.php | 344 ++++++++++++++ .../tools/reporter/includes/security.inc.php | 67 +++ mozilla/tools/reporter/index.php | 4 +- mozilla/tools/reporter/sql/schema.sql | 95 ++++ mozilla/tools/reporter/templates/index.tpl | 136 ++++++ mozilla/tools/reporter/templates/layout.tpl | 72 +++ mozilla/tools/reporter/templates/query.tpl | 18 + mozilla/tools/reporter/templates/report.tpl | 66 +++ mozilla/tools/reporter/templates/stats.tpl | 17 + 17 files changed, 1322 insertions(+), 466 deletions(-) create mode 100644 mozilla/tools/reporter/config-default.inc.php create mode 100644 mozilla/tools/reporter/includes/contrib/README.txt create mode 100644 mozilla/tools/reporter/includes/iolib.inc.php create mode 100644 mozilla/tools/reporter/includes/security.inc.php create mode 100644 mozilla/tools/reporter/sql/schema.sql create mode 100644 mozilla/tools/reporter/templates/index.tpl create mode 100644 mozilla/tools/reporter/templates/layout.tpl create mode 100644 mozilla/tools/reporter/templates/query.tpl create mode 100644 mozilla/tools/reporter/templates/report.tpl create mode 100644 mozilla/tools/reporter/templates/stats.tpl diff --git a/mozilla/tools/reporter/app/index.php b/mozilla/tools/reporter/app/index.php index 4fbc4641fa9..421b05aa6e3 100644 --- a/mozilla/tools/reporter/app/index.php +++ b/mozilla/tools/reporter/app/index.php @@ -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'); ?> - -
- Look up Report -
- - - - -
-
- - -
- Search for a Report -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- checked="true">
- checked="true">
- checked="true">
- checked="true">
- checked="true">
-
- checked="true">
- checked="true">
- checked="true">
- checked="true">
-
-
- -
checked="checked" >
-
- checked="true">
- $title){ ?> - checked="true">
- -
- checked="true"> - checked="true"> - checked="true"> -
- -
-
-
- -
-isLoggedIn()){ ?> -Welcome | Logout - -You are not logged in - -
- - -

-
-

Wildcards

-

Description, Hostname, Useragent support wildcards.

-

% will search for 0+ characters, _ (underscore) is for a single character.

-
- - diff --git a/mozilla/tools/reporter/app/login/index.php b/mozilla/tools/reporter/app/login/index.php index 72b909b7bf9..10d575584d1 100644 --- a/mozilla/tools/reporter/app/login/index.php +++ b/mozilla/tools/reporter/app/login/index.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'); -?> \ No newline at end of file +?> diff --git a/mozilla/tools/reporter/app/logout/index.php b/mozilla/tools/reporter/app/logout/index.php index 52b5039fab2..ee7c3007d18 100644 --- a/mozilla/tools/reporter/app/logout/index.php +++ b/mozilla/tools/reporter/app/logout/index.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); } -?> \ No newline at end of file +?> diff --git a/mozilla/tools/reporter/app/query/index.php b/mozilla/tools/reporter/app/query/index.php index e339c6213e8..31b1be9a805 100644 --- a/mozilla/tools/reporter/app/query/index.php +++ b/mozilla/tools/reporter/app/query/index.php @@ -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 { - ?>

No Query

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.'&'; + } + } } -?> - - - - - - - - - - EOF; $i++) { ?> - class="alt" > - - - - - MoveNext(); - } - } - ?> +$continuity_params .= 'submit_query=Search'; +if(isset($_GET['count'])){ + $continuity_params .= '&count=on'; +} -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'); ?> -
- - - -

No Results found

Reportfields['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]; - } - ?> - fields[$key]; ?> - fields[$key]; - } - } ?> -
- - -

Edit Query   |   New Query

- diff --git a/mozilla/tools/reporter/app/report/index.php b/mozilla/tools/reporter/app/report/index.php index ca7a5d05517..d0af4da5f6b 100644 --- a/mozilla/tools/reporter/app/report/index.php +++ b/mozilla/tools/reporter/app/report/index.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){ - ?>

No Report Found

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); ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - isLoggedIn()){ ?> - - - - - - - - - - - - - -
Report ID:fields['report_id']; ?>
URL:fields['report_url']; ?>
Host:Reports For This Host
Problem Type:fields['report_problem_type']); ?>
Behind Login:fields['report_behind_login']]; ?>
Product:fields['report_product']; ?>
Gecko:fields['report_gecko']; ?>
Useragent:fields['report_useragent']; ?>
Build Config:fields['report_buildconfig']; ?>
Platform:fields['report_platform']; ?>
OS:fields['report_oscpu']; ?>
Language:fields['report_language']; ?>
Date Filed:fields['report_file_date']; ?>
Email:fields['report_email']; ?>
IP:fields['report_ip']; ?>
Description:", $query->fields['report_description']); ?>
- diff --git a/mozilla/tools/reporter/app/style.css b/mozilla/tools/reporter/app/style.css index 952cd7ff96a..56b70b9c877 100644 --- a/mozilla/tools/reporter/app/style.css +++ b/mozilla/tools/reporter/app/style.css @@ -18,58 +18,35 @@ } -#query_table th { - text-align: left; - background-color: #999; - color: #fff; - padding: 2px 0 2px 0; +#query_table .header{ + background-color: #e4ecec; } - -#query_table th>a { - color: #fff; +#query_table .header a { + color: #000; text-decoration: none; } -#query_table .alt { - background: #eee; +#query_table td { + border: 1px dotted #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; - } +.navigation { + font-size: 0.9em; +} #message { padding: 4px; margin: 8px 3px 12px 3px; background: #FFD1D1; border: 1px solid #FF0000; -} \ No newline at end of file +} +*/ + +.rmo_error { + border: 0; + text-align: center; +} + +#header h1 a { + background: transparent url("/app/img/logo.gif") no-repeat; +} diff --git a/mozilla/tools/reporter/config-default.inc.php b/mozilla/tools/reporter/config-default.inc.php new file mode 100644 index 00000000000..c72b30dbf60 --- /dev/null +++ b/mozilla/tools/reporter/config-default.inc.php @@ -0,0 +1,142 @@ +. + * + * 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'; + +?> diff --git a/mozilla/tools/reporter/includes/contrib/README.txt b/mozilla/tools/reporter/includes/contrib/README.txt new file mode 100644 index 00000000000..0a2293320f4 --- /dev/null +++ b/mozilla/tools/reporter/includes/contrib/README.txt @@ -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 + diff --git a/mozilla/tools/reporter/includes/iolib.inc.php b/mozilla/tools/reporter/includes/iolib.inc.php new file mode 100644 index 00000000000..3aeba284e91 --- /dev/null +++ b/mozilla/tools/reporter/includes/iolib.inc.php @@ -0,0 +1,344 @@ +. + * + * 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 = ' … '."\n\t".''; + + // 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 = '\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; +} +?> diff --git a/mozilla/tools/reporter/includes/security.inc.php b/mozilla/tools/reporter/includes/security.inc.php new file mode 100644 index 00000000000..446130e81fb --- /dev/null +++ b/mozilla/tools/reporter/includes/security.inc.php @@ -0,0 +1,67 @@ +. + * + * 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; +?> diff --git a/mozilla/tools/reporter/index.php b/mozilla/tools/reporter/index.php index d8434b8d171..56f5d9ea158 100644 --- a/mozilla/tools/reporter/index.php +++ b/mozilla/tools/reporter/index.php @@ -37,9 +37,9 @@ * ***** END LICENSE BLOCK ***** */ require_once('config.inc.php'); -require_once($config['app_path'].'/includes/iolib.inc.php'); +require_once($config['base_path'].'/includes/iolib.inc.php'); printheaders(); header("Location: app"); -?> \ No newline at end of file +?> diff --git a/mozilla/tools/reporter/sql/schema.sql b/mozilla/tools/reporter/sql/schema.sql new file mode 100644 index 00000000000..f0b4dfe82e4 --- /dev/null +++ b/mozilla/tools/reporter/sql/schema.sql @@ -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; diff --git a/mozilla/tools/reporter/templates/index.tpl b/mozilla/tools/reporter/templates/index.tpl new file mode 100644 index 00000000000..22335e0d70c --- /dev/null +++ b/mozilla/tools/reporter/templates/index.tpl @@ -0,0 +1,136 @@ +
+ Look up Report +
+ + + +
+
+ + +
+ Search for a Report +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+ {html_radios name="report_problem_type" options=$problem_types selected=$report_problem_type separator="
"} +
+ + + +
+ +
+ +
+
+
+{* +
+ isLoggedIn()){ ?> + Welcome | Logout + + You are not logged in + +
+*} +

+
+

Wildcards

+

Description, Hostname, Useragent support wildcards.

+

% will search for 0+ characters, _ (underscore) is for a single character.

+
+ diff --git a/mozilla/tools/reporter/templates/layout.tpl b/mozilla/tools/reporter/templates/layout.tpl new file mode 100644 index 00000000000..a24971dfdfe --- /dev/null +++ b/mozilla/tools/reporter/templates/layout.tpl @@ -0,0 +1,72 @@ + + + + + {$title} + + + + + + + + + + + + + + + + + +
+ + + + + +

Mozilla Reporter

+ +{$content} +
+ + + +
+ + + + diff --git a/mozilla/tools/reporter/templates/query.tpl b/mozilla/tools/reporter/templates/query.tpl new file mode 100644 index 00000000000..32073cfc051 --- /dev/null +++ b/mozilla/tools/reporter/templates/query.tpl @@ -0,0 +1,18 @@ +{if $error != ''}

Error: {$error}

{/if} +{if !$error} + + + {section name=mysec loop=$column} + + {/section} + + {section name=mysec2 loop=$row} + + {section name=col loop=$row[mysec2]} + + {/section} + + {/section} +
{if $column[mysec].url != null}{/if}{$column[mysec].title}{if $column[mysec].url != null}{/if}
{if $row[mysec2][col].url != null}{/if}{$row[mysec2][col].text|truncate:100}{if $row[mysec2][col].url != null}{/if}
+ +{/if} diff --git a/mozilla/tools/reporter/templates/report.tpl b/mozilla/tools/reporter/templates/report.tpl new file mode 100644 index 00000000000..74442facb77 --- /dev/null +++ b/mozilla/tools/reporter/templates/report.tpl @@ -0,0 +1,66 @@ +{if $error != ''}

Error: {$error}

{else} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{if $is_admin == true} + + + + + + + + +{/if} + + + + +
Report ID:{$report_id}
URL:{$report_url|truncate:60}
Host:Reports for {$host_hostname}
Problem Type:{$report_problem_type}
Behind Login:{$report_behind_login}
Product:{$report_product}
Gecko Version:{$report_gecko}
Platform:{$report_platform}
OS/CPU:{$report_oscpu}
Language:{$report_language}
User Agent:{$report_useragent}
Build Config:{$report_buildconfig}
Email:{$report_email}
IP Address:{$report_ip}
Description:{$report_description}
{/if} + diff --git a/mozilla/tools/reporter/templates/stats.tpl b/mozilla/tools/reporter/templates/stats.tpl new file mode 100644 index 00000000000..03a89760091 --- /dev/null +++ b/mozilla/tools/reporter/templates/stats.tpl @@ -0,0 +1,17 @@ +

Unique Users

+

{$users_quant}

+ +

Total Reports

+

{$reports_quant}

+ +

Reports Per User

+

{$avgRepPerUsr}

+ +

Hostnames found in the system

+

{$hosts_quant}

+ +

Reports in the last 24 hours

+

{$reports24}

+ +

Reports in the last 7 days

+

{$last7days}