summaryrefslogtreecommitdiff
path: root/utilities/diatheke/soap
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:53:59 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:53:59 -0400
commit03134fa5f6f25d92724ce4c183f9bbe12a9e37dc (patch)
tree847326a4de82f0241ac87cbbc427a1b92a696a02 /utilities/diatheke/soap
parentd7469385b05b9510338407fa123e9ad090f80af6 (diff)
Imported Upstream version 1.5.11
Diffstat (limited to 'utilities/diatheke/soap')
-rwxr-xr-xutilities/diatheke/soap/sapouni.cgi97
-rwxr-xr-xutilities/diatheke/soap/soapatheke.pl16
2 files changed, 113 insertions, 0 deletions
diff --git a/utilities/diatheke/soap/sapouni.cgi b/utilities/diatheke/soap/sapouni.cgi
new file mode 100755
index 0000000..24df769
--- /dev/null
+++ b/utilities/diatheke/soap/sapouni.cgi
@@ -0,0 +1,97 @@
+#!/usr/bin/perl
+
+#version 1.0
+
+package sapouni;
+$sapouni = "nice /usr/bin/diatheke"; # location of diatheke command line program -- if you are using a MS Windows server, you might need to remove the "nice"
+
+$sword_path = "/home/sword"; # SWORD_PATH environment variable you want to use
+$maxverses = 0; # maximum number of verses diatheke will return per query (prevents people from asking for Gen1:1-Rev22:21; 0 for unlim.)
+$defversion = "KJV"; # book to query when none is selected, but a verse/search is entered
+$deflocale = "abbr"; # this is just the default for cases where user has not selected a locale and his browser does not reveal one -- you can also set locale using locael=<locale> in the GET URL
+
+
+###############################################################################
+## You should not need to edit anything below this line.
+## Unless you want to modify functionality of course. :)
+###############################################################################
+
+$ENV{'SWORD_PATH'} = $sword_path;
+
+use SOAP::Transport::HTTP;
+
+SOAP::Transport::HTTP::CGI
+ -> dispatch_to('sapouni')
+ -> handle;
+
+package sapouni;
+
+sub biblequery {
+ my ($class, $books, $key, $options, $encoding, $markup, $searchtype, $locale, $script, $max) = @_;
+
+ if ($key eq "") {
+ $key = "Jn 3:16";
+ }
+
+ @booklist = split ' ', $books;
+
+ $n = scalar(@booklist);
+ if ($n == 0) {
+ @booklist[0] = $defversion;
+ $n++;
+ }
+
+ $query = "";
+
+ if ($options ne "") {
+ $query .= " -o \"$options\"";
+ }
+
+ if ($encoding ne "") {
+ $query .= " -e \"$encoding\"";
+ }
+ else {
+ $query .= " -e UTF8";
+ }
+
+ if ($markup ne "") {
+ $query .= " -f \"$markup\"";
+ }
+ else {
+ $query .= " -f ThML";
+ }
+
+ if ($searchtype ne "") {
+ $query .= " -s \"$searchtype\"";
+ }
+
+ if ($locale ne "") {
+ $query .= " -l \"$locale\"";
+ }
+ else {
+ $query .= " -l $deflocale";
+ }
+
+ if ($script ne "") {
+ $query .= " -t \"$script\"";
+ }
+
+ if ($max ne "" && $max ne 0) {
+ $query .= " -m \"$max\"";
+ }
+
+ $rval = "";
+ for ($i = 0; $i < $n; $i++) {
+ $line = "$sapouni $query -b $booklist[$i] -k \"$key\" 2> /dev/null";
+
+ # uncomment to print the command line send to Diatheke (for debugging)
+ # $rval .= "$line\n";
+
+ $line = `$line`;
+ chomp($line);
+
+ $rval .= "$line\n";
+ }
+
+ return "$rval";
+}
diff --git a/utilities/diatheke/soap/soapatheke.pl b/utilities/diatheke/soap/soapatheke.pl
new file mode 100755
index 0000000..e3f88ed
--- /dev/null
+++ b/utilities/diatheke/soap/soapatheke.pl
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+
+## This is a test app and has no other purpose.
+
+use SOAP::Lite;
+
+my ($books, $key, $options, $encoding, $markup, $searchtype, $locale, $script, $max) = @ARGV;
+
+# uncomment to see parameters being passed to the SOAP server (for debugging)
+# print "$books\n$key\n$options\n$encoding\n$markup\n$searchtype\n$locale\n$script\n$max\n";
+
+print SOAP::Lite
+ -> uri('http://bible.gotjesus.org/sapouni')
+ -> proxy('http://bible.gotjesus.org/cgi-bin/sapouni.cgi')
+ -> biblequery($books, $key, $options, $encoding, $markup, $searchtype, $locale, $script, $max)
+ -> result;