segment the admin gui
[matches/MCTX3420.git] / testing / MCTXWeb / public_html / users / original / admin_pages.php
diff --git a/testing/MCTXWeb/public_html/users/original/admin_pages.php b/testing/MCTXWeb/public_html/users/original/admin_pages.php
new file mode 100644 (file)
index 0000000..6918367
--- /dev/null
@@ -0,0 +1,96 @@
+<?php\r
+/*\r
+UserCake Version: 2.0.2\r
+http://usercake.com\r
+*/\r
+\r
+require_once("models/config.php");\r
+if (!securePage($_SERVER['PHP_SELF'])){die();}\r
+\r
+$pages = getPageFiles(); //Retrieve list of pages in root usercake folder\r
+$dbpages = fetchAllPages(); //Retrieve list of pages in pages table\r
+$creations = array();\r
+$deletions = array();\r
+\r
+//Check if any pages exist which are not in DB\r
+foreach ($pages as $page){\r
+       if(!isset($dbpages[$page])){\r
+               $creations[] = $page;   \r
+       }\r
+}\r
+\r
+//Enter new pages in DB if found\r
+if (count($creations) > 0) {\r
+       createPages($creations) ;\r
+}\r
+\r
+if (count($dbpages) > 0){\r
+       //Check if DB contains pages that don't exist\r
+       foreach ($dbpages as $page){\r
+               if(!isset($pages[$page['page']])){\r
+                       $deletions[] = $page['id'];     \r
+               }\r
+       }\r
+}\r
+\r
+//Delete pages from DB if not found\r
+if (count($deletions) > 0) {\r
+       deletePages($deletions);\r
+}\r
+\r
+//Update DB pages\r
+$dbpages = fetchAllPages();\r
+\r
+require_once("models/header.php");\r
+\r
+echo "\r
+<body>\r
+<div id='wrapper'>\r
+<div id='top'><div id='logo'></div></div>\r
+<div id='content'>\r
+<h1>UserCake</h1>\r
+<h2>Admin Pages</h2>\r
+<div id='left-nav'>";\r
+\r
+include("left-nav.php");\r
+\r
+echo "\r
+</div>\r
+<div id='main'>\r
+<table class='admin'>\r
+<tr><th>Id</th><th>Page</th><th>Access</th></tr>";\r
+\r
+//Display list of pages\r
+foreach ($dbpages as $page){\r
+       echo "\r
+       <tr>\r
+       <td>\r
+       ".$page['id']."\r
+       </td>\r
+       <td>\r
+       <a href ='admin_page.php?id=".$page['id']."'>".$page['page']."</a>\r
+       </td>\r
+       <td>";\r
+       \r
+       //Show public/private setting of page\r
+       if($page['private'] == 0){\r
+               echo "Public";\r
+       }\r
+       else {\r
+               echo "Private"; \r
+       }\r
+       \r
+       echo "\r
+       </td>\r
+       </tr>";\r
+}\r
+\r
+echo "\r
+</table>\r
+</div>\r
+<div id='bottom'></div>\r
+</div>\r
+</body>\r
+</html>";\r
+\r
+?>\r

UCC git Repository :: git.ucc.asn.au