summaryrefslogtreecommitdiffabout
path: root/src
Side-by-side diff
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/cgi-bin/conj.scm49
-rw-r--r--src/cgi-bin/dict.scm428
-rw-r--r--src/cgi-bin/nea.scm422
-rw-r--r--src/ellinika/cgi.scm425
-rw-r--r--src/ellinika/i18n.scm6
5 files changed, 55 insertions, 35 deletions
diff --git a/src/cgi-bin/conj.scm4 b/src/cgi-bin/conj.scm4
index 83fb846..6a49c62 100644
--- a/src/cgi-bin/conj.scm4
+++ b/src/cgi-bin/conj.scm4
@@ -1,5 +1,5 @@
;;;; Greek Dictionary Web Engine
-;;;; Copyright (C) 2004, 2005, 2006, 2007, 2010, 2011 Sergey Poznyakoff
+;;;; Copyright (C) 2004, 2005, 2006, 2007, 2010, 2011, 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
@@ -18,6 +18,7 @@
;;; Tailor this statement to your needs if necessary.
(set! %load-path (cons "GUILE_SITE" %load-path))
+(setlocale LC_ALL "")
(use-modules ifelse(IFACE,[CGI],(www cgi),(guile-user))
(srfi srfi-1)
(ice-9 rdelim)
@@ -61,7 +62,7 @@ ifelse(IFACE,[CGI],(cgi:init))
</td>
<td>
<input size=\"36\" name=\"key\" tabindex=\"1\"")
- (let ((value (cgi:value "key")))
+ (let ((value (cgi:value-u8 "key")))
(if value
(begin
(display " value=\"")
@@ -350,7 +351,7 @@ ifelse(IFACE,[CGI],(cgi:init))
(define (do-conj)
- (let ((keyval (cgi:value "key")))
+ (let ((keyval (cgi:value-u8 "key")))
(if (and keyval (not (string-null? keyval)))
(let ((input (ellinika:translate-input
(let ((keyval keyval))
@@ -400,7 +401,7 @@ ifelse(IFACE,[CGI],(cgi:init))
(cond
((string=? name "lang"))
(else
- (let ((v (cgi:value name)))
+ (let ((v (cgi:value-u8 name)))
(cond ((and v (not (string-null? v)))
(display "&amp;")
(display name)
diff --git a/src/cgi-bin/dict.scm4 b/src/cgi-bin/dict.scm4
index 77c1b3a..3b24367 100644
--- a/src/cgi-bin/dict.scm4
+++ b/src/cgi-bin/dict.scm4
@@ -1,5 +1,5 @@
;;;; Greek Dictionary Web Engine
-;;;; Copyright (C) 2004, 2005, 2006, 2007, 2010, 2011 Sergey Poznyakoff
+;;;; Copyright (C) 2004, 2005, 2006, 2007, 2010, 2011, 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
@@ -18,10 +18,13 @@
;;; Tailor this statement to your needs if necessary.
(set! %load-path (cons "GUILE_SITE" %load-path))
+(setlocale LC_ALL "")
+
(use-modules ifelse(IFACE,[CGI],(www cgi),(guile-user))
(ice-9 rdelim)
(xmltools dict)
(gamma sql)
+ (gamma syslog)
(ellinika elmorph)
(ellinika sql)
(ellinika i18n)
@@ -79,7 +82,7 @@ ifelse(IFACE,[CGI],(cgi:init))
(define (join-widget widget-id tabindex)
(let* ((name (string-append "join" widget-id))
- (selected-choice (or (let ((s (cgi:value name)))
+ (selected-choice (or (let ((s (cgi:value-u8 name)))
(if s
(string->number s)
#f))
@@ -112,7 +115,7 @@ ifelse(IFACE,[CGI],(cgi:init))
</td>
<td>
<input size=\"36\" name=\"key\" tabindex=\"1\"")
- (let ((value (cgi:value "key")))
+ (let ((value (cgi:value-u8 "key")))
(if value
(begin
(display " value=\"")
@@ -132,7 +135,7 @@ ifelse(IFACE,[CGI],(cgi:init))
(display (_"Επιλέξτε το μέρος του λόγου"))
(display "</td><td>")
- (let ((selected-choice (or (let ((s (cgi:value "pos")))
+ (let ((selected-choice (or (let ((s (cgi:value-u8 "pos")))
(if s
(string->number s)
#f))
@@ -166,7 +169,7 @@ ifelse(IFACE,[CGI],(cgi:init))
(display "<tr><td>")
(display (list-ref category 1))
(display "</td><td>")
- (let ((selected-choice (or (let ((s (cgi:value (list-ref category 0))))
+ (let ((selected-choice (or (let ((s (cgi:value-u8 (list-ref category 0))))
(if s
(string->number s)
#f))
@@ -353,7 +356,7 @@ ifelse(IFACE,[CGI],(cgi:init))
(list-ref part-of-speech (string->number pos))))
(if (or (not (string-null? key)) (not (null? theme)))
(set! where-cond (cons
- (if (string=? (cgi:value "joinpos") "0")
+ (if (string=? (cgi:value-u8 "joinpos") "0")
" AND"
" OR")
where-cond)))
@@ -418,21 +421,20 @@ ifelse(IFACE,[CGI],(cgi:init))
(define (dict-search)
- (let ((keyval (if (cgi:value "ident")
- (dict:decode-string (cgi:value "ident"))
- (cgi:value "key")))
+ (let ((keyval (or (cgi:value-u8 "ident")
+ (cgi:value-u8 "key")))
(theme (do ((catlist (get-topic-list) (cdr catlist))
(ret '()))
((null? catlist) ret)
(let ((name (caar catlist)))
- (let ((v (cgi:value name)))
+ (let ((v (cgi:value-u8 name)))
(if (and v (> (string->number v) 0))
(set! ret (append
ret
(list (= (string->number
- (cgi:value (string-append "join" name))) 0)
+ (cgi:value-u8 (string-append "join" name))) 0)
v))))))))
- (pos (or (cgi:value "pos") "0")))
+ (pos (or (cgi:value-u8 "pos") "0")))
(sql-catch-failure
(cond
@@ -521,7 +523,7 @@ dict.forms,articles.subindex,articles.meaning,(dict.pos & conv(\"100000\",16,10)
(cond
((string=? name "lang"))
(else
- (let ((v (cgi:value name)))
+ (let ((v (cgi:value-u8 name)))
(cond ((and v (not (string-null? v)))
(display "&amp;")
(display name)
diff --git a/src/cgi-bin/nea.scm4 b/src/cgi-bin/nea.scm4
index f64aca2..e366a7c 100644
--- a/src/cgi-bin/nea.scm4
+++ b/src/cgi-bin/nea.scm4
@@ -1,5 +1,5 @@
;;;; News page for Ellinika
-;;;; Copyright (C) 2004, 2005, 2006, 2007, 2010, 2011 Sergey Poznyakoff
+;;;; Copyright (C) 2004, 2005, 2006, 2007, 2010, 2011, 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
@@ -30,7 +30,7 @@
ifelse(IFACE,[CGI],(cgi:init))
(define tmpl (if (and monima-nea-template-file-name
- (cgi:value "timestamp"))
+ (cgi:value-u8 "timestamp"))
monima-nea-template-file-name
nea-template-file-name))
@@ -177,13 +177,13 @@ ifelse(IFACE,[CGI],(cgi:init))
0)))
(from (catch #t
(lambda ()
- (let ((x (string->number (cgi:value "from"))))
+ (let ((x (string->number (cgi:value-u8 "from"))))
(if (< x count)
x
0)))
(lambda args
0)))
- (fwd (let ((dir (cgi:value "dir")))
+ (fwd (let ((dir (cgi:value-u8 "dir")))
(or (not dir)
(string=? dir "1"))))
(entries (collect-entries from fwd)))
@@ -199,7 +199,7 @@ ifelse(IFACE,[CGI],(cgi:init))
(let ((num-entries (length result))
(begin (if fwd from start))
(end (if fwd start from))
- (id (cgi:value "id")))
+ (id (cgi:value-u8 "id")))
(cond
((not (and (= from 0) (< num-entries nea-max-rows)))
@@ -273,7 +273,7 @@ ifelse(IFACE,[CGI],(cgi:init))
(display "<span class=\"itemsubject\">\n")
(display (list-ref item 2))
(display "</span>")
- (if (not (cgi:value "timestamp"))
+ (if (not (cgi:value-u8 "timestamp"))
(permalink "span" (list-ref item 1)))
(display "</div><!-- news-header -->"))
@@ -337,7 +337,7 @@ ifelse(IFACE,[CGI],(cgi:init))
(cond
((string=? name "lang"))
(else
- (let ((v (cgi:value name)))
+ (let ((v (cgi:value-u8 name)))
(cond ((and v (not (string-null? v)))
(display "&amp;")
(display name)
@@ -435,7 +435,7 @@ ifelse(IFACE,[CGI],(cgi:init))
;;; Main
(cond
- ((cgi:value "rss")
+ ((cgi:value-u8 "rss")
ifelse(IFACE,[CGI],
(display ["Content-type: text/xml; charset=utf-8\r\n\r\n"]),
(request-rec:set-content-type! Request ["text/xml; charset=UTF-8"]))
@@ -447,15 +447,15 @@ ifelse(IFACE,[CGI],(cgi:init))
(display ["Content-type: text/html; charset=utf-8\r\n\r\n"]))
(ellinika:sql-connect ellinika-sql-connection)
(cond
- ((or (cgi:value "timestamp") (cgi:value "id"))
+ ((or (cgi:value-u8 "timestamp") (cgi:value-u8 "id"))
(let ((tuples
(cond
- ((cgi:value "timestamp") =>
+ ((cgi:value-u8 "timestamp") =>
(lambda (ts)
(ellinika:sql-query
"SELECT date,unix_timestamp(date),ident\
FROM news WHERE unix_timestamp(date)=~Q" ts)))
- ((cgi:value "id") =>
+ ((cgi:value-u8 "id") =>
(lambda (id)
(ellinika:sql-query
"SELECT date,unix_timestamp(date),ident\
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,6 +1,5 @@
-;;;; -*- 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
@@ -19,12 +18,28 @@
#: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
@@ -59,7 +74,7 @@ ifelse(IFACE,[CGI],,dnl
(set! cgi-server-protocol-version (substring server-protocol
(1+ slash))))))
-)
+])
;;; User-definable variables
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,5 +1,5 @@
;;;; 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
@@ -15,10 +15,12 @@
;;;; 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))))

Return to:

Send suggestions and report system problems to the System administrator.