1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-24 00:45:52 +00:00

Localize it

This commit is contained in:
Andrey A. Chernov 1998-11-02 20:04:30 +00:00
parent c40cfa8f1d
commit c2c19a265f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=14317
13 changed files with 613 additions and 4 deletions

View File

@ -29,6 +29,8 @@ pre-configure:
do-install:
cd ${WRKSRC}; ./wginstall
${INSTALL} -o nobody -m 644 /dev/null \
${PREFIX}/www/webglimpse/.sitecache
${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m 755 \
${PREFIX}/share/doc/webglimpse
cd ${WRKSRC}/docs && ${INSTALL_DATA} * ${PREFIX}/share/doc/webglimpse

View File

@ -1,6 +1,52 @@
--- cgi-bin/webglimpse-fullsearch.orig Mon Nov 2 08:52:04 1998
+++ cgi-bin/webglimpse-fullsearch Mon Nov 2 08:53:25 1998
@@ -159,19 +159,19 @@
--- cgi-bin/webglimpse-fullsearch.orig Mon Jan 26 00:22:51 1998
+++ cgi-bin/webglimpse-fullsearch Mon Nov 2 15:17:02 1998
@@ -7,6 +7,9 @@
# returns full search box (with preference to the referring page)
#########################################################################
+use POSIX qw(locale_h);
+use locale;
+
# The following variables are changed by wginstall
$WEBGLIMPSE_HOME = "/usr/local/webglimpse";
$CGIBIN = "cgi-bin/webglimpse";
@@ -25,8 +28,18 @@
# name of config file
$CONFIGFILE = "archive.cfg";
+$charset = '';
+$locale = '';
+$put_header = 0;
+
+sub http_header {
+
+return if ($put_header);
+$put_header = 1;
+
# start the header
-print "Content-type: text/html\n\n";
+print "Content-type: text/html$charset\n\n";
+}
# ENV variables
# path info contains the archive directory
@@ -115,7 +128,14 @@
&err_conf;
}
($title, $archiveurl, $traverse_type, $explicit_only, $numhops,
- $nhhops, $local_limit, $remote_limit, $addboxes, @urllist) = ReadConfig($archivepwd);
+ $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, $locale, $charset, @urllist) = ReadConfig($indexdir);
+
+$ENV{LANG}=$locale if ($locale ne '');
+setlocale(LC_CTYPE, "");
+
+$charset = "; charset=$charset" if ($charset ne '');
+
+&http_header;
# look for the title for this page
$thistitle = &lookup_title($file);
@@ -159,19 +179,19 @@
print "<INPUT TYPE=submit VALUE=Submit>\n";
print "<br>\n";
print "<center>\n";
@ -28,3 +74,19 @@
print "<br>\n";
print "</center>\n";
print "Return only files modified within the last <INPUT NAME=age size=5>\n";
@@ -273,6 +293,7 @@
#########################################################################
sub err_conf{
+ &http_header;
print "<title>Cannot find archive</title>\n";
print "</head><body>\n";
print "<h1>Specified directory $archivepwd is not an archive directory.</h1>\n";
@@ -283,6 +304,7 @@
sub err_file{
local ($file) = @_;
+ &http_header;
print "<title>Can't read file</title>\n";
print "</head><body>\n";
print "<h1>Specified file $file is not readable.</h1>\n";

View File

@ -1,5 +1,5 @@
--- makenh.orig Tue Jul 28 03:21:30 1998
+++ makenh Mon Nov 2 11:46:14 1998
+++ makenh Mon Nov 2 19:55:02 1998
@@ -68,6 +68,7 @@
$SITE_RE = '[^:]+:\/\/([^\/]+)\/.*';
$NumLocalCollected = 0;
@ -8,6 +8,34 @@
# LOGFILE, ERRFILE -- files for logging
### *TO CHANGE TRAVERSAL*
@@ -187,22 +188,22 @@
# Initialize variables to avoid warnings
($title, $urlpath, $traverse_type, $explicit_only, $numhops,
- $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem) =
- ('','','','','','','','','','','');
+ $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, $locale, $charset) =
+ ('','','','','','','','','','','','','');
($title, $urlpath, $traverse_type, $explicit_only, $numhops,
- $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, @urllist) = ReadConfig($archivepwd);
+ $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, $locale, $charset, @urllist) = ReadConfig($archivepwd);
# open logs
&open_logs();
print LOGFILE "From Configuration:\n";
my(@configlist) = qw(title urlpath traverse_type explicit_only numhops
- nhhops local_limit remote_limit addboxes vhost usemaxmem ) ;
+ nhhops local_limit remote_limit addboxes vhost usemaxmem locale charset) ;
foreach $item (@configlist)
{
$value = '';
- eval "$value = \$$item";
+ eval "\$value = \$$item";
print LOGFILE " $item: $value\n";
}
print LOGFILE " urllist: @urllist\n\n";
@@ -398,7 +399,7 @@
&close_logs();
@ -102,3 +130,28 @@
last;
}
}
@@ -1159,6 +1178,15 @@
($prot, $host, $port, $path) = &url::parse_url($url);
#print "URL after parsing: $prot://$host:$port$path\n";
+ next if !defined($prot);
+ if (!defined($port) ||
+ ($port eq '80' && $prot =~ /^https?$/) ||
+ ($port eq '21' && $prot eq 'ftp')) {
+ $port = '';
+ } else {
+ $port = ":$port";
+ }
+
# make sure the path has a preceding /
$path = "/$path" if $path!~/^\//;
@@ -1177,7 +1205,7 @@
# $host = "$a.$b.$c.$d";
# }
- $url = "$prot://$host:$port$path";
+ $url = "$prot://$host$port$path";
#print "URL after normalization: $url\n";
# strip off any #text

View File

@ -0,0 +1,18 @@
--- addsearch.orig Thu Jul 2 03:02:53 1998
+++ addsearch Mon Nov 2 14:51:28 1998
@@ -121,12 +121,12 @@
# Initialize variables to avoid warnings
($title, $archiveurl, $traverse_type, $explicit_only, $numhops,
- $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem) =
- ('','','','','','','','','','','');
+ $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, $locale, $charset) =
+ ('','','','','','','','','','','','','');
($title, $archiveurl, $traverse_type, $explicit_only, $numhops,
- $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, @urllist) = ReadConfig($archivepwd);
+ $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, $locale, $charset, @urllist) = ReadConfig($archivepwd);
### HUH? What does this code do? Can we remove it?
### here just in case.

View File

@ -0,0 +1,20 @@
--- lib/config.pl.orig Tue Jul 28 03:19:55 1998
+++ lib/config.pl Mon Nov 2 18:00:02 1998
@@ -36,6 +36,8 @@
addboxes
vhost
usemaxmem
+ locale
+ charset
urllist
); # in *that* order
@@ -101,7 +103,7 @@
# fill in the values so there's *something* there...
foreach $var (@ConfigVars) {
- $Values{$var} = "{}";
+ $Values{$var} = "";
}
foreach $line (@lines) {

View File

@ -0,0 +1,131 @@
--- cgi-bin/webglimpse.orig Mon Jul 27 22:59:49 1998
+++ cgi-bin/webglimpse Mon Nov 2 15:06:45 1998
@@ -39,6 +39,9 @@
# **** **** **** **** CONFIGURABLE VARIABLES **** **** **** ****
# We need some of these to find our libraries, so wrap them in a BEGIN block
+use POSIX qw(locale_h);
+use locale;
+
BEGIN{
$WEBGLIMPSE_HOME = "/usr/local/webglimpse";
@@ -117,14 +120,21 @@
# Added optional module to support result caching
$QS_cache = '';
+$charset = '';
+$put_header = 0;
+
# **** **** **** **** Done settings **** **** **** ****
-BEGIN {
+sub http_header {
+
+return if ($put_header);
+$put_header = 1;
+
# make the output as we can
$| = 1;
# might as well start the message now
-print "Content-type: text/html\n\n";
+print "Content-type: text/html$charset\n\n";
print "<!-- TESTING -->\n";
@@ -216,10 +226,20 @@
$nhhops = 0;
$traverse_type = 0;
$urlpath = '';
+$vhost = '';
+$usemaxmem = '';
+$locale = '';
@urllist = ();
($title, $urlpath, $traverse_type, $explicit_only, $numhops,
- $nhhops, $local_limit, $remote_limit, $addboxes, @urllist) = ReadConfig($indexdir);
+ $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, $locale, $charset, @urllist) = ReadConfig($indexdir);
+
+$ENV{LANG}=$locale if ($locale ne '');
+setlocale(LC_CTYPE, "");
+
+$charset = "; charset=$charset" if ($charset ne '');
+
+&http_header;
# Ensure that Glimpse is available on this machine
-x $GLIMPSE_LOC || &err_noglimpse($GLIMPSE_LOC) ;
@@ -667,7 +687,7 @@
sub err_noneighborhood {
local($_) = @_;
-
+ &http_header;
# neighborhood does not exist
print <<EOM;
<hr>
@@ -683,6 +703,7 @@
##########################################################################
sub err_noquery {
+ &http_header;
# The script was called without a query.
# Provide an ISINDEX type response for browsers
# without form support.
@@ -732,6 +753,7 @@
##########################################################################
sub err_noglimpse {
local($_) = @_;
+ &http_header;
#
# Glimpse was not found
# Report a useful message
@@ -756,6 +778,7 @@
##########################################################################
sub err_badglimpse {
my(@glines) = @_;
+ &http_header;
#
# Glimpse had an error
# Report a useful message
@@ -786,6 +809,7 @@
##########################################################################
sub err_noindex {
local ($indexdir) = @_;
+ &http_header;
# Glimpse index was not found
# Give recommendations for indexing
print "<TITLE>Glimpse Index not found</TITLE>\n";
@@ -801,6 +825,7 @@
}
##########################################################################
sub err_insecurepath {
+ &http_header;
# Path user requested contains ".." characters
print "<TITLE>Path not accepted</TITLE>\n";
print "</HEAD>\n";
@@ -814,6 +839,7 @@
##########################################################################
sub err_conf {
+ &http_header;
# Glimpse archive Configuration File was not found
print "<TITLE>Glimpse Archive Configuration File not found</TITLE>\n";
print "</HEAD>\n";
@@ -827,6 +853,7 @@
##########################################################################
sub err_badquery {
+ &http_header;
print "<TITLE>Query is too broad</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
@@ -840,6 +867,7 @@
##########################################################################
sub err_locked {
+ &http_header;
print "<TITLE>Indexing in progress</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";

View File

@ -0,0 +1,80 @@
--- confarc.orig Mon Jul 27 21:30:54 1998
+++ confarc Mon Nov 2 18:56:11 1998
@@ -75,6 +75,8 @@
elsif (/^-l/) { $nu_list = &get_option("-list"); }
elsif (/^-T/) { $nu_title = &get_option("-Title"); }
elsif (/^-b/) { $nu_addboxes = 1; }
+ elsif (/^-L/) { $nu_locale = &get_option("-Locale"); }
+ elsif (/^-C/) { $nu_charset = &get_option("-Charset"); }
elsif (/^-[\?hH]/) { &usage; }
else { &usage("unknown argument: $_"); }
}
@@ -142,6 +144,8 @@
$addboxes = 0;
$usemaxmem = 0;
$vhost = "";
+$locale = '';
+$charset = '';
@urllist = ();
# pre-set localscope
@@ -219,7 +223,7 @@
print "\nFound archive. Reading in previous settings for update.\n";
($title, $urlpath, $traverse_type, $explicit_only, $numhops,
- $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, @urllist) = ReadConfig($indexdir);
+ $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, $locale, $charset, @urllist) = ReadConfig($indexdir);
}
# If we had a virtual host on the command line, revert to that.
@@ -423,6 +427,23 @@
}
}
+if ($nu_locale) {
+ $locale = $nu_locale;
+} elsif (! $nu_quiet) {
+ $oldlocale=$locale;
+
+ $locale = &prompt("System locale (press return to leave it as is or * to cancel old one)\n",$oldlocale);
+ $locale = '' if ($locale eq "*");
+}
+
+if ($nu_charset) {
+ $charset = $nu_charset;
+} elsif (! $nu_quiet) {
+ $oldcharset=$charset;
+
+ $charset = &prompt("Charset for CGI (press return to leave it as is or * to cancel old one)\n",$oldcharset);
+ $charset = '' if ($charset eq "*");
+}
# generate the comment
if ($found_archive) {
@@ -452,6 +473,8 @@
# vhost Hostname = name of virtual host to use for this index
# usemaxmem 0 = 0 to NOT use maximum available memory
# = 1 to use maximum memory to speed up indexing
+# locale LOCALE = system locale or empty
+# charset CHARSET = character set for CGI output or empty
# urllist Url1,Url2,.. = List of starting URL's or Directories to index
# ";
}
@@ -473,7 +496,7 @@
# save the configuration
if(&SaveConfig($indexdir, $topcomment,
$title,$url,$traverse_type,$explicit_only,$numhops,$nhhops,
- $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, @urllist) == 0){
+ $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, $locale, $charset, @urllist) == 0){
print "Error saving configuration to file!\n";
exit 3;
}
@@ -483,7 +506,7 @@
&copy_files($indexdir);
# construct the cron file
-if (system("$MAKECRON $indexdir $usemaxmem") < 0) {
+if (system("$MAKECRON $indexdir $usemaxmem $locale") < 0) {
print "ERROR: Unable to create cronfile $mycronfile\n";
exit 6;
}

View File

@ -0,0 +1,28 @@
--- dist/wgall.html.bak Sat May 16 01:51:08 1998
+++ dist/wgall.html Mon Nov 2 16:05:33 1998
@@ -32,18 +32,18 @@
</SELECT>
<br>
-<INPUT NAME=case TYPE=checkbox>Case&#160;sensitive
-<!-- SPACES -->&#160;&#160;&#160;
-<INPUT NAME=whole TYPE=checkbox>Partial&#160;match
-<!-- SPACES -->&#160;&#160;&#160;
-<INPUT NAME=lines TYPE=checkbox>Jump&#160;to&#160;line
-<!-- SPACES -->&#160;&#160;&#160;
+<INPUT NAME=case TYPE=checkbox>Case&nbsp;sensitive
+<!-- SPACES -->&nbsp;&nbsp;&nbsp;
+<INPUT NAME=whole TYPE=checkbox>Partial&nbsp;match
+<!-- SPACES -->&nbsp;&nbsp;&nbsp;
+<INPUT NAME=lines TYPE=checkbox>Jump&nbsp;to&nbsp;line
+<!-- SPACES -->&nbsp;&nbsp;&nbsp;
<SELECT NAME=errors align=right>
<OPTION>0
<OPTION>1
<OPTION>2
</SELECT>
-misspellings&#160;allowed
+misspellings&nbsp;allowed
<br>
</center>
Return only files modified within the last <INPUT NAME=age size=5>

View File

@ -0,0 +1,28 @@
--- dist/wgindex.html.bak Mon Jul 27 22:56:52 1998
+++ dist/wgindex.html Mon Nov 2 16:05:33 1998
@@ -27,18 +27,18 @@
<INPUT TYPE=submit VALUE=Submit>
<br>
-<INPUT NAME=case TYPE=checkbox>Case&#160;sensitive
-<!-- SPACES -->&#160;&#160;&#160;
-<INPUT NAME=whole TYPE=checkbox>Partial&#160;match
-<!-- SPACES -->&#160;&#160;&#160;
-<INPUT NAME=lines TYPE=checkbox>Jump&#160;to&#160;line
-<!-- SPACES -->&#160;&#160;&#160;
+<INPUT NAME=case TYPE=checkbox>Case&nbsp;sensitive
+<!-- SPACES -->&nbsp;&nbsp;&nbsp;
+<INPUT NAME=whole TYPE=checkbox>Partial&nbsp;match
+<!-- SPACES -->&nbsp;&nbsp;&nbsp;
+<INPUT NAME=lines TYPE=checkbox>Jump&nbsp;to&nbsp;line
+<!-- SPACES -->&nbsp;&nbsp;&nbsp;
<SELECT NAME=errors align=right>
<OPTION>0
<OPTION>1
<OPTION>2
</SELECT>
-misspellings&#160;allowed
+misspellings&nbsp;allowed
<br>
</center>
Return only files modified within the last <INPUT NAME=age size=5>

View File

@ -0,0 +1,62 @@
--- dist/wgfilter-index.orig Tue Jun 16 02:16:17 1998
+++ dist/wgfilter-index Mon Nov 2 22:11:17 1998
@@ -1,26 +1,59 @@
Deny \.gif$
Deny \.jpeg$
Deny \.mpeg$
+Deny \.mpg$
+Deny \.tif$
+Deny \.tiff$
+Deny \.xbm$
+Deny \.png$
+Deny \.jpe$
Deny \.jpg$
+Deny \.mp3$
+Deny \.m3u$
+Deny \.ra$
+Deny \.rv$
+Deny \.rm$
+Deny \.ram$
+Deny \.rpm$
+Deny \.rmm$
Deny \.au$
+Deny \.aiff$
+Deny \.aif$
+Deny \.snd$
+Deny \.mid$
+Deny \.midi$
Deny \.wav$
Deny \.pdf$
Deny \.mov$
+Deny \.avi$
Deny \.gz$
Deny \.Z$
+Deny \.tar$
Deny \.tgz$
Deny \.zip$
+Deny \.lha$
+Deny \.lzh$
+Deny \.doc$
+Deny \.eps$
Deny \.ps$
+Deny \.js$
+Deny \.map$
+Deny \.css$
+Deny \.cgi$
Deny \.exe$
+Deny \.wrl$
+Deny \.vrml$
Deny (^|/)wgindex\.html$
Deny \.wg
Deny \.glimpse_
Deny (^|/)indexing-in-progress$
Deny (^|/)wgreindex$
+Deny (^|/).sitecache$
Deny (^|/)archive.cfg$
Deny (^|/)\.nh\.
Deny \?
Deny ~$
Deny (^|/)_vti
Deny (^|/)\.htpasswd$
+Deny (^|/)\.htaccess$
Deny (^|/)\.htgroup$

View File

@ -0,0 +1,103 @@
--- getfile.old Wed Nov 12 15:38:21 1997
+++ getfile Mon Nov 2 17:00:00 1998
@@ -22,7 +22,16 @@
require "config.pl";
#---------------------------------
-print "Content-type: text/html\n\n";
+$charset = '';
+$put_header = 0;
+
+sub http_header {
+
+return if ($put_header);
+$put_header = 1;
+
+print "Content-type: text/html$charset\n\n";
+}
$query = $ENV{'QUERY_STRING'};
@@ -67,11 +76,25 @@
&err_badindexdir;
}
-# get the url for the file from the config
-open(CFG, "<$indexdir/archive.cfg") || &err_badconfig;
-$input = <CFG>;
-($title,$url,$subindex) = split("\t", $input);
-close(CFG);
+$explicit_only = 0;
+$remote_limit = 0;
+$local_limit = 0;
+$addboxes = 0;
+$numhops = 0;
+$nhhops = 0;
+$traverse_type = 0;
+$url = '';
+$vhost = '';
+$usemaxmem = '';
+$locale = '';
+@urllist = ();
+
+($title, $url, $traverse_type, $explicit_only, $numhops,
+ $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, $locale, $charset, @urllist) = ReadConfig($indexdir);
+
+$charset = "; charset=$charset" if ($charset ne '');
+
+&http_header;
# print "indexdir = $indexdir<br>file = $file<br>line = $line<br>query=$query<br>\n";
@@ -149,12 +172,12 @@
if ($HTML) {
$baseurl &&
s#<title>#<BASE HREF=\"$baseurl\">$&#i;
- s|\&lt;([\w\$][-\w.\$]*\@\w[-\w.]+)&gt;|\<a href="/cgi-bin/artbyid?$1"\>\&lt;$1\&gt;\</a\>|g;
+# s|\&lt;([\w\$][-\w.\$]*\@\w[-\w.]+)&gt;|\<a href="/cgi-bin/artbyid?$1"\>\&lt;$1\&gt;\</a\>|g;
} else {
s|\&|\&amp;|g;
s|\<|\&lt;|g;
s|\>|\&gt;|g;
- s|\&lt;([\w\$][-\w.\$]*\@\w[-\w.]+)&gt;|\<a href="/cgi-bin/artbyid?$1"\>\&lt;$1\&gt;\</a\>|g;
+# s|\&lt;([\w\$][-\w.\$]*\@\w[-\w.]+)&gt;|\<a href="/cgi-bin/artbyid?$1"\>\&lt;$1\&gt;\</a\>|g;
# s|\bgopher://([^ ><'")(]*[\w\/])\b|\<a href="$&">$&\</a>|g;
# s|\bhttp://[-.\w?/+&\%:]+[.\w/]\b|\<a href="$&">$&\</a>|g;
# s|\bftp://[-.\w/+]+[.\w/]\b|\<a href="$&"\>$&\</a\>|g;
@@ -177,24 +200,28 @@
close(INPUT);
sub err_badconfig {
+ &http_header;
print "<TITLE>Error</TITLE>\n";
print "<H1>Error with \"$indexdir\"</H1>\n";
print "Cannot open configuration file for archive directory.\n";
exit;
}
sub err_noindexdir {
+ &http_header;
print "<TITLE>Error</TITLE>\n";
print "<H1>Error with \"$indexdir\"</H1>\n";
print "Archive directory does not exist.\n";
exit;
}
sub err_badindexdir {
+ &http_header;
print "<TITLE>Error</TITLE>\n";
print "<H1>Error with \"$indexdir\"</H1>\n";
print "Directory is not an archive directory.\n";
exit;
}
sub err_noaccess {
+ &http_header;
print "<TITLE>Access denied</TITLE>\n";
print "<H1>Access to \"$path\" denied</H1>\n";
print "You don't have permission to get file \"$path\"\n";
@@ -203,6 +230,7 @@
}
sub err_file {
local ($path) = @_;
+ &http_header;
print "<TITLE>Cannot read file \"$path\"</TITLE>\n";
print "<H1>Cannot read file \"$path\": $!</H1>\n";
exit;

View File

@ -0,0 +1,21 @@
--- makecron.bak Mon Jan 26 00:27:25 1998
+++ makecron Mon Nov 2 18:20:39 1998
@@ -37,6 +37,7 @@
# Get command-line options
$indexdir = $ARGV[0];
$usemaxmem = $ARGV[1];
+$locale = $ARGV[2];
# lock file
$LOCKFILE = "indexing-in-progress";
@@ -104,6 +105,10 @@
print OUT "#!$SHELL\n\n";
print OUT "# CRONFILE FOR ARCHIVE IN DIRECTORY $indexdir\n\n";
+
+if (defined($locale) && $locale ne '') {
+ print OUT "LANG=$locale; export LANG\n";
+}
print OUT ('quiet=""',"\n");
print OUT ('if [ "$1" = "-q" ] ; then',"\n");

View File

@ -5,6 +5,7 @@ www/cgi-bin/mfs
www/cgi-bin/webglimpse
www/cgi-bin/webglimpse-fullsearch
www/webglimpse/.archives
www/webglimpse/.sitecache
www/webglimpse/.wgsiteconf
www/webglimpse/Makefile
www/webglimpse/addsearch