use constants for permissions names
This commit is contained in:
parent
f0be282b5e
commit
3039ca75e5
30
_admin.php
30
_admin.php
@ -26,18 +26,18 @@ dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
|||||||
'/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer')) . '(&.*)?$/',
|
'/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer')) . '(&.*)?$/',
|
||||||
$_SERVER['REQUEST_URI']
|
$_SERVER['REQUEST_URI']
|
||||||
),
|
),
|
||||||
dcCore::app()->auth->check('admin', dcCore::app()->blog->id)
|
dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id)
|
||||||
);
|
);
|
||||||
|
|
||||||
# Delete related info about feed post in meta table
|
# Delete related info about feed post in meta table
|
||||||
dcCore::app()->addBehavior('adminBeforePostDelete', ['zcfsAdminBehaviors', 'adminBeforePostDelete']);
|
dcCore::app()->addBehavior('adminBeforePostDelete', ['zcfsAdminBehaviors', 'adminBeforePostDelete']);
|
||||||
|
|
||||||
if (dcCore::app()->auth->check('admin', dcCore::app()->blog->id)) {
|
if (dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id)) {
|
||||||
# Dashboard icon
|
# Dashboard icon
|
||||||
dcCore::app()->addBehavior('adminDashboardFavoritesV2', ['zcfsAdminBehaviors', 'adminDashboardFavorites']);
|
dcCore::app()->addBehavior('adminDashboardFavoritesV2', ['zcfsAdminBehaviors', 'adminDashboardFavoritesV2']);
|
||||||
# User pref
|
# User pref
|
||||||
dcCore::app()->addBehavior('adminColumnsListsV2', ['zcfsAdminBehaviors', 'adminColumnsLists']);
|
dcCore::app()->addBehavior('adminColumnsListsV2', ['zcfsAdminBehaviors', 'adminColumnsListsV2']);
|
||||||
dcCore::app()->addBehavior('adminFiltersListsV2', ['zcfsAdminBehaviors', 'adminFiltersLists']);
|
dcCore::app()->addBehavior('adminFiltersListsV2', ['zcfsAdminBehaviors', 'adminFiltersListsV2']);
|
||||||
# Add info about feed on post page sidebar
|
# Add info about feed on post page sidebar
|
||||||
dcCore::app()->addBehavior('adminPostHeaders', ['zcfsAdminBehaviors', 'adminPostHeaders']);
|
dcCore::app()->addBehavior('adminPostHeaders', ['zcfsAdminBehaviors', 'adminPostHeaders']);
|
||||||
dcCore::app()->addBehavior('adminPostFormItems', ['zcfsAdminBehaviors', 'adminPostFormItems']);
|
dcCore::app()->addBehavior('adminPostFormItems', ['zcfsAdminBehaviors', 'adminPostFormItems']);
|
||||||
@ -82,7 +82,7 @@ class zcfsAdminBehaviors
|
|||||||
*
|
*
|
||||||
* @param dcFavorites $favs Array of favorites
|
* @param dcFavorites $favs Array of favorites
|
||||||
*/
|
*/
|
||||||
public static function adminDashboardFavorites(dcFavorites $favs)
|
public static function adminDashboardFavoritesV2(dcFavorites $favs)
|
||||||
{
|
{
|
||||||
$favs->register('zcfs', [
|
$favs->register('zcfs', [
|
||||||
'title' => __('Feeds server'),
|
'title' => __('Feeds server'),
|
||||||
@ -90,24 +90,10 @@ class zcfsAdminBehaviors
|
|||||||
'small-icon' => dcPage::getPF('zoneclearFeedServer/icon.svg'),
|
'small-icon' => dcPage::getPF('zoneclearFeedServer/icon.svg'),
|
||||||
'large-icon' => dcPage::getPF('zoneclearFeedServer/icon.svg'),
|
'large-icon' => dcPage::getPF('zoneclearFeedServer/icon.svg'),
|
||||||
'permissions' => 'usage,contentadmin',
|
'permissions' => 'usage,contentadmin',
|
||||||
'active_cb' => ['zcfsAdminBehaviors', 'adminDashboardFavoritesActive'],
|
|
||||||
'dashboard_cb' => ['zcfsAdminBehaviors', 'adminDashboardFavoritesCallback'],
|
'dashboard_cb' => ['zcfsAdminBehaviors', 'adminDashboardFavoritesCallback'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Favorites selection.
|
|
||||||
*
|
|
||||||
* @param string $request Requested page
|
|
||||||
* @param array $params Requested parameters
|
|
||||||
*/
|
|
||||||
public static function adminDashboardFavoritesActive($request, $params)
|
|
||||||
{
|
|
||||||
return $request == 'plugin.php'
|
|
||||||
&& isset($params['p'])
|
|
||||||
&& $params['p'] == 'zoneclearFeedServer';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Favorites hack.
|
* Favorites hack.
|
||||||
*
|
*
|
||||||
@ -135,7 +121,7 @@ class zcfsAdminBehaviors
|
|||||||
*
|
*
|
||||||
* @param arrayObject $cols Columns
|
* @param arrayObject $cols Columns
|
||||||
*/
|
*/
|
||||||
public static function adminColumnsLists($cols)
|
public static function adminColumnsListsV2($cols)
|
||||||
{
|
{
|
||||||
$cols['zcfs_feeds'] = [
|
$cols['zcfs_feeds'] = [
|
||||||
__('Feeds server: Feeds'),
|
__('Feeds server: Feeds'),
|
||||||
@ -161,7 +147,7 @@ class zcfsAdminBehaviors
|
|||||||
*
|
*
|
||||||
* @param arrayObject $sorts Sort options
|
* @param arrayObject $sorts Sort options
|
||||||
*/
|
*/
|
||||||
public static function adminFiltersLists($sorts)
|
public static function adminFiltersListsV2($sorts)
|
||||||
{
|
{
|
||||||
$sorts['zcfs_feeds'] = [
|
$sorts['zcfs_feeds'] = [
|
||||||
__('Feeds server: Feeds'),
|
__('Feeds server: Feeds'),
|
||||||
|
@ -211,7 +211,7 @@ class zcfsEntriesList extends adminGenericList
|
|||||||
|
|
||||||
private function postLine()
|
private function postLine()
|
||||||
{
|
{
|
||||||
$cat_link = dcCore::app()->auth->check('categories', dcCore::app()->blog->id) ?
|
$cat_link = dcCore::app()->auth->check(dcAuth::PERMISSION_CATEGORIES, dcCore::app()->blog->id) ?
|
||||||
'<a href="category.php?id=%s" title="' . __('Edit category') . '">%s</a>'
|
'<a href="category.php?id=%s" title="' . __('Edit category') . '">%s</a>'
|
||||||
: '%2$s';
|
: '%2$s';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user