From 7c60894e19c304c6ec72bc10bdf10478eef4b060 Mon Sep 17 00:00:00 2001 From: Koichi KAMICHI Date: Tue, 24 Oct 2006 01:01:23 +0000 Subject: [PATCH] Devide to css file. Clean up the sources. Security fix (map.pl). --- linkmap/map.cgi | 15 ++++++++++----- linkmap/map.css | 22 ++++++++++++++++++++++ linkmap/map.pl | 36 ++++++++++++++---------------------- 3 files changed, 46 insertions(+), 27 deletions(-) create mode 100644 linkmap/map.css diff --git a/linkmap/map.cgi b/linkmap/map.cgi index 0b72acc..646fdd4 100755 --- a/linkmap/map.cgi +++ b/linkmap/map.cgi @@ -1,19 +1,24 @@ #!/usr/bin/perl +$PERL = "/usr/bin/perl"; +$LINKMAP_DIR = "/var/www/chiseperl"; + $random = "linkmap_".(sprintf "%05X", int(rand()*0x100000)); use CGI; $cgi = new CGI; $target = $cgi->param('code'); -$target =~ tr/\;\<\>\|//d; -$dummy = `/usr/bin/perl /var/www/chiseperl/map.pl $target $random 2>/dev/null`; +$target =~ s/[^a-zA-Z0-9]//g; + +$dummy = `$PERL $LINKMAP_DIR/map.pl $target $random 2>/dev/null`; $buffer = ""; -open FH, "<$random.html"; -foreach(){ - $buffer .= $_; +open FH, "<${random}.html"; +while(!eof(FH)){ + $buffer .= ; } close FH; print "Content-type: text/html\n\n"; print $buffer; + diff --git a/linkmap/map.css b/linkmap/map.css new file mode 100644 index 0000000..4b6e36d --- /dev/null +++ b/linkmap/map.css @@ -0,0 +1,22 @@ +div.general { position: absolute; } +div.gb { position: absolute; font-family: serif, SimSun, 'AR_PL_ShanHeiSun_Uni', 'AR_PL_SungtiL_GB', '文鼎PL简报宋', STSong; font-size: 40px; } +div.ucs { position: absolute; font-family: 'MS 明朝', 'IPAMincho', 'Sazanami Mincho', SimSun, 'SimSun (Founder Extended)', 'AR_PL_ShanHeiSun_Uni', 'AR_PL_Mingti2L_Big5', 'AR_PL_SungtiL_GB', '文鼎PL简报宋', '文鼎PL細上海宋', UnBatang, 'Baekmuk Batang', '은 신문', 'ヒラギノ明朝 Pro W3', STSong, 'LiSong Pro', AppleMyungjo; font-size: 40px; } +div.big5 { position: absolute; font-family: MingLiU, 'AR_PL_Mingti2L_Big5', '文鼎PL細上海宋', 'LiSong Pro'; font-size: 40px; } +div.cdp { position: absolute; font-family: EUDC; font-size: 40px; } +div.jis { position: absolute; font-family: 'MS 明朝', 'IPAMincho', 'Sazanami Mincho', 'ヒラギノ明朝 Pro W3', HiraMinPro-W3; font-size: 40px; } +div.ks { position: absolute; font-family: BatangChe, UnBatang, 'Baekmuk Batang', '은 신문', AppleMyungjo; font-size: 40px; } +div.gt01 { position: absolute; font-family: GT2000-01; font-size: 40px; } +div.gt02 { position: absolute; font-family: GT2000-02; font-size: 40px; } +div.gt03 { position: absolute; font-family: GT2000-03; font-size: 40px; } +div.gt04 { position: absolute; font-family: GT2000-04; font-size: 40px; } +div.gt05 { position: absolute; font-family: GT2000-05; font-size: 40px; } +div.gt06 { position: absolute; font-family: GT2000-06; font-size: 40px; } +div.gt07 { position: absolute; font-family: GT2000-07; font-size: 40px; } +div.gt08 { position: absolute; font-family: GT2000-08; font-size: 40px; } +div.gt09 { position: absolute; font-family: GT2000-09; font-size: 40px; } +div.gt10 { position: absolute; font-family: GT2000-10; font-size: 40px; } +div.gt11 { position: absolute; font-family: GT2000-11; font-size: 40px; } +div.gt12 { position: absolute; font-family: GT2000-12; font-size: 40px; } +div.gt13 { position: absolute; font-family: GT2000-13; font-size: 40px; } +div.gtK1 { position: absolute; font-family: GT2000-K1; font-size: 40px; } +div.gtK2 { position: absolute; font-family: GT2000-K2; font-size: 40px; } diff --git a/linkmap/map.pl b/linkmap/map.pl index 6b0ed74..f7df3f6 100755 --- a/linkmap/map.pl +++ b/linkmap/map.pl @@ -12,19 +12,12 @@ $y = 14; %family = (); %object = (); @list= (); -#$file = "map"; $file= @ARGV[1]; $txt = "txt"; $png = "png"; $svg = "svg"; -#$graphviz = '"C:\Program Files\ATT\Graphviz\bin\dot.exe"'; $graphviz = '/usr/bin/dot'; $html = "html"; -$fontGB = "serif, SimSun, 'AR_PL_ShanHeiSun_Uni', 'AR_PL_SungtiL_GB', '文鼎PL简报宋', STSong"; -$fontJP = "'MS 明朝', 'IPAMincho', 'Sazanami Mincho', 'ヒラギノ明朝 Pro W3', HiraMinPro-W3"; -$fontUCS = "'MS 明朝', 'IPAMincho', 'Sazanami Mincho', SimSun, 'SimSun (Founder Extended)', 'AR_PL_ShanHeiSun_Uni', 'AR_PL_Mingti2L_Big5', 'AR_PL_SungtiL_GB', '文鼎PL简报宋', '文鼎PL細上海宋', UnBatang, 'Baekmuk Batang', '은 신문', 'ヒラギノ明朝 Pro W3', STSong, 'LiSong Pro', AppleMyungjo"; -$fontBIG5 = "MingLiU, 'AR_PL_Mingti2L_Big5', '文鼎PL細上海宋', 'LiSong Pro'"; -$fontKS = "BatangChe, UnBatang, 'Baekmuk Batang', '은 신문', AppleMyungjo"; #----------------------------------------------------------------------------- &init_chise; @@ -52,7 +45,6 @@ foreach(sort(keys %family)){ } foreach(sort(keys %char)){ printf FH "\t\"%X\" [ label = \"$char{$_}\", shape = \"record\" ];\r\n", $_; - #printf FH "\t\"%X\" [ label = \"$char{$_}\", shape = \"record\", fontname = \"simhei.ttf\" ];\r\n", $_; } foreach(sort(keys %link)){ @temp = split(/-/, $_); @@ -67,8 +59,6 @@ $dummy = `$graphviz -Tpng -o$file.$png $file.$txt`; #create svg $dummy = `$graphviz -Tsvg -o$file.$svg $file.$txt`; -# - #create html open FH, "<:utf8", "$file.$svg"; open FH2, ">:utf8", "$file.$html"; @@ -76,6 +66,8 @@ print FH2 < + +chise_linkmap : u$ARGV[0] @@ -84,7 +76,7 @@ foreach(){ if(m/x\=\"([0-9]+)\" y\=\"([0-9]+)\"\>\=cns11643\&\#45\;([1-9])\:([0-9A-F]{4})/){ $left = int($1 / $rate) + $x; $top = int($2 / $rate) + $y; - print FH2 "
"; + print FH2 "
"; print FH2 "\r\n"; print FH2 "
"; } elsif(m/x\=\"([0-9]+)\" y\=\"([0-9]+)\"\>\=jef\&\#45\;china3\:([0-9A-F]{4})/){ @@ -92,7 +84,7 @@ foreach(){ $top = int($2 / $rate) + $y; $target = $3; $target =~ tr/A-F/a-f/; - print FH2 "
"; + print FH2 "
"; print FH2 "\r\n"; print FH2 "
"; #} elsif(m/x\=\"([0-9]+)\" y\=\"([0-9]+)\"\>\=gb2312\:([0-9A-F]{4})/){ @@ -106,7 +98,7 @@ foreach(){ } elsif(m/x\=\"([0-9]+)\" y\=\"([0-9]+)\"\>\=gb2312\:([0-9A-F]{4})/){ $left = int($1 / $rate) + $x; $top = int($2 / $rate) + $y; - print FH2 "
"; + print FH2 "
"; $char = $3; $char =~ s/([0-9A-F]{2})/pack('H2', $1)/eg; Encode::from_to($char, 'gb2312-raw', 'utf-8'); @@ -116,7 +108,7 @@ foreach(){ } elsif(m/x\=\"([0-9]+)\" y\=\"([0-9]+)\"\>\=jis\&\#45\;x0208\@19(78|83|90|97)\:([0-9A-F]{4})/){ $left = int($1 / $rate) + $x; $top = int($2 / $rate) + $y; - print FH2 "
"; + print FH2 "
"; $ku = int(eval('0x'.$4) / 0x100) - 0x20; $ten = sprintf "%02d", eval('0x'.$4) % 0x100 - 0x20; print FH2 "\r\n"; @@ -124,7 +116,7 @@ foreach(){ } elsif(m/x\=\"([0-9]+)\" y\=\"([0-9]+)\"\>\=jis\&\#45\;x0212\:([0-9A-F]{4})/){ $left = int($1 / $rate) + $x; $top = int($2 / $rate) + $y; - print FH2 "
"; + print FH2 "
"; $ku = int(eval('0x'.$3) / 0x100) - 0x20; $ten = sprintf "%02d", eval('0x'.$3) % 0x100 - 0x20; print FH2 "\r\n"; @@ -138,13 +130,13 @@ foreach(){ } elsif(m/x\=\"([0-9]+)\" y\=\"([0-9]+)\"\>\=ucs\:([0-9A-F]{4,6})/){ $left = int($1 / $rate) + $x - 20; $top = int($2 / $rate) + $y; - print FH2 "
"; + print FH2 "
"; print FH2 "[".pack('U',eval('0x'.$3))."]\r\n"; print FH2 "
"; } elsif(m/x\=\"([0-9]+)\" y\=\"([0-9]+)\"\>\=big5\:([0-9A-F]{4,6})/){ $left = int($1 / $rate) + $x; $top = int($2 / $rate) + $y; - print FH2 "
"; + print FH2 "
"; $char = $3; $char =~ s/([0-9A-F]{2})/pack('H2', $1)/eg; Encode::from_to($char, 'big5', 'utf-8'); @@ -171,13 +163,13 @@ foreach(){ } elsif(m/x\=\"([0-9]+)\" y\=\"([0-9]+)\"\>\=big5\&\#45\;cdp\:([0-9A-F]{4,6})/){ $left = int($1 / $rate) + $x; $top = int($2 / $rate) + $y; - print FH2 "
"; + print FH2 "
"; printf FH2 pack('U', chise::chise_ds_decode_char($chise_ds, chise::get_uchar('=big5-pua'), eval('0x'.$3))); print FH2 "
"; } elsif(m/x\=\"([0-9]+)\" y\=\"([0-9]+)\"\>\=jis\&\#45\;x0208\:([0-9A-F]{4,6})/){ $left = int($1 / $rate) + $x; $top = int($2 / $rate) + $y; - print FH2 "
"; + print FH2 "
"; $char = $3; $char =~ s/([0-9A-F]{2})/pack('H2', $1)/eg; Encode::from_to($char, 'jis0208-raw', 'utf-8'); @@ -187,7 +179,7 @@ foreach(){ } elsif(m/x\=\"([0-9]+)\" y\=\"([0-9]+)\"\>\=ks\&\#45\;x1001\:([0-9A-F]{4,6})/){ $left = int($1 / $rate) + $x; $top = int($2 / $rate) + $y; - print FH2 "
"; + print FH2 "
"; $char = $3; $char =~ s/([0-9A-F]{2})/pack('H2', $1)/eg; Encode::from_to($char, 'ksc5601-raw', 'utf-8'); @@ -198,7 +190,7 @@ foreach(){ $left = int($1 / $rate) + $x; $top = int($2 / $rate) + $y; $number = sprintf("%02d", $3); - print FH2 "
"; + print FH2 "
"; $char = $4; $char =~ s/([0-9A-F]{2})/pack('H2', $1)/eg; Encode::from_to($char, 'jis0208-raw', 'utf-8'); @@ -208,7 +200,7 @@ foreach(){ } elsif(m/x\=\"([0-9]+)\" y\=\"([0-9]+)\"\>\=gt\&\#45\;pj\&\#45\;(k[12]):([0-9A-F]{4})/){ $left = int($1 / $rate) + $x; $top = int($2 / $rate) + $y; - print FH2 "
"; + print FH2 "
"; $char = $4; $char =~ s/([0-9A-F]{2})/pack('H2', $1)/eg; Encode::from_to($char, 'jis0208-raw', 'utf-8'); -- 1.7.10.4