diff options
Diffstat (limited to 'src/ellinika')
-rw-r--r-- | src/ellinika/cgi.scm4 | 25 | ||||
-rw-r--r-- | src/ellinika/i18n.scm | 6 |
2 files changed, 24 insertions, 7 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,7 +1,6 @@ -;;;; -*- 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 @@ -18,14 +17,30 @@ (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")) @@ -58,9 +73,9 @@ ifelse(IFACE,[CGI],,dnl 0 slash)) (set! cgi-server-protocol-version (substring server-protocol (1+ slash)))))) -) +]) ;;; User-definable variables (define-public dict-template-file-name "dict.html") diff --git a/src/ellinika/i18n.scm b/src/ellinika/i18n.scm index c05d727..40cb47d 100644 --- a/src/ellinika/i18n.scm +++ b/src/ellinika/i18n.scm @@ -1,6 +1,6 @@ ;;;; This file is part of Greek Dictionary Web Engine -;;;; Copyright (C) 2006, 2007 Sergey Poznyakoff +;;;; Copyright (C) 2006, 2007, 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, or (at your option) @@ -14,12 +14,14 @@ ;;;; 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 i18n) - #:use-syntax (ice-9 syncase) #:export-syntax (_) #:export (locale-setup)) +(if (= (string->number (major-version)) 1) + (use-modules (ice-9 syncase))) + (define-syntax _ (syntax-rules () ((_ msg) (gettext msg)))) |