]> git.plutz.net Git - shellwiki/blob - handlers/90_brackets.sh
Merge commit '7c216c9e226458114e3d186605e54b51aae75ab7'
[shellwiki] / handlers / 90_brackets.sh
1 #!/bin/sh
2
3 # special case for odd pages that are not handled otherwise
4 # usually those pages look like handlers (i.e. containing brackets)
5 # but are not
6 # attachment and edit (and really all) handlers should take precedence
7
8 case "${PATH_INFO}" in
9   */\[view\])
10     # explicit view handler for linking
11     REDIRECT "${_BASE}${PATH_INFO%\[view\]}"
12     ;;
13   */)
14     if [ ! "$(mdfile "${PATH_INFO}")" ]; then
15       theme_error 404
16     elif ! acl_read "${PATH_INFO}"; then
17       theme_error 403
18     else
19       theme_page "${PATH_INFO}"
20     fi
21     return 0
22     ;;
23   *)
24     if [ -d "$_DATA/pages${PATH_INFO}/" -o -d "$_EXEC/pages${PATH_INFO}/" ]; then
25       REDIRECT "${_BASE}${PATH_INFO}/"
26     fi
27     ;;
28 esac
29
30 return 1