diff --git a/src/dokuwiki.scm b/src/dokuwiki.scm new file mode 100644 index 0000000..07deee6 --- /dev/null +++ b/src/dokuwiki.scm @@ -0,0 +1,60 @@ +;; +;; dokuwiki.scm +;; +;; Dokuwiki internals support. +;; +;; ISC License +;; +;; Copyright 2023 Dominik Pantůček +;; +;; Permission to use, copy, modify, and/or distribute this software +;; for any purpose with or without fee is hereby granted, provided +;; that the above copyright notice and this permission notice appear +;; in all copies. +;; +;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +;; WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +;; AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR +;; CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +;; OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +;; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +;; CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +;; + +(declare (unit dokuwiki)) + +(module + dokuwiki + ( + ) + + (import scheme + (chicken base) + (chicken pathname) + (chicken io) + racket-kwargs + configuration + util-parser) + + ;; Parses all dokuwiki users from current-input-port + (define (parse-dokuwiki-users-auth) + (let loop ((lines (read-lines)) + (users '())) + (if (null? lines) + users + (let ((line (car lines))) + (loop (cdr lines) + users))))) + + ;; Parses all users from given filename + (define (load-dokuwiki-users-auth fname) + (with-input-from-file fname + parse-dokuwiki-users-auth)) + + ;; Loads all users from default dokuwiki users database + (define* (dokuwiki-load-users (doku-base (*doku-base*))) + (load-dokuwiki-users-auth + (make-pathname doku-base "conf/users.auth.php"))) + + )