inital landing of reporter webtool!

lacks documentation, some things still not implemented.  A functional work in progress.

a=asa
This commit is contained in:
robert%accettura.com 2005-01-28 04:01:32 +00:00
Родитель 71a87945dc
Коммит ec1c88cc67
15 изменённых файлов: 1956 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,59 @@
<?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 ***** */
?>
<hr class="hide">
<div id="footer">
<ul id="bn">
<li><a href="http://planet.mozilla.org">Community Blogs</a></li>
<li><a href="sitemap.html">Site Map</a></li>
<li><a href="security/">Security Updates</a></li>
<li><a href="contact/">Contact Us</a></li>
<li><a href="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 &copy; 1998-2004 The Mozilla Organization</p>
</div>
<!-- closes #footer-->
</div>
<!-- closes #container -->
</body>
</html>

Просмотреть файл

@ -0,0 +1,96 @@
<?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 ***** */
printheaders();
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title><?php print $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="<?php print $config['app_url']; ?>/style.css" media="all">
<link rel="icon" href="images/mozilla-16.png" type="image/png">
<link rel="alternate" type="application/rss+xml" title="Mozilla Announcements" href="http://www.mozilla.org/news.rdf">
<link rel="alternate" type="application/rss+xml" title="Mozilla Weblogs" href="http://planet.mozilla.org/rss10.xml">
<link rel="alternate" type="application/rss+xml" title="mozillaZine News" href="http://www.mozillazine.org/atom.xml">
<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="menu_aboutus"><a href="about/" title="Getting the most out of your online experience">About</a></li>
<li id="menu_developers"><a href="developer/" title="Using Mozilla's products for your own applications">Developers</a></li>
<li id="menu_store"><a href="http://www.mozillastore.com/?r=mozorg1" title="Shop for Mozilla products on CD and other merchandise">Store</a></li>
<li id="menu_support"><a href="support/" title="Installation, trouble-shooting, and the knowledge base">Support</a></li>
<li id="menu_products"><a href="products/" title="All software Mozilla currently offers">Products</a></li>
</ul>
<form id="search" method="get" action="http://www.google.com/custom" title="Mozilla.org Search">
<div>
<label for="q" title="Search mozilla.org&quot;s sites">search mozilla:</label>
<input type="hidden" name="cof" value="LW:174;LH:60;L:http://www.mozilla.org/images/mlogosm.gif;GIMP:#cc0000;T:black;ALC:#0000ff;GFNT:grey;LC:#990000;BGC:white;AH:center;VLC:purple;GL:0;GALT:#666633;AWFID:9262c37cefe23a86;">
<input type="hidden" name="domains" value="mozilla.org">
<input type="hidden" name="sitesearch" value="mozilla.org">
<input type="text" id="q" name="q" accesskey="s" size="30">
<input type="submit" id="submit" value="Go">
</div>
</form>
</div>
<!-- closes #header-->
<h1>Mozilla Reporter</h1>

Просмотреть файл

@ -0,0 +1,296 @@
<?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 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;
reset($problemTypes);
while (list($key, $val) = each($problemTypes)) {
if (isset($val[$q])) {
$result = $val[$q];
}
}
return $result;
}
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"> &//8230; '."\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">&laquo;</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">&raquo;</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: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('X-Powered-By: A Barrel of Monkey\'s ');
}
?>

Просмотреть файл

@ -0,0 +1,46 @@
<?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 ***** */
// Message
// to turn off, set it to ''
$message = '';
if ($message != ''){
?><div id="message"><?php print $message; ?></div><?php
}
?>

Просмотреть файл

@ -0,0 +1,72 @@
<?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 = '".$username."' AND user.user_password = md5('".$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, '');
} else {
return array(false, 'Bad Status');
}
return true;
}
function isLoggedIn(){
if ($_SESSION['user_username'] && $_SESSION['login'] == true){
return true;
}
else {
return false;
}
}
// End Class
}
$userlib = new userlib;
?>

Просмотреть файл

@ -0,0 +1,188 @@
<?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/security.inc.php');
require_once($config['app_path'].'/includes/iolib.inc.php');
// Start Session
session_name('reportSessID');
session_start();
header("Cache-control: private"); //IE 6 Fix
include($config['app_path'].'/includes/header.inc.php');
include($config['app_path'].'/includes/message.inc.php');
?>
<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>
</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_0" VALUE="0_0" <?php if (($_GET['report_problem_type'] == '0_0') || ($_GET['report_problem_type'] == '')) { ?>checked="true"<?php } ?>><label for="0_0">All types</label><br>
<input type="radio" name="report_problem_type" ID="1_1" VALUE="1_1" <?php if ($_GET['report_problem_type'] == '1_1') { ?>checked="true"<?php } ?>><label for="1_1">Program freezes</label><br>
<input type="radio" name="report_problem_type" ID="1_2" VALUE="1_2" <?php if ($_GET['report_problem_type'] == '1_2') { ?>checked="true"<?php } ?>><label for="1_2">Program crashes</label><br>
<input type="radio" name="report_problem_type" ID="2_1" VALUE="2_1" <?php if ($_GET['report_problem_type'] == '2_1') { ?>checked="true"<?php } ?>><label for="2_1">Program slows down</label><br>
<input type="radio" name="report_problem_type" ID="3_1" VALUE="3_1" <?php if ($_GET['report_problem_type'] == '3_1') { ?>checked="true"<?php } ?>><label for="3_1">Page displays improperly</label><br>
<input type="radio" name="report_problem_type" ID="3_2" VALUE="3_2" <?php if ($_GET['report_problem_type'] == '3_2') { ?>checked="true"<?php } ?>><label for="3_2">Page does not display</label><br>
<input type="radio" name="report_problem_type" ID="3_3" VALUE="3_3" <?php if ($_GET['report_problem_type'] == '3_3') { ?>checked="true"<?php } ?>><label for="3_3">Page does not work properly</label><br>
<input type="radio" name="report_problem_type" ID="3_4" VALUE="3_4" <?php if ($_GET['report_problem_type'] == '3_4') { ?>checked="true"<?php } ?>><label for="3_4">Page does not load</label><br>
<input type="radio" name="report_problem_type" ID="3_5" VALUE="3_5" <?php if ($_GET['report_problem_type'] == '3_5') { ?>checked="true"<?php } ?>><label for="3_5">Program blocked/("Netscape not supported")</label><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" <?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'); ?>

Просмотреть файл

@ -0,0 +1,117 @@
<?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('DB.php');
require_once($config['app_path'].'/includes/iolib.inc.php');
require_once($config['app_path'].'/includes/security.inc.php');
// Start Session
session_name('reportSessID');
session_start();
header("Cache-control: private"); //IE 6 Fix
include($config['app_path'].'/includes/header.inc.php');
include($config['app_path'].'/includes/message.inc.php');
if (isset($_POST['redirect'])){
$redirect = $_POST['redirect'];
}
else if (isset($_GET['redirect'])){
$redirect = $_GET['redirect'];
}
else {
$redirect = $config['app_url'];
}
if ($_SESSION['login'] != true){
// submit form?
if (isset($_POST['submit_login'])){
// Open DB
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handleErrors');
$db =& DB::connect($config['db_dsn']);
$loginCheck = false;
$loginCheck = $userlib->login($_POST['username'], $_POST['password']);
// disconnect database
$db->disconnect();
if ($loginCheck[0] == true){
header("Location: ".$redirect);
exit;
} else {
$error = true;
?>Login Failed<?php
}
}
?>
<table>
<tr>
<td>
<fieldset>
<legend>Login</legend>
<form method="post" action ="<?php print $config['app_url']; ?>/login/" ID="login">
<table>
<tr>
<td><label for="username">Username: </label></td>
<td><input type="text" id="username" name="username" <?php if ($error == true){ print 'value="'.$_POST['username'].'" ';}?>/></td>
</tr>
<tr>
<td><label for="password">Password: </label></td>
<td><input type="password" id="password" name="password" /></td>
</tr>
</table>
<input type="hidden" id="redirect" name="redirect" value="<?php print $redirect; ?>" />
<input type="submit" id="submit_login" name="submit_login" value="Login" />
</form>
</fieldset>
</td>
<td valign="top">
<h5>Administrator Login</h5>
<p>Contact <a href="http://robert.accettura.com/contact/?subject=Reporter%20Access%20Request">Robert Accettura</a> if you need an admin account. This is for special circumstances only.</p>
</td>
</tr>
</table>
<?
} else {
header("Location: ".$redirect);
}
include($config['app_path'].'/includes/footer.inc.php');
?>

Просмотреть файл

@ -0,0 +1,62 @@
<?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');
// start the session
session_name('reportSessID');
session_start();
header("Cache-control: private"); //IE 6 Fix
$_SESSION = array();
session_destroy();
if (isset($_GET['redirect'])){
$redirect = $_GET['redirect'];
} else {
$redirect = $config['app_url'];
}
if($_SESSION['username']){
// not sure if this could ever happen, but just incase.
echo 'Failed to logout';
} else {
header("Location: ".$redirect);
}
?>

Просмотреть файл

@ -0,0 +1,280 @@
<?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('DB.php');
require_once($config['app_path'].'/includes/iolib.inc.php');
$title = "Searching Results";
include($config['app_path'].'/includes/header.inc.php');
include($config['app_path'].'/includes/message.inc.php');
// Ascending or Descending
if (!$_GET['ascdesc']){
$ascdesc = 'asc';
} else {
$ascdesc = $_GET['ascdesc'];
}
// order by
if (!$_GET['orderby']){
$orderby = 'report_file_date';
} else {
$orderby = $_GET['orderby'];
}
if (!$_GET['show']){
$_GET['show'] = $config['show'];
}
// no more than 200 results per page
if (!$_GET['show'] > 200){
$_GET['show'] = 200;
}
if (!$_GET['page']){
$_GET['page'] = 1;
}
if (isset($_GET['count']) && $_GET['count'] == null){
$_GET['count'] = 'host_id';
}
// Open DB
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handleErrors');
$db =& DB::connect($config['db_dsn']);
$selected = array('report_id' => 'Report ID', 'host_hostname' => 'Host', 'report_file_date' => "Date");
if (isset($_GET['count'])){
$selected['count'] = 'Number';
unset($selected['report_id']);
}
// Build SELECT clause of SQL
reset($selected);
while (list($key, $title) = each($selected)) {
if ($key == 'count'){
$sql_select .= 'COUNT( `'.$db->escapeSimple($_GET['count']).'` ) AS count';
} else {
$key = $db->escapeSimple($key);
$sql_select .= "`$key`";
}
$sql_select .= ',';
}
$sql_select = substr($sql_select, 0, -1);
if (isset($_GET['count'])){
$group_by = "GROUP BY ".$db->escapeSimple($_GET['count']);
}
// Build the Where clause of the SQL
if (isset($_GET['submit_reportID'])){
$sql_where = "report_id = '".$db->escapeSimple($_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_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
$sql_where .= $db->escapeSimple($param)." ".$operator." '".$db->escapeSimple($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 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->escapeSimple($_GET['report_file_date_start'])."' and '".$db->escapeSimple($_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->escapeSimple($_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->escapeSimple($_GET['report_file_date_end'])."' AND ";
}
}
$sql_where .= 'host.host_id = report_host_id AND ';
$sql_where = substr($sql_where, 0, -5);
} else {
?><h1>No Query</h1><?php
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
$start = ($_GET['page']-1)*$_GET['show'];
print "<!-- SELECT $sql_select
FROM `report`, `host`
WHERE $sql_where
ORDER BY ".$db->escapeSimple($orderby)." ".$db->escapeSimple($ascdesc).
" LIMIT $start, ".$db->escapeSimple($_GET['show'])."-->";
$result = $db->query("SELECT $sql_select
FROM `report`, `host`
WHERE $sql_where
$group_by
ORDER BY ".$db->escapeSimple($orderby)." ".$db->escapeSimple($ascdesc).
" LIMIT $start, ".$db->escapeSimple($_GET['show']));
$numresults = $result->numRows();
if (isset($_GET['count'])){
$totalresults = 2;
}
else {
$totalresults = $db->getRow("SELECT count(*)
FROM `report`, `host`
WHERE $sql_where");
$totalresults = $totalresults[0];
}
?><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.'='.$val.'&amp;';
}
reset($selected);
while (list($key, $title) = each($selected)) { ?>
<th><a href="<?php print $config['self']; ?>?orderby=<?php print $key; ?>&amp;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 print $title; ?></a></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; $row = $result->fetchRow(DB_FETCHMODE_ASSOC); $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='.$row[$key] ?>">Report</a><?php
}
else if (substr($key, 0, 5) == "COUNT"){
print $row['count'];
} else {
if($key == $_GET['count']){
?><a href="<?php print $config['app_url']; ?>/query/?<?PHP print $_GET['count'].'='.$row[$key]; ?>&submit_query=true">
<?PHP print $row[$key]; ?></a>
<?PHP }
else {
print $row[$key];
}
} ?>
</td>
<?php $count++;
} ?>
</tr>
<?php }
}
?>
<?php // disconnect database
$db->disconnect();
?>
</table>
<?php
reset($_GET);
while (list($param, $val) = each($_GET)) {
if (($param != 'page') && ($param != 'show'))
$paginate_params .= $param.'='.$val.'&amp;';
}
$paginate_params = substr($paginate_params, 0, -5);
?>
<?php print navigation('?page=', '&amp;'.$paginate_params.'&amp;show='.$_GET['show'], $totalresults, $_GET['show'], $_GET['page']); ?>
<p><a href="<?PHP print $config['app_url']; ?>/?<?PHP print $continuity_params; ?>">Edit Query</a> &nbsp; | &nbsp; <a href="<?PHP print $config['app_url']; ?>/">New Query</a></p>
<?php include($config['app_path'].'/includes/footer.inc.php'); ?>

Просмотреть файл

@ -0,0 +1,146 @@
<?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('DB.php');
require_once($config['app_path'].'/includes/iolib.inc.php');
require_once($config['app_path'].'/includes/security.inc.php');
// Start Session
session_name('reportSessID');
session_start();
header("Cache-control: private"); //IE 6 Fix
// Open DB
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handleErrors');
$db =& DB::connect($config['db_dsn']);
$data =& $db->getRow("SELECT *
FROM report, host
WHERE report.report_id = '".$_GET['report_id']."'
AND host.host_id = report_host_id", DB_FETCHMODE_ASSOC);
// disconnect database
$db->disconnect();
$title = "Report for - ".$data['host_hostname'];
include($config['app_path'].'/includes/header.inc.php');
include($config['app_path'].'/includes/message.inc.php');
if (!$data){
?><h1>No Report Found</h1><?php
exit;
}
?>
<table id="report_table">
<tr>
<th>Report ID:</th>
<td><?php print $data['report_id']; ?></td>
</tr>
<tr>
<th>URL:</th>
<td><a href="<?php print $data['report_url']; ?>" target="_blank"><?php print $data['report_url']; ?></a></td>
</tr>
<tr>
<th>Host:</th>
<td><a href="<?php print $config['app_url']; ?>/query/?host_hostname=<?php print $data['host_hostname']; ?>&submit_query=Query">Reports For This Host</a></td>
</tr>
<tr>
<th>Problem Type:</th>
<td><?php print resolveProblemTypes($data['report_problem_type']); ?></td>
</tr>
<tr>
<th>Behind Login:</th>
<td><?php print $boolTypes[$data['report_behind_login']]; ?></td>
</tr>
<tr>
<th>Product:</th>
<td><?php print $data['report_product']; ?></td>
</tr>
<tr>
<th>Gecko:</th>
<td><?php print $data['report_gecko']; ?></td>
</tr>
<tr>
<th>Useragent:</th>
<td><?php print $data['report_useragent']; ?></td>
</tr>
<tr>
<th>Build Config:</th>
<td><?php print $data['report_buildconfig']; ?></td>
</tr>
<tr>
<th>Platform:</th>
<td><?php print $data['report_platform']; ?></td>
</tr>
<tr>
<th>OS:</th>
<td><?php print $data['report_oscpu']; ?></td>
</tr>
<tr>
<th>Language:</th>
<td><?php print $data['report_language']; ?></td>
</tr>
<tr>
<th>Date Filed:</th>
<td><?php print $data['report_file_date']; ?></td>
</tr>
<?php if ($userlib->isLoggedIn()){ ?>
<tr>
<th>Email:</th>
<td><a href="mailto:<?php print $data['report_email']; ?>"><?php print $data['report_email']; ?></a></td>
</tr>
<tr>
<th>IP:</th>
<td><a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php print $data['report_ip']; ?>" target="_blank"><?php print $data['report_ip']; ?></a></td>
</tr>
<?php } ?>
<tr>
<th>Description:</th>
<td><?php print str_replace("\n", "<br />", $data['report_description']); ?></td>
</tr>
</table>
<!--report_ip-->
<?php include($config['app_path'].'/includes/footer.inc.php'); ?>

Просмотреть файл

@ -0,0 +1,75 @@
#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,106 @@
<?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 ***** */
// Debug
$config['debug'] = false;
// Paths
$config['app_url'] = 'http://reporter.host.tld/app';
$config['app_path'] = '/opt/webtools/reporter';
$config['pear_path'] = ''; // empty if use default system path
ini_set('include_path', $config['pear_path'] . PATH_SEPARATOR . ini_get('include_path'));
$config['nusoap_path'] = $config['app_path'].'/contrib/nusoap';
// Database
$config['db_type'] = 'mysql';
$config['db_server'] = 'localhost';
$config['db_user'] = 'USERNAME';
$config['db_pass'] = 'PASSWORD';
$config['db_database'] = 'DATABASE_NAME';
$config['db_dsn'] = $config['db_type'].'://'.$config['db_user'].':'.$config['db_pass'].'@'.$config['db_server'].'/'.$config['db_database'];
$config['db_options'] = array(
'debug' => 2,
'portability' => DB_PORTABILITY_ALL,
);
$config['gzip'] = false; // should we gzip encode (more cpu, less bandwidth) XX-> Not implemented
$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['show'] = 25;
/*****************************/
// 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
$problemTypes['0_0'] = '--';
$problemTypes['Crash']['1_1'] = 'Freeze';
$problemTypes['Crash']['1_2'] = 'Crashes Mozilla';
$problemTypes['Performance']['2_1'] = 'Slows Down Mozilla';
$problemTypes['Compatibility']['3_1'] = 'Appears Wrong';
$problemTypes['Compatibility']['3_2'] = 'Doesn\'t Appear';
$problemTypes['Compatibility']['3_3'] = 'Doesn\'t Function Properly';
$problemTypes['Compatibility']['3_4'] = 'Doesn\'t Load';
$problemTypes['Compatibility']['3_5'] = 'Mozilla Blocked / ("Netscape Not Supported")';
$problemTypes['Compatibility']['3_6'] = 'Appears Wrong';
// DB Debug code
function handleErrors($error) {
echo "<hr />";
echo "An error occurred while trying to run your query.<br>\n";
echo "Error message: " . $error->getMessage() . "<br>\n";
echo "A more detailed error description: " . $error->getDebugInfo() . "<br>\n";
echo "<hr />";
exit;
}
?>

45
tools/reporter/index.php Normal file
Просмотреть файл

@ -0,0 +1,45 @@
<?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,99 @@
<?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');
if (!isset($_GET['plain'])) {
include($config['app_path'].'/includes/header.inc.php');
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php print $title; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
body {
padding: 5px;
}
body, h1, h2, h3, h4, h5, h6, li {
font-family: verdana, sans-serif;
font-size: x-small;
voice-family: "\"}\"";
voice-family: inherit;
font-size: small;
}
h1, h2, h3, h4, h5, h6 {
margin: 1em 0 0.2em 0;
font-family: arial, verdana, sans-serif;
}
li h1, li h2, li h3, li h4, li h5, li h6 {
border: none;
}
#header h1 { border: 0; }
h1 { font-size: 160%; font-weight: normal; }
h2 { font-size: 150%; font-weight: normal; }
h3 { font-size: 120%; }
h4 { font-size: 100%; }
h5 { font-size: 90%; }
h6 { font-size: 90%; border: 0; }
}
</style>
<?php } ?>
<h4>How it works</h4>
<p>When you find a site, simply launch the reporter in the help menu, and fill out the short form. Then submit it</p>
<h4>Why should I participate</h4>
<p>By helping alert us of broken websites, we can work with the webmaster to correct the problem, and make the website compatible. You can help make sure Mozilla can access the entire internet</p>
<h4>What about my privacy</h4>
<p>Your privacy is important. We do collect some information, but we only make anonymous bits of it available in to the general community. We collect the following: information.</p>
<ul>
<li>List for the paranoid goes here</li>
<li>To do later</li>
</ul>
<?php
if (!isset($_GET['plain'])) {
include($config['app_path'].'/includes/footer.inc.php');
} else {
?> </body>
</html>
<?php } ?>

Просмотреть файл

@ -0,0 +1,269 @@
<?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('DB.php');
require_once($config['nusoap_path'].'/nusoap.php');
// Create the server instance
$server = new soap_server;
// Register the method to expose
// Note: with NuSOAP 0.6.3, only method name is used w/o WSDL
$server->register(
'register', // method name
array('language' => 'xsd:string',), // input parameters
array('return' => 'xsd:string'), // output parameters
'uri:MozillaReporter', // namespace
'uri:MozillaReporter/register', // SOAPAction
'rpc', // style
'encoded' // use
);
$server->register(
'submitReport', // method name
array('rmoVers' => 'xsd:string',
'url' => 'xsd:string',
'problem_type' => 'xsd:string',
'description' => 'xsd:string',
'behind_login' => 'xsd:string',
'platform' => 'xsd:string',
'oscpu' => 'xsd:string',
'gecko' => 'xsd:string',
'product' => 'xsd:string',
'useragent' => 'xsd:string',
'buildconfig' => 'xsd:string',
'language' => 'xsd:string',
'email' => 'xsd:string',
'sysid' => 'xsd:string'), // input parameters
array('return' => 'xsd:string'), // output parameters
'uri:MozillaReporter', // namespace
'uri:MozillaReporter/submitReport', // SOAPAction
'rpc', // style
'encoded' // use
);
function submitReport($rmoVers, $url, $problem_type, $description, $behind_login, $platform, $oscpu, $gecko, $product, $useragent, $buildconfig, $language, $email, $sysid) {
global $config;
// check verison
if ($rmoVers < $config['min_vers']){
return new soap_fault('Client', '', 'Your product is out of date, please upgrade. See http://reporter-test.mozilla.org/install for details.', $rmoVers);
}
$parsedURL = parse_url($url);
if (!$url || !$parsedURL['host']){
return new soap_fault('Client', '', 'url must use a valid URL syntax http://domain.tld/foo', $url);
}
if (!$problem_type || $problem_type == -1 || $problem_type == "0_0") {
}
if ($behind_login != 1 && $behind_login != 0) {
return new soap_fault('Client', '', 'behind_login must be type bool int', $behind_login);
}
if (!$platform) {
return new soap_fault('Client', '', 'Invalid Platform Type', $platform);
}
if (!$product) {
return new soap_fault('Client', '', 'Invalid Product', $product);
}
if (!$language) {
return new soap_fault('Client', '', 'Invalid Localization', $language);
}
/* not used until we have a way to gather this info
if (!$gecko) {
return new soap_fault('Client', '', 'Invalid Gecko ID', $gecko);
}*/
if (!$oscpu) {
return new soap_fault('Client', '', 'Invalid OS CPU', $oscpu);
}
if (!$useragent) {
return new soap_fault('Client', '', 'Invalid Useragent', $useragent);
}
if (!$buildconfig) {
return new soap_fault('Client', '', 'Invalid Build Config', $buildconfig);
}
if (!$sysid) {
return new soap_fault('Client', '', 'No SysID Entered', $sysid);
}
/* we don't require email... it's optional
if (!$email) {
return new soap_fault('Client', '', 'Invalid Email', $email);
}*/
// create report_id. We just MD5 it, becase we don't need people counting reports, since it's inaccurate.
// we can have dup's, so it's not a good thing for people to be saying 'mozilla.org reports 500,000 incompatable sites'
$report_id = 'RMO'.str_replace(".", "", array_sum(explode(' ', microtime())));
// Initialize Database
//PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handleErrorsSOAP');
$db =& DB::connect($config['db_dsn']);
$sysIDQuery = $db->query("SELECT `sysid_id` FROM `sysid` WHERE `sysid_id` = '".$db->escapeSimple($sysid)."'");
$sysidCount = $sysIDQuery->numRows();
if ($sysidCount != 1){
return new soap_fault('Client', '', 'Invalid SysID', $sysid);
}
$queryURL = $db->query("SELECT `host_id` FROM `host` WHERE `host_hostname` = '".$db->escapeSimple($parsedURL['host'])."'");
$resultURL = $queryURL->numRows();
if ($resultURL <= 0) {
// generate hash
$host_id = md5($parsedURL['host'].microtime());
// We add the URL
$addURL = $db->query("INSERT INTO `host` (`host_id`, `host_hostname`, `host_date_added`)
VALUES (
'".$db->escapeSimple($host_id)."',
'".$db->escapeSimple($parsedURL['host'])."',
now()
)
");
if (!$addURL) {
return new soap_fault('SERVER', '', 'Database Error');
}
}
else if ($resultURL == 1) {
// pull the hash from DB
$queryURLResult = $queryURL->fetchRow(DB_FETCHMODE_ASSOC);
$host_id = $queryURLResult['host_id'];
} else{
return new soap_fault('SERVER', '', 'Host Exception Error');
}
$addReport = $db->query("INSERT INTO `report` (
`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`,
`report_sysid`
)
VALUES (
'".$db->escapeSimple($report_id)."',
'".$db->escapeSimple($url)."',
'".$db->escapeSimple($host_id)."',
'".$db->escapeSimple($problem_type)."',
'".$db->escapeSimple($description)."',
'".$db->escapeSimple($behind_login)."',
'".$db->escapeSimple($useragent)."',
'".$db->escapeSimple($platform)."',
'".$db->escapeSimple($oscpu)."',
'".$db->escapeSimple($language)."',
'".$db->escapeSimple($gecko)."',
'".$db->escapeSimple($buildconfig)."',
'".$db->escapeSimple($product)."',
'".$db->escapeSimple($email)."',
'".$db->escapeSimple($_SERVER['REMOTE_ADDR'])."',
now(),
'".$db->escapeSimple($sysid)."'
)
");
// Disconnect Database
$db->disconnect();
if (!$addReport) {
return new soap_fault('SERVER', '', 'Database Error');
} else {
return $report_id;
}
}
function register($language){
global $config;
// Initialize Database
//PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handleErrorsSOAP');
$db =& DB::connect($config['db_dsn']);
// generate an ID
$unique = false;
// in theory a collision could happen, though unlikely. So just to make sure, we do this
// since that would really suck
while (!$unique) {
$id = date("ymd").rand(1000,9999);
$query =& $db->query("SELECT sysid.sysid_id
FROM sysid
WHERE sysid.sysid_id = '$newid'
");
$numRows = $query->numRows();
if ($numRows == 0) {
// It's unique, stop the loop.
$unique = true;
}
}
$addsysid = $db->query("INSERT INTO `sysid` (
`sysid_id`,
`sysid_created`,
`sysid_created_ip`,
`sysid_language`
)
VALUES (
'".$id."',
now(),
'".$_SERVER['REMOTE_ADDR']."',
'".$db->escapeSimple($language)."'
)
");
// Disconnect Database
$db->disconnect();
if (!$addsysid) {
return new soap_fault('SERVER', '', 'Database Error');
} else {
return $id;
}
}
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>