12
use CGI qw(:standard :escapeHTML -nosticky);
13
use CGI::Util qw(unescape);
14
use CGI::Carp qw(fatalsToBrowser);
15
+use Encode;
16
use Fcntl ':mode';
17
18
my $cgi = new CGI;
19
my $version = "249";
20
my $my_url = $cgi->url();
21
my $my_uri = $cgi->url(-absolute => 1);
21
-my $rss_link = "";
22
+my $rss_link = "";
23
24
# absolute fs-path which will be prepended to the project path
25
#my $projectroot = "/pub/scm";
25
-my $projectroot = "/home/kay/public_html/pub/scm";
26
+my $projectroot = "/home/kay/public_html/pub/scm";
27
28
# location of the git-core binaries
29
my $gitbin = "/usr/bin";
38
my $home_text = "indextext.html";
39
40
# source of projects list
40
-#my $projects_list = $projectroot;
41
-my $projects_list = "index/index.aux";
41
+#my $projects_list = $projectroot;
42
+my $projects_list = "index/index.aux";
43
44
# input validation and dispatch
45
my $action = $cgi->param('a');
79
undef $project;
80
die_error(undef, "No such project.");
81
}
81
- $rss_link = "<link rel=\"alternate\" title=\"" . esc($project) . " log\" href=\"" .
82
- esc("$my_uri?p=$project;a=rss") . "\" type=\"application/rss+xml\"/>";
82
+ $rss_link = "<link rel=\"alternate\" title=\"" . esc_url($project) . " log\" href=\"" .
83
+ esc_url("$my_uri?p=$project;a=rss") . "\" type=\"application/rss+xml\"/>";
84
$ENV{'GIT_DIR'} = "$projectroot/$project";
85
} else {
86
git_project_list();
208
exit;
209
}
210
210
-sub esc {
211
+sub esc_url {
212
my $str = shift;
213
$str =~ s/\+/%2B/g;
214
$str =~ s/ /\+/g;
215
return $str;
216
}
217
218
+sub esc_html {
219
+ my $str = shift;
220
+ $str = escapeHTML($str);
221
+ $str = decode("utf8", $str, Encode::FB_DEFAULT);
222
+ return $str;
223
+}
224
+
225
sub git_header_html {
226
my $status = shift || "200 OK";
227
my $expires = shift;
302
EOF
303
print "<div class=\"page_header\">\n" .
304
"<a href=\"http://www.kernel.org/pub/software/scm/git/docs/\" title=\"git documentation\">" .
297
- "<img src=\"" . esc("$my_uri?a=git-logo.png") . "\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/>" .
305
+ "<img src=\"" . esc_url("$my_uri?a=git-logo.png") . "\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/>" .
306
"</a>\n";
299
- print $cgi->a({-href => esc($home_link)}, "projects") . " / ";
307
+ print $cgi->a({-href => esc_url($home_link)}, "projects") . " / ";
308
if (defined $project) {
301
- print $cgi->a({-href => esc("$my_uri?p=$project;a=summary")}, escapeHTML($project));
309
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary")}, esc_html($project));
310
if (defined $action) {
311
print " / $action";
312
}
339
if (defined $project) {
340
my $descr = git_read_description($project);
341
if (defined $descr) {
334
- print "<div class=\"page_footer_text\">" . escapeHTML($descr) . "</div>\n";
342
+ print "<div class=\"page_footer_text\">" . esc_html($descr) . "</div>\n";
343
}
336
- print $cgi->a({-href => esc("$my_uri?p=$project;a=rss"), -class => "rss_logo"}, "RSS") . "\n";
344
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=rss"), -class => "rss_logo"}, "RSS") . "\n";
345
} else {
338
- print $cgi->a({-href => esc("$my_uri?a=opml"), -class => "rss_logo"}, "OPML") . "\n";
346
+ print $cgi->a({-href => esc_url("$my_uri?a=opml"), -class => "rss_logo"}, "OPML") . "\n";
347
}
348
print "</div>\n" .
349
"</body>\n" .
614
$line =~ s/\t/$spaces/;
615
}
616
}
609
- print "<div class=\"pre\"$color>" . escapeHTML($line) . "</div>\n";
617
+ print "<div class=\"pre\"$color>" . esc_html($line) . "</div>\n";
618
}
619
}
620
close $fd;
679
sub format_log_line_html {
680
my $line = shift;
681
674
- $line = escapeHTML($line);
682
+ $line = esc_html($line);
683
$line =~ s/ / /g;
684
if ($line =~ m/([0-9a-fA-F]{40})/) {
685
my $hash_text = $1;
686
if (git_get_type($hash_text) eq "commit") {
679
- my $link = $cgi->a({-class => "text", -href => esc("$my_uri?p=$project;a=commit;h=$hash_text")}, $hash_text);
687
+ my $link = $cgi->a({-class => "text", -href => esc_url("$my_uri?p=$project;a=commit;h=$hash_text")}, $hash_text);
688
$line =~ s/$hash_text/$link/;
689
}
690
}
832
@projects = sort {$a->{'path'} cmp $b->{'path'}} @projects;
833
print "<th>Project</th>\n";
834
} else {
827
- print "<th>" . $cgi->a({-class => "header", -href => esc("$my_uri?o=project")}, "Project") . "</th>\n";
835
+ print "<th>" . $cgi->a({-class => "header", -href => esc_url("$my_uri?o=project")}, "Project") . "</th>\n";
836
}
837
if (defined($order) && ($order eq "descr")) {
838
@projects = sort {$a->{'descr'} cmp $b->{'descr'}} @projects;
839
print "<th>Description</th>\n";
840
} else {
833
- print "<th>" . $cgi->a({-class => "header", -href => esc("$my_uri?o=descr")}, "Description") . "</th>\n";
841
+ print "<th>" . $cgi->a({-class => "header", -href => esc_url("$my_uri?o=descr")}, "Description") . "</th>\n";
842
}
843
if (defined($order) && ($order eq "owner")) {
844
@projects = sort {$a->{'owner'} cmp $b->{'owner'}} @projects;
845
print "<th>Owner</th>\n";
846
} else {
839
- print "<th>" . $cgi->a({-class => "header", -href => esc("$my_uri?o=owner")}, "Owner") . "</th>\n";
847
+ print "<th>" . $cgi->a({-class => "header", -href => esc_url("$my_uri?o=owner")}, "Owner") . "</th>\n";
848
}
849
if (defined($order) && ($order eq "age")) {
850
@projects = sort {$a->{'commit'}{'age'} <=> $b->{'commit'}{'age'}} @projects;
851
print "<th>Last Change</th>\n";
852
} else {
845
- print "<th>" . $cgi->a({-class => "header", -href => esc("$my_uri?o=age")}, "Last Change") . "</th>\n";
853
+ print "<th>" . $cgi->a({-class => "header", -href => esc_url("$my_uri?o=age")}, "Last Change") . "</th>\n";
854
}
855
print "<th></th>\n" .
856
"</tr>\n";
862
print "<tr class=\"light\">\n";
863
}
864
$alternate ^= 1;
857
- print "<td>" . $cgi->a({-href => esc("$my_uri?p=$pr->{'path'};a=summary"), -class => "list"}, escapeHTML($pr->{'path'})) . "</td>\n" .
865
+ print "<td>" . $cgi->a({-href => esc_url("$my_uri?p=$pr->{'path'};a=summary"), -class => "list"}, esc_html($pr->{'path'})) . "</td>\n" .
866
"<td>$pr->{'descr'}</td>\n" .
867
"<td><i>" . chop_str($pr->{'owner'}, 15) . "</i></td>\n";
868
my $colored_age;
875
}
876
print "<td>$colored_age</td>\n" .
877
"<td class=\"link\">" .
870
- $cgi->a({-href => esc("$my_uri?p=$pr->{'path'};a=summary")}, "summary") .
871
- " | " . $cgi->a({-href => esc("$my_uri?p=$pr->{'path'};a=shortlog")}, "shortlog") .
872
- " | " . $cgi->a({-href => esc("$my_uri?p=$pr->{'path'};a=log")}, "log") .
878
+ $cgi->a({-href => esc_url("$my_uri?p=$pr->{'path'};a=summary")}, "summary") .
879
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$pr->{'path'};a=shortlog")}, "shortlog") .
880
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$pr->{'path'};a=log")}, "log") .
881
"</td>\n" .
882
"</tr>\n";
883
}
976
git_header_html();
977
print "<div class=\"page_nav\">\n" .
978
"summary".
971
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog")}, "shortlog") .
972
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log")}, "log") .
973
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$head")}, "commit") .
974
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$head")}, "commitdiff") .
975
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree")}, "tree") .
979
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog")}, "shortlog") .
980
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log")}, "log") .
981
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$head")}, "commit") .
982
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$head")}, "commitdiff") .
983
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree")}, "tree") .
984
"<br/><br/>\n" .
985
"</div>\n";
986
print "<div class=\"title\"> </div>\n";
987
print "<table cellspacing=\"0\">\n" .
980
- "<tr><td>description</td><td>" . escapeHTML($descr) . "</td></tr>\n" .
988
+ "<tr><td>description</td><td>" . esc_html($descr) . "</td></tr>\n" .
989
"<tr><td>owner</td><td>$owner</td></tr>\n" .
990
"<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n" .
991
"</table>\n";
993
my (@revlist) = map { chomp; $_ } <$fd>;
994
close $fd;
995
print "<div>\n" .
988
- $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog"), -class => "title"}, "shortlog") .
996
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog"), -class => "title"}, "shortlog") .
997
"</div>\n";
998
my $i = 16;
999
print "<table cellspacing=\"0\">\n";
1009
$alternate ^= 1;
1010
if ($i-- > 0) {
1011
print "<td><i>$co{'age_string'}</i></td>\n" .
1004
- "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
1012
+ "<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
1013
"<td>";
1014
if (length($co{'title_short'}) < length($co{'title'})) {
1007
- print $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"},
1008
- "<b>" . escapeHTML($co{'title_short'}) . "</b>");
1015
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"},
1016
+ "<b>" . esc_html($co{'title_short'}) . "</b>");
1017
} else {
1010
- print $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$commit"), -class => "list"},
1011
- "<b>" . escapeHTML($co{'title'}) . "</b>");
1018
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$commit"), -class => "list"},
1019
+ "<b>" . esc_html($co{'title'}) . "</b>");
1020
}
1021
print "</td>\n" .
1022
"<td class=\"link\">" .
1015
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$commit")}, "commit") .
1016
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
1023
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$commit")}, "commit") .
1024
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
1025
"</td>\n" .
1026
"</tr>";
1027
} else {
1020
- print "<td>" . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog")}, "...") . "</td>\n" .
1028
+ print "<td>" . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog")}, "...") . "</td>\n" .
1029
"</tr>";
1030
last;
1031
}
1035
my $taglist = git_read_refs("refs/tags");
1036
if (defined @$taglist) {
1037
print "<div>\n" .
1030
- $cgi->a({-href => esc("$my_uri?p=$project;a=tags"), -class => "title"}, "tags") .
1038
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=tags"), -class => "title"}, "tags") .
1039
"</div>\n";
1040
my $i = 16;
1041
print "<table cellspacing=\"0\">\n";
1056
if ($i-- > 0) {
1057
print "<td><i>$tag{'age'}</i></td>\n" .
1058
"<td>" .
1051
- $cgi->a({-href => esc("$my_uri?p=$project;a=$tag{'reftype'};h=$tag{'refid'}"), -class => "list"},
1052
- "<b>" . escapeHTML($tag{'name'}) . "</b>") .
1059
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=$tag{'reftype'};h=$tag{'refid'}"), -class => "list"},
1060
+ "<b>" . esc_html($tag{'name'}) . "</b>") .
1061
"</td>\n" .
1062
"<td>";
1063
if (defined($comment)) {
1056
- print $cgi->a({-class => "list", -href => esc("$my_uri?p=$project;a=tag;h=$tag{'id'}")}, $comment);
1064
+ print $cgi->a({-class => "list", -href => esc_url("$my_uri?p=$project;a=tag;h=$tag{'id'}")}, $comment);
1065
}
1066
print "</td>\n" .
1067
"<td class=\"link\">";
1068
if ($tag{'type'} eq "tag") {
1061
- print $cgi->a({-href => esc("$my_uri?p=$project;a=tag;h=$tag{'id'}")}, "tag") . " | ";
1069
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=tag;h=$tag{'id'}")}, "tag") . " | ";
1070
}
1063
- print $cgi->a({-href => esc("$my_uri?p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'});
1071
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'});
1072
if ($tag{'reftype'} eq "commit") {
1065
- print " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1066
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log;h=$tag{'refid'}")}, "log");
1073
+ print " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1074
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log;h=$tag{'refid'}")}, "log");
1075
}
1076
print "</td>\n" .
1077
"</tr>";
1078
} else {
1071
- print "<td>" . $cgi->a({-href => esc("$my_uri?p=$project;a=tags")}, "...") . "</td>\n" .
1079
+ print "<td>" . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tags")}, "...") . "</td>\n" .
1080
"</tr>";
1081
last;
1082
}
1087
my $headlist = git_read_refs("refs/heads");
1088
if (defined @$headlist) {
1089
print "<div>\n" .
1082
- $cgi->a({-href => esc("$my_uri?p=$project;a=heads"), -class => "title"}, "heads") .
1090
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=heads"), -class => "title"}, "heads") .
1091
"</div>\n";
1092
my $i = 16;
1093
print "<table cellspacing=\"0\">\n";
1103
if ($i-- > 0) {
1104
print "<td><i>$tag{'age'}</i></td>\n" .
1105
"<td>" .
1098
- $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$tag{'name'}"), -class => "list"},
1099
- "<b>" . escapeHTML($tag{'name'}) . "</b>") .
1106
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$tag{'name'}"), -class => "list"},
1107
+ "<b>" . esc_html($tag{'name'}) . "</b>") .
1108
"</td>\n" .
1109
"<td class=\"link\">" .
1102
- $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1103
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log;h=$tag{'name'}")}, "log") .
1110
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1111
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log;h=$tag{'name'}")}, "log") .
1112
"</td>\n" .
1113
"</tr>";
1114
} else {
1107
- print "<td>" . $cgi->a({-href => esc("$my_uri?p=$project;a=heads")}, "...") . "</td>\n" .
1115
+ print "<td>" . $cgi->a({-href => esc_url("$my_uri?p=$project;a=heads")}, "...") . "</td>\n" .
1116
"</tr>";
1117
last;
1118
}
1126
my $head = git_read_hash("$project/HEAD");
1127
git_header_html();
1128
print "<div class=\"page_nav\">\n" .
1121
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary")}, "summary") .
1122
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog")}, "shortlog") .
1123
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log")}, "log") .
1124
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$head")}, "commit") .
1125
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1126
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
1129
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary")}, "summary") .
1130
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog")}, "shortlog") .
1131
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log")}, "log") .
1132
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$head")}, "commit") .
1133
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1134
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
1135
"<br/>\n" .
1136
"</div>\n";
1137
my %tag = git_read_tag($hash);
1138
print "<div>\n" .
1131
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash"), -class => "title"}, escapeHTML($tag{'name'})) . "\n" .
1139
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($tag{'name'})) . "\n" .
1140
"</div>\n";
1141
print "<div class=\"title_text\">\n" .
1142
"<table cellspacing=\"0\">\n" .
1143
"<tr>\n" .
1144
"<td>object</td>\n" .
1137
- "<td>" . $cgi->a({-class => "list", -href => esc("$my_uri?p=$project;a=$tag{'type'};h=$tag{'object'}")}, $tag{'object'}) . "</td>\n" .
1138
- "<td class=\"link\">" . $cgi->a({-href => esc("$my_uri?p=$project;a=$tag{'type'};h=$tag{'object'}")}, $tag{'type'}) . "</td>\n" .
1145
+ "<td>" . $cgi->a({-class => "list", -href => esc_url("$my_uri?p=$project;a=$tag{'type'};h=$tag{'object'}")}, $tag{'object'}) . "</td>\n" .
1146
+ "<td class=\"link\">" . $cgi->a({-href => esc_url("$my_uri?p=$project;a=$tag{'type'};h=$tag{'object'}")}, $tag{'type'}) . "</td>\n" .
1147
"</tr>\n";
1148
if (defined($tag{'author'})) {
1149
my %ad = date_str($tag{'epoch'}, $tag{'tz'});
1142
- print "<tr><td>author</td><td>" . escapeHTML($tag{'author'}) . "</td></tr>\n";
1150
+ print "<tr><td>author</td><td>" . esc_html($tag{'author'}) . "</td></tr>\n";
1151
print "<tr><td></td><td>" . $ad{'rfc2822'} . sprintf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'}) . "</td></tr>\n";
1152
}
1153
print "</table>\n\n" .
1155
print "<div class=\"page_body\">";
1156
my $comment = $tag{'comment'};
1157
foreach my $line (@$comment) {
1150
- print escapeHTML($line) . "<br/>\n";
1158
+ print esc_html($line) . "<br/>\n";
1159
}
1160
print "</div>\n";
1161
git_footer_html();
1165
my $head = git_read_hash("$project/HEAD");
1166
git_header_html();
1167
print "<div class=\"page_nav\">\n" .
1160
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary")}, "summary") .
1161
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog")}, "shortlog") .
1162
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log")}, "log") .
1163
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$head")}, "commit") .
1164
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1165
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
1168
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary")}, "summary") .
1169
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog")}, "shortlog") .
1170
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log")}, "log") .
1171
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$head")}, "commit") .
1172
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1173
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
1174
"<br/>\n" .
1175
"</div>\n";
1176
my $taglist = git_read_refs("refs/tags");
1177
print "<div>\n" .
1170
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary"), -class => "title"}, " ") .
1178
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary"), -class => "title"}, " ") .
1179
"</div>\n";
1180
print "<table cellspacing=\"0\">\n";
1181
my $alternate = 0;
1195
$alternate ^= 1;
1196
print "<td><i>$tag{'age'}</i></td>\n" .
1197
"<td>" .
1190
- $cgi->a({-href => esc("$my_uri?p=$project;a=$tag{'reftype'};h=$tag{'refid'}"), -class => "list"},
1191
- "<b>" . escapeHTML($tag{'name'}) . "</b>") .
1198
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=$tag{'reftype'};h=$tag{'refid'}"), -class => "list"},
1199
+ "<b>" . esc_html($tag{'name'}) . "</b>") .
1200
"</td>\n" .
1201
"<td>";
1202
if (defined($comment)) {
1195
- print $cgi->a({-class => "list", -href => esc("$my_uri?p=$project;a=tag;h=$tag{'id'}")}, $comment);
1203
+ print $cgi->a({-class => "list", -href => esc_url("$my_uri?p=$project;a=tag;h=$tag{'id'}")}, $comment);
1204
}
1205
print "</td>\n" .
1206
"<td class=\"link\">";
1207
if ($tag{'type'} eq "tag") {
1200
- print $cgi->a({-href => esc("$my_uri?p=$project;a=tag;h=$tag{'id'}")}, "tag") . " | ";
1208
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=tag;h=$tag{'id'}")}, "tag") . " | ";
1209
}
1202
- print $cgi->a({-href => esc("$my_uri?p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'});
1210
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'});
1211
if ($tag{'reftype'} eq "commit") {
1204
- print " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1205
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log;h=$tag{'refid'}")}, "log");
1212
+ print " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1213
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log;h=$tag{'refid'}")}, "log");
1214
}
1215
print "</td>\n" .
1216
"</tr>";
1224
my $head = git_read_hash("$project/HEAD");
1225
git_header_html();
1226
print "<div class=\"page_nav\">\n" .
1219
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary")}, "summary") .
1220
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog")}, "shortlog") .
1221
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log")}, "log") .
1222
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$head")}, "commit") .
1223
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1224
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
1227
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary")}, "summary") .
1228
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog")}, "shortlog") .
1229
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log")}, "log") .
1230
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$head")}, "commit") .
1231
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$head")}, "commitdiff") .
1232
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
1233
"<br/>\n" .
1234
"</div>\n";
1235
my $taglist = git_read_refs("refs/heads");
1236
print "<div>\n" .
1229
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary"), -class => "title"}, " ") .
1237
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary"), -class => "title"}, " ") .
1238
"</div>\n";
1239
print "<table cellspacing=\"0\">\n";
1240
my $alternate = 0;
1249
$alternate ^= 1;
1250
print "<td><i>$tag{'age'}</i></td>\n" .
1251
"<td>" .
1244
- $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$tag{'name'}"), -class => "list"}, "<b>" . escapeHTML($tag{'name'}) . "</b>") .
1252
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$tag{'name'}"), -class => "list"}, "<b>" . esc_html($tag{'name'}) . "</b>") .
1253
"</td>\n" .
1254
"<td class=\"link\">" .
1247
- $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1248
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log;h=$tag{'name'}")}, "log") .
1255
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1256
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log;h=$tag{'name'}")}, "log") .
1257
"</td>\n" .
1258
"</tr>";
1259
}
1301
git_header_html();
1302
if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
1303
print "<div class=\"page_nav\">\n" .
1296
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary")}, "summary") .
1297
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog")}, "shortlog") .
1298
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log")}, "log") .
1299
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash_base")}, "commit") .
1300
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1301
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") . "<br/>\n";
1304
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary")}, "summary") .
1305
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog")}, "shortlog") .
1306
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log")}, "log") .
1307
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash_base")}, "commit") .
1308
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1309
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") . "<br/>\n";
1310
if (defined $file_name) {
1303
- print $cgi->a({-href => esc("$my_uri?p=$project;a=blob_plain;h=$hash;f=$file_name")}, "plain") . "<br/>\n";
1311
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob_plain;h=$hash;f=$file_name")}, "plain") . "<br/>\n";
1312
} else {
1305
- print $cgi->a({-href => esc("$my_uri?p=$project;a=blob_plain;h=$hash")}, "plain") . "<br/>\n";
1313
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob_plain;h=$hash")}, "plain") . "<br/>\n";
1314
}
1315
print "</div>\n".
1316
"<div>" .
1309
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash_base"), -class => "title"}, escapeHTML($co{'title'})) .
1317
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) .
1318
"</div>\n";
1319
} else {
1320
print "<div class=\"page_nav\">\n" .
1335
$line =~ s/\t/$spaces/;
1336
}
1337
}
1330
- printf "<div class=\"pre\"><a id=\"l%i\" href=\"#l%i\" class=\"linenr\">%4i</a> %s</div>\n", $nr, $nr, $nr, escapeHTML($line);
1338
+ printf "<div class=\"pre\"><a id=\"l%i\" href=\"#l%i\" class=\"linenr\">%4i</a> %s</div>\n", $nr, $nr, $nr, esc_html($line);
1339
}
1340
close $fd or print "Reading blob failed.\n";
1341
print "</div>";
1377
if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
1378
$base_key = ";hb=$hash_base";
1379
print "<div class=\"page_nav\">\n" .
1372
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary")}, "summary") .
1373
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$hash_base")}, "shortlog") .
1374
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log;h=$hash_base")}, "log") .
1375
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash_base")}, "commit") .
1376
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1380
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary")}, "summary") .
1381
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$hash_base")}, "shortlog") .
1382
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log;h=$hash_base")}, "log") .
1383
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash_base")}, "commit") .
1384
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1385
" | tree" .
1386
"<br/><br/>\n" .
1387
"</div>\n";
1388
print "<div>\n" .
1381
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash_base"), -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1389
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) . "\n" .
1390
"</div>\n";
1391
} else {
1392
print "<div class=\"page_nav\">\n";
1419
print "<td style=\"font-family:monospace\">" . mode_str($t_mode) . "</td>\n";
1420
if ($t_type eq "blob") {
1421
print "<td class=\"list\">" .
1414
- $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$t_hash" . $base_key . $file_key), -class => "list"}, $t_name) .
1422
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$t_hash" . $base_key . $file_key), -class => "list"}, $t_name) .
1423
"</td>\n" .
1424
"<td class=\"link\">" .
1417
- $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$t_hash" . $base_key . $file_key)}, "blob") .
1418
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=history;h=$hash_base" . $file_key)}, "history") .
1425
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$t_hash" . $base_key . $file_key)}, "blob") .
1426
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=history;h=$hash_base" . $file_key)}, "history") .
1427
"</td>\n";
1428
} elsif ($t_type eq "tree") {
1429
print "<td class=\"list\">" .
1422
- $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$t_hash" . $base_key . $file_key)}, $t_name) .
1430
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$t_hash" . $base_key . $file_key)}, $t_name) .
1431
"</td>\n" .
1432
"<td class=\"link\">" .
1433
$cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$t_hash" . $base_key . $file_key)}, "tree") .
1450
"<rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">\n";
1451
print "<channel>\n";
1452
print "<title>$project</title>\n".
1445
- "<link>" . escapeHTML("$my_url?p=$project;a=summary") . "</link>\n".
1453
+ "<link>" . esc_html("$my_url?p=$project;a=summary") . "</link>\n".
1454
"<description>$project log</description>\n".
1455
"<language>en</language>\n";
1456
1467
close $fd or next;
1468
print "<item>\n" .
1469
"<title>" .
1462
- sprintf("%d %s %02d:%02d", $cd{'mday'}, $cd{'month'}, $cd{'hour'}, $cd{'minute'}) . " - " . escapeHTML($co{'title'}) .
1470
+ sprintf("%d %s %02d:%02d", $cd{'mday'}, $cd{'month'}, $cd{'hour'}, $cd{'minute'}) . " - " . esc_html($co{'title'}) .
1471
"</title>\n" .
1464
- "<author>" . escapeHTML($co{'author'}) . "</author>\n" .
1472
+ "<author>" . esc_html($co{'author'}) . "</author>\n" .
1473
"<pubDate>$cd{'rfc2822'}</pubDate>\n" .
1466
- "<guid isPermaLink=\"true\">" . escapeHTML("$my_url?p=$project;a=commit;h=$commit") . "</guid>\n" .
1467
- "<link>" . escapeHTML("$my_url?p=$project;a=commit;h=$commit") . "</link>\n" .
1468
- "<description>" . escapeHTML($co{'title'}) . "</description>\n" .
1474
+ "<guid isPermaLink=\"true\">" . esc_html("$my_url?p=$project;a=commit;h=$commit") . "</guid>\n" .
1475
+ "<link>" . esc_html("$my_url?p=$project;a=commit;h=$commit") . "</link>\n" .
1476
+ "<description>" . esc_html($co{'title'}) . "</description>\n" .
1477
"<content:encoded>" .
1478
"<![CDATA[\n";
1479
my $comment = $co{'comment'};
1480
foreach my $line (@$comment) {
1481
+ $line = decode("utf8", $line, Encode::FB_DEFAULT);
1482
print "$line<br/>\n";
1483
}
1484
print "<br/>\n";
1520
next;
1521
}
1522
1514
- my $path = escapeHTML(chop_str($proj{'path'}, 25, 5));
1523
+ my $path = esc_html(chop_str($proj{'path'}, 25, 5));
1524
my $rss = "$my_url?p=$proj{'path'};a=rss";
1525
my $html = "$my_url?p=$proj{'path'};a=summary";
1526
print "<outline type=\"rss\" text=\"$path\" title=\"$path\" xmlUrl=\"$rss\" htmlUrl=\"$html\"/>\n";
1540
}
1541
git_header_html();
1542
print "<div class=\"page_nav\">\n";
1534
- print $cgi->a({-href => esc("$my_uri?p=$project;a=summary")}, "summary") .
1535
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$hash")}, "shortlog") .
1543
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary")}, "summary") .
1544
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$hash")}, "shortlog") .
1545
" | log" .
1537
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash")}, "commit") .
1538
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
1539
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$hash;hb=$hash")}, "tree") . "<br/>\n";
1546
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash")}, "commit") .
1547
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
1548
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$hash;hb=$hash")}, "tree") . "<br/>\n";
1549
1550
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
1551
open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed.");
1553
close $fd;
1554
1555
if ($hash ne $head || $page) {
1547
- print $cgi->a({-href => esc("$my_uri?p=$project;a=log")}, "HEAD");
1556
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=log")}, "HEAD");
1557
} else {
1558
print "HEAD";
1559
}
1560
if ($page > 0) {
1561
print " ⋅ " .
1553
- $cgi->a({-href => esc("$my_uri?p=$project;a=log;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
1562
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=log;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
1563
} else {
1564
print " ⋅ prev";
1565
}
1566
if ($#revlist >= (100 * ($page+1)-1)) {
1567
print " ⋅ " .
1559
- $cgi->a({-href => esc("$my_uri?p=$project;a=log;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
1568
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=log;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
1569
} else {
1570
print " ⋅ next";
1571
}
1573
"</div>\n";
1574
if (!@revlist) {
1575
print "<div>\n" .
1567
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary"), -class => "title"}, " ") .
1576
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary"), -class => "title"}, " ") .
1577
"</div>\n";
1578
my %co = git_read_commit($hash);
1579
print "<div class=\"page_body\"> Last change $co{'age_string'}.<br/><br/></div>\n";
1584
next if !%co;
1585
my %ad = date_str($co{'author_epoch'});
1586
print "<div>\n" .
1578
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$commit"), -class => "title"},
1579
- "<span class=\"age\">$co{'age_string'}</span>" . escapeHTML($co{'title'})) . "\n" .
1587
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$commit"), -class => "title"},
1588
+ "<span class=\"age\">$co{'age_string'}</span>" . esc_html($co{'title'})) . "\n" .
1589
"</div>\n";
1590
print "<div class=\"title_text\">\n" .
1591
"<div class=\"log_link\">\n" .
1583
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$commit")}, "commit") .
1584
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
1592
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$commit")}, "commit") .
1593
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
1594
"<br/>\n" .
1595
"</div>\n" .
1587
- "<i>" . escapeHTML($co{'author_name'}) . " [$ad{'rfc2822'}]</i><br/>\n" .
1596
+ "<i>" . esc_html($co{'author_name'}) . " [$ad{'rfc2822'}]</i><br/>\n" .
1597
"</div>\n" .
1598
"<div class=\"log_body\">\n";
1599
my $comment = $co{'comment'};
1646
}
1647
git_header_html(undef, $expires);
1648
print "<div class=\"page_nav\">\n" .
1640
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary")}, "summary") .
1641
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$hash")}, "shortlog") .
1642
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log;h=$hash")}, "log") .
1649
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary")}, "summary") .
1650
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$hash")}, "shortlog") .
1651
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log;h=$hash")}, "log") .
1652
" | commit";
1653
if (defined $co{'parent'}) {
1645
- print " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$hash")}, "commitdiff");
1654
+ print " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$hash")}, "commitdiff");
1655
}
1647
- print " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") . "\n" .
1656
+ print " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") . "\n" .
1657
"<br/><br/></div>\n";
1658
if (defined $co{'parent'}) {
1659
print "<div>\n" .
1651
- $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$hash"), -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1660
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$hash"), -class => "title"}, esc_html($co{'title'})) . "\n" .
1661
"</div>\n";
1662
} else {
1663
print "<div>\n" .
1655
- $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"), -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1664
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"), -class => "title"}, esc_html($co{'title'})) . "\n" .
1665
"</div>\n";
1666
}
1667
print "<div class=\"title_text\">\n" .
1668
"<table cellspacing=\"0\">\n";
1660
- print "<tr><td>author</td><td>" . escapeHTML($co{'author'}) . "</td></tr>\n".
1669
+ print "<tr><td>author</td><td>" . esc_html($co{'author'}) . "</td></tr>\n".
1670
"<tr>" .
1671
"<td></td><td> $ad{'rfc2822'}";
1672
if ($ad{'hour_local'} < 6) {
1676
}
1677
print "</td>" .
1678
"</tr>\n";
1670
- print "<tr><td>committer</td><td>" . escapeHTML($co{'committer'}) . "</td></tr>\n";
1679
+ print "<tr><td>committer</td><td>" . esc_html($co{'committer'}) . "</td></tr>\n";
1680
print "<tr><td></td><td> $cd{'rfc2822'}" . sprintf(" (%02d:%02d %s)", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'}) . "</td></tr>\n";
1681
print "<tr><td>commit</td><td style=\"font-family:monospace\">$co{'id'}</td></tr>\n";
1682
print "<tr>" .
1683
"<td>tree</td>" .
1684
"<td style=\"font-family:monospace\">" .
1676
- $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"), class => "list"}, $co{'tree'}) .
1685
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"), class => "list"}, $co{'tree'}) .
1686
"</td>" .
1678
- "<td class=\"link\">" . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
1687
+ "<td class=\"link\">" . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
1688
"</td>" .
1689
"</tr>\n";
1690
my $parents = $co{'parents'};
1691
foreach my $par (@$parents) {
1692
print "<tr>" .
1693
"<td>parent</td>" .
1685
- "<td style=\"font-family:monospace\">" . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$par"), class => "list"}, $par) . "</td>" .
1694
+ "<td style=\"font-family:monospace\">" . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$par"), class => "list"}, $par) . "</td>" .
1695
"<td class=\"link\">" .
1687
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$par")}, "commit") .
1688
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$hash;hp=$par")}, "commitdiff") .
1696
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$par")}, "commit") .
1697
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$hash;hp=$par")}, "commitdiff") .
1698
"</td>" .
1699
"</tr>\n";
1700
}
1716
}
1717
if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
1718
$signed = 1;
1710
- print "<span style=\"color: #888888\">" . escapeHTML($line) . "</span><br/>\n";
1719
+ print "<span style=\"color: #888888\">" . esc_html($line) . "</span><br/>\n";
1720
} else {
1721
$signed = 0;
1722
print format_log_line_html($line) . "<br/>\n";
1755
$mode_chng = sprintf(" with mode: %04o", (oct $to_mode) & 0777);
1756
}
1757
print "<td>" .
1749
- $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"), -class => "list"}, escapeHTML($file)) . "</td>\n" .
1758
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"), -class => "list"}, esc_html($file)) . "</td>\n" .
1759
"<td><span style=\"color: #008000;\">[new " . file_type($to_mode) . "$mode_chng]</span></td>\n" .
1751
- "<td class=\"link\">" . $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, "blob") . "</td>\n";
1760
+ "<td class=\"link\">" . $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, "blob") . "</td>\n";
1761
} elsif ($status eq "D") {
1762
print "<td>" .
1754
- $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file"), -class => "list"}, escapeHTML($file)) . "</td>\n" .
1763
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file"), -class => "list"}, esc_html($file)) . "</td>\n" .
1764
"<td><span style=\"color: #c00000;\">[deleted " . file_type($from_mode). "]</span></td>\n" .
1765
"<td class=\"link\">" .
1757
- $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, "blob") .
1758
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=history;h=$hash;f=$file")}, "history") .
1766
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, "blob") .
1767
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=history;h=$hash;f=$file")}, "history") .
1768
"</td>\n"
1769
} elsif ($status eq "M" || $status eq "T") {
1770
my $mode_chnge = "";
1784
}
1785
print "<td>";
1786
if ($to_id ne $from_id) {
1778
- print $cgi->a({-href => esc("$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file"), -class => "list"}, escapeHTML($file));
1787
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file"), -class => "list"}, esc_html($file));
1788
} else {
1780
- print $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"), -class => "list"}, escapeHTML($file));
1789
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file"), -class => "list"}, esc_html($file));
1790
}
1791
print "</td>\n" .
1792
"<td>$mode_chnge</td>\n" .
1793
"<td class=\"link\">";
1785
- print $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, "blob");
1794
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, "blob");
1795
if ($to_id ne $from_id) {
1787
- print " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file")}, "diff");
1796
+ print " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file")}, "diff");
1797
}
1789
- print " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=history;h=$hash;f=$file")}, "history") . "\n";
1798
+ print " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=history;h=$hash;f=$file")}, "history") . "\n";
1799
print "</td>\n";
1800
} elsif ($status eq "R") {
1801
my ($from_file, $to_file) = split "\t", $file;
1804
$mode_chng = sprintf(", mode: %04o", (oct $to_mode) & 0777);
1805
}
1806
print "<td>" .
1798
- $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file"), -class => "list"}, escapeHTML($to_file)) . "</td>\n" .
1807
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file"), -class => "list"}, esc_html($to_file)) . "</td>\n" .
1808
"<td><span style=\"color: #777777;\">[moved from " .
1800
- $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$from_file"), -class => "list"}, escapeHTML($from_file)) .
1809
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$from_file"), -class => "list"}, esc_html($from_file)) .
1810
" with " . (int $similarity) . "% similarity$mode_chng]</span></td>\n" .
1811
"<td class=\"link\">" .
1803
- $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file")}, "blob");
1812
+ $cgi->a({-href => esc_uresc_url("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file")}, "blob");
1813
if ($to_id ne $from_id) {
1805
- print " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$to_file")}, "diff");
1814
+ print " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$to_file")}, "diff");
1815
}
1816
print "</td>\n";
1817
}
1826
git_header_html();
1827
if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
1828
print "<div class=\"page_nav\">\n" .
1820
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary")}, "summary") .
1821
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog")}, "shortlog") .
1822
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log")}, "log") .
1823
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash_base")}, "commit") .
1824
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1825
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") .
1829
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary")}, "summary") .
1830
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog")}, "shortlog") .
1831
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log")}, "log") .
1832
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash_base")}, "commit") .
1833
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
1834
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") .
1835
"<br/>\n";
1827
- print $cgi->a({-href => esc("$my_uri?p=$project;a=blobdiff_plain;h=$hash;hp=$hash_parent")}, "plain") .
1836
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=blobdiff_plain;h=$hash;hp=$hash_parent")}, "plain") .
1837
"</div>\n";
1838
print "<div>\n" .
1830
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash_base"), -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1839
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) . "\n" .
1840
"</div>\n";
1841
} else {
1842
print "<div class=\"page_nav\">\n" .
1848
}
1849
print "<div class=\"page_body\">\n" .
1850
"<div class=\"diff_info\">blob:" .
1842
- $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$hash_parent;hb=$hash_base;f=$file_name")}, $hash_parent) .
1851
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$hash_parent;hb=$hash_base;f=$file_name")}, $hash_parent) .
1852
" -> blob:" .
1844
- $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, $hash) .
1853
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, $hash) .
1854
"</div>\n";
1855
git_diff_print($hash_parent, $file_name || $hash_parent, $hash, $file_name || $hash);
1856
print "</div>";
1883
}
1884
git_header_html(undef, $expires);
1885
print "<div class=\"page_nav\">\n" .
1877
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary")}, "summary") .
1878
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$hash")}, "shortlog") .
1879
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log;h=$hash")}, "log") .
1880
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash")}, "commit") .
1886
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary")}, "summary") .
1887
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$hash")}, "shortlog") .
1888
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log;h=$hash")}, "log") .
1889
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash")}, "commit") .
1890
" | commitdiff" .
1882
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") . "<br/>\n";
1883
- print $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent")}, "plain") . "\n" .
1891
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") . "<br/>\n";
1892
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent")}, "plain") . "\n" .
1893
"</div>\n";
1894
print "<div>\n" .
1886
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash"), -class => "title"}, escapeHTML($co{'title'})) . "\n" .
1895
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'})) . "\n" .
1896
"</div>\n";
1897
print "<div class=\"page_body\">\n";
1898
my $comment = $co{'comment'};
1931
my $file = $6;
1932
if ($status eq "A") {
1933
print "<div class=\"diff_info\">" . file_type($to_mode) . ":" .
1925
- $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, $to_id) . "(new)" .
1934
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, $to_id) . "(new)" .
1935
"</div>\n";
1936
git_diff_print(undef, "/dev/null", $to_id, "b/$file");
1937
} elsif ($status eq "D") {
1938
print "<div class=\"diff_info\">" . file_type($from_mode) . ":" .
1930
- $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, $from_id) . "(deleted)" .
1939
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, $from_id) . "(deleted)" .
1940
"</div>\n";
1941
git_diff_print($from_id, "a/$file", undef, "/dev/null");
1942
} elsif ($status eq "M") {
1943
if ($from_id ne $to_id) {
1944
print "<div class=\"diff_info\">" .
1936
- file_type($from_mode) . ":" . $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, $from_id) .
1945
+ file_type($from_mode) . ":" . $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, $from_id) .
1946
" -> " .
1938
- file_type($to_mode) . ":" . $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, $to_id);
1947
+ file_type($to_mode) . ":" . $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, $to_id);
1948
print "</div>\n";
1949
git_diff_print($from_id, "a/$file", $to_id, "b/$file");
1950
}
2025
}
2026
git_header_html();
2027
print "<div class=\"page_nav\">\n" .
2019
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary")}, "summary") .
2020
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog")}, "shortlog") .
2021
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log")}, "log") .
2022
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash")}, "commit") .
2023
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
2024
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
2028
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary")}, "summary") .
2029
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog")}, "shortlog") .
2030
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log")}, "log") .
2031
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash")}, "commit") .
2032
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
2033
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
2034
"<br/><br/>\n" .
2035
"</div>\n";
2036
print "<div>\n" .
2028
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash"), -class => "title"}, escapeHTML($co{'title'})) . "\n" .
2037
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'})) . "\n" .
2038
"</div>\n";
2039
print "<div class=\"page_path\"><b>/$file_name</b><br/></div>\n";
2040
2059
}
2060
$alternate ^= 1;
2061
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
2053
- "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 15, 3)) . "</i></td>\n" .
2054
- "<td>" . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$commit"), -class => "list"}, "<b>" .
2055
- escapeHTML(chop_str($co{'title'}, 50)) . "</b>") . "</td>\n" .
2062
+ "<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 3)) . "</i></td>\n" .
2063
+ "<td>" . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$commit"), -class => "list"}, "<b>" .
2064
+ esc_html(chop_str($co{'title'}, 50)) . "</b>") . "</td>\n" .
2065
"<td class=\"link\">" .
2057
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$commit")}, "commit") .
2058
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
2059
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=blob;hb=$commit;f=$file_name")}, "blob");
2066
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$commit")}, "commit") .
2067
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
2068
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;hb=$commit;f=$file_name")}, "blob");
2069
my $blob = git_get_hash_by_path($hash, $file_name);
2070
my $blob_parent = git_get_hash_by_path($commit, $file_name);
2071
if (defined $blob && defined $blob_parent && $blob ne $blob_parent) {
2072
print " | " .
2064
- $cgi->a({-href => esc("$my_uri?p=$project;a=blobdiff;h=$blob;hp=$blob_parent;hb=$commit;f=$file_name")},
2073
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=blobdiff;h=$blob;hp=$blob_parent;hb=$commit;f=$file_name")},
2074
"diff to current");
2075
}
2076
print "</td>\n" .
2110
}
2111
git_header_html();
2112
print "<div class=\"page_nav\">\n" .
2104
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary;h=$hash")}, "summary") .
2105
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog")}, "shortlog") .
2106
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log;h=$hash")}, "log") .
2107
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash")}, "commit") .
2108
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
2109
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
2113
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary;h=$hash")}, "summary") .
2114
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog")}, "shortlog") .
2115
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log;h=$hash")}, "log") .
2116
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash")}, "commit") .
2117
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
2118
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
2119
"<br/><br/>\n" .
2120
"</div>\n";
2121
2122
print "<div>\n" .
2114
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash"), -class => "title"}, escapeHTML($co{'title'})) . "\n" .
2123
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'})) . "\n" .
2124
"</div>\n";
2125
print "<table cellspacing=\"0\">\n";
2126
my $alternate = 0;
2149
}
2150
$alternate ^= 1;
2151
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
2143
- "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
2152
+ "<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
2153
"<td>" .
2145
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$co{'id'}"), -class => "list"}, "<b>" . escapeHTML(chop_str($co{'title'}, 50)) . "</b><br/>");
2154
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$co{'id'}"), -class => "list"}, "<b>" . esc_html(chop_str($co{'title'}, 50)) . "</b><br/>");
2155
my $comment = $co{'comment'};
2156
foreach my $line (@$comment) {
2157
if ($line =~ m/^(.*)($searchtext)(.*)$/i) {
2149
- my $lead = escapeHTML($1) || "";
2158
+ my $lead = esc_html($1) || "";
2159
$lead = chop_str($lead, 30, 10);
2151
- my $match = escapeHTML($2) || "";
2152
- my $trail = escapeHTML($3) || "";
2160
+ my $match = esc_html($2) || "";
2161
+ my $trail = esc_html($3) || "";
2162
$trail = chop_str($trail, 30, 10);
2163
my $text = "$lead<span style=\"color:#e00000\">$match</span>$trail";
2164
print chop_str($text, 80, 5) . "<br/>\n";
2166
}
2167
print "</td>\n" .
2168
"<td class=\"link\">" .
2160
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$co{'id'}")}, "commit") .
2161
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$co{'id'}")}, "tree");
2169
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$co{'id'}")}, "commit") .
2170
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$co{'id'}")}, "tree");
2171
print "</td>\n" .
2172
"</tr>\n";
2173
}
2202
}
2203
$alternate ^= 1;
2204
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
2196
- "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
2205
+ "<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
2206
"<td>" .
2198
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$co{'id'}"), -class => "list"}, "<b>" .
2199
- escapeHTML(chop_str($co{'title'}, 50)) . "</b><br/>");
2207
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$co{'id'}"), -class => "list"}, "<b>" .
2208
+ esc_html(chop_str($co{'title'}, 50)) . "</b><br/>");
2209
while (my $setref = shift @files) {
2210
my %set = %$setref;
2202
- print $cgi->a({-href => esc("$my_uri?p=$project;a=blob;h=$set{'id'};hb=$co{'id'};f=$set{'file'}"), class => "list"},
2203
- "<span style=\"color:#e00000\">" . escapeHTML($set{'file'}) . "</span>") .
2211
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=blob;h=$set{'id'};hb=$co{'id'};f=$set{'file'}"), class => "list"},
2212
+ "<span style=\"color:#e00000\">" . esc_html($set{'file'}) . "</span>") .
2213
"<br/>\n";
2214
}
2215
print "</td>\n" .
2216
"<td class=\"link\">" .
2208
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$co{'id'}")}, "commit") .
2209
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$co{'id'}")}, "tree");
2217
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$co{'id'}")}, "commit") .
2218
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$co{'id'}")}, "tree");
2219
print "</td>\n" .
2220
"</tr>\n";
2221
}
2238
}
2239
git_header_html();
2240
print "<div class=\"page_nav\">\n" .
2232
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary")}, "summary") .
2241
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary")}, "summary") .
2242
" | shortlog" .
2234
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=log;h=$hash")}, "log") .
2235
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$hash")}, "commit") .
2236
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
2237
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=tree;h=$hash;hb=$hash")}, "tree") . "<br/>\n";
2243
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=log;h=$hash")}, "log") .
2244
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$hash")}, "commit") .
2245
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
2246
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=tree;h=$hash;hb=$hash")}, "tree") . "<br/>\n";
2247
2248
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
2249
open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed.");
2251
close $fd;
2252
2253
if ($hash ne $head || $page) {
2245
- print $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog")}, "HEAD");
2254
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog")}, "HEAD");
2255
} else {
2256
print "HEAD";
2257
}
2258
if ($page > 0) {
2259
print " ⋅ " .
2251
- $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
2260
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
2261
} else {
2262
print " ⋅ prev";
2263
}
2264
if ($#revlist >= (100 * ($page+1)-1)) {
2265
print " ⋅ " .
2257
- $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
2266
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
2267
} else {
2268
print " ⋅ next";
2269
}
2270
print "<br/>\n" .
2271
"</div>\n";
2272
print "<div>\n" .
2264
- $cgi->a({-href => esc("$my_uri?p=$project;a=summary"), -class => "title"}, " ") .
2273
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=summary"), -class => "title"}, " ") .
2274
"</div>\n";
2275
print "<table cellspacing=\"0\">\n";
2276
my $alternate = 0;
2285
}
2286
$alternate ^= 1;
2287
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
2279
- "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
2288
+ "<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
2289
"<td>";
2290
if (length($co{'title_short'}) < length($co{'title'})) {
2282
- print $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"},
2283
- "<b>" . escapeHTML($co{'title_short'}) . "</b>");
2291
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"},
2292
+ "<b>" . esc_html($co{'title_short'}) . "</b>");
2293
} else {
2285
- print $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$commit"), -class => "list"},
2286
- "<b>" . escapeHTML($co{'title_short'}) . "</b>");
2294
+ print $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$commit"), -class => "list"},
2295
+ "<b>" . esc_html($co{'title_short'}) . "</b>");
2296
}
2297
print "</td>\n" .
2298
"<td class=\"link\">" .
2290
- $cgi->a({-href => esc("$my_uri?p=$project;a=commit;h=$commit")}, "commit") .
2291
- " | " . $cgi->a({-href => esc("$my_uri?p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
2299
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=commit;h=$commit")}, "commit") .
2300
+ " | " . $cgi->a({-href => esc_url("$my_uri?p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
2301
"</td>\n" .
2302
"</tr>";
2303
}
2304
if ($#revlist >= (100 * ($page+1)-1)) {
2305
print "<tr>\n" .
2306
"<td>" .
2298
- $cgi->a({-href => esc("$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page+1)), -title => "Alt-n"}, "next") .
2307
+ $cgi->a({-href => esc_url("$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page+1)), -title => "Alt-n"}, "next") .
2308
"</td>\n" .
2309
"</tr>\n";
2310
}