summaryrefslogtreecommitdiffabout
path: root/src/ellinika
Side-by-side diff
Diffstat (limited to 'src/ellinika') (more/less context) (ignore whitespace changes)
-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,9 +1,8 @@
-;;;; -*- 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.
;;;;
@@ -16,18 +15,34 @@
;;;; 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))
@@ -56,13 +71,13 @@ ifelse(IFACE,[CGI],,dnl
(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")
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 @@
;;;; 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.
;;;;
@@ -12,16 +12,18 @@
;;;; 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

Return to:

Send suggestions and report system problems to the System administrator.