diff options
author | Malf Furious <m@lfurio.us> | 2018-07-22 03:31:24 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2018-07-22 03:31:24 -0400 |
commit | 380187ee5aadf008c7a71a9015008c155c528ccc (patch) | |
tree | 896316c58b08f539f636fd2a7c7c10ba6ce802e8 /app | |
parent | 97caeedeb07604eec3fed36b44334c4f6324518a (diff) | |
download | scrott-380187ee5aadf008c7a71a9015008c155c528ccc.tar.gz scrott-380187ee5aadf008c7a71a9015008c155c528ccc.zip |
Update function location()
Passing no argument (or NULL) now causes this function to redirect to
the 'app-path' (current request page). This is a way to reload the
current page.
Diffstat (limited to '')
-rw-r--r-- | app/class/globals.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/class/globals.php b/app/class/globals.php index ab82edd..c81c9a2 100644 --- a/app/class/globals.php +++ b/app/class/globals.php @@ -69,11 +69,14 @@ function redirect(string $url) : void /* * Redirect to the given in-app URL and die. The given URL should be a path - * relative to the app root. + * relative to the app root. No argument reloads the current path. */ -function location(string $path) : void +function location(?string $path = NULL) : void { - redirect(ar() . $path); + if ($path) + redirect(ar() . $path); + else + redirect(ap()); } /* |