Big module renaming: Git::RepoCGI -> Girocco::*
[girocco.git] / cgi / tagproj.cgi
blobd890e738c2e9af688ccbf3fdaeb02ae89c5162ab
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::CGI;
10 use CGI;
12 our $cgi = CGI->new;
14 my $pname = $cgi->param('p');
15 my $ctags = $cgi->param('t');
17 my $proj = Girocco::Project->load($pname);
18 if (not $proj) {
19 print $cgi->header(-status=>404);
20 print "Project $pname does not exist.";
21 exit;
24 if ($ctags =~ /[^ a-zA-Z0-9:.+#_-]/) {
25 print $cgi->header(-status=>403);
26 print "Content tag(s) '$ctags' contain evil characters.";
27 exit;
30 foreach my $ctag (split(/ /, $ctags)) {
31 # Locking is not important
32 my $val = 0;
33 open CT, $proj->{path}."/ctags/$ctag" and $val = <CT> and close CT;
34 chomp $val;
35 open CT, '>'.$proj->{path}."/ctags/$ctag" and print CT ($val+1)."\n" and close CT;
38 print $cgi->header(-status=>303, -location=>"$Girocco::Config::gitweburl/$pname.git");