rpicms

A CMS for the Raspberry Pi
git clone git://archive.git.mtrnord.blog/RpicmsTeam/rpicms.git
Log | Files | Refs | README | LICENSE

commit 66285d598be512816a11e67fac9cbc0b32c13c60
parent 063748e0a0c4c83c0ac61929b78873f023a39fdf
Author: MTRNord <mtrnord1@gmail.com>
Date:   Thu, 16 Apr 2015 18:48:01 +0200

add user_pages.php

Diffstat:
Mthemes/jumbotron/admin_pages/user_pages.php | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+), 0 deletions(-)

diff --git a/themes/jumbotron/admin_pages/user_pages.php b/themes/jumbotron/admin_pages/user_pages.php @@ -1 +1,66 @@ <h2>User-Pages</h2> +<?php +require_once($root."/core/backend/admin/modules/module_normal_login/models/config.php"); +$pages = getPageFiles(); //Retrieve list of pages in root usercake folder +$dbpages = fetchAllPages(); //Retrieve list of pages in pages table +$creations = array(); +$deletions = array(); + +//Check if any pages exist which are not in DB +foreach ($pages as $page){ + if(!isset($dbpages[$page])){ + $creations[] = $page; + } +} + +//Enter new pages in DB if found +if (count($creations) > 0) { + createPages($creations) ; +} + +if (count($dbpages) > 0){ + //Check if DB contains pages that don't exist + foreach ($dbpages as $page){ + if(!isset($pages[$page['page']])){ + $deletions[] = $page['id']; + } + } +} + +//Delete pages from DB if not found +if (count($deletions) > 0) { + deletePages($deletions); +} + +//Update DB pages +$dbpages = fetchAllPages(); +?> +<tr><th>Id</th><th>Page</th><th>Access</th></tr> +<?php +//Display list of pages +foreach ($dbpages as $page){ + echo " + <tr> + <td> + ".$page['id']." + </td> + <td> + <a href ='admin_page.php?id=".$page['id']."'>".$page['page']."</a> + </td> + <td>"; + + //Show public/private setting of page + if($page['private'] == 0){ + echo "Public"; + } + else { + echo "Private"; + } + + echo " + </td> + </tr>"; +} + +echo " +</table>