Bug 619889 - Remove obsolete image-related code from tinderbox. [p=reed r=timeless]
git-svn-id: svn://10.0.0.236/trunk@261676 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -53,17 +53,14 @@ SETUID_PATH = '/usr/bin:/bin'
|
||||
ALL_UTILS = PERL
|
||||
|
||||
EXE_FILES = \
|
||||
addimage.cgi \
|
||||
addnote.cgi \
|
||||
admintree.cgi \
|
||||
buildwho.pl \
|
||||
clean.pl \
|
||||
checksetup.pl \
|
||||
doadmin.cgi \
|
||||
fixupimages.pl \
|
||||
scrape.pl \
|
||||
showbuilds.cgi \
|
||||
showimages.cgi \
|
||||
showlog.cgi \
|
||||
warnings.pl \
|
||||
$(NULL)
|
||||
@@ -82,7 +79,6 @@ FILES = \
|
||||
ep_windows.pl \
|
||||
get_line.pl \
|
||||
header.pl \
|
||||
imagelog.pl \
|
||||
showbuilds.pl \
|
||||
tbglobals.pl \
|
||||
Empty.html \
|
||||
|
||||
@@ -276,9 +276,6 @@ Other Files
|
||||
|
||||
Empty.html Document used for an empty frame by ???
|
||||
|
||||
addimage.cgi The form that lets you add a new image to the list of
|
||||
images that Tinderbox picks from randomly.
|
||||
|
||||
addnote.cgi Add a note to a build log.
|
||||
|
||||
admintree.cgi Lets you perform various admin tasks on a Tinderbox tree.
|
||||
@@ -295,12 +292,8 @@ ep_windows.pl Knows how to parse Windows build error logs. Used by ???
|
||||
|
||||
faq.html Wildly out of date.
|
||||
|
||||
fixupimages.pl ???
|
||||
tbglobals.pl ???
|
||||
imagelog.pl ???
|
||||
index.html ???
|
||||
reledanim.gif ???
|
||||
|
||||
showimages.cgi Show all the images in the Tinderbox list. Password-protected.
|
||||
|
||||
star.gif The "star" image used to annotate builds. Used by showbuilds.cgi
|
||||
|
||||
@@ -1,398 +0,0 @@
|
||||
#!/usr/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape 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/NPL/
|
||||
#
|
||||
# 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 the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
use strict;
|
||||
use Socket;
|
||||
|
||||
require 'header.pl';
|
||||
|
||||
print "Content-type: text/html\n\n";
|
||||
|
||||
EmitHtmlTitleAndHeader("tinderbox: add images", "add images");
|
||||
|
||||
$| = 1;
|
||||
|
||||
require "tbglobals.pl";
|
||||
require "imagelog.pl";
|
||||
|
||||
my %form = &split_cgi_args();
|
||||
|
||||
|
||||
sub Error {
|
||||
my ($msg) = @_;
|
||||
print "<BR><BR><BR>";
|
||||
print "<UL><FONT SIZE='+1'><B>Something went wrong:</B><P>";
|
||||
print "<UL>";
|
||||
print $msg;
|
||||
print "</UL>";
|
||||
print "<P>";
|
||||
print "Hit <B>\`Back'</B> and try again.";
|
||||
print "</UL>";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
my ($url, $safe_url, $quote, $safe_quote, $width, $height, $size );
|
||||
|
||||
if( $url = $form{"url"} ){
|
||||
$quote = $form{"quote"};
|
||||
|
||||
$quote =~ s/[\r\n]/ /g;
|
||||
$url =~ s/[\r\n]/ /g;
|
||||
$safe_url = value_encode($url);
|
||||
$safe_quote = value_encode($quote);
|
||||
|
||||
$width = "";
|
||||
$height = "";
|
||||
# I think we don't want to allow this --jwz
|
||||
# $width = $form{"width"};
|
||||
# $height = $form{"height"};
|
||||
|
||||
# if ($width eq "" || $height eq "") {
|
||||
$size = &URLsize($url);
|
||||
if ($size =~ /WIDTH=([0-9]*)/) {
|
||||
$width = $1;
|
||||
}
|
||||
if ($size =~ /HEIGHT=([0-9]*)/) {
|
||||
$height = $1;
|
||||
}
|
||||
if ($width eq "" || $height eq "") {
|
||||
Error "Couldn't get image size for \"$safe_url\".\n";
|
||||
}
|
||||
# }
|
||||
|
||||
print "
|
||||
|
||||
<P><center><img border=2 src='$safe_url' width=$width height=$height><br>
|
||||
<i>$safe_quote</i><br><br>
|
||||
";
|
||||
|
||||
if( $form{"submit"} ne "Yes" ){
|
||||
print "
|
||||
<form action='addimage.cgi' METHOD='get'>
|
||||
<input type=hidden name=url value=\"$safe_url\">
|
||||
<input type=hidden name=quote value=\"$safe_quote\">
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR>
|
||||
<TH ALIGN=RIGHT NOWRAP>Image URL:</TH>
|
||||
<TD><TT><B>$safe_url</B></TT></TD>
|
||||
</TR><TR>
|
||||
<TH ALIGN=RIGHT>Caption:</TH>
|
||||
<TD><TT><B>$safe_quote</B></TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD></TD>
|
||||
<TD>
|
||||
<FONT SIZE=+2><B>
|
||||
Does that look right?
|
||||
<SPACER SIZE=10>
|
||||
<INPUT Type='submit' name='submit' value='Yes'>
|
||||
</B><BR>(If not, hit \`Back' and fix it.)
|
||||
</FONT>
|
||||
</TD>
|
||||
</TABLE>
|
||||
</form>
|
||||
";
|
||||
}
|
||||
else {
|
||||
&add_imagelog( $url, $quote, $width, $height );
|
||||
print "<br><br>
|
||||
<font size=+2>Has been added</font><br><br>
|
||||
<a href=showbuilds.cgi>Return to Log</a>";
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
print "
|
||||
<h2>Add an image and a funny caption.</h2>
|
||||
|
||||
<ul>
|
||||
<p>This is about fun, and making your daily excursion to
|
||||
<A HREF=http://www.mozilla.org/tinderbox.html>Tinderbox</A> a
|
||||
novel experience. Engineers spend a lot of time here; it might as well
|
||||
have some entertainment value.
|
||||
|
||||
<p>Please play nice. We don't have the time or inclination to look at
|
||||
everything you people submit, but if we get nastygrams or legalgrams
|
||||
and have to take something down, we will curse your IP address, and you
|
||||
might even make it so the whole thing goes away forever. Please don't
|
||||
make us go there. You might also avoid links to big images or slow
|
||||
servers.
|
||||
|
||||
<p><ul><B>Thank you for playing nice.</B></UL>
|
||||
|
||||
<p>If you really find an image offensive, please
|
||||
<A HREF=mailto:terry\@netscape.com?Subject=offensive%20tinderbox%20image>tell us</A>
|
||||
nicely before someone causes a stink. Be sure to include the URL of
|
||||
the image. Remember, we don't screen these submissions and may not
|
||||
have even seen it.
|
||||
|
||||
<p><ul><B>P.S. Please, no more pictures of Bill Gates.</B></UL>
|
||||
</ul>
|
||||
|
||||
<p><form action='addimage.cgi' METHOD='get'>
|
||||
<TABLE>
|
||||
<TR>
|
||||
<TH ALIGN=RIGHT NOWRAP>Image URL:</TH>
|
||||
<TD><INPUT NAME='url' SIZE=60></TD>
|
||||
</TR><TR>
|
||||
<TH ALIGN=RIGHT>Caption:</TH>
|
||||
<TD><INPUT NAME='quote' SIZE=60></TD>
|
||||
</TR><TR>
|
||||
<TD></TD>
|
||||
<TD><B>
|
||||
<INPUT Type='submit' name='submit' value='Test'>
|
||||
<SPACER SIZE=25>
|
||||
<INPUT Type='reset' name='reset' value='Reset'>
|
||||
</B></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
</form>
|
||||
<br><br>
|
||||
";
|
||||
}
|
||||
|
||||
#sub imgsize {
|
||||
# local($file)= @_;
|
||||
#
|
||||
# #first try to open the file
|
||||
# if( !open(STREAM, "<", $file) ){
|
||||
# Error "Can't open IMG $file";
|
||||
## $size="";
|
||||
# } else {
|
||||
# if ($file =~ /.jpg/i || $file =~ /.jpeg/i) {
|
||||
# $size = &jpegsize(STREAM);
|
||||
# } elsif($file =~ /.gif/i) {
|
||||
# $size = &gifsize(STREAM);
|
||||
# } elsif($file =~ /.xbm/i) {
|
||||
# $size = &xbmsize(STREAM);
|
||||
# } else {
|
||||
# return "";
|
||||
# }
|
||||
# $_ = $size;
|
||||
# if( /\s*width\s*=\s*([0-9]*)\s*/i ){
|
||||
# ($newwidth)= /\s*width\s*=\s*(\d*)\s*/i;
|
||||
# }
|
||||
# if( /\s*height\s*=\s*([0-9]*)\s*/i ){
|
||||
# ($newheight)=/\s*height\s*=\s*(\d*)\s*/i;
|
||||
# }
|
||||
# close(STREAM);
|
||||
# }
|
||||
# return $size;
|
||||
#}
|
||||
|
||||
###########################################################################
|
||||
# Subroutine gets the size of the specified GIF
|
||||
###########################################################################
|
||||
|
||||
# bug: it thinks that
|
||||
# http://cvs1.mozilla.org/webtools/tinderbox/data/knotts.gif
|
||||
# is 640x400, but it's really 200x245.
|
||||
# giftrans says of that image:
|
||||
#
|
||||
# Header: "GIF87a"
|
||||
# Logical Screen Descriptor:
|
||||
# Logical Screen Width: 640 pixels
|
||||
# Logical Screen Height: 480 pixels
|
||||
# Image Descriptor:
|
||||
# Image Width: 200 pixels
|
||||
# Image Height: 245 pixels
|
||||
|
||||
|
||||
sub gifsize {
|
||||
my ($GIF) = @_;
|
||||
my ($size, $type, $s);
|
||||
my ($a,$b,$c,$d);
|
||||
read($GIF, $type, 6);
|
||||
if(!($type =~ /GIF8[7,9]a/) ||
|
||||
!(read($GIF, $s, 4) == 4) ){
|
||||
Error "Invalid or Corrupted GIF";
|
||||
$size="";
|
||||
} else {
|
||||
($a,$b,$c,$d)=unpack("C"x4,$s);
|
||||
$size=join ("", 'WIDTH=', $b<<8|$a, ' HEIGHT=', $d<<8|$c);
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
sub xbmsize {
|
||||
my ($XBM) = @_;
|
||||
my $input ="";
|
||||
my ($size, $a, $b);
|
||||
|
||||
$input .= <$XBM>;
|
||||
$input .= <$XBM>;
|
||||
$_ = $input;
|
||||
if( /#define\s*\S*\s*\d*\s*\n#define\s*\S*\s*\d*\s*\n/i ){
|
||||
($a,$b)=/#define\s*\S*\s*(\d*)\s*\n#define\s*\S*\s*(\d*)\s*\n/i;
|
||||
$size=join ("", 'WIDTH=', $a, ' HEIGHT=', $b );
|
||||
} else {
|
||||
Error "Doesn't look like an XBM file";
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
# jpegsize : gets the width and height (in pixels) of a jpeg file
|
||||
# Andrew Tong, werdna@ugcs.caltech.edu February 14, 1995
|
||||
# modified slightly by alex@ed.ac.uk
|
||||
sub jpegsize {
|
||||
my ($JPEG) = @_;
|
||||
my $done=0;
|
||||
my $size="";
|
||||
my ($c1, $c2, $ch, $s, $length, $marker, $junk);
|
||||
my ($a,$b,$c,$d);
|
||||
|
||||
read($JPEG, $c1, 1); read($JPEG, $c2, 1);
|
||||
if( !((ord($c1) == 0xFF) && (ord($c2) == 0xD8))){
|
||||
my $s = sprintf "This is not a JPEG! (Codes %02X %02X)\n", ord($c1), ord($c2);
|
||||
Error $s;
|
||||
$done=1;
|
||||
}
|
||||
while (ord($ch) != 0xDA && !$done) {
|
||||
# Find next marker (JPEG markers begin with 0xFF)
|
||||
# This can hang the program!!
|
||||
while (ord($ch) != 0xFF) { read($JPEG, $ch, 1); }
|
||||
# JPEG markers can be padded with unlimited 0xFF's
|
||||
while (ord($ch) == 0xFF) { read($JPEG, $ch, 1); }
|
||||
# Now, $ch contains the value of the marker.
|
||||
$marker=ord($ch);
|
||||
|
||||
if (($marker >= 0xC0) && ($marker <= 0xCF) &&
|
||||
($marker != 0xC4) && ($marker != 0xCC)) { # it's a SOFn marker
|
||||
read ($JPEG, $junk, 3); read($JPEG, $s, 4);
|
||||
($a,$b,$c,$d)=unpack("C"x4,$s);
|
||||
$size=join("", 'HEIGHT=',$a<<8|$b,' WIDTH=',$c<<8|$d );
|
||||
$done=1;
|
||||
} else {
|
||||
# We **MUST** skip variables, since FF's within variable
|
||||
# names are NOT valid JPEG markers
|
||||
read ($JPEG, $s, 2);
|
||||
($c1, $c2) = unpack("C"x2,$s);
|
||||
$length = $c1<<8|$c2;
|
||||
if( ($length < 2) ){
|
||||
Error "Bad JPEG file: erroneous marker length";
|
||||
$done=1;
|
||||
} else {
|
||||
read($JPEG, $junk, $length-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# Subroutine grabs a gif from another server and gets its size
|
||||
###########################################################################
|
||||
|
||||
|
||||
sub URLsize {
|
||||
my ($fullurl) = @_;
|
||||
my $S = new IO::Handle;
|
||||
|
||||
$_ = value_quote($fullurl);
|
||||
if ( ! m@^http://@ ) {
|
||||
Error "HTTP URLs only, please: \"$_\" is no good.";
|
||||
}
|
||||
|
||||
my($dummy, $dummy2, $serverstring, $url) = split(/\//, $fullurl, 4);
|
||||
my($them,$port) = split(/:/, $serverstring);
|
||||
$port = 80 unless $port;
|
||||
my $size="";
|
||||
my ($newheight, $newwidth);
|
||||
|
||||
$_ = value_quote($them);
|
||||
if ( m@^[^.]*$@ ) {
|
||||
Error "Fully-qualified host names only, please: \"$_\" is no good.";
|
||||
}
|
||||
|
||||
$_=$url;
|
||||
my ($remote, $safe_remote, $iaddr, $paddr, $proto, $line);
|
||||
$remote = $them;
|
||||
$safe_remote = value_encode($them);
|
||||
if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
|
||||
die "No port" unless $port;
|
||||
$iaddr = inet_aton($remote) || die "no host: $safe_remote";
|
||||
$paddr = sockaddr_in($port, $iaddr);
|
||||
|
||||
$proto = getprotobyname('tcp');
|
||||
socket($S, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
|
||||
connect($S, $paddr) || die "connect: $!";
|
||||
select($S); $| = 1; select(STDOUT);
|
||||
|
||||
print $S "GET /$url HTTP/1.0\r\n";
|
||||
print $S "Host: $them\r\n";
|
||||
print $S "User-Agent: Tinderbox/0.0\r\n";
|
||||
print $S "\r\n";
|
||||
|
||||
$_ = <$S>;
|
||||
if (! m@^HTTP/[0-9.]+ 200@ ) {
|
||||
Error "$them responded badly";
|
||||
}
|
||||
|
||||
my $ctype = "";
|
||||
while (<$S>) {
|
||||
# print "read: $_<br>\n";
|
||||
if ( m@^Content-Type:[ \t]*([^ \t\r\n]+)@io ) {
|
||||
$ctype = $1;
|
||||
}
|
||||
last if (/^[\r\n]/);
|
||||
}
|
||||
|
||||
$_ = $ctype;
|
||||
if ( $_ eq "" ) {
|
||||
Error "Server returned no content-type for url?";
|
||||
} elsif ( m@image/jpeg@i || m@image/pjpeg@i ) {
|
||||
$size = &jpegsize($S);
|
||||
} elsif ( m@image/gif@i ) {
|
||||
$size = &gifsize($S);
|
||||
} elsif ( m@image/xbm@i || m@image/x-xbm@i || m@image/x-xbitmap@i ) {
|
||||
$size = &xbmsize($S);
|
||||
} else {
|
||||
Error "Not a GIF, JPEG, or XBM.";
|
||||
}
|
||||
|
||||
$_ = $size;
|
||||
if( /\s*width\s*=\s*([0-9]*)\s*/i ){
|
||||
($newwidth)= /\s*width\s*=\s*(\d*)\s*/i;
|
||||
}
|
||||
if( /\s*height\s*=\s*([0-9]*)\s*/i ){
|
||||
($newheight)=/\s*height\s*=\s*(\d*)\s*/i;
|
||||
}
|
||||
|
||||
if ( $newwidth eq "" || $newheight eq "" ) {
|
||||
return "";
|
||||
} else {
|
||||
if ( $newwidth <= 5 || $newheight <= 5 ) {
|
||||
Error "${newwidth}x${newheight} seems small, don't you think?";
|
||||
} elsif ( $newwidth >= 400 || $newheight >= 400 ) {
|
||||
Error "${newwidth}x${newheight} is too big; please" .
|
||||
" keep it under 400x400."
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
}
|
||||
|
||||
#sub dokill {
|
||||
# kill 9,$child if $child;
|
||||
#}
|
||||
@@ -89,10 +89,6 @@ do
|
||||
wget $bonsai_link/data/$tree/batch-$id.pl
|
||||
done
|
||||
|
||||
cd $tinderbox_dir/data
|
||||
rm -f imagelog.txt
|
||||
wget $tinderbox_link/data/imagelog.txt
|
||||
|
||||
cd $tinderbox_dir
|
||||
perl copylogs
|
||||
|
||||
|
||||
@@ -1,248 +0,0 @@
|
||||
#!/usr/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape 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/NPL/
|
||||
#
|
||||
# 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 the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
use strict;
|
||||
use Socket;
|
||||
|
||||
require 'tbglobals.pl';
|
||||
require 'imagelog.pl';
|
||||
|
||||
# Set up an alarm handler for URLs that take too long.
|
||||
$SIG{ALRM} = sub { die "timeout" };
|
||||
|
||||
# Move an old imagelog to a new one
|
||||
|
||||
open( IMAGELOG, "<", "$::data_dir/imagelog.txt" ) || die "can't open file";
|
||||
open (OUT, ">", "$::data_dir/newimagelog.txt") || die "can't open output file";
|
||||
select(OUT); $| = 1; select(STDOUT);
|
||||
|
||||
my ($size, $height, $width);
|
||||
while( <IMAGELOG> ){
|
||||
chop;
|
||||
my ($url,$quote) = split(/\`/);
|
||||
print "$url\n";
|
||||
|
||||
eval {
|
||||
# Only wait 8 seconds for images to load.
|
||||
alarm(8);
|
||||
$size = &URLsize($url);
|
||||
alarm(0);
|
||||
};
|
||||
# Check if the eval block died.
|
||||
if ($@) {
|
||||
if ($@ =~ /timeout/) {
|
||||
# URL took to long skip it.
|
||||
warn "URL took too long. Skip it.\n";
|
||||
next;
|
||||
} else {
|
||||
# Some other error (e.g. no host)
|
||||
warn "$@\n";
|
||||
alarm(0);
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
$width = "";
|
||||
$height = "";
|
||||
if ($size =~ /WIDTH=([0-9]*)/) {
|
||||
$width = $1;
|
||||
}
|
||||
if ($size =~ /HEIGHT=([0-9]*)/) {
|
||||
$height = $1;
|
||||
}
|
||||
if ($width eq "" || $height eq "") {
|
||||
print "Couldn't get image size; skipping.\n";
|
||||
} else {
|
||||
print OUT "$url`$width`$height`$quote\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub imgsize {
|
||||
my ($file)= @_;
|
||||
my ($size, $s, $newwidth, $newheight);
|
||||
my $STREAM = new IO::Handle;
|
||||
|
||||
#first try to open the file
|
||||
if( !open($STREAM, "<", $file) ){
|
||||
print "Can't open IMG $file";
|
||||
$size="";
|
||||
} else {
|
||||
if ($file =~ /.jpg/i || $file =~ /.jpeg/i) {
|
||||
$size = &jpegsize($STREAM);
|
||||
} elsif($file =~ /.gif/i) {
|
||||
$size = &gifsize($STREAM);
|
||||
} elsif($file =~ /.xbm/i) {
|
||||
$size = &xbmsize($STREAM);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
$_ = $size;
|
||||
if( /\s*width\s*=\s*([0-9]*)\s*/i ){
|
||||
($newwidth)= /\s*width\s*=\s*(\d*)\s*/i;
|
||||
}
|
||||
if( /\s*height\s*=\s*([0-9]*)\s*/i ){
|
||||
($newheight)=/\s*height\s*=\s*(\d*)\s*/i;
|
||||
}
|
||||
close($STREAM);
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# Subroutine gets the size of the specified GIF
|
||||
###########################################################################
|
||||
sub gifsize {
|
||||
my ($GIF) = @_;
|
||||
my ($size, $s, $type);
|
||||
my ($a,$b,$c,$d);
|
||||
|
||||
read($GIF, $type, 6);
|
||||
if(!($type =~ /GIF8[7,9]a/) ||
|
||||
!(read($GIF, $s, 4) == 4) ){
|
||||
print "Invalid or Corrupted GIF";
|
||||
$size="";
|
||||
} else {
|
||||
($a,$b,$c,$d)=unpack("C"x4,$s);
|
||||
$size=join ("", 'WIDTH=', $b<<8|$a, ' HEIGHT=', $d<<8|$c);
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
sub xbmsize {
|
||||
my ($XBM) = @_;
|
||||
my ($input)="";
|
||||
my ($size, $a, $b);
|
||||
|
||||
$input .= <$XBM>;
|
||||
$input .= <$XBM>;
|
||||
$_ = $input;
|
||||
if( /#define\s*\S*\s*\d*\s*\n#define\s*\S*\s*\d*\s*\n/i ){
|
||||
($a,$b)=/#define\s*\S*\s*(\d*)\s*\n#define\s*\S*\s*(\d*)\s*\n/i;
|
||||
$size=join ("", 'WIDTH=', $a, ' HEIGHT=', $b );
|
||||
} else {
|
||||
print "Hmmm... Doesn't look like an XBM file";
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
# jpegsize : gets the width and height (in pixels) of a jpeg file
|
||||
# Andrew Tong, werdna@ugcs.caltech.edu February 14, 1995
|
||||
# modified slightly by alex@ed.ac.uk
|
||||
sub jpegsize {
|
||||
my ($JPEG) = @_;
|
||||
my ($done)=0;
|
||||
my $size="";
|
||||
my ($c1, $c2, $ch, $s, $length, $marker, $junk, $done);
|
||||
my ($a,$b,$c,$d);
|
||||
|
||||
read($JPEG, $c1, 1); read($JPEG, $c2, 1);
|
||||
if( !((ord($c1) == 0xFF) && (ord($c2) == 0xD8))){
|
||||
printf "This is not a JPEG! (Codes %02X %02X)\n", ord($c1), ord($c2);
|
||||
$done=1;
|
||||
}
|
||||
while (ord($ch) != 0xDA && !$done) {
|
||||
# Find next marker (JPEG markers begin with 0xFF)
|
||||
# This can hang the program!!
|
||||
while (ord($ch) != 0xFF) { read($JPEG, $ch, 1); }
|
||||
# JPEG markers can be padded with unlimited 0xFF's
|
||||
while (ord($ch) == 0xFF) { read($JPEG, $ch, 1); }
|
||||
# Now, $ch contains the value of the marker.
|
||||
$marker=ord($ch);
|
||||
|
||||
if (($marker >= 0xC0) && ($marker <= 0xCF) &&
|
||||
($marker != 0xC4) && ($marker != 0xCC)) { # it's a SOFn marker
|
||||
read ($JPEG, $junk, 3); read($JPEG, $s, 4);
|
||||
($a,$b,$c,$d)=unpack("C"x4,$s);
|
||||
$size=join("", 'HEIGHT=',$a<<8|$b,' WIDTH=',$c<<8|$d );
|
||||
$done=1;
|
||||
} else {
|
||||
# We **MUST** skip variables, since FF's within variable
|
||||
# names are NOT valid JPEG markers
|
||||
read ($JPEG, $s, 2);
|
||||
($c1, $c2) = unpack("C"x2,$s);
|
||||
$length = $c1<<8|$c2;
|
||||
if( ($length < 2) ){
|
||||
print "Erroneous JPEG marker length";
|
||||
$done=1;
|
||||
} else {
|
||||
read($JPEG, $junk, $length-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# Subroutine grabs a gif from another server and gets its size
|
||||
###########################################################################
|
||||
|
||||
|
||||
sub URLsize {
|
||||
my ($fullurl) = @_;
|
||||
my($dummy, $dummy, $serverstring, $url) = split(/\//, $fullurl, 4);
|
||||
my($them,$port) = split(/:/, $serverstring);
|
||||
my $port = 80 unless $port;
|
||||
$them = 'localhost' unless $them;
|
||||
my $size="";
|
||||
my ($newheight, $newwidth);
|
||||
my $S = new IO::Handle;
|
||||
|
||||
$_=$url;
|
||||
if( /gif/i || /jpeg/i || /jpg/i || /xbm/i ) {
|
||||
my ($remote, $iaddr, $paddr, $proto, $line);
|
||||
$remote = $them;
|
||||
if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
|
||||
die "No port" unless $port;
|
||||
$iaddr = inet_aton($remote) || die "no host: $remote";
|
||||
$paddr = sockaddr_in($port, $iaddr);
|
||||
|
||||
$proto = getprotobyname('tcp');
|
||||
socket($S, PF_INET, SOCK_STREAM, $proto) || return "socket: $!";
|
||||
connect($S, $paddr) || return "connect: $!";
|
||||
select($S); $| = 1; select(STDOUT);
|
||||
|
||||
|
||||
|
||||
print $S "GET /$url\n";
|
||||
if ($url =~ /.jpg/i || $url =~ /.jpeg/i) {
|
||||
$size = &jpegsize($S);
|
||||
} elsif($url =~ /.gif/i) {
|
||||
$size = &gifsize($S);
|
||||
} elsif($url =~ /.xbm/i) {
|
||||
$size = &xbmsize($S);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
$_ = $size;
|
||||
if( /\s*width\s*=\s*([0-9]*)\s*/i ){
|
||||
($newwidth)= /\s*width\s*=\s*(\d*)\s*/i;
|
||||
}
|
||||
if( /\s*height\s*=\s*([0-9]*)\s*/i ){
|
||||
($newheight)=/\s*height\s*=\s*(\d*)\s*/i;
|
||||
}
|
||||
} else {
|
||||
$size="";
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/usr/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape 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/NPL/
|
||||
#
|
||||
# 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 the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
1;
|
||||
|
||||
use strict;
|
||||
|
||||
sub add_imagelog {
|
||||
my ($url,$quote,$width,$height) = @_;
|
||||
open( IMAGELOG, ">>", "$::data_dir/imagelog.txt" ) || die "Oops; can't open imagelog.txt";
|
||||
print IMAGELOG "$url`$width`$height`$quote\n";
|
||||
close( IMAGELOG );
|
||||
}
|
||||
|
||||
sub get_image{
|
||||
my (@log,@ret,$i);
|
||||
|
||||
open( IMAGELOG, "<", "$::data_dir/imagelog.txt" );
|
||||
@log = <IMAGELOG>;
|
||||
|
||||
# return a random line
|
||||
srand;
|
||||
@ret = split(/\`/,$log[rand @log]);
|
||||
|
||||
close( IMAGELOG );
|
||||
@ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
http://cedric.cnam.fr/ABU/BIB/lesmains.gif`300`267`Les mains
|
||||
http://cnn.com/ALLPOLITICS/stories/1999/09/27/president.2000/quayle.drop.out/quayle.jpg`220`170`Dan Quayle announced Monday that he is no longer be a candidate. He stated "I will stay focused and begin work on the 2002 Presidential election".
|
||||
http://gs.cdnow.com/graphics/COVERART/local/L/69/29/00136929.jpg`170`170`You didn't get your checkin reviewed first?
|
||||
http://home.hiwaay.net/~stephena/link_pics/mos31d_full.jpg`300`223`If I find out you broke the build.....
|
||||
http://homepages.ihug.co.nz/~rgoodger/keyboard.gif`350`191`New Microsoft Keyboard
|
||||
http://members.aol.com/hatusatu/Commander/PICS/TEEF.GIF`72`72`
|
||||
http://members.tripod.com/SMercury99/panda.jpg`311`362`I hate when i get panda droppings on my schedule book!
|
||||
http://members.tripod.com/SMercury99/sarah15.jpg`356`240`The unfortunate end of one of the few female members of the Mozilla development crew.
|
||||
http://metalab.unc.edu/Dave/Dr-Fun/inline/thumbs/tn991019.jpg`258`190`No. 1 bestseller this week on amazon.com
|
||||
http://news.bbc.co.uk/olmedia/525000/images/_527034_prescottglum_150.jpg`150`180`Go....green....please!
|
||||
http://people.clarityconnect.com/webpages/shand/sagan02.jpg`159`182`Billions and billions of times better - not quite infinite, though.
|
||||
http://pla-netx.com/linebackn/good/santamoz.gif`350`131`SantaMoz says Merry Christmas!
|
||||
http://www-personal.umich.edu/~rmutt/Do.gif`200`394`mmmm, yeah
|
||||
http://www.acc.umu.se/~torben/torbennow.gif`88`31`Hej! Vill du bli min kompis?
|
||||
http://www.angelfire.com/ms/kjvbible/microsoft78.jpg`380`302`A source of inspiration...
|
||||
http://www.cluetrain.com/dillo2.jpg`188`258`Competed with Microsoft
|
||||
http://www.cnn.com/images/9810/top.house.impeach.jpg`280`170`He may have cheated on his wife and put himself at risk of impeachment, but at least he didn't break the tree
|
||||
http://www.cs.purdue.edu/images/people-small/spaf.jpg`113`165`"What, me worry?"
|
||||
http://www.cullasaja.com/images/office.jpg`278`399`best seat in the house
|
||||
http://www.darryl.com/viman.gif`203`146`Vi everywhere, always
|
||||
http://www.geocities.com/Hollywood/Screen/7857/headbut.jpg`294`349`Listen to me guys - I did NOT check in when it was RED!!!!!
|
||||
http://www.gothic.net/~luvcraft/tamagothi/raver.gif`136`72`whoop whoop! whoop whoop!
|
||||
http://www.hillside.co.uk/tour/d91.jpg`384`256`You're in the bazaar, so here's a cathedral to gaze at
|
||||
http://www.marymt.edu/~madden/redeyec3.jpg`320`240`You too must stare at the tree till your eyes go red...
|
||||
http://www.news.com/Images/Frontdoor/fd_1013moss_k.gif`150`145`Yay! Mozilla goes green again! Oh, wait, is that Moss? Nevermind.
|
||||
http://www.nzwwa.com/mirror/clipart/graphics/animated/netscape/icon.gif`32`32`
|
||||
http://www.pbs.org/newshour/images/cyberspace/jan-june98/ms16.gif`140`108`Where is my hair?
|
||||
http://www.robots.ox.ac.uk/~geoff/windows99.jpg`377`251`Windows 99 Now Available
|
||||
http://www.shapiroshapiro.com/site/graphics/G-JimHam2.gif`202`81`You call, I hammer!
|
||||
http://www.th.physik.uni-frankfurt.de/~jr/gif/phys/thumb/einstein_tongue.jpg`69`96`Have fun coding.
|
||||
http://www.ugcs.caltech.edu/~blacker/photos/images/fireplace.jpg`220`231`Looks like the tree is in flames...
|
||||
http://www.upv.es/~ecabrera/icon/paranoia.jpg`354`232`I feel fine
|
||||
http://www.worldsgreatestparty.com/images/shitashtray.GIF`146`123`Something for Father's Day
|
||||
http://yup.com/images/mda2.jpg`398`238`I told you it was still alpha!
|
||||
http://www.rpi.edu/~boberb/Mozilla/Friends.jpg`369`284`"He thinks I'm a cat and I don't want to tell him otherwise."
|
||||
http://www.rpi.edu/~boberb/Mozilla/breaks.jpg`354`184`Don't end up here!
|
||||
http://static.userland.com/images/post695/pieface2.jpg`72`72`mmmmm lemon merangue
|
||||
http://www.chrisneale.co.uk/animatronics/AnImg/sanitybg.gif`320`396`Ornithological Oddity
|
||||
http://cnn.com/ALLPOLITICS/stories/1999/09/27/president.2000/quayle.drop.out/quayle.jpg`220`170`Yes, I'll admit it. I broke the build.
|
||||
http://people.netscape.com/endico/mrgecko.jpg`220`170`Mr. Gecko didn't look both ways
|
||||
http://home.c2i.net/dark/blackbug_red.jpg`103`75`You can't honestly mean you want me to be HOMELESS??
|
||||
http://www.blueskystudios.com/splash/anim_nick.gif`108`92`"I keep walking but I don't seem to get anywhere."
|
||||
http://www.bigidea.com/kids/king_george/images/img_main.gif`224`271`I'm A Cucumber!
|
||||
http://news.bbc.co.uk/olmedia/735000/images/_737109_300kencameras.jpg`300`180`London mayor Ken Livingston unveils planned front cover of his new album, entitled 'Working with Dinosaurs'
|
||||
http://www.thespark.com/content/120399/greenspan.jpg`220`220`"It was </i>this<i> big, people."
|
||||
http://www.reeveswilson.com/yawner.jpg`398`177`Poweruser Reeves, still waiting for version 5, then hearing about 6!
|
||||
http://www.sigkill.com/stupid.jpg`382`125`It *said* "Best viewed with IE 5.0 or higher," so I fired up Mozilla...
|
||||
http://bandits.aist-nara.ac.jp/~masata-y/gyve/sq2.gif`291`227`Stop squirreling around!
|
||||
http://galileo.jpl.nasa.gov/graphics/PIA02535_thumb.jpg`130`100`Ground zero, mozilla release date.
|
||||
http://www.netaction.org/msoft/winfish.gif`120`76`Don't Be Soft On Microsoft!
|
||||
http://www.q-net.net.au/images/matt3.gif`180`158`I used to work with this guy. *shudder*
|
||||
http://www.otak-k.com/~lawrence/lawrence.jpg`196`303`I want to have mozilla's baby.
|
||||
http://www.salon.com/ent/movies/review/2000/05/26/women/story.jpg`370`251`If you break the build, I'll do it.
|
||||
http://gallery.yimg.com/c/256wm/10864129.jpg`169`256`-- Don't break the tree --
|
||||
http://image.listen.com/img/albums/170x170/290/294665.jpg`170`170`OOPS! I did it again. I broke the tree.
|
||||
http://www.brunching.com/cgi/clintonwords.cgi?picture=clintontwo&phrase=Don%27t+break+the+build%21`225`180`Advice from your Chief Executive
|
||||
http://www.modernhumorist.com/mh/0004/propaganda/bundle.gif`111`150`
|
||||
http://www.modernhumorist.com/mh/0004/propaganda/surfing.gif`113`150`
|
||||
http://www.modernhumorist.com/mh/0004/propaganda/mp3.gif`111`150`
|
||||
http://www.elephants.com/jupclosesm.jpg`306`223`Don't think about elephants.
|
||||
http://iww.ca/images/mini_infowork.jpg`327`250`We're wage slaves, too.
|
||||
http://grafica.mareotis.com/mozilla/img/comic_mozi_garabat.gif`261`310`La la la
|
||||
http://grafica.mareotis.com/mozilla/img/version1_b.gif`258`258`Pixel me harder
|
||||
@@ -23,7 +23,6 @@
|
||||
use strict;
|
||||
use lib "@TINDERBOX_DIR@";
|
||||
require 'tbglobals.pl';
|
||||
require 'imagelog.pl';
|
||||
require 'showbuilds.pl';
|
||||
|
||||
umask 002;
|
||||
|
||||
@@ -214,16 +214,9 @@ sub print_page_head($$) {
|
||||
# Quote and Legend
|
||||
#
|
||||
if ($form_ref->{legend}) {
|
||||
my ($imageurl,$imagewidth,$imageheight,$quote) = &get_image;
|
||||
print qq{
|
||||
<table width="100%" cellpadding=0 cellspacing=0>
|
||||
<tr>
|
||||
<td valign=bottom>
|
||||
<p><center><a href=addimage.cgi><img src="$rel_path$imageurl"
|
||||
width=$imagewidth height=$imageheight><br>
|
||||
$quote</a><br>
|
||||
</center>
|
||||
<p>
|
||||
<td align=right valign=bottom>
|
||||
<table cellspacing=0 cellpadding=1 border=0>
|
||||
<tr>
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
#!/usr/bin/perl --
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Netscape 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/NPL/
|
||||
#
|
||||
# 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 the Tinderbox build tool.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
|
||||
$| = 1;
|
||||
|
||||
use strict;
|
||||
require 'tbglobals.pl';
|
||||
require 'imagelog.pl';
|
||||
require 'header.pl';
|
||||
|
||||
# Process the form arguments
|
||||
my %form = &split_cgi_args();
|
||||
my %cookie_jar = &split_cookie_args();
|
||||
|
||||
&tb_check_password(\%form, \%cookie_jar);
|
||||
|
||||
print "Content-type: text/html\n\n";
|
||||
|
||||
my @url = ();
|
||||
my @quote = ();
|
||||
my @width = ();
|
||||
my @height = ();
|
||||
my $i = 0;
|
||||
|
||||
my ($oldname, $newname, $foundit, $url, $quote, $width, $height);
|
||||
|
||||
EmitHtmlHeader("tinderbox: all images");
|
||||
|
||||
print '<UL>
|
||||
<P>These are all of the images currently in
|
||||
<A HREF=http://www.mozilla.org/tinderbox.html>Tinderbox</A>.
|
||||
<P>Please don\'t give out this URL: this is only here for our debugging
|
||||
needs, and isn\'t linked to by the rest of Tinderbox: because looking at
|
||||
all the images at once would be be cheating! you\'re supposed to let them
|
||||
surprise you over time. What, do you read ahead in your desktop calendar,
|
||||
too? Where\'s your sense of mystery and anticipation?
|
||||
|
||||
<P>
|
||||
</UL>
|
||||
';
|
||||
|
||||
|
||||
|
||||
|
||||
if ($form{'url'} ne "") {
|
||||
$oldname = "$::data_dir/imagelog.txt";
|
||||
open (OLD, "<$oldname") || die "Oops; can't open imagelog.txt";
|
||||
$newname = "$oldname-$$";
|
||||
open (NEW, ">$newname") || die "Can't open $newname";
|
||||
$foundit = 0;
|
||||
while (<OLD>) {
|
||||
chomp;
|
||||
($url, $width, $height, $quote) = split(/\`/);
|
||||
if ($url eq $form{'url'} && $quote eq $form{'origquote'}) {
|
||||
$foundit = 1;
|
||||
if ($form{'nukeit'} ne "") {
|
||||
next;
|
||||
}
|
||||
$quote = $form{'quote'};
|
||||
}
|
||||
print NEW "$url`$width`$height`$quote\n";
|
||||
}
|
||||
close OLD;
|
||||
close NEW;
|
||||
if (!$foundit) {
|
||||
print "<font color=red>Hey, couldn't find it!</font> Did someone\n";
|
||||
print "else already edit it?<P>\n";
|
||||
unlink $newname;
|
||||
} else {
|
||||
print "Change made.<P>";
|
||||
rename ($newname, $oldname) || die "Couldn't rename $newname to $oldname";
|
||||
}
|
||||
$form{'doedit'} = "1";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
my $doedit = ($form{'doedit'} ne "");
|
||||
|
||||
if (!$doedit) {
|
||||
print "
|
||||
<form method=post>
|
||||
<input type=hidden name=password value=\"$form{'password'}\">
|
||||
<input type=hidden name=doedit value=1>
|
||||
<input type=submit value='Let me edit text or remove pictures.'>
|
||||
</form><P>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
open( IMAGELOG, "<$::data_dir/imagelog.txt" ) || die "can't open file";
|
||||
while( <IMAGELOG> ){
|
||||
chop;
|
||||
($url[$i],$width[$i],$height[$i],$quote[$i]) = split(/\`/);
|
||||
$i++;
|
||||
}
|
||||
close( IMAGELOG );
|
||||
|
||||
$i--;
|
||||
print "<center>";
|
||||
while( $i >= 0 ){
|
||||
my $qurl = value_encode($url[$i]);
|
||||
my $qquote = value_encode($quote[$i]);
|
||||
print "
|
||||
<img border=2 src='$url[$i]' width='$width[$i]' height='$height[$i]'><br>
|
||||
<i>$quote[$i]</i>";
|
||||
if ($doedit) {
|
||||
print "
|
||||
<form method=post>
|
||||
<input type=submit name=nukeit value='Delete this image'><br>
|
||||
<input name=quote size=60 value=\"$qquote\"><br>
|
||||
<input type=submit name=edit value='Change text'><hr>
|
||||
<input type=hidden name=url value=\"$qurl\">
|
||||
<input type=hidden name=origquote value=\"$qquote\">
|
||||
<input type=hidden name=password value=\"$form{'password'}\">
|
||||
</form>";
|
||||
}
|
||||
print "<br><br>\n";
|
||||
$i--;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user