summaryrefslogtreecommitdiffabout
path: root/src/ellinika/cgi.scm4
Side-by-side diff
Diffstat (limited to 'src/ellinika/cgi.scm4') (more/less context) (ignore whitespace changes)
-rw-r--r--src/ellinika/cgi.scm425
1 files changed, 20 insertions, 5 deletions
diff --git a/src/ellinika/cgi.scm4 b/src/ellinika/cgi.scm4
index 8c9b54d..51f9570 100644
--- a/src/ellinika/cgi.scm4
+++ b/src/ellinika/cgi.scm4
@@ -1,39 +1,54 @@
-;;;; -*- scheme -*-
-;;;; Greek Dictionary Web Engine
-;;;; Copyright (C) 2005, 2007, 2010 Sergey Poznyakoff
+;;;; Greek Dictionary Web Engine -*- scheme -*-
+;;;; Copyright (C) 2005, 2007, 2010, 2015 Sergey Poznyakoff
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation; either version 3 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;;; GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;;;
(define-module (ellinika cgi)
#:use-module (ellinika config)
#:use-module (ellinika i18n)
#:use-module ifelse(IFACE,[CGI],(www cgi),(guile-user))
+ #:use-module (ice-9 iconv)
+ #:use-module (rnrs bytevectors)
#:re-export (base-dir html-dir sysconf-dir locale-path
ellinika-sql-connection
config-file-name ))
-ifelse(IFACE,[CGI],,dnl
+ifelse(IFACE,[CGI],[
+(define-public cgi-script-name
+ (cgi:getenv 'script-name))
+(define-public cgi-server-hostname
+ (cgi:getenv 'server-hostname))
+(define-public cgi-server-protocol-name
+ (cgi:getenv 'server-protocol-name))
+(define-public cgi-server-protocol-version
+ (cgi:getenv 'server-protocol-version))
+(define-public (cgi:value-u8 key)
+ (let ((x (cgi:value key)))
+ (if x
+ (utf8->string (string->bytevector x "ISO-8859-1"))
+ x)))
+],[
(define form-data
(append
(parse-form-data
(table:get (request-rec:subprocess-env Request) "QUERY_STRING"))
(if (= (request-rec:method-number Request) 2)
(parse-form-data (read-post-data Request))
'())))
(define-public (cgi:value name)
(assoc-ref form-data name))
(define-public (cgi:names)
@@ -50,25 +65,25 @@ ifelse(IFACE,[CGI],,dnl
(define-public cgi-server-protocol-name #f)
(define-public cgi-server-protocol-version #f)
(let* ((server-protocol (table:get (request-rec:subprocess-env Request)
"SERVER_PROTOCOL")))
(if server-protocol
(let ((slash (string-index server-protocol #\/)))
(set! cgi-server-protocol-name (substring server-protocol
0 slash))
(set! cgi-server-protocol-version (substring server-protocol
(1+ slash))))))
-)
+])
;;; User-definable variables
(define-public dict-template-file-name "dict.html")
(define-public nea-template-file-name "nea.html")
(define-public monima-nea-template-file-name "monima.html")
(define-public target-language "el_GR")
(define-public word-forms-reference '())
(define-public ref-loc #f)

Return to:

Send suggestions and report system problems to the System administrator.