mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
e7aa393b43
- add proper unique keys to users table - check for empty username and/or passwords - compare the entered password against the db version instead of itself <- !!! - check form submissions in JS prior to submission - require a unique IRC nickname if it is provided, but allow users not to enter one if they so choose - display mailto: links for admins only - display account created page when updating accounts - make login look-and-feel consistent with the rest of the site b=321265 - add getDisplayName function to User.pm -> returns IRC nickname, real name, or email depending on what is available. Used wherever user information is displayed. b=324022 - add scrollbars to testcase display (css -> overflow: auto) b=324648 - use quotemeta in Testresults.pm to avoid SQL injection when searching results Misc: - update copyrights to 2006 - fix log_text db schema regression - remove validity_lookup and vetting_status_lookup tables and assoicated perl classes. Replaced by per-test-result fields. - remove out-of-date formats/ directory and contents - add functions to DBTools.pm to manipulate keys and drop tables - display error/success/info messages in a transient popup div - update version to 0.6. Make version string part of sidebar title. - allow re-testing of completed subgroups by same tester, i.e. don't disable subgroups with 100% testing coverage - remove 'next' regression on run_tests testcase display - comment out user table on stats page - whitespace fixes
198 lines
6.7 KiB
Perl
Executable File
198 lines
6.7 KiB
Perl
Executable File
#!/usr/bin/perl -w
|
|
# -*- mode: cperl; c-basic-offset: 8; indent-tabs-mode: nil; -*-
|
|
|
|
# ***** BEGIN LICENSE BLOCK *****
|
|
# Version: MPL 1.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 Litmus.
|
|
#
|
|
# The Initial Developer of the Original Code is
|
|
# the Mozilla Corporation.
|
|
# Portions created by the Initial Developer are Copyright (C) 2006
|
|
# the Initial Developer. All Rights Reserved.
|
|
#
|
|
# Contributor(s):
|
|
# Chris Cooper <ccooper@deadsquid.com>
|
|
# Zach Lipton <zach@zachlipton.com>
|
|
#
|
|
# ***** END LICENSE BLOCK *****
|
|
|
|
use strict;
|
|
|
|
# Litmus homepage
|
|
|
|
use Litmus;
|
|
use Litmus::Auth;
|
|
use Litmus::Error;
|
|
use Litmus::DB::Testresult;
|
|
use Litmus::FormWidget;
|
|
|
|
use CGI;
|
|
use Time::Piece::MySQL;
|
|
|
|
my $c = Litmus->cgi();
|
|
print $c->header();
|
|
|
|
use diagnostics;
|
|
|
|
my $criteria = "Custom<br/>";
|
|
my $results;
|
|
my @where;
|
|
my @order_by;
|
|
my $limit;
|
|
my $where_criteria = "";
|
|
my $order_by_criteria = "";
|
|
my $limit_criteria = "";
|
|
if ($c->param) {
|
|
foreach my $param ($c->param) {
|
|
next if ($c->param($param) eq '');
|
|
if ($param =~ /^order_by_(.*)$/) {
|
|
my $order_by_proto = quotemeta($1);
|
|
next if ($c->param($param) ne 'ASC' and
|
|
$c->param($param) ne 'DESC');
|
|
my $order_by_direction = $c->param($param);
|
|
push @order_by, {field => $order_by_proto,
|
|
direction => $order_by_direction};
|
|
$order_by_criteria .= "Order by $order_by_proto $order_by_direction<br/>";
|
|
} elsif ($param eq 'branch') {
|
|
my $value = quotemeta($c->param($param));
|
|
push @where, {field => $param,
|
|
value => $value};
|
|
$where_criteria .= "Branch is \'".$c->param($param)."\'<br/>";
|
|
} elsif ($param eq 'locale') {
|
|
my $value = quotemeta($c->param($param));
|
|
push @where, {field => 'locale',
|
|
value => $value};
|
|
$where_criteria .= "Locale is \'".$c->param($param)."\'<br/>";
|
|
} elsif ($param eq 'product') {
|
|
my $value = quotemeta($c->param($param));
|
|
push @where, {field => $param,
|
|
value => $value};
|
|
$where_criteria .= "Product is \'".$c->param($param)."\'<br/>";
|
|
} elsif ($param eq 'platform') {
|
|
my $value = quotemeta($c->param($param));
|
|
push @where, {field => $param,
|
|
value => $value};
|
|
$where_criteria .= "Platform is \'".$c->param($param)."\'<br/>";
|
|
} elsif ($param eq 'test_group') {
|
|
my $value = quotemeta($c->param($param));
|
|
push @where, {field => $param,
|
|
value => $value};
|
|
$where_criteria .= "Test group is \'".$c->param($param)."\'<br/>";
|
|
} elsif ($param eq 'test_id') {
|
|
my $value = quotemeta($c->param($param));
|
|
push @where, {field => $param,
|
|
value => $value};
|
|
$where_criteria .= "Testcase ID# is \'".$c->param($param)."\'<br/>";
|
|
} elsif ($param eq 'summary') {
|
|
my $value = quotemeta($c->param($param));
|
|
push @where, {field => $param,
|
|
value => $value};
|
|
$where_criteria .= "Summary like \'".$c->param($param)."\'<br/>";
|
|
} elsif ($param eq 'email') {
|
|
my $value = quotemeta($c->param($param));
|
|
push @where, {field => $param,
|
|
value => $value};
|
|
$where_criteria .= "Submitted By like \'".$c->param($param)."\'<br/>";
|
|
} elsif ($param eq 'result_status') {
|
|
my $value = quotemeta($c->param($param));
|
|
push @where, {field => $param,
|
|
value => $value};
|
|
$where_criteria .= "Status is \'".$c->param($param)."\'<br/>";
|
|
} elsif ($param eq 'timespan') {
|
|
my $value = $c->param($param);
|
|
if ($value ne 'all') {
|
|
$value =~ s/[^\-0-9]//g;
|
|
push @where, {field => $param,
|
|
value => $value};
|
|
$value =~ s/\-//g;
|
|
if ($value == 1) {
|
|
$where_criteria .= "Submitted in the last day<br/>";
|
|
} else {
|
|
$where_criteria .= "Submitted in the last $value days<br/>";
|
|
}
|
|
} else {
|
|
$where_criteria .= "All Results<br/>";
|
|
}
|
|
} elsif ($param eq "limit") {
|
|
$limit = quotemeta($c->param($param));
|
|
next if ($limit == $Litmus::DB::Testresult::_num_results_default);
|
|
$limit_criteria .= "Limit to $limit results";
|
|
} else {
|
|
# Skip unknown field
|
|
}
|
|
}
|
|
if ($where_criteria eq '' and
|
|
$order_by_criteria eq '' and
|
|
$limit_criteria eq '') {
|
|
($criteria,$results) =
|
|
Litmus::DB::Testresult->getDefaultTestResults;
|
|
} else {
|
|
$criteria .= $where_criteria . $order_by_criteria . $limit_criteria;
|
|
$criteria =~ s/_/ /g;
|
|
$results = Litmus::DB::Testresult->getTestResults(\@where,
|
|
\@order_by,
|
|
$limit);
|
|
}
|
|
} else {
|
|
($criteria,$results) =
|
|
Litmus::DB::Testresult->getDefaultTestResults;
|
|
}
|
|
|
|
# Populate each of our form widgets for select/input.
|
|
# Set a default value as appropriate.
|
|
my $products = Litmus::FormWidget->getProducts;
|
|
my $platforms = Litmus::FormWidget->getUniquePlatforms;
|
|
my $test_groups = Litmus::FormWidget->getTestGroups;
|
|
my $result_statuses = Litmus::FormWidget->getResultStatuses;
|
|
my $branches = Litmus::FormWidget->getBranches;
|
|
my $locales = Litmus::FormWidget->getLocales;
|
|
|
|
my $title = 'Search Test Results';
|
|
|
|
my $vars = {
|
|
title => $title,
|
|
criteria => $criteria,
|
|
products => $products,
|
|
platforms => $platforms,
|
|
test_groups => $test_groups,
|
|
result_statuses => $result_statuses,
|
|
branches => $branches,
|
|
locales => $locales,
|
|
limit => $limit,
|
|
};
|
|
|
|
# Only include results if we have them.
|
|
if ($results and scalar @$results > 0) {
|
|
$vars->{results} = $results;
|
|
}
|
|
|
|
my $cookie = Litmus::Auth::getCookie();
|
|
$vars->{"defaultemail"} = $cookie;
|
|
$vars->{"show_admin"} = Litmus::Auth::istrusted($cookie);
|
|
|
|
Litmus->template()->process("reporting/search_results.tmpl", $vars) ||
|
|
internalError(Litmus->template()->error());
|
|
|
|
exit 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|