Moving some files around for a more logical file structure, and to allow for using mod_rewrite to get friendly url's. While I'm at it, landing some theme related stuff.

This commit is contained in:
robert%accettura.com 2006-01-20 02:53:33 +00:00
Родитель 91408cf272
Коммит ca2237cb3d
24 изменённых файлов: 1215 добавлений и 0 удалений

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

@ -0,0 +1,232 @@
body {
margin: 0 30px 2em 30px;
color: #333;
background: #fff url("img/body_back.gif") repeat-x;
font-size: 100%;
}
body, td, th, h3, input, pre { /* redundant rules for bad browsers */
font-family: verdana, sans-serif;
voice-family: "\"}\"";
voice-family: inherit;
}
#container {
width: 100%;
margin: 0 auto;
}
#page {
padding: 15px 0 0 0;
}
#content {
background: url("img/page-background.gif") repeat-x top left;
font-size: 0.8em;
}
#mozilla-org {
position: relative;
height: 25px;
}
#mozilla-org a {
position: absolute;
right: 0;
top: 0;
display: block;
width: 110px;
height: 25px;
background: url("img/mozilla-org.gif") no-repeat;
text-decoration: none;
text-indent: -5000em;
}
.skipLink {
display: none;
}
#reporterSearch .label, #reporterSearch label {
font-weight: bold;
text-align: right;
}
#reporterQuery {
font-size: 0.9em;
}
#reporterQuery .header {
background-color: #ddd;
color: #666;
text-align: left;
}
#reporterQuery .header a {
color: #666;
text-decoration: none;
}
#reporterQuery td {
border-bottom: 1px solid #eee;
padding: 1px 0 1px 0;
font-size: 0.9em;
}
#reporterReport .header{
background-color: #eee;
width: 100%;
text-align: center;
font-weight: bold;
padding: 4px 0 4px 0;
}
#reporterReport div {
margin-bottom: 3px;
}
#reporterReport .title {
float: left;
width: 9em;
padding: 0 .5em;
text-align: right;
font-weight: bold;
}
#reporterReport .data {
overflow: auto;
}
#header{
margin: 20px 0 16px 0;
bottom: 1px solid #eee;
}
#header h1 {
display: inline;
font-size: 2.2em;
}
#header #logo {
margin: 0;
float: left;
width: 500px;
}
#header #logo a {
text-decoration: none;
color: #000;
}
#header a img {
border: 0;
}
#header #navbox {
float: right;
margin-top: 8px;
margin-right: 15px;
background-color: #eee;
border: 1px solid #333;
font-size: 0.8em;
}
#navbox ul {
padding: 0 0 0 8px;
}
#navbox li {
display: inline;
margin: 0;
padding: 0 8px 0 0;
text-align: left;
border: 0;
}
.navigation {
text-align: center;
margin: 12px auto 5px auto;
}
.navigation .currentPage {
font-weight: bold;
}
.navigation a {
text-decoration: none;
color: #000;
}
.navigation a:hover {
border-bottom: 2px solid #000;
}
#login_form label{
float: left;
width: 9em;
padding: 0 .5em;
text-align: right;
font-weight: bold;
}
#login_leftcol{
float: left;
width: 45%;
padding: 2px 9px 5px 9px;
}
#login_rightcol {
float: right;
width: 45%;
padding: 2px 9px 5px 9px;
}
/*
#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 .header{
background-color: #e4ecec;
}
#query_table .header a {
color: #000;
text-decoration: none;
}
#query_table td {
border: 1px dotted #eee;
}
.navigation {
font-size: 0.9em;
}
#message {
padding: 4px;
margin: 8px 3px 12px 3px;
background: #FFD1D1;
border: 1px solid #FF0000;
}
.rmo_error {
border: 0;
text-align: center;
}
#header h1 a {
background: transparent url("/app/img/logo.gif") no-repeat;
}
*/

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

@ -0,0 +1,15 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^app/query(/)?(.*)$ query.php$1 [QSA,L]
RewriteRule ^app/report(/)?(.*)$ report.php$1 [QSA,L]
RewriteRule ^app/stats(/)?(.*)$ stats.php$1 [QSA,L]
RewriteRule ^app/login(/)?(.*)$ login.php$1 [QSA,L]
RewriteRule ^app/logout(/)?(.*)$ logout.php$1 [QSA,L]
RewriteRule ^privacy(/)? privacy.php$1 [QSA,L]
RewriteRule ^service(/)? service.php$1 [QSA,L]
RewriteRule ^app index.php [QSA,L]
#Static Content
RewriteRule ^(scripts|styles)$/(.*)$ $1/$2 [QSA,L]
</IfModule>

Двоичные данные
tools/reporter/htdocs/img/reporter.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 6.6 KiB

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/body_back.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 791 B

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/header_bl.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/header_br.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 546 B

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/header_logo.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.0 KiB

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/header_tab.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.2 KiB

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/header_tl.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 836 B

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/header_tr.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 466 B

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/key-point_bl.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 102 B

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/menu_back.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 94 B

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/menu_br.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 384 B

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/menu_tr.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 107 B

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/mozilla-org.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичные данные
tools/reporter/htdocs/img/theme/mozilla/page-background.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 396 B

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

@ -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($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();
$content = initializeTemplate();
if(isset($_GET['report_description'])){
$content->assign('report_description', $_GET['report_description']);
}
if(isset($_GET['report_useragent'])){
$content->assign('report_useragent', $_GET['report_useragent']);
}
if(isset($_GET['report_gecko'])){
$content->assign('report_gecko', $_GET['report_gecko']);
}
if(isset($_GET['report_language'])){
$content->assign('report_language', $_GET['report_language']);
}
if(isset($_GET['report_platform'])){
$content->assign('report_platform', $_GET['report_platform']);
}
if(isset($_GET['report_oscpu'])){
$content->assign('report_oscpu', $_GET['report_oscpu']);
}
if(isset($config['products'])){
$content->assign('product_options', $config['products']);
}
if(isset($_GET['report_product'])){
$content->assign('report_product', $_GET['report_product']);
}
if(isset($_GET['report_file_date_start'])){
$content->assign('report_file_date_start', $_GET['report_file_date_start']);
}
if(isset($_GET['report_file_date_end'])){
$content->assign('report_file_date_end', $_GET['report_file_date_end']);
}
if(isset($_GET['show'])){
$content->assign('show', $_GET['show']);
}
if(isset($_GET['count'])){
$content->assign('count', $_GET['count']);
}
if(isset($_GET['host_hostname'])){
$content->assign('host_hostname', $_GET['host_hostname']);
}
if(isset($_GET['report_problem_type'])){
$content->assign('report_problem_type', $_GET['report_problem_type']);
}
if(isset($_GET['report_behind_login'])){
$content->assign('report_behind_login', $_GET['report_behind_login']);
}
if(isset($products)){
$content->assign('products', $products);
}
if(isset($problemTypes)){
$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 (isset($_GET['selected'])){
$content->assign('selected', $_GET['selected']);
}
else {
$content->assign('selected', array('report_id', 'host_hostname', 'report_file_date'));
}
displayPage($content, 'index', 'index.tpl');
?>

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

@ -0,0 +1,78 @@
<?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['base_path'].'/includes/iolib.inc.php');
require_once($config['base_path'].'/includes/db.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();
if (!isset($_SESSION['login']) || $_SESSION['login'] != true){
if(isset($_POST['do_login'])){
$login = false;
$db = NewDBConnection($config['db_dsn']);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$login = $securitylib->login($_POST['username'], $_POST['password']);
$db->Close();
if($login === true){
header('Location: '.$config['base_url']);
exit;
}
$content = initializeTemplate();
$content->assign('error', 'Incorrect Username or Password');
}
if(!isset($content)){
$content = initializeTemplate();
}
displayPage($content, 'login', 'login.tpl');
exit;
} else {
header('Location: '.$config['base_url']);
}
?>

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

@ -0,0 +1,57 @@
<?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['base_path'].'/includes/iolib.inc.php');
// start the session
session_name('reportSessID');
session_start();
header("Cache-control: private"); //IE 6 Fix
printheaders();
$_SESSION = array();
session_destroy();
if($_SESSION['username']){
// not sure if this could ever happen, but just in case.
echo 'Failed to logout';
} else {
header("Location: ".$config['base_url']);
}
?>

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

@ -0,0 +1,51 @@
<?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['base_path'].'/includes/iolib.inc.php');
if (!isset($_GET['plain'])) {
// URL for page formatted version
header("Location: ".$config['privacy_policy_web']);
exit;
} else {
// Plain version for inline use
header("Location: ".$config['privacy_policy_inline']);
exit;
}
?>

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

@ -0,0 +1,134 @@
<?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['base_path'].'/includes/iolib.inc.php');
require_once($config['base_path'].'/includes/db.inc.php');
require_once($config['base_path'].'/includes/contrib/smarty/libs/Smarty.class.php');
require_once($config['base_path'].'/includes/security.inc.php');
require_once($config['base_path'].'/includes/query.inc.php');
// start the session
session_name('reportSessID');
session_start();
header("Cache-control: private"); //IE 6 Fix
printheaders();
if(!$_GET['method']){
$method = 'html';
}
$title = "Searching Results";
$content = initializeTemplate();
$content->assign('method', $method);
// Open DB
$db = NewDBConnection($config['db_dsn']);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = new query;
$query_input = $query->getQueryInputs();
$continuityParams = $query->continuityParams($query_input, null);
$columnHeaders = $query->columnHeaders($query_input, $continuityParams);
$result = $query->doQuery($query_input['selected'],
$query_input['where'],
$query_input['orderby'],
$query_input['show'],
$query_input['page'],
$query_input['count']
);
$output = $query->outputHTML($result, $query_input, $continuityParams, $columnHeaders);
// disconnect database
$db->Close();
if (sizeof($output['data']) == 0){
$content->assign('error', 'No Results found');
displayPage($content, 'query', 'query.tpl');
exit;
}
// Start Next/Prev Navigation
/*******
* We cap the navigation at 2000 items because php sometimes acts wierd
* when sessions get to big. In most cases, this won't effect anyone.
*******/
if($result['totalResults'] < $config['max_nav_count']){
$_SESSION['reportList'] = $result['reportList'];
} else {
unset($_SESSION['reportList']);
$content->assign('notice', 'This query returned too many reports for next/previous navigation to work');
}
$content->assign('column', $columnHeaders);
$content->assign('row', $output['data']);
/* this particular continuity_params is for pagination (it doesn't include 'page') */
$content->assign('continuity_params', $query->continuityParams($query_input, array('page')));
/* Pagination */
$pages = ceil($result['totalResults']/$query_input['show']);
/* These variables are also used for pagination purposes */
$content->assign('count', $result['totalResults']);
$content->assign('show', $query_input['show']);
$content->assign('page', $query_input['page']);
$content->assign('pages', $pages);
if($query_input['page'] > 10){
$start = $query_input['page']-10;
}
if($query_input['page'] < 10){
$start = 1;
}
$content->assign('start', $start);
$content->assign('step', 1);
if(ceil($result['totalResults']/$query_input['show']) < 20){
$content->assign('amt', ceil($result['totalResults']/$query_input['show']));
} else {
$content->assign('amt', 20);
}
displayPage($content, 'query', 'query.tpl');
?>

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

@ -0,0 +1,130 @@
<?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['base_path'].'/includes/iolib.inc.php');
require_once($config['base_path'].'/includes/db.inc.php');
require_once($config['base_path'].'/includes/contrib/smarty/libs/Smarty.class.php');
require_once($config['base_path'].'/includes/security.inc.php');
require_once($config['base_path'].'/includes/query.inc.php');
// Start Session
session_name('reportSessID');
session_start();
header("Cache-control: private"); //IE 6 Fix
printheaders();
// Open DB
$db = NewDBConnection($config['db_dsn']);
$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");
// disconnect database
$db->Close();
$content = initializeTemplate();
if (!$query->fields){
$content->assign('error', 'No Report Found');
displayPage($content, 'report', 'report.tpl', 'Mozilla Reporter - Error');
exit;
}
$title = "Report for ".$query->fields['host_hostname']." - ".$query->fields['report_id'];
$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'].'&amp;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']);
// Last/Next Functionality
if(isset($_SESSION['reportList'])){
$query = new query;
$query_input = $query->getQueryInputs();
$continuity_params = $query->continuityParams($query_input, null);
$content->assign('continuity_params', $continuity_params);
$reportIndex = array_search($_GET['report_id'], $_SESSION['reportList']);
$content->assign('index', $reportIndex);
$content->assign('total', sizeof($_SESSION['reportList']));
$content->assign('showReportNavigation', true);
if($reportIndex > 0){
$content->assign('first_report', $_SESSION['reportList'][0]);
$content->assign('previous_report', $_SESSION['reportList'][$reportIndex-1]);
} else {
$content->assign('first_report', 'disable');
$content->assign('previous_report', 'disable');
}
if($reportIndex < sizeof($_SESSION['reportList'])-1){
$content->assign('next_report', $_SESSION['reportList'][$reportIndex+1]);
$content->assign('last_report', $_SESSION['reportList'][sizeof($_SESSION['reportList'])-1]);
} else {
$content->assign('next_report', 'disable');
$content->assign('last_report', 'disable');
}
} else {
$content->assign('showReportNavigation', false);
}
displayPage($content, 'report', 'report.tpl', $title);
?>

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

@ -0,0 +1,286 @@
<?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['base_path'].'/includes/iolib.inc.php');
require_once($config['base_path'].'/includes/contrib/adodb/adodb.inc.php');
require_once($config['base_path'].'/includes/contrib/nusoap/lib/nusoap.php');
// Turn off Error Reporting
error_reporting(0);
// 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;
// Remove any HTML tags and whitespace
$rmoVers = trim(strip_all_tags($rmoVers));
$url = trim(strip_all_tags($url));
$problem_type = trim(strip_all_tags($problem_type));
$description = trim(strip_all_tags($description));
$behind_login = trim(strip_all_tags($behind_login));
$platform = trim(strip_all_tags($platform));
$oscpu = trim(strip_all_tags($oscpu));
$gecko = trim(strip_all_tags($gecko));
$product = trim(strip_all_tags($product));
$useragent = trim(strip_all_tags($useragent));
$buildconfig = trim(strip_all_tags($buildconfig));
$language = trim(strip_all_tags($language));
$email = trim(strip_all_tags($email));
$sysid = trim(strip_all_tags($sysid));
// 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") {
}
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())));
// Open DB
$db = NewADOConnection($config['db_dsn']);
if (!$db) die("Connection failed");
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$sysIDQuery = $db->Execute("SELECT `sysid_id` FROM `sysid` WHERE `sysid_id` = ".$db->quote($sysid));
$sysidCount = $sysIDQuery->RecordCount();
if ($sysidCount != 1){
return new soap_fault('Client', '', 'Invalid SysID', $sysid);
}
$queryURL = $db->Execute("SELECT `host_id` FROM `host` WHERE `host_hostname` = ".$db->quote($parsedURL['host']));
$resultURL = $queryURL->RecordCount();
if ($resultURL <= 0) {
// generate hash
$host_id = md5($parsedURL['host'].microtime());
// We add the URL
$addURL = $db->Execute("INSERT INTO `host` (`host_id`, `host_hostname`, `host_date_added`)
VALUES (
".$db->quote($host_id).",
".$db->quote($parsedURL['host']).",
now()
)
");
if (!$addURL) {
return new soap_fault('SERVER', '', 'Database Error');
}
}
else if ($resultURL == 1) {
// pull the hash from DB
$host_id = $queryURL->fields['host_id'];
} else{
return new soap_fault('SERVER', '', 'Host Exception Error');
}
$addReport = $db->Execute("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->quote($report_id).",
".$db->quote($url).",
".$db->quote($host_id).",
".$db->quote($problem_type).",
".$db->quote($description).",
".$db->quote($behind_login).",
".$db->quote($useragent).",
".$db->quote($platform).",
".$db->quote($oscpu).",
".$db->quote($language).",
".$db->quote($gecko).",
".$db->quote($buildconfig).",
".$db->quote($product).",
".$db->quote($email).",
".$db->quote($_SERVER['REMOTE_ADDR']).",
now(),
".$db->quote($sysid)."
)
");
if (!$addReport) {
return new soap_fault('SERVER', '', 'Database Error');
} else {
return $report_id;
}
}
function register($language){
global $config;
// Open DB
$db = NewADOConnection($config['db_dsn']);
if (!$db) die("Connection failed");
$db->SetFetchMode(ADODB_FETCH_ASSOC);
// 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->Execute("SELECT sysid.sysid_id
FROM sysid
WHERE sysid.sysid_id = '$newid'
");
$numRows = $query->RecordCount();
if ($numRows == 0) {
// It's unique, stop the loop.
$unique = true;
}
}
$addsysid = $db->Execute("INSERT INTO `sysid` (
`sysid_id`,
`sysid_created`,
`sysid_created_ip`,
`sysid_language`
)
VALUES (
'".$id."',
now(),
'".$_SERVER['REMOTE_ADDR']."',
".$db->quote($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);
?>

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

@ -0,0 +1,115 @@
<?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['base_path'].'/includes/iolib.inc.php');
require_once($config['base_path'].'/includes/db.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
// Open DB
$db = NewADOConnection($config['db_dsn']);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$content = initializeTemplate();
// Total Reports
$reports_q =& $db->Execute("SELECT COUNT(*)
FROM report");
$reports = $reports_q->fields['COUNT(*)'];
$content->assign('reports_quant', $reports);
// Total Unique Users
$uniqueusers_q =& $db->Execute("SELECT COUNT(*)
FROM sysid");
$uniqueusers = $uniqueusers_q->fields['COUNT(*)'];
$content->assign('users_quant', $uniqueusers);
// Average # of reports per user
$avgRepPerUsr = $reports/$uniqueusers;
$content->assign('avgRepPerUsr', $avgRepPerUsr);
// Top Users (by reports)
// XXX TODO
// Total Reports per product
// XXX TODO
// Total Reports per platform
// XXX TODO
// Total Hosts
$uniquehosts_q =& $db->Execute("SELECT COUNT(*)
FROM host");
$uniquehosts = $uniquehosts_q->fields['COUNT(*)'];
$content->assign('hosts_quant', $uniquehosts);
// Reports in last 24 hours
$yesterday = mktime(date("H"), date("i"), date("s"), date("m") , date("d")-1, date("Y"));
$reports24_q =& $db->Execute("SELECT COUNT(*)
FROM report
WHERE report_file_date > "."'".date('Y-m-d H:i:s', $yesterday)."'");
$reports24 = $reports24_q->fields['COUNT(*)'];
$content->assign('reports24', $reports24);
// Reports in last week
$last7days = mktime(date("H"), date("i"), date("s"), date("m") , date("d")-7, date("Y"));
$last7days_q =& $db->Execute("SELECT COUNT(*)
FROM report
WHERE report_file_date > "."'".date('Y-m-d H:i:s', $last7days)."'");
$last7days = $last7days_q->fields['COUNT(*)'];
$content->assign('last7days', $last7days);
// Reports by month
// XXX TODO
// disconnect database
$db->Close();
$title = "Statistics";
displayPage($content, 'stats', 'stats.tpl');
?>