summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2018-07-22 03:31:24 -0400
committerMalf Furious <m@lfurio.us>2018-07-22 03:31:24 -0400
commit380187ee5aadf008c7a71a9015008c155c528ccc (patch)
tree896316c58b08f539f636fd2a7c7c10ba6ce802e8
parent97caeedeb07604eec3fed36b44334c4f6324518a (diff)
downloadscrott-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.
-rw-r--r--app/class/globals.php9
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());
}
/*