From 14722a2e4de3cbc1e2c99b2a736c7facd2c37169 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Sat, 15 Jan 2011 20:12:15 +0000 Subject: added config, fixed nobr issiue on lenny --- cancel.pl | 4 ++-- config.pm.example | 8 ++++++++ local/db.pm | 3 ++- local/menu.pm | 3 ++- remove.pl | 5 ++++- search.pl | 2 +- 6 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 config.pm.example 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 als: ').$user->get_name)]))); + $html.= table({class=>'nohigh'},Tr({class=>'nohigh'},td({style=>'font-weight: bold'},[$config::config{page_name} ]),td({class=>'login',align=>'right'},[''.b('Angemeldet als: ').$user->get_name.'']))); $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([' '])), + Tr(td([qw/   /])), ); print CGI::end_form; my $param_obj=new local::params; -- cgit v1.2.3