From 39ad0dfc8ce79a3e3b013cef67568edd01fe48d2 Mon Sep 17 00:00:00 2001 From: M Date: Sat, 21 Nov 2015 13:31:48 -0500 Subject: + Adding main source file which invokes the master controller --- app/index.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 app/index.php (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php new file mode 100644 index 0000000..ca2ce45 --- /dev/null +++ b/app/index.php @@ -0,0 +1,16 @@ +"; +} + +main(explode("/", $_SERVER['PATH_INFO'])); // Start rendering web page for the requested path. + +?> -- cgit v1.2.3 From 2f353e89409420b875afefd7b412c17996c32045 Mon Sep 17 00:00:00 2001 From: M Date: Sat, 21 Nov 2015 16:33:28 -0500 Subject: * Changing the mechanism by which the requested path is passed to the app ! It has been observed that on server nginx, some of the assumptions from doing similar work on apache have broken down and a more general mechanism must be used to handle paths in the clean-url app. ! New scheme is this: app is invoked with `index.php?path=` The app will be configured with its own root location on the virt. server and use logic to dedue the relative path requested from that. Also app will use the configured path to predend to urls linked/directed to during use of the app --- app/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index ca2ce45..5f2d9f4 100644 --- a/app/index.php +++ b/app/index.php @@ -11,6 +11,6 @@ function main($argv) echo "Scrott!
"; } -main(explode("/", $_SERVER['PATH_INFO'])); // Start rendering web page for the requested path. +main(explode("/", $_REQUEST['path'])); // Start rendering web page for the requested path. ?> -- cgit v1.2.3 From dbba1012ca163a9e9117ff3f6c2a7ca984b4dc4c Mon Sep 17 00:00:00 2001 From: M Date: Sat, 21 Nov 2015 16:51:52 -0500 Subject: * Now using require in favor of include throughout PHP in the app --- app/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 5f2d9f4..854df0b 100644 --- a/app/index.php +++ b/app/index.php @@ -1,6 +1,6 @@ Date: Sat, 21 Nov 2015 19:59:25 -0500 Subject: + Added app root controller * Finished implementing app main function to instanciate root and delegate to it --- app/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 854df0b..37258d7 100644 --- a/app/index.php +++ b/app/index.php @@ -7,8 +7,8 @@ require_once "controller/root.control.php"; */ function main($argv) { - /* TODO */ - echo "Scrott!
"; + $app = new Root(); + $app->handle($argv); } main(explode("/", $_REQUEST['path'])); // Start rendering web page for the requested path. -- cgit v1.2.3 From 13c67f782f9901c3c8a88cc736e62fa0b1d712c3 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Fri, 27 May 2016 00:01:01 -0400 Subject: Add copyright notice to Scrott entry-point files --- app/index.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 37258d7..692756c 100644 --- a/app/index.php +++ b/app/index.php @@ -1,5 +1,19 @@ Date: Sat, 22 Oct 2016 00:29:30 -0400 Subject: Deprecate application code Setup to perform an iteration of development focused on a simpler implementation and eliminating redundancy in design. --- app/index.php | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 app/index.php (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php deleted file mode 100644 index 692756c..0000000 --- a/app/index.php +++ /dev/null @@ -1,30 +0,0 @@ -handle($argv); -} - -main(explode("/", $_REQUEST['path'])); // Start rendering web page for the requested path. - -?> -- cgit v1.2.3 From 143615fc1761f1cfaa368bb8573473e80af7e27a Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Tue, 6 Feb 2018 22:17:05 -0500 Subject: Add index.php --- app/index.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 app/index.php (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php new file mode 100644 index 0000000..710dc8d --- /dev/null +++ b/app/index.php @@ -0,0 +1,49 @@ + -- cgit v1.2.3 From 66aa954421c093ad54da8806e42d4ff9bba59091 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Wed, 7 Feb 2018 21:15:03 -0500 Subject: Add login view to controller --- app/index.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 710dc8d..7f39cca 100644 --- a/app/index.php +++ b/app/index.php @@ -14,6 +14,7 @@ require_once "class/database.class.php"; require_once "class/settings.class.php"; +require_once "class/user.class.php"; /* * This file is the entry-point to the Scrott application. main() will @@ -34,8 +35,15 @@ function main(array $argv) : void if (settings::sslOnly()) require_https(); + /* assert that a user is logged in */ + if (!user::getCurrent()) + { + require "view/login.php"; + return; + } + /* TODO */ - echo "database is config!"; + echo "logged in"; } catch (Exception $e) -- cgit v1.2.3 From 319d38f0eb0d78d30b4261856b0abbf674535366 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sat, 10 Feb 2018 21:44:23 -0500 Subject: Add exception view to index.php --- app/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 7f39cca..8547671 100644 --- a/app/index.php +++ b/app/index.php @@ -48,7 +48,7 @@ function main(array $argv) : void catch (Exception $e) { - /* TODO */ + require "view/except.php"; } } -- cgit v1.2.3 From 36a565c0713a68c758768190d3d336873611775b Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 19 Jul 2018 02:45:43 -0400 Subject: Add basic dashboard page --- app/index.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 8547671..177cb1b 100644 --- a/app/index.php +++ b/app/index.php @@ -42,6 +42,13 @@ function main(array $argv) : void return; } + /* no arguments? display dashboard */ + if (count($argv) == 0) + { + require "view/dashboard.php"; + return; + } + /* TODO */ echo "logged in"; } -- cgit v1.2.3 From 57b9b6afe8f3e7d87b327b68861be2011e0d69ee Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 19 Jul 2018 02:55:04 -0400 Subject: Define /logout route --- app/index.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 177cb1b..e883eff 100644 --- a/app/index.php +++ b/app/index.php @@ -49,6 +49,15 @@ function main(array $argv) : void return; } + switch ($argv[0]) + { + case "logout": + /* logout user */ + user::setCurrent(); + location("/"); + break; + } + /* TODO */ echo "logged in"; } -- cgit v1.2.3 From 2664ece9e14e9d4b73125f44611f234345371c0a Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 19 Jul 2018 03:11:57 -0400 Subject: Fix bug in index.php Perform minor sanitization on the input $_SERVER['PATH_INFO']. This commit adds logic that strips empty strings from main's $argv array. The pass to array_values() is to discard original $tokens array keys and re-number them starting from zero. --- app/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index e883eff..3fee675 100644 --- a/app/index.php +++ b/app/index.php @@ -68,6 +68,7 @@ function main(array $argv) : void } } -main(explode("/", $_SERVER['PATH_INFO'])); +$tokens = explode("/", $_SERVER['PATH_INFO']); +main(array_values(array_filter($tokens))); ?> -- cgit v1.2.3 From 26ab0a495365ddc7de9a70309305d366bfafeaac Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sat, 21 Jul 2018 23:27:02 -0400 Subject: Update index.php to set appropriate page objects --- app/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 3fee675..1617652 100644 --- a/app/index.php +++ b/app/index.php @@ -36,7 +36,7 @@ function main(array $argv) : void require_https(); /* assert that a user is logged in */ - if (!user::getCurrent()) + if (!($user = user::getCurrent())) { require "view/login.php"; return; @@ -45,6 +45,7 @@ function main(array $argv) : void /* no arguments? display dashboard */ if (count($argv) == 0) { + setPageObj($user); require "view/dashboard.php"; return; } -- cgit v1.2.3 From 3a5c526c38fc823e393330ae3f9dad74342b3f1f Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Tue, 24 Jul 2018 05:19:24 -0400 Subject: Add call to setPageName() --- app/index.php | 1 + 1 file changed, 1 insertion(+) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 1617652..63ad931 100644 --- a/app/index.php +++ b/app/index.php @@ -46,6 +46,7 @@ function main(array $argv) : void if (count($argv) == 0) { setPageObj($user); + setPageName("Dashboard"); require "view/dashboard.php"; return; } -- cgit v1.2.3 From 9e5ff3763ad4f8d62f410e57aa661675146ac863 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Tue, 24 Jul 2018 06:07:05 -0400 Subject: Move $user page object scope Since several routes will use the current $user as the PAGE_OBJECT, I'm just setting it once above most of the logic. Any route that needs something else can change it. There's a condition in the setPageObj() function that throws if we attempt to call it more than once. I'm thinking this can be removed it's not protecting from much. --- app/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 63ad931..b0b191f 100644 --- a/app/index.php +++ b/app/index.php @@ -42,10 +42,11 @@ function main(array $argv) : void return; } + setPageObj($user); + /* no arguments? display dashboard */ if (count($argv) == 0) { - setPageObj($user); setPageName("Dashboard"); require "view/dashboard.php"; return; -- cgit v1.2.3 From d8b715d86069f247853565a2fde83d2846e853b0 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 26 Jul 2018 05:00:27 -0400 Subject: Add "My Groups" page --- app/index.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index b0b191f..0a106c2 100644 --- a/app/index.php +++ b/app/index.php @@ -59,6 +59,11 @@ function main(array $argv) : void user::setCurrent(); location("/"); break; + + case "groups": + setPageName("Groups"); + require "view/groups.php"; + break; } /* TODO */ -- cgit v1.2.3 From b2ba827957aa15ea7ad48e5a661827704fa395c7 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 26 Jul 2018 05:10:04 -0400 Subject: Remove TODO and placeholder --- app/index.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 0a106c2..36f2d1d 100644 --- a/app/index.php +++ b/app/index.php @@ -65,9 +65,6 @@ function main(array $argv) : void require "view/groups.php"; break; } - - /* TODO */ - echo "logged in"; } catch (Exception $e) -- cgit v1.2.3 From d0948ac023b21404bd051b41b744b3b0f7415a31 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sat, 15 Sep 2018 11:29:51 -0400 Subject: Add 'my pads' page --- app/index.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 36f2d1d..d20aaff 100644 --- a/app/index.php +++ b/app/index.php @@ -64,6 +64,11 @@ function main(array $argv) : void setPageName("Groups"); require "view/groups.php"; break; + + case "pads": + setPageName("Pads"); + require "view/pads.php"; + break; } } -- cgit v1.2.3 From 694f876bc8655bc00f3a4ae3d650e54d947ea42a Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 20 Sep 2018 01:07:35 -0400 Subject: Add start of single-pad view --- app/index.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index d20aaff..182ab1b 100644 --- a/app/index.php +++ b/app/index.php @@ -69,6 +69,21 @@ function main(array $argv) : void setPageName("Pads"); require "view/pads.php"; break; + + default: + /* view object */ + if (table::isGUID($argv[0])) + { + switch (obj::typeOf($argv[0])) + { + case "pad": + $obj = new pad($argv[0]); + setPageObj($obj); + setPageName($obj->name); + require "view/pad.php"; + break; + } + } } } -- cgit v1.2.3 From 52ae87e3fe90a0231e874cb498797e2ef2295518 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 20 Sep 2018 23:21:49 -0400 Subject: index: Enforce access permission when viewing object by URL The controller now (again) prevents browsing to objects the user is not allowed to access. --- app/index.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 182ab1b..a40f8c1 100644 --- a/app/index.php +++ b/app/index.php @@ -74,6 +74,14 @@ function main(array $argv) : void /* view object */ if (table::isGUID($argv[0])) { + /* check permissions */ + if (!$user->canAccess(new obj($argv[0]))) + { + /* TODO - use notice modal instead of an exception */ + throw new Exception("You do not have access permission for the requested object"); + } + + /* setup page */ switch (obj::typeOf($argv[0])) { case "pad": -- cgit v1.2.3 From 3424ebde9147ab5838c0433d6723c0d8b0d66c8c Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Fri, 21 Sep 2018 01:21:55 -0400 Subject: deleteaccount: Add view --- app/index.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index a40f8c1..1b9b15a 100644 --- a/app/index.php +++ b/app/index.php @@ -60,6 +60,11 @@ function main(array $argv) : void location("/"); break; + case "deleteaccount": + setPageName("Leaving Scrott"); + require "view/deleteaccount.php"; + break; + case "groups": setPageName("Groups"); require "view/groups.php"; -- cgit v1.2.3 From dd499f3b42e760ed26b0be180274422ea3941158 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 23 Sep 2018 22:26:57 -0400 Subject: admin: Add empty admin panel --- app/index.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 1b9b15a..13b6779 100644 --- a/app/index.php +++ b/app/index.php @@ -60,6 +60,15 @@ function main(array $argv) : void location("/"); break; + case "admin": + /* check permissions */ + if ($user->admin == 0) + location("/"); + + setPageName("Administration"); + require "view/administration.php"; + break; + case "deleteaccount": setPageName("Leaving Scrott"); require "view/deleteaccount.php"; -- cgit v1.2.3 From 83be80e89dbbf22a18023fa8443fcab975358c3f Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Tue, 25 Sep 2018 17:58:58 -0400 Subject: group: Add group page view --- app/index.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 13b6779..44c2de9 100644 --- a/app/index.php +++ b/app/index.php @@ -15,6 +15,8 @@ require_once "class/database.class.php"; require_once "class/settings.class.php"; require_once "class/user.class.php"; +require_once "class/group.class.php"; +require_once "class/pad.class.php"; /* * This file is the entry-point to the Scrott application. main() will @@ -98,6 +100,13 @@ function main(array $argv) : void /* setup page */ switch (obj::typeOf($argv[0])) { + case "group": + $obj = new group($argv[0]); + setPageObj($obj); + setPageName($obj->name); + require "view/group.php"; + break; + case "pad": $obj = new pad($argv[0]); setPageObj($obj); -- cgit v1.2.3 From 07c3bb3169bbc41ab9dc8aca312cb4f36581ccd4 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sat, 27 Oct 2018 01:22:15 -0400 Subject: Add 404 Page not found view Previously, when the app was asked for non-existant paths, no content was returned and a blank page was presented to the user. Now a canned message stating that the requested page does not exist is shown, along with a helpful link back to the Dashboard page. Signed-off-by: Malf Furious --- app/index.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/index.php') diff --git a/app/index.php b/app/index.php index 44c2de9..21f3036 100644 --- a/app/index.php +++ b/app/index.php @@ -115,6 +115,12 @@ function main(array $argv) : void break; } } + + /* page not found */ + else + { + require "view/404.php"; + } } } -- cgit v1.2.3