]> git.sesse.net Git - itkacl/blob - itkacl-web-1.0/web/deletenode.pl
Add the bare minimum of what is required for the web interface to work (but be butt...
[itkacl] / itkacl-web-1.0 / web / deletenode.pl
1 #! /usr/bin/perl -T
2 use strict;
3 use warnings;
4 use utf8;
5
6 use lib '../include';
7 use itkaclcommon;
8
9 itkaclcommon::init();
10
11 my $entry = $itkaclcommon::cgi->param('entry');
12
13 # Find the parent node before we delete this (FIXME: this will fail badly
14 # for root nodes!)
15 my $ref = $itkaclcommon::dbh->selectrow_hashref('SELECT parent FROM objects WHERE id=?',
16         undef, $entry);
17
18 $itkaclcommon::dbh->do('DELETE FROM objects WHERE id=?', undef, $entry)
19         or die "Couldn't delete object";
20
21 # Let sync-itkacl know there's updates
22 utime(time(), time(), '/etc/itkacl/updated');
23
24 # Redirect to the parent
25 print $itkaclcommon::cgi->redirect("view.pl?entry=$ref->{'parent'}");
26