taskd: Listen on $chroot/etc/taskd.socket, change protocol to allow multiple commands
[girocco/susan.git] / cgi / tagproj.cgi
blobe8e57c15ad4bbf823d5a74c464f18dda2940de97
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 CGI;
13 our $cgi = CGI->new;
15 my $pname = $cgi->param('p');
16 my $ctags = $cgi->param('t');
17 $pname =~ s/\.git$//;
19 my $proj = Girocco::Project->load($pname);
20 if (not $proj) {
21 print $cgi->header(-status=>404);
22 print "Project $pname does not exist.";
23 exit;
26 if ($ctags =~ /[^ a-zA-Z0-9:.+#_-]/) {
27 print $cgi->header(-status=>403);
28 print "Content tag(s) '$ctags' contain evil characters.";
29 exit;
32 foreach my $ctag (split(/ /, $ctags)) {
33 # Locking is not important
34 my $val = 0;
35 open CT, $proj->{path}."/ctags/$ctag" and $val = <CT> and close CT;
36 chomp $val;
37 open CT, '>'.$proj->{path}."/ctags/$ctag" and print CT ($val+1)."\n" and close CT;
40 print $cgi->header(-status=>303, -location=>"$Girocco::Config::gitweburl/$pname.git");