RSS

trunk : 1851

myk%mozilla.org
2002-11-05 03:53:59
Revision ID: cvs-1:mykmozilla.org-20021105095359-zwoy5ydyr1rg8e17
Fix for bug 156548: XUL implementation of duplicates report.

collapse all collapse all

added added

removed removed

206
    my ($ipaddr) = @_;
206
    my ($ipaddr) = @_;
207
 
207
 
208
    # Check for a valid IPv4 addr which we know how to parse
208
    # Check for a valid IPv4 addr which we know how to parse
209
    if ($ipaddr !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
209
    if (!$ipaddr || $ipaddr !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
210
        return undef;
210
        return undef;
211
    }
211
    }
212
 
212
 
837
    open HTACCESS, ">data/.htaccess";
837
    open HTACCESS, ">data/.htaccess";
838
    print HTACCESS <<'END';
838
    print HTACCESS <<'END';
839
# nothing in this directory is retrievable unless overriden by an .htaccess
839
# nothing in this directory is retrievable unless overriden by an .htaccess
840
# in a subdirectory
840
# in a subdirectory; the only exception is duplicates.rdf, which is used by
 
 
841
# duplicates.xul and must be loadable over the web
841
deny from all
842
deny from all
 
 
843
<Files duplicates.rdf>
 
 
844
  allow from all
 
 
845
</Files>
842
END
846
END
843
    close HTACCESS;
847
    close HTACCESS;
844
    chmod $fileperm, "data/.htaccess";
848
    chmod $fileperm, "data/.htaccess";
53
 
53
 
54
&calculate_dupes();
54
&calculate_dupes();
55
 
55
 
 
 
56
# Generate a static RDF file containing the default view of the duplicates data.
 
 
57
open(CGI, "REQUEST_METHOD=GET QUERY_STRING=ctype=rdf ./duplicates.cgi |")
 
 
58
  || die "can't fork duplicates.cgi: $!";
 
 
59
open(RDF, ">data/duplicates.tmp")
 
 
60
  || die "can't write to data/duplicates.tmp: $!";
 
 
61
my $headers_done = 0;
 
 
62
while (<CGI>) {
 
 
63
  print RDF if $headers_done;
 
 
64
  $headers_done = 1 if $_ eq "\n";
 
 
65
}
 
 
66
close CGI;
 
 
67
close RDF;
 
 
68
if (-s "data/duplicates.tmp") {
 
 
69
    rename("data/duplicates.rdf", "data/duplicates-old.rdf");
 
 
70
    rename("data/duplicates.tmp", "data/duplicates.rdf");
 
 
71
}
 
 
72
 
56
sub check_data_dir {
73
sub check_data_dir {
57
    my $dir = shift;
74
    my $dir = shift;
58
 
75
 
32
require "globals.pl";
32
require "globals.pl";
33
require "CGI.pl";
33
require "CGI.pl";
34
 
34
 
 
 
35
use vars qw($buffer);
 
 
36
 
 
 
37
# Go directly to the XUL version of the duplicates report (duplicates.xul)
 
 
38
# if the user specified ctype=xul.  Adds params if they exist, and directs
 
 
39
# the user to a signed copy of the script in duplicates.jar if it exists.
 
 
40
if ($::FORM{'ctype'} eq "xul") {
 
 
41
    my $params = CanonicaliseParams($::buffer, ["format", "ctype"]);
 
 
42
    print "Location: " . (-e "duplicates.jar" ? "duplicates.jar!/" : "") . 
 
 
43
          "duplicates.xul" . ($params ? "?$params" : "") . "\n\n";
 
 
44
    exit;
 
 
45
}
 
 
46
 
35
# Use global templatisation variables.
47
# Use global templatisation variables.
36
use vars qw($template $vars);
48
use vars qw($template $vars);
37
 
49
 

Loggerhead runs on Bazaar branches