diff options
author | Peter Grassberger <petertheone@gmail.com> | 2015-12-27 22:04:18 (GMT) |
---|---|---|
committer | Peter Grassberger <petertheone@gmail.com> | 2015-12-27 22:04:18 (GMT) |
commit | f7c5ad3a69e89a558a1f9d4375c5aaaee270e997 (patch) | |
tree | 6c02fb18830c7a517adbe9f1793805d767ae820a /rh-bin/listdropboxes.cgi | |
parent | 2d4a4c039d588a26610daed552e1570b707e3e46 (diff) | |
parent | 5f72eb4960c9e6fb48a06fcb428ab70b742d9ace (diff) |
Merge branch 'master' of ssh://git@git.helsinki.at:2342/rhwebimport.git
Diffstat (limited to 'rh-bin/listdropboxes.cgi')
-rwxr-xr-x | rh-bin/listdropboxes.cgi | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/rh-bin/listdropboxes.cgi b/rh-bin/listdropboxes.cgi index cb608f4..2b753d1 100755 --- a/rh-bin/listdropboxes.cgi +++ b/rh-bin/listdropboxes.cgi @@ -36,24 +36,32 @@ my $q = CGI->new; my $username = $q->param('LOGIN_NAME'); my $token = $q->param('PASSWORD'); -(my $ctx, $status, $errorstring) = RHRD::rddb::init(); -if(defined $ctx) { - my $result; - ($result, $status, $errorstring) = RHRD::rddb::check_token($ctx, $username, $token); - if($result == 1) { - $responsecode = 200; - @dropboxes = RHRD::rddb::get_dropboxes($ctx, $username); - if(!defined $dropboxes[0] && defined $dropboxes[1]) { +if(!defined $username) { + $responsecode = 400; + $errorstring = "mandatory field LOGIN_NAME is missing" +} elsif(!defined $token) { + $responsecode = 400; + $errorstring = "mandatory field PASSWORD is missing" +} else { + (my $ctx, $status, $errorstring) = RHRD::rddb::init(); + if(defined $ctx) { + my $result; + ($result, $status, $errorstring) = RHRD::rddb::check_token($ctx, $username, $token); + if($result == 1) { + $responsecode = 200; + @dropboxes = RHRD::rddb::get_dropboxes($ctx, $username); + if(!defined $dropboxes[0] && defined $dropboxes[1]) { + $responsecode = 500; + $status = $dropboxes[1]; + $errorstring = $dropboxes[2]; + } + } elsif($result == 0) { + $responsecode = 401; + } else { $responsecode = 500; - $status = $dropboxes[1]; - $errorstring = $dropboxes[2]; } - } elsif($result == 0) { - $responsecode = 401; - } else { - $responsecode = 500; + RHRD::rddb::destroy($ctx); } - RHRD::rddb::destroy($ctx); } print "Content-type: application/xml; charset=UTF-8\n"; @@ -92,6 +100,7 @@ if($responsecode != 200) { print " <jingle-title>" . xml_quote($href->{'JINGLETITLE'}) . "</jingle-title>\n"; } elsif($href->{'TYPE'} eq "musicpool") { print " <musicpool-title>" . xml_quote($href->{'MUSICPOOLTITLE'}) . "</musicpool-title>\n"; + print " <musicpool-clock>" . xml_quote($href->{'MUSICPOOLCLOCK'}) . "</musicpool-clock>\n"; } print " </dropbox>\n"; } |