summaryrefslogtreecommitdiff
path: root/rh-bin/listdropboxes.cgi
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2014-09-22 12:00:06 (GMT)
committerChristian Pointner <equinox@helsinki.at>2014-09-22 12:00:06 (GMT)
commit431d138784ea13af9a26a16780d52b3385ab0b21 (patch)
tree61d0e2648fab1f674c1bc7265ca03de8ab0d4213 /rh-bin/listdropboxes.cgi
parente1b7f1d5db69ef7deac50c2171c2dce477a94aff (diff)
moved cgi stuff to rh-bin
Diffstat (limited to 'rh-bin/listdropboxes.cgi')
-rwxr-xr-xrh-bin/listdropboxes.cgi70
1 files changed, 70 insertions, 0 deletions
diff --git a/rh-bin/listdropboxes.cgi b/rh-bin/listdropboxes.cgi
new file mode 100755
index 0000000..14ecf11
--- /dev/null
+++ b/rh-bin/listdropboxes.cgi
@@ -0,0 +1,70 @@
+#!/usr/bin/perl
+
+use strict;
+use CGI;
+use File::Basename;
+use lib dirname( __FILE__ );
+use rddb;
+
+my $status = 'ERROR';
+my $errorstring = 'unknown';
+my $responsecode = 500;
+my @dropboxes = ();
+
+my $q = CGI->new;
+my $username = $q->param('LOGIN_NAME');
+my $token = $q->param('PASSWORD');
+
+my $dbh;
+($dbh, $status, $errorstring) = rddb::opendb();
+if(defined $dbh) {
+ my $result;
+ ($result, $status, $errorstring) = rddb::check_token($dbh, $username, $token);
+ if($result == 1) {
+ $responsecode = 200;
+ @dropboxes = rddb::get_dropboxes($dbh, $username);
+ unless (defined $dropboxes[0]) {
+ $responsecode = 500;
+ $status = $dropboxes[1];
+ $errorstring = $dropboxes[2];
+ }
+ } elsif($result == 0) {
+ $responsecode = 403;
+ } else {
+ $responsecode = 500;
+ }
+ rddb::closedb($dbh);
+}
+
+print "Content-type: application/xml; charset=UTF-8\n\n";
+
+if($responsecode != 200) {
+ print "<RDWebResult>\n";
+ print " <ResponseCode>" . $responsecode . "</ResponseCode>\n";
+ print " <ErrorString>" . $errorstring . "</ErrorString>\n";
+ print "</RDWebResult>\n";
+} else {
+ print "<dropboxList>\n";
+ for my $href (@dropboxes) {
+ print " <dropbox>\n";
+ print " <group>" . $href->{'GROUP'} . "</group>\n";
+ print " <group-description>" . $href->{'GROUPDESC'} . "</group-description>\n";
+ print " <group-low-cart>" . $href->{'GROUPLOWCART'} . "</group-low-cart>\n";
+ print " <group-high-cart>" . $href->{'GROUPHIGHCART'} . "</group-high-cart>\n";
+ print " <normalization-level>" . $href->{'NORMLEVEL'} . "</normalization-level>\n";
+ print " <autotrim-level>" . $href->{'TRIMLEVEL'} . "</autotrim-level>\n";
+ print " <parameters>" . $href->{'PARAM'} . "</parameters>\n";
+ print " <type>" . $href->{'TYPE'} . "</type>\n";
+ if($href->{'TYPE'} eq "show") {
+ print " <show-id>" . $href->{'SHOWID'} . "</show-id>\n";
+ print " <show-title>" . $href->{'SHOWTITLE'} . "</show-title>\n";
+ print " <show-log>" . $href->{'SHOWLOG'} . "</show-log>\n";
+ print " <show-rhythm>" . $href->{'SHOWRHYTHM'} . "</show-rhythm>\n";
+ print " <show-dayofweek>" . $href->{'SHOWDOW'} . "</show-dayofweek>\n";
+ print " <show-starttime>" . $href->{'SHOWSTARTTIME'} . "</show-starttime>\n";
+ print " <show-length>" . $href->{'SHOWLEN'} . "</show-length>\n";
+ }
+ print " </dropbox>\n";
+ }
+ print "</dropboxList>\n";
+}