aboutsummaryrefslogtreecommitdiff
path: root/src/ellinika
diff options
context:
space:
mode:
Diffstat (limited to 'src/ellinika')
-rw-r--r--src/ellinika/cgi.scm425
-rw-r--r--src/ellinika/i18n.scm6
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,11 +1,10 @@
-;;;; -*- 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
@@ -14,22 +13,38 @@
;;;;
;;;; 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))
'())))
@@ -54,17 +69,17 @@ ifelse(IFACE,[CGI],,dnl
"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")
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,29 +1,31 @@
;;;; 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)
;;;; 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 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))))
;;; ISO 639 language code => ISO 3166 country code
;;; The corresponding country codes where selected using the following
;;; principles:
;;; 1. If the language is spoken in only one country, this country code is

Return to:

Send suggestions and report system problems to the System administrator.