Eliminate a few stray typo bugs
[girocco.git] / cgi / tagproj.cgi
blob98ddbe363565a4730a3f51bb1c679cb0e36372e5
1 #!/usr/bin/perl
2 # (c) Petr Baudis <pasky@suse.cz>
3 # GPLv2
5 use strict;
6 use warnings;
8 use lib ".";
9 use Girocco::Config;
10 use Girocco::Project;
11 use Girocco::Util;
12 use CGI;
14 our $cgi = CGI->new;
16 my $pname = $cgi->param('p')||'';
17 my $ctags = $cgi->param('t')||'';
18 $pname =~ s/\.git$//;
20 my $proj = Girocco::Project->load($pname);
21 if (not $proj) {
22 print $cgi->header(-status=>404);
23 print "Project $pname does not exist.";
24 exit;
27 if ($ctags =~ /[^ a-zA-Z0-9:.+#_-]/) {
28 print $cgi->header(-status=>403);
29 print "Content tag(s) '$ctags' contain evil characters.";
30 exit;
33 foreach my $ctag (split(/ /, $ctags)) {
34 # Locking is not important
35 my $val = 0;
36 open CT, '<', $proj->{path}."/ctags/$ctag" and $val = <CT> and close CT;
37 chomp $val;
38 open CT, '>', $proj->{path}."/ctags/$ctag" and print CT ($val+1)."\n" and close CT;
41 print $cgi->header(-status=>303, -location=>"@{[url_path($Girocco::Config::gitweburl)]}/$pname.git");