Index: misc-stml.scm ================================================================== --- misc-stml.scm +++ misc-stml.scm @@ -11,10 +11,12 @@ ;; dumbobj helpers ;;====================================================================== (declare (unit misc-stml)) (use regex) +(use dbi) +(import (prefix dbi dbi:)) ;; given a list of symbols give the count of the matching symbol ;; l => '(a b c) (dumobj:indx a 'b) => 1 (define (s:get-fieldnum lst field-name) (let loop ((head (car lst)) Index: session.scm ================================================================== --- session.scm +++ session.scm @@ -6,11 +6,13 @@ ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (declare (unit session)) -(require-library dbi) +;; (require-library dbi) +(use dbi) +(import (prefix dbi dbi:)) (require-extension regex) (declare (uses cookie)) ;; sessions table ;; id session_id session_key @@ -721,20 +723,39 @@ ;; (session:log s:session "params=" (slot-ref s:session 'params)) (let ((params (sdat-get-params self))) (session:get-param-from params key))) ;; This one will get the first value found regardless of form -(define (session:get-input self key) - (let* ((formdat (sdat-get-formdat self))) - (if (not formdat) #f - (if (or (string? key)(number? key)(symbol? key)) - (if (and (vector? formdat)(eq? (vector-length formdat) 1)(hash-table? (vector-ref formdat 0))) - (formdat:get formdat key) - (begin - (session:log self "ERROR: formdat: " formdat " is not of class ") - #f)) - (session:log self "ERROR: bad key " key))))) +;; param: (dtype [tag1 tag2 ...]) +;; dtype: +;; 'raw : do no conversion +;; 'number : convert to number, return #f if fails +;; 'escaped : use html-escape to protect the input +;; +(define (session:get-input self key params) + (let* ((dtype (if (null? params) + 'escaped + (car params))) + (tags (if (null? params) + '() + (cdr params))) + (formdat (sdat-get-formdat self)) + (res (if (not formdat) #f + (if (or (string? key)(number? key)(symbol? key)) + (if (and (vector? formdat)(eq? (vector-length formdat) 1)(hash-table? (vector-ref formdat 0))) + (formdat:get formdat key) + (begin + (session:log self "ERROR: formdat: " formdat " is not of class ") + #f)) + (begin + (session:log self "ERROR: bad key " key) + #f))))) + (case dtype + ((raw) res) + ((number) (if (string? res)(string->number res) #f)) + ((escaped) (s:html-filter res tags)) + (else (s:html-filter res '()))))) ;; This one will get the first value found regardless of form (define (session:get-input-keys self) (let* ((formdat (sdat-get-formdat self))) (if (not formdat) #f Index: stmlcommon.scm ================================================================== --- stmlcommon.scm +++ stmlcommon.scm @@ -75,11 +75,11 @@ ;; return something useful to the user (print "Content-type: text/html") (print "") (print " EXCEPTION ") (print "

CRASH!

") - (print " Please notify support at " (sdat-get-domain s:session) " that the error log is stmlcrash-" (current-process-id) ".log
") + (print " Please notify support at " (sdat-get-domain s:session) " that the error log is stml-crash-" (current-process-id) ".log
") ;; (print "
")
 	 ;; ;; (print "   EXCEPTION: " ((condition-property-accessor 'exn 'message) exn))
 	 ;; ;; (print-error-message exn)
 	 ;; ;; (print-call-chain)
 	 ;; (print "
")