summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-10-10 01:20:06 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-10-10 01:20:06 (GMT)
commit8d58c2e47ca74514200040951eed769755a837e9 (patch)
treef9e7e3f61f3b392afe8db361dfe5ae602e7ecb8f
parent0138e75f8947d764a3542055448e0c2bcf7610a3 (diff)
parent3607d75e5cb24a30cd1f944d01c2d6d7c8470429 (diff)
Merge branch 'rhrd-libs-update'
-rwxr-xr-xrh-bin/authtoken.json11
-rwxr-xr-xrh-bin/listdropboxes.cgi19
2 files changed, 16 insertions, 14 deletions
diff --git a/rh-bin/authtoken.json b/rh-bin/authtoken.json
index 2c19cb0..973a492 100755
--- a/rh-bin/authtoken.json
+++ b/rh-bin/authtoken.json
@@ -33,15 +33,14 @@ my $fullname = '';
my $responsecode = 500;
if(defined $ENV{REMOTE_USER}) {
- my $dbh;
- ($dbh, $status, $errorstring) = RHRD::rddb::opendb();
- if(defined $dbh) {
+ (my $ctx, $status, $errorstring) = RHRD::rddb::init();
+ if(defined $ctx) {
$username = $ENV{REMOTE_USER};
- ($token, $status, $errorstring) = RHRD::rddb::get_token($dbh, $username);
+ ($token, $status, $errorstring) = RHRD::rddb::get_token($ctx, $username);
$token = '' unless($token);
- ($fullname, $status, $errorstring) = RHRD::rddb::get_fullname($dbh, $username);
+ ($fullname, $status, $errorstring) = RHRD::rddb::get_fullname($ctx, $username);
$fullname = '' unless($fullname);
- RHRD::rddb::closedb($dbh);
+ RHRD::rddb::destroy($ctx);
if($status == "OK") {
$responsecode = 200;
}
diff --git a/rh-bin/listdropboxes.cgi b/rh-bin/listdropboxes.cgi
index 0a65105..a451dc7 100755
--- a/rh-bin/listdropboxes.cgi
+++ b/rh-bin/listdropboxes.cgi
@@ -36,14 +36,13 @@ my $q = CGI->new;
my $username = $q->param('LOGIN_NAME');
my $token = $q->param('PASSWORD');
-my $dbh;
-($dbh, $status, $errorstring) = RHRD::rddb::opendb();
-if(defined $dbh) {
+(my $ctx, $status, $errorstring) = RHRD::rddb::init();
+if(defined $ctx) {
my $result;
- ($result, $status, $errorstring) = RHRD::rddb::check_token($dbh, $username, $token);
+ ($result, $status, $errorstring) = RHRD::rddb::check_token($ctx, $username, $token);
if($result == 1) {
$responsecode = 200;
- @dropboxes = RHRD::rddb::get_dropboxes($dbh, $username);
+ @dropboxes = RHRD::rddb::get_dropboxes($ctx, $username);
if(!defined $dropboxes[0] && defined $dropboxes[1]) {
$responsecode = 500;
$status = $dropboxes[1];
@@ -54,7 +53,7 @@ if(defined $dbh) {
} else {
$responsecode = 500;
}
- RHRD::rddb::closedb($dbh);
+ RHRD::rddb::destroy($ctx);
}
print "Content-type: application/xml; charset=UTF-8\n";
@@ -78,12 +77,16 @@ if($responsecode != 200) {
print " <parameters>" . xml_quote($href->{'PARAM'}) . "</parameters>\n";
print " <type>" . xml_quote($href->{'TYPE'}) . "</type>\n";
if($href->{'TYPE'} eq "show") {
+ my $dow = $href->{'SHOWDOW'};
+ $dow = 0 unless $dow < 7;
+ my $starttime = $href->{'SHOWSTARTTIME'};
+ substr($starttime, 2, 0) = ':';
print " <show-id>" . xml_quote($href->{'SHOWID'}) . "</show-id>\n";
print " <show-title>" . xml_quote($href->{'SHOWTITLE'}) . "</show-title>\n";
print " <show-log>" . xml_quote($href->{'SHOWLOG'}) . "</show-log>\n";
print " <show-rhythm>" . xml_quote($href->{'SHOWRHYTHM'}) . "</show-rhythm>\n";
- print " <show-dayofweek>" . xml_quote($href->{'SHOWDOW'}) . "</show-dayofweek>\n";
- print " <show-starttime>" . xml_quote($href->{'SHOWSTARTTIME'}) . "</show-starttime>\n";
+ print " <show-dayofweek>" . xml_quote($dow) . "</show-dayofweek>\n";
+ print " <show-starttime>" . xml_quote($starttime) . "</show-starttime>\n";
print " <show-length>" . xml_quote($href->{'SHOWLEN'}) . "</show-length>\n";
} elsif($href->{'TYPE'} eq "jingle") {
print " <jingle-title>" . xml_quote($href->{'JINGLETITLE'}) . "</jingle-title>\n";