summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2012-09-25 20:53:32 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2012-09-25 20:53:32 (GMT)
commit761222eb1133d5ba6d48785719e8ff3b343499aa (patch)
tree28f95907c2a71d0bb39ea4da7f7e2110e2e19fa2
parentc690575ab4ed0f6784da9e01fdcab20a49256f7c (diff)
admin can cancel any download
-rw-r--r--nzbget/cancel.pm4
-rw-r--r--nzbget/download.pm6
2 files changed, 5 insertions, 5 deletions
diff --git a/nzbget/cancel.pm b/nzbget/cancel.pm
index ed08fc5..0a96091 100644
--- a/nzbget/cancel.pm
+++ b/nzbget/cancel.pm
@@ -15,10 +15,10 @@ sub handler
my $del_id = param('id');
my ($download) = local::db::download->retrieve($del_id) or die 'Error in cancel';
- die "Not allowed" if not $download->owner->owner_id() eq $user->get_id();
+ die "Not allowed" unless (($download->owner->owner_id() eq $user->get_id()) or ($user->is_admin()));
my $basedir = $config::config{files_dir} or die 'Missing files_dir in config';
my $cli = new local::nzbget;
- my $row = $cli->send_request('listgroups') or die "Can't connect to nubget";
+ my $row = $cli->send_request('listgroups') or die "Can't connect to nzbget";
foreach my $value ( @$row)
{
my ($dl) = local::db::download->retrieve($value->{NZBNicename}) or die ' Error in groups';
diff --git a/nzbget/download.pm b/nzbget/download.pm
index 4609aee..505df9b 100644
--- a/nzbget/download.pm
+++ b/nzbget/download.pm
@@ -49,12 +49,12 @@ sub get_download_table
$user->obj->quota_used($user->obj->quota_used+$total);
$user->obj->update();
}
- my $cancel;
+ my $cancel;
if ($download->processing == 1)
- {
+ {
$html.=Tr(td([$download->category->name,$download->name,$download->owner->name,$total,'unpacking','']));
} else {
- $cancel=a({href=>'cancel?id='.$value->{NZBNicename}},'Abbrechen') if ($download->owner->owner_id() eq $user->get_id());
+ $cancel=a({href=>'cancel?id='.$value->{NZBNicename}},'Abbrechen') if (($download->owner->owner_id() eq $user->get_id()) or ($user->is_admin));
$html.= Tr(td([$download->category->name,$download->name,$download->owner->name,$total,$percent.'%',$cancel]));
}
#foreach my $key (keys %$value)