X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=handlers%2F20_page.sh;fp=handlers%2F20_page.sh;h=0000000000000000000000000000000000000000;hb=1bc3367c9a1a5eb725688802927bd544cc9d9c63;hp=5c3da0ccf77573169383d756ebe2593d38bbf079;hpb=d75f33f647280ada400fb51f740701cdb12dd4d3;p=shellwiki diff --git a/handlers/20_page.sh b/handlers/20_page.sh deleted file mode 100755 index 5c3da0c..0000000 --- a/handlers/20_page.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh - -. "$_EXEC/cgilite/file.sh" - -CACHE_AGE=${CACHE_AGE:-300} -export MD_MACROS="$_EXEC/macros" -export MD_HTML="${MD_HTML:-false}" - -wiki() { - # Print content of a wiki page - # Get page from data or underlay dir, handle caching - local page="$(PATH "$1")" mdfile cache cachetime - - cache="$_DATA/pages/$page/#page:${LANGUAGE}.${USER_ID}.cache" - - mdfile="$(mdfile "$page")" || return 4 - acl_read "$page" || return 3 - - cachetime="$(stat -c %Y -- "$mdfile" "$cache" 2>/dev/null)" - - if [ "${cachetime#*${BR}}" -gt "${cachetime%${BR}*}" \ - -a "${cachetime#*${BR}}" -gt "$((_DATE - CACHE_AGE))" ]; then - cat "${cache}" - else - mkdir -p -- "$_DATA/pages/$page/" - # Macros expect to find page directory as working dir - ( cd -- "$_DATA/pages/$page/"; - md <"$mdfile" \ - | tee -- "${cache}.$$" - ) - grep -q '^%nocache' "$mdfile" \ - && rm -- "${cache}.$$" \ - || mv -- "${cache}.$$" "${cache}" - fi -} - -case "${PATH_INFO}" in - /"[.]"/*) - # usually some file related to theme - # let file server handle errors - FILE "${_EXEC}/${PATH_INFO#/\[.\]}" - return 0 - ;; - *${BR}*) - export ERROR_MSG='Page names containing newline character are not allowed' - theme_error 400 - return 0 - ;; - */\#*) - export ERROR_MSG='Page names starting with "#" are not allowed' - theme_error 400 - return 0 - ;; - */\[*\]/*|*/\[*\]) - # looks like some kind of handler - return 1 - ;; - */) - if ! mdfile "$PATH_INFO" >&-; then - theme_error 404 - elif ! acl_read "$PATH_INFO"; then - theme_error 403 - else - theme_page "${PATH_INFO}" - fi - return 0 - ;; -esac - -return 1