Bug 261616 r=timeless
This commit is contained in:
cls%seawood.org 2004-12-01 04:25:22 +00:00
Родитель 264f382481
Коммит f078ee86fd
11 изменённых файлов: 138 добавлений и 139 удалений

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

@ -199,10 +199,12 @@ $use_html = 1 if defined $::FORM{use_html} and $::FORM{use_html} eq '1';
#
my %mark_line;
my $mark_arg = '';
$mark_arg = $::FORM{mark} if defined $::FORM{mark};
$mark_arg = &SanitizeMark($::FORM{mark}) if defined $::FORM{mark};
foreach my $mark (split ',', $mark_arg) {
my ($begin, $end);
if (($begin, $end) = $mark =~ /(\d*)\-(\d*)/) {
if ($mark =~ m/^(\d*)-(\d*)$/) {
$begin = $1;
$end = $2;
$begin = 1 if $begin eq '';
$end = $#text + 1 if $end eq '' or $end > $#text + 1;
next if $begin >= $end;

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

@ -25,9 +25,9 @@ use strict;
require 'CGI.pl';
my $file= $::FORM{'file'};
my $mark= $::FORM{'mark'};
my $ln = ($mark > 10 ? $mark-10 : 1 );
my $rev = SanitizeRevision($::FORM{'rev'});
my $mark= &SanitizeMark($::FORM{'mark'});
my $ln = (($mark =~ m/^\d+$/ && $mark > 10) ? $mark-10 : 1 );
my $rev = &SanitizeRevision($::FORM{'rev'});
my $debug = $::FORM{'debug'};
print "Content-Type: text/html\n\n";

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

@ -147,18 +147,16 @@ if ($browse_revtag eq 'HEAD') {
# Handle the "mark" argument
#
my %mark;
my $mark_arg = '';
$mark_arg = $::FORM{'mark'} if defined($::FORM{'mark'});
my $mark_arg = &SanitizeMark($::FORM{'mark'});
foreach my $rev (split(',',$mark_arg)) {
$mark{$rev} = 1;
$mark{$rev} = 1 if ($rev =~ m/^\d+$/);
}
# Handle the "author" argument
#
my %use_author;
my $author_arg = '';
$author_arg = $::FORM{'author'} if defined($::FORM{'author'});
my $author_arg = &SanitizeUsernames($::FORM{'author'});
foreach my $author (split(',',$author_arg)) {
$use_author{$author} = 1;
}

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

@ -46,19 +46,21 @@ sub sillyness {
require 'CGI.pl';
$::query_debug = (defined($::FORM{'debug'}) ? 1 : 0);
$::query_module = &SanitizeModule($::FORM{'module'});
$::CVS_ROOT = $::FORM{'cvsroot'};
$::CVS_ROOT = pickDefaultRepository() unless $::CVS_ROOT;
$::CVS_ROOT = &pickDefaultRepository() unless $::CVS_ROOT;
&validateRepository($::CVS_ROOT);
$::TreeID = $::FORM{'module'}
if (!exists($::FORM{'treeid'}) &&
exists($::FORM{'module'}) &&
exists($::TreeInfo{$::FORM{'module'}}{'repository'}));
$::TreeID = $::query_module
if (!exists($::FORM{'treeid'}) &&
exists($::TreeInfo{$::query_module}{'repository'}));
$::TreeID = 'default'
if (!exists($::TreeInfo{$::TreeID}{'repository'}) ||
exists($::TreeInfo{$::TreeID}{'nobonsai'}));
if (!exists($::TreeInfo{$::TreeID}{'repository'}) ||
exists($::TreeInfo{$::TreeID}{'nobonsai'}));
LoadTreeConfig();
&LoadTreeConfig();
require 'cvsquery.pl';
@ -101,7 +103,6 @@ Log("Query [$ENV{'REMOTE_ADDR'}]: $ENV{'QUERY_STRING'}");
#
# build a module map
#
$::query_module = $::FORM{'module'};
#
# allow ?file=/a/b/c/foo.c to be synonymous with ?dir=/a/b/c&file=foo.c
@ -120,18 +121,20 @@ unless ($::FORM{'dir'}) {
#
# build a directory map
#
@::query_dirs = split(/[;, \t]+/, $::FORM{'dir'});
@::query_dirs = split(/[;, \t\000]+/, $::FORM{'dir'});
$::query_file = $::FORM{'file'};
$::query_filetype = $::FORM{'filetype'};
$::query_filetype = &ExpectMatchtype($::FORM{'filetype'});
$::query_logexpr = $::FORM{'logexpr'};
#
# date
#
$::query_date_type = $::FORM{'date'};
my $query_hours;
if( $::query_date_type eq 'hours' ){
$::query_date_min = time - $::FORM{'hours'}*60*60;
$query_hours = &ExpectDigit('hours', $::FORM{'hours'});
$::query_date_min = time - $query_hours*60*60;
}
elsif( $::query_date_type eq 'day' ){
$::query_date_min = time - 24*60*60;
@ -161,8 +164,8 @@ else {
#
# who
#
$::query_who = $::FORM{'who'};
$::query_whotype = $::FORM{'whotype'};
$::query_who = &SanitizeUsernames($::FORM{'who'});
$::query_whotype = &ExpectMatchtype($::FORM{'whotype'});
my $show_raw = 0;
@ -173,11 +176,8 @@ if ($::FORM{'raw'}) {
#
# branch
#
$::query_branch = $::FORM{'branch'};
if (!defined $::query_branch) {
$::query_branch = 'HEAD';
}
$::query_branchtype = $::FORM{'branchtype'};
$::query_branch = &SanitizeRevision($::FORM{'branch'});
$::query_branchtype = &ExpectMatchtype($::FORM{'branchtype'});
if ($::query_branch eq 'HEAD' &&
($::query_branchtype eq 'match' || $::query_branchtype eq 'regexp')) {
@ -187,8 +187,8 @@ if ($::query_branch eq 'HEAD' &&
#
# tags
#
$::query_begin_tag = $::FORM{'begin_tag'};
$::query_end_tag = $::FORM{'end_tag'};
$::query_begin_tag = &SanitizeRevision($::FORM{'begin_tag'});
$::query_end_tag = &SanitizeRevision($::FORM{'end_tag'});
#
@ -529,14 +529,7 @@ sub PrevRev {
sub parse_date {
my($d) = @_;
my($result) = str2time($d);
if (defined $result) {
return $result;
} elsif ($d > 7000000) {
return $d;
}
return 0;
return &ExpectDate($d);
}
@ -654,7 +647,7 @@ sub query_to_english {
$::query_date_type = $::FORM{'date'};
if( $::query_date_type eq 'hours' ){
$english .="in the last " . html_quote($::FORM{hours}) . " hours";
$english .="in the last $query_hours hours";
}
elsif( $::query_date_type eq 'day' ){
$english .="in the last day";

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

@ -31,21 +31,21 @@ $|=1;
print "Content-type: text/html\n\n";
LoadTreeConfig();
&LoadTreeConfig();
$::CVS_ROOT = $::FORM{'cvsroot'};
$::CVS_ROOT = pickDefaultRepository() unless $::CVS_ROOT;
$::CVS_ROOT = &pickDefaultRepository() unless $::CVS_ROOT;
&validateRepository($::CVS_ROOT);
if (exists $::FORM{'module'}) {
if (exists($::TreeInfo{$::FORM{'module'}}{'repository'})) {
$::TreeID = $::FORM{'module'}
}
my $Module = &SanitizeModule($::FORM{'module'}) || 'default';
if (exists($::TreeInfo{$Module}{'repository'})) {
$::TreeID = $Module;
}
$::modules = {};
require 'modules.pl';
PutsHeader("Bonsai - CVS Query Form", "CVS Query Form",
&PutsHeader("Bonsai - CVS Query Form", "CVS Query Form",
"$::CVS_ROOT - $::TreeInfo{$::TreeID}{shortdesc}");
print "
@ -72,45 +72,36 @@ print "
#
my @reposList = &getRepositoryList();
my $bMultiRepos = (@reposList > 1);
my %module_selection;
$module_selection{'all'} = $module_selection{'allrepos'} = "";
#
# This code sucks, I should rewrite it to be shorter
#
my $Module = 'default';
if ($::TreeID eq 'default' || $Module eq 'default' || $Module eq 'all') {
$module_selection{'all'} = "SELECTED";
} elsif( $Module eq 'allrepositories'){
$module_selection{'allrepos'} = "SELECTED";
} else {
$module_selection{'custom'} = "SELECTED";
}
if (!exists $::FORM{module} || $::FORM{module} eq 'all' ||
$::FORM{module} eq '') {
print "<OPTION SELECTED VALUE='all'>All Files in the Repository\n";
if( $bMultiRepos ){
print "<OPTION VALUE='allrepositories'>All Files in all Repositories\n";
}
print "<OPTION $module_selection{'all'} VALUE='all'>All Files in the Repository\n";
if( $bMultiRepos ){
print "<OPTION $module_selection{'allreps'} VALUE='allrepositories'>All Files in all Repositories\n";
}
elsif( $::FORM{module} eq 'allrepositories' ){
print "<OPTION VALUE='all'>All Files in the Repository\n";
if( $bMultiRepos ){
print "<OPTION SELECTED VALUE='allrepositories'>All Files in all Repositories\n";
}
}
else {
$Module = $::FORM{module};
print "<OPTION VALUE='all'>All Files in the Repository\n";
if( $bMultiRepos ){
print "<OPTION VALUE='allrepositories'>All Files in all Repositories\n";
}
my $escaped_module = html_quote($::FORM{module});
if (defined($module_selection{'custom'})) {
my $escaped_module = &html_quote($Module);
print "<OPTION SELECTED VALUE='$escaped_module'>$escaped_module\n";
}
#
# Print out all the Different Modules
#
for my $k (sort( keys( %$::modules ) ) ){
if (defined $::FORM{module} && $k eq $::FORM{module}) {
next;
}
print "<OPTION value='$k'>$k\n";
}
if ($::TreeID eq "default") {
for my $k (sort( keys( %$::modules ) ) ){
print "<OPTION value='$k'>$k\n";
}
}
print "</SELECT></td>\n";
print "<td rowspan=2>";
@ -120,11 +111,7 @@ print "</td></tr>";
#
# Branch
#
if( defined $::FORM{branch} ){
$b = &SanitizeRevision($::FORM{branch});
} else {
$b = "HEAD";
}
$b = &SanitizeRevision($::FORM{branch}) || "HEAD";
print "<tr>
<th align=right>Branch:</th>
<td> <input type=text name=branch value='$b' size=25><br>\n" .
@ -138,24 +125,26 @@ regexpradio('branchtype') .
#
$::FORM{dir} ||= "";
my $url_dir = &url_quote($::FORM{'dir'});
print "
<tr>
<th align=right>Directory:</th>
<td colspan=2>
<input type=text name=dir value='$::FORM{dir}' size=45><br>
<input type=text name=dir value='$url_dir' size=45><br>
(you can list multiple directories)
</td>
</tr>
";
$::FORM{file} ||= "";
my $url_file = &url_quote($::FORM{'file'}) || "";
print "
<tr>
<th align=right>File:</th>
<td colspan=2>
<input type=text name=file value='$::FORM{file}' size=45><br>" .
<input type=text name=file value='$url_file' size=45><br>" .
regexpradio('filetype') . "
</td>
</tr>
@ -166,12 +155,12 @@ regexpradio('filetype') . "
# Who
#
$::FORM{who} ||= "";
my $url_who = &url_quote(&SanitizeUsernames($::FORM{'who'}));
print "
<tr>
<th align=right>Who:</th>
<td colspan=2> <input type=text name=who value='$::FORM{who}' size=45><br>" .
<td colspan=2> <input type=text name=who value='$url_who' size=45><br>" .
regexpradio('whotype') . "
</td>
</tr>";
@ -217,8 +206,10 @@ if (!defined($::FORM{date}) || $::FORM{date} eq "") {
$::FORM{date} = "hours";
}
$::FORM{mindate} = '' unless defined($::FORM{mindate});
$::FORM{maxdate} = '' unless defined($::FORM{maxdate});
my $mindate = '';
my $maxdate = '';
$mindate = &ExpectDate($::FORM{'mindate'}) if ($::FORM{'mindate'});
$maxdate = &ExpectDate($::FORM{'maxdate'}) if ($::FORM{'maxdate'});
print "
<tr>
@ -245,7 +236,7 @@ print "
<td><table BORDER=0 CELLPADDING=0 CELLPSPACING=0>
<tr>
<TD VALIGN=TOP ALIGN=RIGHT NOWRAP>
Between <input type=text name=mindate value='$::FORM{mindate}' size=25></td>
Between <input type=text name=mindate value='$mindate' size=25></td>
<td valign=top rowspan=2>You can use the form
<B><TT><NOBR>yyyy-mm-dd hh:mm:ss</NOBR></TT></B> or a Unix <TT>time_t</TT>
(seconds since the Epoch.)
@ -253,7 +244,7 @@ Between <input type=text name=mindate value='$::FORM{mindate}' size=25></td>
</tr>
<tr>
<td VALIGN=TOP ALIGN=RIGHT NOWRAP>
and <input type=text name=maxdate value='$::FORM{maxdate}' size=25></td>
and <input type=text name=maxdate value='$maxdate' size=25></td>
</tr>
</table>
</td>

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

@ -37,11 +37,13 @@ LoadCheckins();
my $busted = 0;
my $info;
my $id;
if (!exists $::FORM{'id'}) {
$busted = 1;
} else {
$info = eval("\\%" . $::FORM{'id'});
$id = &ExpectCheckinId($::FORM{'id'});
$info = eval("\\%" . $id);
if (!exists $info->{'notes'}) {
$info->{'notes'} = "";
@ -83,7 +85,7 @@ foreach my $i ('person', 'dir', 'files', 'notes', 'treeopen', 'log') {
}
if (exists $::FORM{'nukeit'}) {
my $w = lsearch(\@::CheckInList, $::FORM{'id'});
my $w = lsearch(\@::CheckInList, $id);
if ($w >= 0) {
splice(@::CheckInList, $w, 1);
}

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

@ -63,11 +63,13 @@ my $origtree = $::TreeID;
my $what = "";
my $i;
my $id;
SWITCH: for ($::FORM{'command'}) {
/^nuke$/ && do {
foreach $i (@list) {
my $w = lsearch(\@::CheckInList, $i);
$id = &ExpectCheckinId($i);
my $w = lsearch(\@::CheckInList, $id);
if ($w >= 0) {
splice(@::CheckInList, $w, 1);
}
@ -77,7 +79,8 @@ SWITCH: for ($::FORM{'command'}) {
};
/^setopen$/ && do {
foreach $i (@list) {
my $info = eval("\\%" . $i);
$id = &ExpectCheckinId($i);
my $info = eval("\\%" . $id);
$info->{'treeopen'} = 1;
}
$what = "modified to be open.";
@ -86,7 +89,8 @@ SWITCH: for ($::FORM{'command'}) {
/^setclose$/ && do {
foreach $i (@list) {
my $info = eval("\\%" . $i);
$id = &ExpectCheckinId($i);
my $info = eval("\\%" . $id);
$info->{'treeopen'} = 0;
}
$what = "modified to be closed.";
@ -101,7 +105,8 @@ SWITCH: for ($::FORM{'command'}) {
exit();
}
foreach $i (@list) {
my $w = lsearch(\@::CheckInList, $i);
$id = &ExpectCheckinId($i);
my $w = lsearch(\@::CheckInList, $id);
if ($w >= 0) {
splice(@::CheckInList, $w, 1);
}

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

@ -28,16 +28,14 @@ use strict;
sub sillyness {
my $zz;
$zz = $::TreeID;
$zz = $::FORM{'id'};
}
require 'CGI.pl';
LoadCheckins();
# Make sure checkin id is in designated format
my $form_id = $::FORM{'id'};
die("Invalid checkin id.\n") unless ($form_id =~ m/^::checkin_\d+_\d+$/);
&LoadCheckins();
my $form_id = &ExpectCheckinId($::FORM{'id'});
my $info = eval("\\%" . $form_id);
print "Content-type: text/html
@ -69,7 +67,7 @@ if (!exists $info->{'notes'}) {
foreach my $i ('person', 'dir', 'files', 'notes') {
print "<tr><td align=right><B>$i:</B></td>";
print "<td><INPUT NAME=$i VALUE=\"" . value_quote($info->{$i}) .
print "<td><INPUT NAME=$i VALUE=\"" . &value_quote($info->{$i}) .
"\"></td></tr>";
}
@ -105,9 +103,9 @@ foreach my $i (sort(keys(%$info))) {
print qq{<INPUT TYPE=HIDDEN NAME=orig$i VALUE="$q">\n};
}
print "<INPUT TYPE=HIDDEN NAME=id VALUE=\"$::FORM{'id'}\">";
print "<INPUT TYPE=HIDDEN NAME=id VALUE=\"$form_id\">";
print "<INPUT TYPE=HIDDEN NAME=treeid VALUE=\"" . value_quote($::TreeID) . "\">";
print "<INPUT TYPE=HIDDEN NAME=treeid VALUE=\"$::TreeID\">";

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

@ -70,14 +70,14 @@ print "
<SELECT name='module' size=5>
";
my $inmod = &SanitizeModule($::FORM{module});
my $Module = 'default';
if( $::FORM{module} eq 'all' || $::FORM{module} eq '' ){
if( $inmod eq 'all' || $inmod eq 'default' || $inmod eq '' ){
print "<OPTION SELECTED VALUE='all'>All Files in the Repository\n";
}
else {
} else {
print "<OPTION VALUE='all'>All Files in the Repository\n";
print "<OPTION SELECTED VALUE='$::FORM{module}'>$::FORM{module}\n";
$Module = $::FORM{module};
print "<OPTION SELECTED VALUE='$inmod'>$inmod\n";
$Module = $inmod;
}
#

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

@ -44,26 +44,31 @@ my $CVS_ROOT = $::FORM{"cvsroot"};
$CVS_ROOT = pickDefaultRepository() unless $CVS_ROOT;
&validateRepository($CVS_ROOT);
LoadTreeConfig();
$::TreeID = $::FORM{'module'}
if (!exists($::FORM{'treeid'}) &&
exists($::FORM{'module'}) &&
exists($::TreeInfo{$::FORM{'module'}}{'repository'}));
$::TreeID = 'default'
if (!exists($::TreeInfo{$::TreeID}{'repository'}) ||
exists($::TreeInfo{$::TreeID}{'nobonsai'}));
&LoadTreeConfig();
my $intreeid = &SanitizeModule($::FORM{'treeid'});
my $inmod = &SanitizeModule($::FORM{'module'});
if ($intreeid && exists($::TreeInfo{$intreeid}{'repository'}) &&
!exists($::TreeInfo{$intreeid}{'nobonsai'})) {
$::TreeID = $intreeid;
} elsif ($inmod && exists($::TreeInfo{$inmod}{'repository'}) &&
!exists($::TreeInfo{$inmod}{'nobonsai'})) {
$::TreeID = $inmod;
} else {
$::TreeID = 'default';
}
# get dir, remove leading and trailing slashes
my $dir = $::FORM{"dir"};
$dir = "" unless defined $dir;
$dir = "" if ($dir =~ /^\.\.\/$/);
$dir =~ s/^\/([^:]*)/$1/;
$dir =~ s/([^:]*)\/$/$1/;
my $dir = $::FORM{"dir"} || "";
$dir =~ s/^[\/]+([^:]*)/$1/;
$dir =~ s/([^:]*)[\/]+$/$1/;
my $path = "$CVS_ROOT/$dir";
&ChrootFilename($CVS_ROOT, $path);
die "Invalid directory: " . &shell_escape($dir) . ".\n" if (! -d $path);
my $rev = '';
$rev = &SanitizeRevision($::FORM{"rev"}) if defined($::FORM{"rev"});
my $rev = &SanitizeRevision($::FORM{"rev"});
print "Content-type: text/html\n\n";
@ -82,18 +87,16 @@ if ($rev) {
$s = "for branch <i>$rev</i>";
}
CheckHidden("$CVS_ROOT/$dir");
my $revstr = '';
$revstr = "&rev=$rev" unless $rev eq '';
my $rootstr = '';
$rootstr .= "&cvsroot=$::FORM{'cvsroot'}" if defined $::FORM{'cvsroot'};
$rootstr .= "&cvsroot=$CVS_ROOT";
$rootstr .= "&module=$::TreeID";
my $module = $::TreeInfo{$::TreeID}{'module'};
my $toplevel = Param('toplevel');
PutsHeader("Repository Directory $toplevel/$dir $s", "");
&PutsHeader("Repository Directory $toplevel/" . &html_quote($dir) . " $s", "");
my $output = "<DIV ALIGN=LEFT>";
$output .= "<A HREF='toplevel.cgi" . BatchIdPart('?') . "'>$toplevel</a>/ ";

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

@ -55,26 +55,28 @@ sub BreakBig {
return $result . $str;
}
if (exists($::FORM{'person'})) {
my $escaped_person = html_quote($::FORM{'person'});
my $person = &SanitizeUsernames($::FORM{'person'});
if ($person) {
my $escaped_person = &html_quote($person);
$title = $head = "Checkins for $escaped_person";
foreach $checkin (@::CheckInList) {
$info = eval("\\\%$checkin");
push @list, $checkin
if ($$info{'person'} eq $::FORM{'person'});
if ($$info{'person'} eq $person);
}
} elsif (exists($::FORM{'mindate'}) || exists($::FORM{'maxdate'})) {
my ($min, $max) = (0, 1<<30);
$title = "Checkins";
if (exists($::FORM{'mindate'})) {
$title .= " since " . MyFmtClock($min = $::FORM{'mindate'});
$title .= " and" if (exists($::FORM{'maxdate'}));
$title .= " since " .
&MyFmtClock($min = &ExpectDate($::FORM{'mindate}'}));
$title .= " and" if (exists($::FORM{'maxdate'}));
}
$title .= " before" . MyFmtClock($max = $::FORM{'maxdate'})
if (exists($::FORM{'maxdate'}));
$title .= " before" . &MyFmtClock($max = &ExpectDate($::FORM{'maxdate'}))
if (exists($::FORM{'maxdate'}));
$head = $title;
foreach $checkin (@::CheckInList) {
@ -103,13 +105,18 @@ day's checkins</a>.<br>";
PutsHeader($title, $head, $subhead);
$::FORM{'sort'} = 'date' unless $::FORM{'sort'};
my $sort = $::FORM{'sort'} || "";
if (!$sort) {
$sort = 'date';
} else {
die ("Invalid sort string.\n") unless ($sort =~ m/^\w+(,\w+)*$/);
}
print "
(Current sort is by <tt>$::FORM{'sort'}</tt>; click on a column header
(Current sort is by <tt>$sort</tt>; click on a column header
to sort by that column.)";
my @fields = split(/,/, $::FORM{'sort'});
my @fields = split(/,/, $sort);
sub Compare {
my $rval = 0;
@ -179,7 +186,7 @@ my $otherparams;
sub NewSort {
my ($key) = @_;
my @sort_keys = grep(!/^$key$/, split(/,/, $::FORM{'sort'}));
my @sort_keys = grep(!/^$key$/, split(/,/, $sort));
unshift(@sort_keys, $key);
return $otherparams . "&sort=" . join(',', @sort_keys);