2015-11-27 17:03:42 +01:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
|
|
|
// ============================================================================
|
2020-11-30 22:00:54 +01:00
|
|
|
// Authorization
|
2015-11-27 17:03:42 +01:00
|
|
|
// ============================================================================
|
|
|
|
|
2019-05-13 18:26:35 +02:00
|
|
|
checkRole(array('admin', 'editor', 'author'));
|
2018-05-20 21:48:43 +02:00
|
|
|
|
2015-11-27 17:03:42 +01:00
|
|
|
// ============================================================================
|
|
|
|
// Functions
|
|
|
|
// ============================================================================
|
|
|
|
|
2020-11-30 22:00:54 +01:00
|
|
|
// Returns the content belongs to the current logged user
|
2019-05-12 14:31:33 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-11-27 17:03:42 +01:00
|
|
|
// ============================================================================
|
2020-11-30 22:00:54 +01:00
|
|
|
// Main
|
2015-11-28 15:47:03 +01:00
|
|
|
// ============================================================================
|
2017-09-09 00:33:14 +02:00
|
|
|
|
2019-05-12 14:31:33 +02:00
|
|
|
$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);
|
2021-09-12 22:06:01 +02:00
|
|
|
$unlisted = $pages->getUnlistedDB(true);
|
2019-05-12 14:31:33 +02:00
|
|
|
|
2020-11-30 22:00:54 +01:00
|
|
|
// If the user has the role "Author" filter the content so he/she can edit
|
2019-05-13 18:26:35 +02:00
|
|
|
if (checkRole(array('author'), false)) {
|
2019-05-12 14:31:33 +02:00
|
|
|
$published = filterContentOwner($published);
|
|
|
|
$drafts = filterContentOwner($drafts);
|
|
|
|
$scheduled = filterContentOwner($scheduled);
|
|
|
|
$static = filterContentOwner($static);
|
|
|
|
$sticky = filterContentOwner($sticky);
|
2021-09-12 22:06:01 +02:00
|
|
|
$unlisted = filterContentOwner($unlisted);
|
2019-05-12 14:31:33 +02:00
|
|
|
}
|
2017-09-10 23:09:44 +02:00
|
|
|
|
2020-11-30 22:00:54 +01:00
|
|
|
// Check if the page number is out of range
|
2018-07-17 19:13:01 +02:00
|
|
|
if (empty($published) && $url->pageNumber()>1) {
|
2017-10-02 22:42:18 +02:00
|
|
|
Redirect::page('content');
|
2017-09-10 23:09:44 +02:00
|
|
|
}
|
|
|
|
|
2020-11-30 22:00:54 +01:00
|
|
|
// View HTML <title>
|
|
|
|
$layout['title'] = $L->g('Manage content') . ' - ' . $layout['title'];
|