summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-06-08 20:21:12 -0400
committerMalf Furious <m@lfurio.us>2016-06-08 20:21:12 -0400
commit1b24ddb6b12bd85d15beed45476d72678b758128 (patch)
treeba534dd7f0371a22ca73c410bbd74942be0a098c
parentca94dff5d7587c1f401acb022d2598ebb4c06376 (diff)
downloadscrott-1b24ddb6b12bd85d15beed45476d72678b758128.tar.gz
scrott-1b24ddb6b12bd85d15beed45476d72678b758128.zip
Add new MVC, 'Obj'
This MVC will be used to browse scrott datastructures.
-rw-r--r--app/controller/obj.control.php48
-rw-r--r--app/controller/root.control.php12
-rw-r--r--app/model/obj.mod.php23
3 files changed, 83 insertions, 0 deletions
diff --git a/app/controller/obj.control.php b/app/controller/obj.control.php
new file mode 100644
index 0000000..f341b48
--- /dev/null
+++ b/app/controller/obj.control.php
@@ -0,0 +1,48 @@
+<?php
+
+/*
+ * SCROTT Copyright (C) 2016 Malf Furious
+ *
+ * Scrott is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Scrott is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ * License for more details.
+ */
+
+require_once "class/controller.class.php";
+require_once "model/obj.mod.php";
+require_once "class/object.class.php";
+
+/*
+ * Object viewer, Used to view groups, pads, and more!
+ */
+class Obj extends Controller
+{
+ /*
+ * Controller implementation
+ */
+ function handle($argv)
+ {
+ $mod = new ObjModel();
+ $obj = new DBObject($argv[0]);
+
+ switch ($obj->type)
+ {
+ case "group":
+ $this->action_group($mod, $argv[0]);
+ break;
+ }
+ }
+
+ function action_group($mod, $guid)
+ {
+ /* TODO */
+ }
+}
+
+?>
diff --git a/app/controller/root.control.php b/app/controller/root.control.php
index 9a4ebd8..7e4d1ab 100644
--- a/app/controller/root.control.php
+++ b/app/controller/root.control.php
@@ -15,12 +15,14 @@
*/
require_once "class/controller.class.php";
+require_once "class/object.class.php";
require_once "class/setting.class.php";
require_once "controller/sysconf.control.php";
require_once "controller/except.control.php";
require_once "controller/auth.control.php";
require_once "controller/deauth.control.php";
require_once "controller/dashboard.control.php";
+require_once "controller/obj.control.php";
require_once "controller/deleteacct.control.php";
/*
@@ -82,6 +84,16 @@ class Root extends Controller
case "logout": $ctrl = new Deauth(); break;
case "deleteaccount": $ctrl = new Deleteacct(); break;
default:
+ /* Check if arg is an object guid */
+ $obj = new DBObject();
+
+ if ($obj->isGUID($argv[0]))
+ {
+ $ctrl = new Obj();
+ break;
+ }
+
+ /* No page to show for requested path */
throw new Exception("The requested path is not valid.");
break;
}
diff --git a/app/model/obj.mod.php b/app/model/obj.mod.php
new file mode 100644
index 0000000..bccef93
--- /dev/null
+++ b/app/model/obj.mod.php
@@ -0,0 +1,23 @@
+<?php
+
+/*
+ * SCROTT Copyright (C) 2016 Malf Furious
+ *
+ * Scrott is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Scrott is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ * License for more details.
+ */
+
+require_once "model/common.mod.php";
+
+class ObjModel extends CommonModel
+{
+}
+
+?>