summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@wirdorange.org>2011-01-15 20:12:15 +0000
committerOthmar Gsenger <otti@wirdorange.org>2011-01-15 20:12:15 +0000
commit14722a2e4de3cbc1e2c99b2a736c7facd2c37169 (patch)
tree89358010d8ea993ed8876e06b89cd251d0763acc
parentadded db structure (diff)
added config, fixed nobr issiue on lenny
-rwxr-xr-xcancel.pl4
-rw-r--r--config.pm.example8
-rw-r--r--local/db.pm3
-rw-r--r--local/menu.pm3
-rwxr-xr-xremove.pl5
-rwxr-xr-xsearch.pl2
6 files changed, 19 insertions, 6 deletions
diff --git a/cancel.pl b/cancel.pl
index 6aee2bd..75df86a 100755
--- a/cancel.pl
+++ b/cancel.pl
@@ -13,7 +13,7 @@ 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();
-
+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";
foreach my $value ( @$row)
@@ -23,7 +23,7 @@ foreach my $value ( @$row)
{
my $status = $cli->send_request('editqueue','GroupDelete',0,"",[$value->{LastID}->value]) or die "Can't connect to nzbget";
sleep 1;
- remove_tree('/srv/nzbget/done/'.$dl->category->name.'/'.$dl->download_id);
+ remove_tree($basedir'/'.$dl->category->name.'/'.$dl->download_id);
$user->obj->quota_used($user->obj->quota_used - $dl->size);
$user->obj->update;
my @seens = local::db::seen->search(download=>$del_id);
diff --git a/config.pm.example b/config.pm.example
new file mode 100644
index 0000000..b4655df
--- /dev/null
+++ b/config.pm.example
@@ -0,0 +1,8 @@
+package config;
+
+our %config = (
+ db => ['dbi:SQLite:/home/nzbget/datenbank.sqlite', '', ''],
+ page_name => 'anymur binary usenet',
+ files_dir => '/media/wechsel/otti/done/usenet',
+
+);
diff --git a/local/db.pm b/local/db.pm
index 94c5941..9ae4793 100644
--- a/local/db.pm
+++ b/local/db.pm
@@ -1,6 +1,7 @@
package local::db::dbi;
use base 'Class::DBI';
-local::db::dbi->connection('dbi:SQLite:/srv/nzbget/datenbank.sqlite', '', '');
+use config;
+local::db::dbi->connection(@{$config::config{db}});
package local::db::download;
use base 'local::db::dbi';
diff --git a/local/menu.pm b/local/menu.pm
index 6c63c89..62d5947 100644
--- a/local/menu.pm
+++ b/local/menu.pm
@@ -4,6 +4,7 @@ use CGI qw(:standard);
use strict;
use base "Exporter";
use local::user;
+use config;
my %menus =
(
@@ -31,7 +32,7 @@ sub start_html
my $active = $self->{REQUEST_URI};
my $html= CGI::start_html(-style=>{'src'=>'/style.css'},-title=>$title);
my $user = new local::user($ENV{REMOTE_USER});
- $html.= table({class=>'nohigh'},Tr({class=>'nohigh'},td({style=>'font-weight: bold'},[qw/ share.ffgraz.net / ]),td({class=>'login',align=>'right'},[nobr(b('Angemeldet&nbsp;als:&nbsp;').$user->get_name)])));
+ $html.= table({class=>'nohigh'},Tr({class=>'nohigh'},td({style=>'font-weight: bold'},[$config::config{page_name} ]),td({class=>'login',align=>'right'},['<nobr>'.b('Angemeldet&nbsp;als:&nbsp;').$user->get_name.'</nobr>'])));
$html.= CGI::start_div({class=>'bodydiv'});
my @elements;
foreach my $url (sort {$menus{$a}->[0] <=> $menus{$b}->[0] } keys %menus)
diff --git a/remove.pl b/remove.pl
index 25f2a82..1b369bb 100755
--- a/remove.pl
+++ b/remove.pl
@@ -6,13 +6,16 @@ use CGI::Carp 'fatalsToBrowser';
use local::db;
use local::user;
use File::Path qw(remove_tree);
+use $config;
my $user = new local::user($ENV{REMOTE_USER});
my $del_id = param('id');
my ($dl) = local::db::download->retrieve($del_id) or die 'Error in cancel';
die "Not allowed" if not $dl->owner->owner_id() eq $user->get_id();
-remove_tree('/srv/nzbget/done/'.$dl->category->name.'/'.$dl->download_id);
+
+my $basedir = $config::config{files_dir} or die 'Missing files_dir in config';
+remove_tree($basedir.'/'.$dl->category->name.'/'.$dl->download_id);
$user->obj->quota_used($user->obj->quota_used - $dl->size);
$user->obj->update;
my @seens = local::db::seen->search(download=>$del_id);
diff --git a/search.pl b/search.pl
index aad6747..d63d944 100755
--- a/search.pl
+++ b/search.pl
@@ -26,7 +26,7 @@ print
-labels => {25=>'25',100=>'100',500=>500}
) ])),
Tr(td(['',submit()])),
- Tr(td(['&nbsp;'])),
+ Tr(td([qw/&nbsp; &nbsp;/])),
);
print CGI::end_form;
my $param_obj=new local::params;