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,9 +1,8 @@ | |||
1 | ;;;; -*- scheme -*- | 1 | ;;;; Greek Dictionary Web Engine -*- scheme -*- |
2 | ;;;; Greek Dictionary Web Engine | 2 | ;;;; Copyright (C) 2005, 2007, 2010, 2015 Sergey Poznyakoff |
3 | ;;;; Copyright (C) 2005, 2007, 2010 Sergey Poznyakoff | ||
4 | ;;;; | 3 | ;;;; |
5 | ;;;; This program is free software; you can redistribute it and/or modify | 4 | ;;;; This program is free software; you can redistribute it and/or modify |
6 | ;;;; it under the terms of the GNU General Public License as published by | 5 | ;;;; it under the terms of the GNU General Public License as published by |
7 | ;;;; the Free Software Foundation; either version 3 of the License, or | 6 | ;;;; the Free Software Foundation; either version 3 of the License, or |
8 | ;;;; (at your option) any later version. | 7 | ;;;; (at your option) any later version. |
9 | ;;;; | 8 | ;;;; |
@@ -16,18 +15,34 @@ | |||
16 | ;;;; along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | ;;;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | ;;;; | 16 | ;;;; |
18 | (define-module (ellinika cgi) | 17 | (define-module (ellinika cgi) |
19 | #:use-module (ellinika config) | 18 | #:use-module (ellinika config) |
20 | #:use-module (ellinika i18n) | 19 | #:use-module (ellinika i18n) |
21 | #:use-module ifelse(IFACE,[CGI],(www cgi),(guile-user)) | 20 | #:use-module ifelse(IFACE,[CGI],(www cgi),(guile-user)) |
21 | #:use-module (ice-9 iconv) | ||
22 | #:use-module (rnrs bytevectors) | ||
22 | #:re-export (base-dir html-dir sysconf-dir locale-path | 23 | #:re-export (base-dir html-dir sysconf-dir locale-path |
23 | ellinika-sql-connection | 24 | ellinika-sql-connection |
24 | config-file-name )) | 25 | config-file-name )) |
25 | 26 | ||
26 | 27 | ||
27 | ifelse(IFACE,[CGI],,dnl | 28 | ifelse(IFACE,[CGI],[ |
29 | (define-public cgi-script-name | ||
30 | (cgi:getenv 'script-name)) | ||
31 | (define-public cgi-server-hostname | ||
32 | (cgi:getenv 'server-hostname)) | ||
33 | (define-public cgi-server-protocol-name | ||
34 | (cgi:getenv 'server-protocol-name)) | ||
35 | (define-public cgi-server-protocol-version | ||
36 | (cgi:getenv 'server-protocol-version)) | ||
37 | (define-public (cgi:value-u8 key) | ||
38 | (let ((x (cgi:value key))) | ||
39 | (if x | ||
40 | (utf8->string (string->bytevector x "ISO-8859-1")) | ||
41 | x))) | ||
42 | ],[ | ||
28 | (define form-data | 43 | (define form-data |
29 | (append | 44 | (append |
30 | (parse-form-data | 45 | (parse-form-data |
31 | (table:get (request-rec:subprocess-env Request) "QUERY_STRING")) | 46 | (table:get (request-rec:subprocess-env Request) "QUERY_STRING")) |
32 | (if (= (request-rec:method-number Request) 2) | 47 | (if (= (request-rec:method-number Request) 2) |
33 | (parse-form-data (read-post-data Request)) | 48 | (parse-form-data (read-post-data Request)) |
@@ -56,13 +71,13 @@ ifelse(IFACE,[CGI],,dnl | |||
56 | (let ((slash (string-index server-protocol #\/))) | 71 | (let ((slash (string-index server-protocol #\/))) |
57 | (set! cgi-server-protocol-name (substring server-protocol | 72 | (set! cgi-server-protocol-name (substring server-protocol |
58 | 0 slash)) | 73 | 0 slash)) |
59 | (set! cgi-server-protocol-version (substring server-protocol | 74 | (set! cgi-server-protocol-version (substring server-protocol |
60 | (1+ slash)))))) | 75 | (1+ slash)))))) |
61 | 76 | ||
62 | ) | 77 | ]) |
63 | 78 | ||
64 | 79 | ||
65 | ;;; User-definable variables | 80 | ;;; User-definable variables |
66 | (define-public dict-template-file-name "dict.html") | 81 | (define-public dict-template-file-name "dict.html") |
67 | (define-public nea-template-file-name "nea.html") | 82 | (define-public nea-template-file-name "nea.html") |
68 | (define-public monima-nea-template-file-name "monima.html") | 83 | (define-public monima-nea-template-file-name "monima.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,8 +1,8 @@ | |||
1 | ;;;; This file is part of Greek Dictionary Web Engine | 1 | ;;;; This file is part of Greek Dictionary Web Engine |
2 | ;;;; Copyright (C) 2006, 2007 Sergey Poznyakoff | 2 | ;;;; Copyright (C) 2006, 2007, 2015 Sergey Poznyakoff |
3 | ;;;; | 3 | ;;;; |
4 | ;;;; This program is free software; you can redistribute it and/or modify | 4 | ;;;; This program is free software; you can redistribute it and/or modify |
5 | ;;;; it under the terms of the GNU General Public License as published by | 5 | ;;;; it under the terms of the GNU General Public License as published by |
6 | ;;;; the Free Software Foundation; either version 3, or (at your option) | 6 | ;;;; the Free Software Foundation; either version 3, or (at your option) |
7 | ;;;; any later version. | 7 | ;;;; any later version. |
8 | ;;;; | 8 | ;;;; |
@@ -12,16 +12,18 @@ | |||
12 | ;;;; GNU General Public License for more details. | 12 | ;;;; GNU General Public License for more details. |
13 | ;;;; | 13 | ;;;; |
14 | ;;;; You should have received a copy of the GNU General Public License | 14 | ;;;; You should have received a copy of the GNU General Public License |
15 | ;;;; along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | ;;;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | ||
17 | (define-module (ellinika i18n) | 17 | (define-module (ellinika i18n) |
18 | #:use-syntax (ice-9 syncase) | ||
19 | #:export-syntax (_) | 18 | #:export-syntax (_) |
20 | #:export (locale-setup)) | 19 | #:export (locale-setup)) |
21 | 20 | ||
21 | (if (= (string->number (major-version)) 1) | ||
22 | (use-modules (ice-9 syncase))) | ||
23 | |||
22 | (define-syntax _ | 24 | (define-syntax _ |
23 | (syntax-rules () | 25 | (syntax-rules () |
24 | ((_ msg) (gettext msg)))) | 26 | ((_ msg) (gettext msg)))) |
25 | 27 | ||
26 | ;;; ISO 639 language code => ISO 3166 country code | 28 | ;;; ISO 639 language code => ISO 3166 country code |
27 | ;;; The corresponding country codes where selected using the following | 29 | ;;; The corresponding country codes where selected using the following |