diff --git a/bl-kernel/admin/controllers/content.php b/bl-kernel/admin/controllers/content.php index 3ea7755f..f48ee78b 100644 --- a/bl-kernel/admin/controllers/content.php +++ b/bl-kernel/admin/controllers/content.php @@ -10,6 +10,19 @@ checkRole(array('admin', 'editor')); // Functions // ============================================================================ +// Returns the content belongs to the current user if the user has the role Editor +function filterContentOwner($list) { + global $login; + global $pages; + $tmp = array(); + foreach ($list as $pageKey) { + if ($pages->db[$pageKey]['username']==$login->username()) { + array_push($tmp, $pageKey); + } + } + return $tmp; +} + // ============================================================================ // Main before POST // ============================================================================ @@ -22,21 +35,25 @@ checkRole(array('admin', 'editor')); // Main after POST // ============================================================================ -// List of published pages -$onlyPublished = true; -$numberOfItems = ITEMS_PER_PAGE_ADMIN; -$pageNumber = $url->pageNumber(); -$published = $pages->getList($pageNumber, $numberOfItems, $onlyPublished); +$published = $pages->getList($url->pageNumber(), ITEMS_PER_PAGE_ADMIN); +$drafts = $pages->getDraftDB(true); +$scheduled = $pages->getScheduledDB(true); +$static = $pages->getStaticDB(true); +$sticky = $pages->getStickyDB(true); + +// If the user is an Editor filter the content he/she can edit +if (checkRole(array('editor'))) { + $published = filterContentOwner($published); + $drafts = filterContentOwner($drafts); + $scheduled = filterContentOwner($scheduled); + $static = filterContentOwner($static); + $sticky = filterContentOwner($sticky); +} // Check if out of range the pageNumber if (empty($published) && $url->pageNumber()>1) { Redirect::page('content'); } -$drafts = $pages->getDraftDB(true); -$scheduled = $pages->getScheduledDB(true); -$static = $pages->getStaticDB(true); -$sticky = $pages->getStickyDB(true); - // Title of the page $layout['title'] .= ' - '.$L->g('Manage content'); \ No newline at end of file diff --git a/bl-kernel/admin/controllers/edit-content.php b/bl-kernel/admin/controllers/edit-content.php index 0b5ba1d2..16c83d99 100644 --- a/bl-kernel/admin/controllers/edit-content.php +++ b/bl-kernel/admin/controllers/edit-content.php @@ -4,7 +4,7 @@ // Check role // ============================================================================ -if (!checkRole(array('admin','editor'), false)) { +if (checkRole(array('editor'), false)) { try { $pageKey = isset($_POST['key']) ? $_POST['key'] : $layout['parameters']; $page = new Page($pageKey); diff --git a/bl-kernel/admin/views/edit-user.php b/bl-kernel/admin/views/edit-user.php index c92a2ae6..9d93c485 100644 --- a/bl-kernel/admin/views/edit-user.php +++ b/bl-kernel/admin/views/edit-user.php @@ -100,21 +100,34 @@
-
- - -
-
- Profile picture preview +
+
+
+
+ + +
+ +
+
+ Profile picture preview +
+