use URI::Escape;
require HTTP::BrowserDetect;
require HTTP::Negotiate;
-require Geo::IP;
+my $have_Geo_IP; BEGIN { $have_Geo_IP=eval { require Geo::IP; 1; }; }
require CGI;
+require Apache2;
# Undo 'www/engine/httpd-restart' as it may use obsolete Perl for 'mod_perl'
$W->{"browser"}=HTTP::BrowserDetect->new($W->{"user_agent"});
if (!defined $W->{"have_style"}) {
- $W->{"have_style"}=(!$W->{"browser"}->netscape() || $W->{"browser"}->major>4 ? 1 : 0);
+ $W->{"have_style"}=(!$W->{"browser"}->netscape() || ($W->{"browser"}->major() && $W->{"browser"}->major()>4) ? 1 : 0);
}
$W->{"have_js"}=($W->{"args"}{"have_js"} ? 1 : 0);
my($in)=@_;
if (my $uri=$ENV{"REQUEST_URI"}) {
+ if ($W->{"args"}{"Wabs"}) {
+ # FIXME: $in may not be defined here!
+ # to prevent: Use of uninitialized value in ...
+ if ($in=~m#^/#) {
+ $in=~s#^/*##;
+ }
+ else {
+ $in=$ENV{"REQUEST_URI"}."/".$in;
+ $in=~tr#/#/#s;
+ 1 while $in=~s#/(?:[^/]+)/\Q..\E/#/#g
+ }
+ return "http://".&{$W->{"web_hostname_sub"}}()."/".(defined $in ? $in : "");
+ }
$uri.="Index" if $uri=~m#/$#;
if (defined $in) {
my($inpath,$inquery)=split /[?]/,$in,2;
my($url,$contents,%args)=@_;
do { $$_=1 if !defined $$_; } for (\$args{"size"});
- $contents=CGI::escapeHTML($url) if !defined $contents;
+ if (!defined $contents) {
+ $contents=$url;
+ $contents=File::Basename::basename($contents) if $args{"basename"};
+ $contents=CGI::escapeHTML($contents);
+ }
$contents=~s#<a\b[^>]*>##gi;
$contents=~s#</a>##gi;
$r.='"';
do { $r.=" $_" if $_; } for ($args{"attr"});
$r.='>'.$contents.'</a>';
- if ($args{"size"} && url_is_local($url) && $url=~/[.](?:gz|Z|rpm|zip|deb|lha)/) { # Downloadable?
+ if ($args{"size"} && url_is_local($url) && ($args{"size"}>=2 || $url=~/[.](?:gz|Z|rpm|zip|deb|lha)/)) { # Downloadable?
$url=top_dir_disk().$url if $url=~m#^/#;
if (!-r $url)
{ cluck "File not readable: $url"; }
sub is_cz ()
{
+ return 0 if !$have_Geo_IP;
return "CZ" eq Geo::IP->new()->country_code_by_addr(remote_ip());
}
.nowrap { white-space: nowrap; }
.centered { text-align: center; }
.tab-bold { font-weight: bold; }
+.tab-head { font-weight: bold; }
+/*
.tab-head { font-weight: bold; color: yellow; background-color: transparent; }
body {
background-color: black;
:link { color: aqua; background-color: transparent; }
:visited { color: teal; background-color: transparent; }
h1,h2 { color: yellow; background-color: transparent; }
+*/
td { padding: 2px; }
caption { caption-side: bottom; }
.footer img { vertical-align: middle; }
do { print '<link rel="'.$type.'" href="'.$_.'" />'."\n" if $_; } for ($W->{"rel_$type"});
}
print "</head><body";
- print ' bgcolor="black" text="white" link="aqua" vlink="teal"'
- if $W->{"browser"}->netscape() && $W->{"browser"}->major<=4;
+# print ' bgcolor="black" text="white" link="aqua" vlink="teal"'
+# if $W->{"browser"}->netscape() && (!$W->{"browser"}->major() || $W->{"browser"}->major()<=4);
print ">\n";
if ($W->{"heading"}) {