diff options
author | Peter Grassberger <petertheone@gmail.com> | 2015-12-28 11:43:41 (GMT) |
---|---|---|
committer | Peter Grassberger <petertheone@gmail.com> | 2015-12-28 11:43:41 (GMT) |
commit | 17d6568c4da2901e083770d3a6f683d3d98ff488 (patch) | |
tree | 4678e69f12410f1ed6131688c204d16ae350cd99 | |
parent | d4af036bd683a8777e7251726168b7833272ea26 (diff) | |
parent | 00638c1416bc314c581b0ca67efe59c76f12e838 (diff) |
Merge branch 'master' of ssh://git@git.helsinki.at:2342/rhwebimport.git
-rwxr-xr-x | rh-bin/listdropboxes.cgi | 3 | ||||
-rwxr-xr-x | rh-bin/musicgrid.cgi | 15 |
2 files changed, 8 insertions, 10 deletions
diff --git a/rh-bin/listdropboxes.cgi b/rh-bin/listdropboxes.cgi index 2b753d1..2eabf22 100755 --- a/rh-bin/listdropboxes.cgi +++ b/rh-bin/listdropboxes.cgi @@ -35,6 +35,7 @@ my @dropboxes = (); my $q = CGI->new; my $username = $q->param('LOGIN_NAME'); my $token = $q->param('PASSWORD'); +my $type = $q->param('TYPE'); if(!defined $username) { $responsecode = 400; @@ -49,7 +50,7 @@ if(!defined $username) { ($result, $status, $errorstring) = RHRD::rddb::check_token($ctx, $username, $token); if($result == 1) { $responsecode = 200; - @dropboxes = RHRD::rddb::get_dropboxes($ctx, $username); + @dropboxes = RHRD::rddb::get_dropboxes($ctx, $username, undef, $type); if(!defined $dropboxes[0] && defined $dropboxes[1]) { $responsecode = 500; $status = $dropboxes[1]; diff --git a/rh-bin/musicgrid.cgi b/rh-bin/musicgrid.cgi index f2bf9db..5e2888d 100755 --- a/rh-bin/musicgrid.cgi +++ b/rh-bin/musicgrid.cgi @@ -35,7 +35,7 @@ my @clocks = (); my $q = CGI->new; my $username = $q->param('LOGIN_NAME'); my $token = $q->param('PASSWORD'); -my $cmd = $q->param('COMMAND'); +my $cmd = $q->request_method(); sub get_clocks { @@ -83,24 +83,21 @@ if(!defined $username) { } elsif(!defined $token) { $responsecode = 400; $errorstring = "mandatory field PASSWORD is missing"; -} elsif(!defined $cmd) { - $responsecode = 400; - $errorstring = "mandatory field COMMAND is missing"; } else { (my $ctx, $status, $errorstring) = RHRD::rddb::init(); if(defined $ctx) { (my $authenticated, $status, $errorstring) = RHRD::rddb::check_token($ctx, $username, $token); my $authorized = RHRD::rddb::is_musicpools_user($ctx, $username); if($authenticated == 1 && $authorized == 1) { - if($cmd eq "get") { + if($cmd eq "GET") { ($responsecode, $errorstring) = get_clocks($ctx); } - elsif($cmd eq "set") { + elsif($cmd eq "POST") { ($responsecode, $errorstring) = set_clock($ctx); } else { - $responsecode = 400; - $errorstring = "command '$cmd' is unknown"; + $responsecode = 405; + $errorstring = "request method '$cmd' is unknown"; } } elsif($authenticated == 0) { $responsecode = 401; @@ -117,7 +114,7 @@ if(!defined $username) { print "Content-type: application/xml; charset=UTF-8\n"; print "Status: $responsecode\n\n"; -if($cmd eq "set" || $responsecode != 200) { +if($cmd eq "POST" || $responsecode != 200) { print "<RDWebResult>\n"; print " <ResponseCode>" . xml_quote($responsecode) . "</ResponseCode>\n"; print " <ErrorString>" . xml_quote($errorstring) . "</ErrorString>\n"; |