X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=handlers%2F60_newpage.sh;h=7e4159e2fcbb1f9449884c7abbc23e975158f0a4;hb=15a1efa007b85d77f947b377e7561564d4cba7a6;hp=f3cbde7fa464a867eda5f1852aebf775dfd3a770;hpb=c895cb5c92f3b1ab8c61821d79ba2c1438eec304;p=shellwiki diff --git a/handlers/60_newpage.sh b/handlers/60_newpage.sh index f3cbde7..7e4159e 100755 --- a/handlers/60_newpage.sh +++ b/handlers/60_newpage.sh @@ -1,5 +1,19 @@ #!/bin/sh +# Copyright 2022 - 2023 Paul Hänsch +# +# 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. + . "$_EXEC/session_lock.sh" case $PATH_INFO in @@ -19,8 +33,15 @@ template="$(POST template)" page="$(POST page)" if [ "$page" ]; then + # either a page name has been entered pattern="$(date +"$pattern")" page="$(printf -- "$pattern" "$page")" + +elif [ "${pattern%%"%%s"*}" = "${pattern}" ]; then + # or a page name is not part of the pattern + pattern="$(date +"$pattern")" + page="$pattern" + else printf 'Refresh: %i; url=%s\r\n' 4 ./ export ERROR_MSG="Page name required"