PrivilegesHelper shortened to Access
Methods are shorter, too
This commit is contained in:
parent
81e43286b5
commit
396ea97cad
22 changed files with 157 additions and 173 deletions
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
class PrivilegesHelper
|
class Access
|
||||||
{
|
{
|
||||||
private static $privileges = [];
|
private static $privileges = [];
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class PrivilegesHelper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function confirm($privilege, $subPrivilege = null)
|
public static function check($privilege, $subPrivilege = null)
|
||||||
{
|
{
|
||||||
if (php_sapi_name() == 'cli')
|
if (php_sapi_name() == 'cli')
|
||||||
return true;
|
return true;
|
||||||
|
@ -60,13 +60,13 @@ class PrivilegesHelper
|
||||||
return intval($user->accessRank) >= $minAccessRank;
|
return intval($user->accessRank) >= $minAccessRank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function confirmWithException($privilege, $subPrivilege = null)
|
public static function assert($privilege, $subPrivilege = null)
|
||||||
{
|
{
|
||||||
if (!self::confirm($privilege, $subPrivilege))
|
if (!self::check($privilege, $subPrivilege))
|
||||||
throw new SimpleException('Insufficient privileges');
|
throw new SimpleException('Insufficient privileges');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getIdentitySubPrivilege($user)
|
public static function getIdentity($user)
|
||||||
{
|
{
|
||||||
if (!$user)
|
if (!$user)
|
||||||
return 'all';
|
return 'all';
|
||||||
|
@ -74,8 +74,9 @@ class PrivilegesHelper
|
||||||
return $user->id == $userFromContext->id ? 'own' : 'all';
|
return $user->id == $userFromContext->id ? 'own' : 'all';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function confirmEmail($user)
|
public static function assertEmailConfirmation()
|
||||||
{
|
{
|
||||||
|
$user = getContext()->user;
|
||||||
if (!$user->emailConfirmed)
|
if (!$user->emailConfirmed)
|
||||||
throw new SimpleException('Need e-mail address confirmation to continue');
|
throw new SimpleException('Need e-mail address confirmation to continue');
|
||||||
}
|
}
|
||||||
|
@ -88,10 +89,10 @@ class PrivilegesHelper
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
return array_filter(PostSafety::getAll(), function($safety) use ($context)
|
return array_filter(PostSafety::getAll(), function($safety) use ($context)
|
||||||
{
|
{
|
||||||
return PrivilegesHelper::confirm(Privilege::ListPosts, PostSafety::toString($safety)) and
|
return Access::check(Privilege::ListPosts, PostSafety::toString($safety))
|
||||||
$context->user->hasEnabledSafety($safety);
|
and $context->user->hasEnabledSafety($safety);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivilegesHelper::init();
|
Access::init();
|
|
@ -32,7 +32,7 @@ class AuthController
|
||||||
throw new SimpleException('You are banned');
|
throw new SimpleException('You are banned');
|
||||||
|
|
||||||
if ($config->registration->needEmailForRegistering)
|
if ($config->registration->needEmailForRegistering)
|
||||||
PrivilegesHelper::confirmEmail($dbUser);
|
Access::requireEmail($dbUser);
|
||||||
|
|
||||||
$context->user = $dbUser;
|
$context->user = $dbUser;
|
||||||
self::doReLog();
|
self::doReLog();
|
||||||
|
|
|
@ -3,7 +3,7 @@ class CommentController
|
||||||
{
|
{
|
||||||
public function listAction($page)
|
public function listAction($page)
|
||||||
{
|
{
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListComments);
|
Access::assert(Privilege::ListComments);
|
||||||
|
|
||||||
$page = max(1, intval($page));
|
$page = max(1, intval($page));
|
||||||
$commentsPerPage = intval(getConfig()->comments->commentsPerPage);
|
$commentsPerPage = intval(getConfig()->comments->commentsPerPage);
|
||||||
|
@ -33,9 +33,9 @@ class CommentController
|
||||||
public function addAction($postId)
|
public function addAction($postId)
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
PrivilegesHelper::confirmWithException(Privilege::AddComment);
|
Access::assert(Privilege::AddComment);
|
||||||
if (getConfig()->registration->needEmailForCommenting)
|
if (getConfig()->registration->needEmailForCommenting)
|
||||||
PrivilegesHelper::confirmEmail($context->user);
|
Access::assertEmailConfirmation();
|
||||||
|
|
||||||
$post = PostModel::findById($postId);
|
$post = PostModel::findById($postId);
|
||||||
$context->transport->post = $post;
|
$context->transport->post = $post;
|
||||||
|
@ -70,9 +70,9 @@ class CommentController
|
||||||
$comment = CommentModel::findById($id);
|
$comment = CommentModel::findById($id);
|
||||||
$context->transport->comment = $comment;
|
$context->transport->comment = $comment;
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::EditComment,
|
Privilege::EditComment,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($comment->getCommenter()));
|
Access::getIdentity($comment->getCommenter()));
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -95,9 +95,9 @@ class CommentController
|
||||||
{
|
{
|
||||||
$comment = CommentModel::findById($id);
|
$comment = CommentModel::findById($id);
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::DeleteComment,
|
Privilege::DeleteComment,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($comment->getCommenter()));
|
Access::getIdentity($comment->getCommenter()));
|
||||||
|
|
||||||
CommentModel::remove($comment);
|
CommentModel::remove($comment);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ class LogController
|
||||||
public function listAction()
|
public function listAction()
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListLogs);
|
Access::assert(Privilege::ListLogs);
|
||||||
|
|
||||||
$path = TextHelper::absolutePath(getConfig()->main->logsPath);
|
$path = TextHelper::absolutePath(getConfig()->main->logsPath);
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class LogController
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ViewLog);
|
Access::assert(Privilege::ViewLog);
|
||||||
|
|
||||||
//parse input
|
//parse input
|
||||||
$page = max(1, intval($page));
|
$page = max(1, intval($page));
|
||||||
|
|
|
@ -66,14 +66,14 @@ class PostController
|
||||||
$postsPerPage = intval(getConfig()->browsing->postsPerPage);
|
$postsPerPage = intval(getConfig()->browsing->postsPerPage);
|
||||||
$context->transport->searchQuery = $query;
|
$context->transport->searchQuery = $query;
|
||||||
$context->transport->lastSearchQuery = $query;
|
$context->transport->lastSearchQuery = $query;
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListPosts);
|
Access::assert(Privilege::ListPosts);
|
||||||
if ($source == 'mass-tag')
|
if ($source == 'mass-tag')
|
||||||
{
|
{
|
||||||
PrivilegesHelper::confirmWithException(Privilege::MassTag);
|
Access::assert(Privilege::MassTag);
|
||||||
$context->massTagTag = $additionalInfo;
|
$context->massTagTag = $additionalInfo;
|
||||||
$context->massTagQuery = $query;
|
$context->massTagQuery = $query;
|
||||||
|
|
||||||
if (!PrivilegesHelper::confirm(Privilege::MassTag, 'all'))
|
if (!Access::confirm(Privilege::MassTag, 'all'))
|
||||||
$query = trim($query . ' submit:' . $context->user->name);
|
$query = trim($query . ' submit:' . $context->user->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,9 +100,9 @@ class PostController
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::MassTag,
|
Privilege::MassTag,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
$tags = $post->getTags();
|
$tags = $post->getTags();
|
||||||
|
|
||||||
|
@ -157,9 +157,9 @@ class PostController
|
||||||
public function uploadAction()
|
public function uploadAction()
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
PrivilegesHelper::confirmWithException(Privilege::UploadPost);
|
Access::assert(Privilege::UploadPost);
|
||||||
if (getConfig()->registration->needEmailForUploading)
|
if (getConfig()->registration->needEmailForUploading)
|
||||||
PrivilegesHelper::confirmEmail($context->user);
|
Access::assertEmailConfirmation();
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -232,7 +232,7 @@ class PostController
|
||||||
public function flagAction($id)
|
public function flagAction($id)
|
||||||
{
|
{
|
||||||
$post = PostModel::findByIdOrName($id);
|
$post = PostModel::findByIdOrName($id);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::FlagPost, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::FlagPost, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -252,7 +252,7 @@ class PostController
|
||||||
public function hideAction($id)
|
public function hideAction($id)
|
||||||
{
|
{
|
||||||
$post = PostModel::findByIdOrName($id);
|
$post = PostModel::findByIdOrName($id);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::HidePost, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::HidePost, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -267,7 +267,7 @@ class PostController
|
||||||
public function unhideAction($id)
|
public function unhideAction($id)
|
||||||
{
|
{
|
||||||
$post = PostModel::findByIdOrName($id);
|
$post = PostModel::findByIdOrName($id);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::HidePost, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::HidePost, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -282,7 +282,7 @@ class PostController
|
||||||
public function deleteAction($id)
|
public function deleteAction($id)
|
||||||
{
|
{
|
||||||
$post = PostModel::findByIdOrName($id);
|
$post = PostModel::findByIdOrName($id);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::DeletePost, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::DeletePost, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -297,7 +297,7 @@ class PostController
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
$post = PostModel::findByIdOrName($id);
|
$post = PostModel::findByIdOrName($id);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::FavoritePost, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::FavoritePost, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -314,7 +314,7 @@ class PostController
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
$post = PostModel::findByIdOrName($id);
|
$post = PostModel::findByIdOrName($id);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::FavoritePost, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::FavoritePost, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -330,7 +330,7 @@ class PostController
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
$post = PostModel::findByIdOrName($id);
|
$post = PostModel::findByIdOrName($id);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ScorePost, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::ScorePost, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -346,7 +346,7 @@ class PostController
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
$post = PostModel::findByIdOrName($id);
|
$post = PostModel::findByIdOrName($id);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::FeaturePost, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::FeaturePost, Access::getIdentity($post->getUploader()));
|
||||||
PropertyModel::set(PropertyModel::FeaturedPostId, $post->id);
|
PropertyModel::set(PropertyModel::FeaturedPostId, $post->id);
|
||||||
PropertyModel::set(PropertyModel::FeaturedPostDate, time());
|
PropertyModel::set(PropertyModel::FeaturedPostDate, time());
|
||||||
PropertyModel::set(PropertyModel::FeaturedPostUserName, $context->user->name);
|
PropertyModel::set(PropertyModel::FeaturedPostUserName, $context->user->name);
|
||||||
|
@ -361,9 +361,9 @@ class PostController
|
||||||
CommentModel::preloadCommenters($post->getComments());
|
CommentModel::preloadCommenters($post->getComments());
|
||||||
|
|
||||||
if ($post->hidden)
|
if ($post->hidden)
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ViewPost, 'hidden');
|
Access::assert(Privilege::ViewPost, 'hidden');
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ViewPost);
|
Access::assert(Privilege::ViewPost);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ViewPost, PostSafety::toString($post->safety));
|
Access::assert(Privilege::ViewPost, PostSafety::toString($post->safety));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -403,8 +403,8 @@ class PostController
|
||||||
if (!file_exists($path))
|
if (!file_exists($path))
|
||||||
{
|
{
|
||||||
$post = PostModel::findByIdOrName($name);
|
$post = PostModel::findByIdOrName($name);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListPosts);
|
Access::assert(Privilege::ListPosts);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListPosts, PostSafety::toString($post->safety));
|
Access::assert(Privilege::ListPosts, PostSafety::toString($post->safety));
|
||||||
$post->makeThumb($width, $height);
|
$post->makeThumb($width, $height);
|
||||||
if (!file_exists($path))
|
if (!file_exists($path))
|
||||||
{
|
{
|
||||||
|
@ -430,8 +430,8 @@ class PostController
|
||||||
$config = getConfig();
|
$config = getConfig();
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::RetrievePost);
|
Access::assert(Privilege::RetrievePost);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::RetrievePost, PostSafety::toString($post->safety));
|
Access::assert(Privilege::RetrievePost, PostSafety::toString($post->safety));
|
||||||
|
|
||||||
$path = $config->main->filesPath . DS . $post->name;
|
$path = $config->main->filesPath . DS . $post->name;
|
||||||
$path = TextHelper::absolutePath($path);
|
$path = TextHelper::absolutePath($path);
|
||||||
|
@ -465,7 +465,7 @@ class PostController
|
||||||
if (!empty($_FILES['file']['name']))
|
if (!empty($_FILES['file']['name']))
|
||||||
{
|
{
|
||||||
if (!$isNew)
|
if (!$isNew)
|
||||||
PrivilegesHelper::confirmWithException(Privilege::EditPostFile, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::EditPostFile, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
$suppliedFile = $_FILES['file'];
|
$suppliedFile = $_FILES['file'];
|
||||||
self::handleUploadErrors($suppliedFile);
|
self::handleUploadErrors($suppliedFile);
|
||||||
|
@ -480,7 +480,7 @@ class PostController
|
||||||
elseif (InputHelper::get('url'))
|
elseif (InputHelper::get('url'))
|
||||||
{
|
{
|
||||||
if (!$isNew)
|
if (!$isNew)
|
||||||
PrivilegesHelper::confirmWithException(Privilege::EditPostFile, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::EditPostFile, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
$url = InputHelper::get('url');
|
$url = InputHelper::get('url');
|
||||||
$post->setContentFromUrl($url);
|
$post->setContentFromUrl($url);
|
||||||
|
@ -495,7 +495,7 @@ class PostController
|
||||||
if ($suppliedSafety !== null)
|
if ($suppliedSafety !== null)
|
||||||
{
|
{
|
||||||
if (!$isNew)
|
if (!$isNew)
|
||||||
PrivilegesHelper::confirmWithException(Privilege::EditPostSafety, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::EditPostSafety, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
$oldSafety = $post->safety;
|
$oldSafety = $post->safety;
|
||||||
$post->setSafety($suppliedSafety);
|
$post->setSafety($suppliedSafety);
|
||||||
|
@ -510,7 +510,7 @@ class PostController
|
||||||
if ($suppliedTags !== null)
|
if ($suppliedTags !== null)
|
||||||
{
|
{
|
||||||
if (!$isNew)
|
if (!$isNew)
|
||||||
PrivilegesHelper::confirmWithException(Privilege::EditPostTags, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::EditPostTags, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
$oldTags = array_map(function($tag) { return $tag->name; }, $post->getTags());
|
$oldTags = array_map(function($tag) { return $tag->name; }, $post->getTags());
|
||||||
$post->setTagsFromText($suppliedTags);
|
$post->setTagsFromText($suppliedTags);
|
||||||
|
@ -528,7 +528,7 @@ class PostController
|
||||||
if ($suppliedSource !== null)
|
if ($suppliedSource !== null)
|
||||||
{
|
{
|
||||||
if (!$isNew)
|
if (!$isNew)
|
||||||
PrivilegesHelper::confirmWithException(Privilege::EditPostSource, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::EditPostSource, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
$oldSource = $post->source;
|
$oldSource = $post->source;
|
||||||
$post->setSource($suppliedSource);
|
$post->setSource($suppliedSource);
|
||||||
|
@ -543,7 +543,7 @@ class PostController
|
||||||
if ($suppliedRelations !== null)
|
if ($suppliedRelations !== null)
|
||||||
{
|
{
|
||||||
if (!$isNew)
|
if (!$isNew)
|
||||||
PrivilegesHelper::confirmWithException(Privilege::EditPostRelations, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::EditPostRelations, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
$oldRelatedIds = array_map(function($post) { return $post->id; }, $post->getRelations());
|
$oldRelatedIds = array_map(function($post) { return $post->id; }, $post->getRelations());
|
||||||
$post->setRelationsFromText($suppliedRelations);
|
$post->setRelationsFromText($suppliedRelations);
|
||||||
|
@ -560,7 +560,7 @@ class PostController
|
||||||
if (!empty($_FILES['thumb']['name']))
|
if (!empty($_FILES['thumb']['name']))
|
||||||
{
|
{
|
||||||
if (!$isNew)
|
if (!$isNew)
|
||||||
PrivilegesHelper::confirmWithException(Privilege::EditPostThumb, PrivilegesHelper::getIdentitySubPrivilege($post->getUploader()));
|
Access::assert(Privilege::EditPostThumb, Access::getIdentity($post->getUploader()));
|
||||||
|
|
||||||
$suppliedFile = $_FILES['thumb'];
|
$suppliedFile = $_FILES['thumb'];
|
||||||
self::handleUploadErrors($suppliedFile);
|
self::handleUploadErrors($suppliedFile);
|
||||||
|
|
|
@ -5,7 +5,7 @@ class TagController
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
$context->viewName = 'tag-list-wrapper';
|
$context->viewName = 'tag-list-wrapper';
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListTags);
|
Access::assert(Privilege::ListTags);
|
||||||
|
|
||||||
$suppliedFilter = $filter ?: 'order:alpha,asc';
|
$suppliedFilter = $filter ?: 'order:alpha,asc';
|
||||||
$page = max(1, intval($page));
|
$page = max(1, intval($page));
|
||||||
|
@ -39,7 +39,7 @@ class TagController
|
||||||
public function autoCompleteAction()
|
public function autoCompleteAction()
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListTags);
|
Access::assert(Privilege::ListTags);
|
||||||
|
|
||||||
$suppliedSearch = InputHelper::get('search');
|
$suppliedSearch = InputHelper::get('search');
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class TagController
|
||||||
public function relatedAction()
|
public function relatedAction()
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListTags);
|
Access::assert(Privilege::ListTags);
|
||||||
|
|
||||||
$suppliedContext = (array) InputHelper::get('context');
|
$suppliedContext = (array) InputHelper::get('context');
|
||||||
$suppliedTag = InputHelper::get('tag');
|
$suppliedTag = InputHelper::get('tag');
|
||||||
|
@ -85,7 +85,7 @@ class TagController
|
||||||
$context->viewName = 'tag-list-wrapper';
|
$context->viewName = 'tag-list-wrapper';
|
||||||
$context->handleExceptions = true;
|
$context->handleExceptions = true;
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::MergeTags);
|
Access::assert(Privilege::MergeTags);
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
TagModel::removeUnused();
|
TagModel::removeUnused();
|
||||||
|
@ -112,7 +112,7 @@ class TagController
|
||||||
$context->viewName = 'tag-list-wrapper';
|
$context->viewName = 'tag-list-wrapper';
|
||||||
$context->handleExceptions = true;
|
$context->handleExceptions = true;
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::MergeTags);
|
Access::assert(Privilege::MergeTags);
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
TagModel::removeUnused();
|
TagModel::removeUnused();
|
||||||
|
@ -138,7 +138,7 @@ class TagController
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
$context->viewName = 'tag-list-wrapper';
|
$context->viewName = 'tag-list-wrapper';
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::MassTag);
|
Access::assert(Privilege::MassTag);
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
$suppliedOldPage = intval(InputHelper::get('old-page'));
|
$suppliedOldPage = intval(InputHelper::get('old-page'));
|
||||||
|
|
|
@ -103,7 +103,7 @@ class UserController
|
||||||
public function listAction($filter, $page)
|
public function listAction($filter, $page)
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::ListUsers);
|
Privilege::ListUsers);
|
||||||
|
|
||||||
$suppliedFilter = $filter ?: InputHelper::get('filter') ?: 'order:alpha,asc';
|
$suppliedFilter = $filter ?: InputHelper::get('filter') ?: 'order:alpha,asc';
|
||||||
|
@ -128,9 +128,9 @@ class UserController
|
||||||
public function flagAction($name)
|
public function flagAction($name)
|
||||||
{
|
{
|
||||||
$user = UserModel::findByNameOrEmail($name);
|
$user = UserModel::findByNameOrEmail($name);
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::FlagUser,
|
Privilege::FlagUser,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -152,9 +152,9 @@ class UserController
|
||||||
public function banAction($name)
|
public function banAction($name)
|
||||||
{
|
{
|
||||||
$user = UserModel::findByNameOrEmail($name);
|
$user = UserModel::findByNameOrEmail($name);
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::BanUser,
|
Privilege::BanUser,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -169,9 +169,9 @@ class UserController
|
||||||
public function unbanAction($name)
|
public function unbanAction($name)
|
||||||
{
|
{
|
||||||
$user = UserModel::findByNameOrEmail($name);
|
$user = UserModel::findByNameOrEmail($name);
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::BanUser,
|
Privilege::BanUser,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -186,7 +186,7 @@ class UserController
|
||||||
public function acceptRegistrationAction($name)
|
public function acceptRegistrationAction($name)
|
||||||
{
|
{
|
||||||
$user = UserModel::findByNameOrEmail($name);
|
$user = UserModel::findByNameOrEmail($name);
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::AcceptUserRegistration);
|
Privilege::AcceptUserRegistration);
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
|
@ -202,12 +202,12 @@ class UserController
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
$user = UserModel::findByNameOrEmail($name);
|
$user = UserModel::findByNameOrEmail($name);
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::ViewUser,
|
Privilege::ViewUser,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::DeleteUser,
|
Privilege::DeleteUser,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
|
|
||||||
$this->loadUserView($user);
|
$this->loadUserView($user);
|
||||||
$context->transport->tab = 'delete';
|
$context->transport->tab = 'delete';
|
||||||
|
@ -239,12 +239,12 @@ class UserController
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
$user = UserModel::findByNameOrEmail($name);
|
$user = UserModel::findByNameOrEmail($name);
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::ViewUser,
|
Privilege::ViewUser,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::ChangeUserSettings,
|
Privilege::ChangeUserSettings,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
|
|
||||||
$this->loadUserView($user);
|
$this->loadUserView($user);
|
||||||
$context->transport->tab = 'settings';
|
$context->transport->tab = 'settings';
|
||||||
|
@ -276,9 +276,9 @@ class UserController
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$user = UserModel::findByNameOrEmail($name);
|
$user = UserModel::findByNameOrEmail($name);
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::ViewUser,
|
Privilege::ViewUser,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
|
|
||||||
$this->loadUserView($user);
|
$this->loadUserView($user);
|
||||||
$context->transport->tab = 'edit';
|
$context->transport->tab = 'edit';
|
||||||
|
@ -298,9 +298,9 @@ class UserController
|
||||||
|
|
||||||
if ($suppliedName != '' and $suppliedName != $user->name)
|
if ($suppliedName != '' and $suppliedName != $user->name)
|
||||||
{
|
{
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::ChangeUserName,
|
Privilege::ChangeUserName,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
|
|
||||||
$suppliedName = UserModel::validateUserName($suppliedName);
|
$suppliedName = UserModel::validateUserName($suppliedName);
|
||||||
$oldName = $user->name;
|
$oldName = $user->name;
|
||||||
|
@ -312,9 +312,9 @@ class UserController
|
||||||
|
|
||||||
if ($suppliedPassword1 != '')
|
if ($suppliedPassword1 != '')
|
||||||
{
|
{
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::ChangeUserPassword,
|
Privilege::ChangeUserPassword,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
|
|
||||||
if ($suppliedPassword1 != $suppliedPassword2)
|
if ($suppliedPassword1 != $suppliedPassword2)
|
||||||
throw new SimpleException('Specified passwords must be the same');
|
throw new SimpleException('Specified passwords must be the same');
|
||||||
|
@ -325,9 +325,9 @@ class UserController
|
||||||
|
|
||||||
if ($suppliedEmail != '' and $suppliedEmail != $user->emailConfirmed)
|
if ($suppliedEmail != '' and $suppliedEmail != $user->emailConfirmed)
|
||||||
{
|
{
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::ChangeUserEmail,
|
Privilege::ChangeUserEmail,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
|
|
||||||
$suppliedEmail = UserModel::validateEmail($suppliedEmail);
|
$suppliedEmail = UserModel::validateEmail($suppliedEmail);
|
||||||
if ($context->user->id == $user->id)
|
if ($context->user->id == $user->id)
|
||||||
|
@ -349,9 +349,9 @@ class UserController
|
||||||
|
|
||||||
if ($suppliedAccessRank != '' and $suppliedAccessRank != $user->accessRank)
|
if ($suppliedAccessRank != '' and $suppliedAccessRank != $user->accessRank)
|
||||||
{
|
{
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::ChangeUserAccessRank,
|
Privilege::ChangeUserAccessRank,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
|
|
||||||
$suppliedAccessRank = UserModel::validateAccessRank($suppliedAccessRank);
|
$suppliedAccessRank = UserModel::validateAccessRank($suppliedAccessRank);
|
||||||
$user->accessRank = $suppliedAccessRank;
|
$user->accessRank = $suppliedAccessRank;
|
||||||
|
@ -397,9 +397,9 @@ class UserController
|
||||||
if ($page === null)
|
if ($page === null)
|
||||||
$page = 1;
|
$page = 1;
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::ViewUser,
|
Privilege::ViewUser,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($user));
|
Access::getIdentity($user));
|
||||||
|
|
||||||
$this->loadUserView($user);
|
$this->loadUserView($user);
|
||||||
|
|
||||||
|
@ -430,9 +430,9 @@ class UserController
|
||||||
public function toggleSafetyAction($safety)
|
public function toggleSafetyAction($safety)
|
||||||
{
|
{
|
||||||
$context = getContext();
|
$context = getContext();
|
||||||
PrivilegesHelper::confirmWithException(
|
Access::assert(
|
||||||
Privilege::ChangeUserSettings,
|
Privilege::ChangeUserSettings,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($context->user));
|
Access::getIdentity($context->user));
|
||||||
|
|
||||||
if (!in_array($safety, PostSafety::getAll()))
|
if (!in_array($safety, PostSafety::getAll()))
|
||||||
throw new SimpleExcetpion('Invalid safety');
|
throw new SimpleExcetpion('Invalid safety');
|
||||||
|
|
|
@ -36,8 +36,6 @@ class PostEntity extends AbstractEntity
|
||||||
$this->setCache('uploader', $user);
|
$this->setCache('uploader', $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getComments()
|
public function getComments()
|
||||||
{
|
{
|
||||||
if ($this->hasCache('comments'))
|
if ($this->hasCache('comments'))
|
||||||
|
@ -47,9 +45,6 @@ class PostEntity extends AbstractEntity
|
||||||
return $comments;
|
return $comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getFavorites()
|
public function getFavorites()
|
||||||
{
|
{
|
||||||
if ($this->hasCache('favoritee'))
|
if ($this->hasCache('favoritee'))
|
||||||
|
@ -65,8 +60,6 @@ class PostEntity extends AbstractEntity
|
||||||
return $favorites;
|
return $favorites;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getRelations()
|
public function getRelations()
|
||||||
{
|
{
|
||||||
if ($this->hasCache('relations'))
|
if ($this->hasCache('relations'))
|
||||||
|
@ -123,8 +116,6 @@ class PostEntity extends AbstractEntity
|
||||||
$this->setRelations($relatedPosts);
|
$this->setRelations($relatedPosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getTags()
|
public function getTags()
|
||||||
{
|
{
|
||||||
if ($this->hasCache('tags'))
|
if ($this->hasCache('tags'))
|
||||||
|
@ -173,9 +164,6 @@ class PostEntity extends AbstractEntity
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function setHidden($hidden)
|
public function setHidden($hidden)
|
||||||
{
|
{
|
||||||
$this->hidden = boolval($hidden);
|
$this->hidden = boolval($hidden);
|
||||||
|
@ -191,7 +179,6 @@ class PostEntity extends AbstractEntity
|
||||||
$this->source = PostModel::validateSource($source);
|
$this->source = PostModel::validateSource($source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getThumbCustomPath($width = null, $height = null)
|
public function getThumbCustomPath($width = null, $height = null)
|
||||||
{
|
{
|
||||||
return PostModel::getThumbCustomPath($this->name, $width, $height);
|
return PostModel::getThumbCustomPath($this->name, $width, $height);
|
||||||
|
@ -343,8 +330,6 @@ class PostEntity extends AbstractEntity
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function setContentFromPath($srcPath)
|
public function setContentFromPath($srcPath)
|
||||||
{
|
{
|
||||||
$this->fileSize = filesize($srcPath);
|
$this->fileSize = filesize($srcPath);
|
||||||
|
@ -471,8 +456,6 @@ class PostEntity extends AbstractEntity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getEditToken()
|
public function getEditToken()
|
||||||
{
|
{
|
||||||
$x = [];
|
$x = [];
|
||||||
|
|
|
@ -8,10 +8,10 @@ class CommentSearchParser extends AbstractSearchParser
|
||||||
$this->statement->addInnerJoin('post', new Sql\EqualsFunctor('post_id', 'post.id'));
|
$this->statement->addInnerJoin('post', new Sql\EqualsFunctor('post_id', 'post.id'));
|
||||||
$crit = new Sql\ConjunctionFunctor();
|
$crit = new Sql\ConjunctionFunctor();
|
||||||
|
|
||||||
$allowedSafety = PrivilegesHelper::getAllowedSafety();
|
$allowedSafety = Access::getAllowedSafety();
|
||||||
$crit->add(Sql\InFunctor::fromArray('post.safety', Sql\Binding::fromArray($allowedSafety)));
|
$crit->add(Sql\InFunctor::fromArray('post.safety', Sql\Binding::fromArray($allowedSafety)));
|
||||||
|
|
||||||
if (!PrivilegesHelper::confirm(Privilege::ListPosts, 'hidden'))
|
if (!Access::check(Privilege::ListPosts, 'hidden'))
|
||||||
$crit->add(new Sql\NegationFunctor(new Sql\StringExpression('hidden')));
|
$crit->add(new Sql\NegationFunctor(new Sql\StringExpression('hidden')));
|
||||||
|
|
||||||
$this->statement->setCriterion($crit);
|
$this->statement->setCriterion($crit);
|
||||||
|
|
|
@ -14,7 +14,7 @@ class PostSearchParser extends AbstractSearchParser
|
||||||
$this->tags = [];
|
$this->tags = [];
|
||||||
$crit = new Sql\ConjunctionFunctor();
|
$crit = new Sql\ConjunctionFunctor();
|
||||||
|
|
||||||
$allowedSafety = PrivilegesHelper::getAllowedSafety();
|
$allowedSafety = Access::getAllowedSafety();
|
||||||
$crit->add(Sql\InFunctor::fromArray('safety', Sql\Binding::fromArray($allowedSafety)));
|
$crit->add(Sql\InFunctor::fromArray('safety', Sql\Binding::fromArray($allowedSafety)));
|
||||||
|
|
||||||
$this->statement->setCriterion($crit);
|
$this->statement->setCriterion($crit);
|
||||||
|
@ -27,7 +27,7 @@ class PostSearchParser extends AbstractSearchParser
|
||||||
if (getContext()->user->hasEnabledHidingDislikedPosts() and !$this->showDisliked)
|
if (getContext()->user->hasEnabledHidingDislikedPosts() and !$this->showDisliked)
|
||||||
$this->processComplexToken('special', 'disliked', true);
|
$this->processComplexToken('special', 'disliked', true);
|
||||||
|
|
||||||
if (!PrivilegesHelper::confirm(Privilege::ListPosts, 'hidden') or !$this->showHidden)
|
if (!Access::check(Privilege::ListPosts, 'hidden') or !$this->showHidden)
|
||||||
$this->processComplexToken('special', 'hidden', true);
|
$this->processComplexToken('special', 'hidden', true);
|
||||||
|
|
||||||
foreach ($this->tags as $item)
|
foreach ($this->tags as $item)
|
||||||
|
|
|
@ -5,7 +5,7 @@ class TagSearchParser extends AbstractSearchParser
|
||||||
{
|
{
|
||||||
protected function processSetup(&$tokens)
|
protected function processSetup(&$tokens)
|
||||||
{
|
{
|
||||||
$allowedSafety = PrivilegesHelper::getAllowedSafety();
|
$allowedSafety = Access::getAllowedSafety();
|
||||||
$this->statement
|
$this->statement
|
||||||
->addInnerJoin('post_tag', new Sql\EqualsFunctor('tag.id', 'post_tag.tag_id'))
|
->addInnerJoin('post_tag', new Sql\EqualsFunctor('tag.id', 'post_tag.tag_id'))
|
||||||
->addInnerJoin('post', new Sql\EqualsFunctor('post.id', 'post_tag.post_id'))
|
->addInnerJoin('post', new Sql\EqualsFunctor('post.id', 'post_tag.post_id'))
|
||||||
|
|
|
@ -34,9 +34,9 @@ Assets::addScript('comment-edit.js');
|
||||||
<?= TextHelper::formatDate($this->context->comment->commentDate, false) ?>
|
<?= TextHelper::formatDate($this->context->comment->commentDate, false) ?>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(
|
<?php if (Access::check(
|
||||||
Privilege::EditComment,
|
Privilege::EditComment,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($commenter))): ?>
|
Access::getIdentity($commenter))): ?>
|
||||||
<span class="edit">
|
<span class="edit">
|
||||||
<a href="<?= \Chibi\Router::linkTo(['CommentController', 'editAction'], ['id' => $this->context->comment->id]) ?>">
|
<a href="<?= \Chibi\Router::linkTo(['CommentController', 'editAction'], ['id' => $this->context->comment->id]) ?>">
|
||||||
edit
|
edit
|
||||||
|
@ -45,8 +45,8 @@ Assets::addScript('comment-edit.js');
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (
|
<?php if (
|
||||||
PrivilegesHelper::confirm(Privilege::DeleteComment,
|
Access::check(Privilege::DeleteComment,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($commenter))): ?>
|
Access::getIdentity($commenter))): ?>
|
||||||
<span class="delete">
|
<span class="delete">
|
||||||
<a href="<?= \Chibi\Router::linkTo(['CommentController', 'deleteAction'], ['id' => $this->context->comment->id]) ?>"
|
<a href="<?= \Chibi\Router::linkTo(['CommentController', 'deleteAction'], ['id' => $this->context->comment->id]) ?>"
|
||||||
class="simple-action confirmable"
|
class="simple-action confirmable"
|
||||||
|
|
|
@ -42,7 +42,7 @@ Assets::addScript('core.js');
|
||||||
<span>Load: <?= sprintf('%.05f', microtime(true) - $this->context->startTime) ?>s</span>
|
<span>Load: <?= sprintf('%.05f', microtime(true) - $this->context->startTime) ?>s</span>
|
||||||
<span>Queries: <?= count(\Chibi\Database::getLogs()) ?></span>
|
<span>Queries: <?= count(\Chibi\Database::getLogs()) ?></span>
|
||||||
<span><a href="<?= SZURU_LINK ?>">szurubooru v<?= SZURU_VERSION ?></a></span>
|
<span><a href="<?= SZURU_LINK ?>">szurubooru v<?= SZURU_VERSION ?></a></span>
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::ListLogs)): ?>
|
<?php if (Access::check(Privilege::ListLogs)): ?>
|
||||||
<span><a href="<?= \Chibi\Router::linkTo(['LogController', 'listAction']) ?>">Logs</a></span>
|
<span><a href="<?= \Chibi\Router::linkTo(['LogController', 'listAction']) ?>">Logs</a></span>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
id="edit-token"
|
id="edit-token"
|
||||||
value="<?= htmlspecialchars($this->context->transport->post->getEditToken()) ?>"/>
|
value="<?= htmlspecialchars($this->context->transport->post->getEditToken()) ?>"/>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(
|
<?php if (Access::check(
|
||||||
Privilege::EditPostSafety,
|
Privilege::EditPostSafety,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
|
Access::getIdentity($this->context->transport->post->getUploader()))): ?>
|
||||||
|
|
||||||
<div class="form-row safety">
|
<div class="form-row safety">
|
||||||
<label>Safety:</label>
|
<label>Safety:</label>
|
||||||
|
@ -32,9 +32,9 @@
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(
|
<?php if (Access::check(
|
||||||
Privilege::EditPostTags,
|
Privilege::EditPostTags,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
|
Access::getIdentity($this->context->transport->post->getUploader()))): ?>
|
||||||
|
|
||||||
<div class="form-row tags">
|
<div class="form-row tags">
|
||||||
<label for="tags">Tags:</label>
|
<label for="tags">Tags:</label>
|
||||||
|
@ -51,8 +51,8 @@
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (
|
<?php if (
|
||||||
PrivilegesHelper::confirm(Privilege::EditPostSource,
|
Access::check(Privilege::EditPostSource,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
|
Access::getIdentity($this->context->transport->post->getUploader()))): ?>
|
||||||
|
|
||||||
<div class="form-row source">
|
<div class="form-row source">
|
||||||
<label for="source">Source:</label>
|
<label for="source">Source:</label>
|
||||||
|
@ -66,8 +66,8 @@
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (
|
<?php if (
|
||||||
PrivilegesHelper::confirm(Privilege::EditPostRelations,
|
Access::check(Privilege::EditPostRelations,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
|
Access::getIdentity($this->context->transport->post->getUploader()))): ?>
|
||||||
|
|
||||||
<div class="form-row thumb">
|
<div class="form-row thumb">
|
||||||
<label for="relations">Relations:</label>
|
<label for="relations">Relations:</label>
|
||||||
|
@ -84,8 +84,8 @@
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (
|
<?php if (
|
||||||
PrivilegesHelper::confirm(Privilege::EditPostFile,
|
Access::check(Privilege::EditPostFile,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
|
Access::getIdentity($this->context->transport->post->getUploader()))): ?>
|
||||||
|
|
||||||
<div class="form-row url">
|
<div class="form-row url">
|
||||||
<label for="url">File:</label>
|
<label for="url">File:</label>
|
||||||
|
@ -103,8 +103,8 @@
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (
|
<?php if (
|
||||||
PrivilegesHelper::confirm(Privilege::EditPostThumb,
|
Access::check(Privilege::EditPostThumb,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
|
Access::getIdentity($this->context->transport->post->getUploader()))): ?>
|
||||||
|
|
||||||
<div class="form-row thumb">
|
<div class="form-row thumb">
|
||||||
<label for="thumb">Thumb:</label>
|
<label for="thumb">Thumb:</label>
|
||||||
|
|
|
@ -3,31 +3,31 @@ Assets::setSubTitle('posts');
|
||||||
|
|
||||||
$tabs = [];
|
$tabs = [];
|
||||||
$activeTab = 0;
|
$activeTab = 0;
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListPosts))
|
if (Access::check(Privilege::ListPosts))
|
||||||
$tabs []= ['All posts', \Chibi\Router::linkTo(['PostController', 'listAction'])];
|
$tabs []= ['All posts', \Chibi\Router::linkTo(['PostController', 'listAction'])];
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListPosts))
|
if (Access::check(Privilege::ListPosts))
|
||||||
{
|
{
|
||||||
$tabs []= ['Random', \Chibi\Router::linkTo(['PostController', 'randomAction'])];
|
$tabs []= ['Random', \Chibi\Router::linkTo(['PostController', 'randomAction'])];
|
||||||
if ($this->context->simpleActionName == 'random')
|
if ($this->context->simpleActionName == 'random')
|
||||||
$activeTab = count($tabs) - 1;
|
$activeTab = count($tabs) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListPosts))
|
if (Access::check(Privilege::ListPosts))
|
||||||
{
|
{
|
||||||
$tabs []= ['Favorites', \Chibi\Router::linkTo(['PostController', 'favoritesAction'])];
|
$tabs []= ['Favorites', \Chibi\Router::linkTo(['PostController', 'favoritesAction'])];
|
||||||
if ($this->context->simpleActionName == 'favorites')
|
if ($this->context->simpleActionName == 'favorites')
|
||||||
$activeTab = count($tabs) - 1;
|
$activeTab = count($tabs) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListPosts))
|
if (Access::check(Privilege::ListPosts))
|
||||||
{
|
{
|
||||||
$tabs []= ['Upvoted', \Chibi\Router::linkTo(['PostController', 'upvotedAction'])];
|
$tabs []= ['Upvoted', \Chibi\Router::linkTo(['PostController', 'upvotedAction'])];
|
||||||
if ($this->context->simpleActionName == 'upvoted')
|
if ($this->context->simpleActionName == 'upvoted')
|
||||||
$activeTab = count($tabs) - 1;
|
$activeTab = count($tabs) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::MassTag))
|
if (Access::check(Privilege::MassTag))
|
||||||
{
|
{
|
||||||
$tabs []= ['Mass tag', \Chibi\Router::linkTo(['PostController', 'listAction'], [
|
$tabs []= ['Mass tag', \Chibi\Router::linkTo(['PostController', 'listAction'], [
|
||||||
'source' => 'mass-tag',
|
'source' => 'mass-tag',
|
||||||
|
|
|
@ -5,7 +5,7 @@ Assets::addScript('post-list.js');
|
||||||
|
|
||||||
<?php if (isset($this->context->source)
|
<?php if (isset($this->context->source)
|
||||||
and $this->context->source == 'mass-tag'
|
and $this->context->source == 'mass-tag'
|
||||||
and PrivilegesHelper::confirm(Privilege::MassTag)): ?>
|
and Access::check(Privilege::MassTag)): ?>
|
||||||
|
|
||||||
<?php \Chibi\View::render('tag-mass-tag', $this->context) ?>
|
<?php \Chibi\View::render('tag-mass-tag', $this->context) ?>
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,9 @@ $editPostPrivileges = [
|
||||||
$editPostPrivileges = array_fill_keys($editPostPrivileges, false);
|
$editPostPrivileges = array_fill_keys($editPostPrivileges, false);
|
||||||
foreach (array_keys($editPostPrivileges) as $privilege)
|
foreach (array_keys($editPostPrivileges) as $privilege)
|
||||||
{
|
{
|
||||||
if (PrivilegesHelper::confirm(
|
if (Access::check(
|
||||||
$privilege,
|
$privilege,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader())))
|
Access::getIdentity($this->context->transport->post->getUploader())))
|
||||||
|
|
||||||
$editPostPrivileges[$privilege] = true;
|
$editPostPrivileges[$privilege] = true;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
<?= $this->context->transport->post->score ?>
|
<?= $this->context->transport->post->score ?>
|
||||||
|
|
||||||
<?php $scoreLink = function($score) { return \Chibi\Router::linkTo(['PostController', 'scoreAction'], ['id' => $this->context->transport->post->id, 'score' => $score]); } ?>
|
<?php $scoreLink = function($score) { return \Chibi\Router::linkTo(['PostController', 'scoreAction'], ['id' => $this->context->transport->post->id, 'score' => $score]); } ?>
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::ScorePost, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
|
<?php if (Access::check(Privilege::ScorePost, Access::getIdentity($this->context->transport->post->getUploader()))): ?>
|
||||||
<?php if ($this->context->score === 1): ?>
|
<?php if ($this->context->score === 1): ?>
|
||||||
<a class="simple-action selected" href="<?= $scoreLink(0) ?>">
|
<a class="simple-action selected" href="<?= $scoreLink(0) ?>">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
@ -176,7 +176,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::FavoritePost, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader()))): ?>
|
<?php if (Access::check(Privilege::FavoritePost, Access::getIdentity($this->context->transport->post->getUploader()))): ?>
|
||||||
<div class="hl-option">
|
<div class="hl-option">
|
||||||
<?php if (!$this->context->favorite): ?>
|
<?php if (!$this->context->favorite): ?>
|
||||||
<a class="add-fav icon simple-action" href="<?= \Chibi\Router::linkTo(['PostController', 'addFavoriteAction'], ['id' => $this->context->transport->post->id]) ?>">
|
<a class="add-fav icon simple-action" href="<?= \Chibi\Router::linkTo(['PostController', 'addFavoriteAction'], ['id' => $this->context->transport->post->id]) ?>">
|
||||||
|
@ -235,7 +235,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
<?php
|
<?php
|
||||||
$options = [];
|
$options = [];
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::FeaturePost, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader())))
|
if (Access::check(Privilege::FeaturePost, Access::getIdentity($this->context->transport->post->getUploader())))
|
||||||
{
|
{
|
||||||
$options []=
|
$options []=
|
||||||
[
|
[
|
||||||
|
@ -247,7 +247,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::FlagPost, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader())))
|
if (Access::check(Privilege::FlagPost, Access::getIdentity($this->context->transport->post->getUploader())))
|
||||||
{
|
{
|
||||||
if ($this->context->flagged)
|
if ($this->context->flagged)
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::HidePost, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader())))
|
if (Access::check(Privilege::HidePost, Access::getIdentity($this->context->transport->post->getUploader())))
|
||||||
{
|
{
|
||||||
if ($this->context->transport->post->hidden)
|
if ($this->context->transport->post->hidden)
|
||||||
{
|
{
|
||||||
|
@ -292,7 +292,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::DeletePost, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->post->getUploader())))
|
if (Access::check(Privilege::DeletePost, Access::getIdentity($this->context->transport->post->getUploader())))
|
||||||
{
|
{
|
||||||
$options []=
|
$options []=
|
||||||
[
|
[
|
||||||
|
@ -338,7 +338,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::AddComment)): ?>
|
<?php if (Access::check(Privilege::AddComment)): ?>
|
||||||
<div class="unit comment-add">
|
<div class="unit comment-add">
|
||||||
<?php \Chibi\View::render('comment-add', $this->context) ?>
|
<?php \Chibi\View::render('comment-add', $this->context) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,10 +3,10 @@ Assets::setSubTitle('tags');
|
||||||
Assets::addStylesheet('tag-list.css');
|
Assets::addStylesheet('tag-list.css');
|
||||||
|
|
||||||
$tabs = [];
|
$tabs = [];
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListTags)) $tabs['list'] = ['List', 'listAction'];
|
if (Access::check(Privilege::ListTags)) $tabs['list'] = ['List', 'listAction'];
|
||||||
if (PrivilegesHelper::confirm(Privilege::RenameTags)) $tabs['rename'] = ['Rename', 'renameAction'];
|
if (Access::check(Privilege::RenameTags)) $tabs['rename'] = ['Rename', 'renameAction'];
|
||||||
if (PrivilegesHelper::confirm(Privilege::MergeTags)) $tabs['merge'] = ['Merge', 'mergeAction'];
|
if (Access::check(Privilege::MergeTags)) $tabs['merge'] = ['Merge', 'mergeAction'];
|
||||||
if (PrivilegesHelper::confirm(Privilege::MassTag)) $tabs['mass-tag-redirect'] = ['Mass tag', 'massTagRedirectAction'];
|
if (Access::check(Privilege::MassTag)) $tabs['mass-tag-redirect'] = ['Mass tag', 'massTagRedirectAction'];
|
||||||
$showTabs = count($tabs) > 1;
|
$showTabs = count($tabs) > 1;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
\Chibi\Router::linkTo(['IndexController', 'indexAction']),
|
\Chibi\Router::linkTo(['IndexController', 'indexAction']),
|
||||||
$activeController == 'index' and $activeAction == 'index');
|
$activeController == 'index' and $activeAction == 'index');
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListPosts))
|
if (Access::check(Privilege::ListPosts))
|
||||||
{
|
{
|
||||||
$registerNavItem(
|
$registerNavItem(
|
||||||
'Browse',
|
'Browse',
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
$activeController == 'post' and $activeAction != 'upload');
|
$activeController == 'post' and $activeAction != 'upload');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::UploadPost))
|
if (Access::check(Privilege::UploadPost))
|
||||||
{
|
{
|
||||||
$registerNavItem(
|
$registerNavItem(
|
||||||
'Upload',
|
'Upload',
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
$activeController == 'post' and $activeAction == 'upload');
|
$activeController == 'post' and $activeAction == 'upload');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListComments))
|
if (Access::check(Privilege::ListComments))
|
||||||
{
|
{
|
||||||
$registerNavItem(
|
$registerNavItem(
|
||||||
'Comments',
|
'Comments',
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
$activeController == 'comment');
|
$activeController == 'comment');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListTags))
|
if (Access::check(Privilege::ListTags))
|
||||||
{
|
{
|
||||||
$registerNavItem(
|
$registerNavItem(
|
||||||
'Tags',
|
'Tags',
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
$activeController == 'tag');
|
$activeController == 'tag');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListUsers))
|
if (Access::check(Privilege::ListUsers))
|
||||||
{
|
{
|
||||||
$registerNavItem(
|
$registerNavItem(
|
||||||
'Users',
|
'Users',
|
||||||
|
@ -104,11 +104,11 @@
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::ChangeUserSettings, PrivilegesHelper::getIdentitySubPrivilege($this->context->user))): ?>
|
<?php if (Access::check(Privilege::ChangeUserSettings, Access::getIdentity($this->context->user))): ?>
|
||||||
<li class="safety">
|
<li class="safety">
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach (PostSafety::getAll() as $safety): ?>
|
<?php foreach (PostSafety::getAll() as $safety): ?>
|
||||||
<?php if (PrivilegesHelper::confirm(
|
<?php if (Access::check(
|
||||||
Privilege::ListPosts,
|
Privilege::ListPosts,
|
||||||
PostSafety::toString($safety))): ?>
|
PostSafety::toString($safety))): ?>
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
<hr>
|
<hr>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(
|
<?php if (Access::check(
|
||||||
Privilege::ChangeUserName,
|
Privilege::ChangeUserName,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
|
Access::getIdentity($this->context->transport->user))): ?>
|
||||||
|
|
||||||
<div class="form-row nickname">
|
<div class="form-row nickname">
|
||||||
<label for="name">Name:</label>
|
<label for="name">Name:</label>
|
||||||
|
@ -30,9 +30,9 @@
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(
|
<?php if (Access::check(
|
||||||
Privilege::ChangeUserEmail,
|
Privilege::ChangeUserEmail,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
|
Access::getIdentity($this->context->transport->user))): ?>
|
||||||
|
|
||||||
<div class="form-row email">
|
<div class="form-row email">
|
||||||
<label for="name">E-mail:</label>
|
<label for="name">E-mail:</label>
|
||||||
|
@ -48,8 +48,8 @@
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (
|
<?php if (
|
||||||
PrivilegesHelper::confirm(Privilege::ChangeUserPassword,
|
Access::check(Privilege::ChangeUserPassword,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
|
Access::getIdentity($this->context->transport->user))): ?>
|
||||||
|
|
||||||
<div class="form-row password1">
|
<div class="form-row password1">
|
||||||
<label for="password1">New password:</label>
|
<label for="password1">New password:</label>
|
||||||
|
@ -75,9 +75,9 @@
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(
|
<?php if (Access::check(
|
||||||
Privilege::ChangeUserAccessRank,
|
Privilege::ChangeUserAccessRank,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
|
Access::getIdentity($this->context->transport->user))): ?>
|
||||||
|
|
||||||
<div class="form-row access-rank">
|
<div class="form-row access-rank">
|
||||||
<label for="access-rank">Access rank:</label>
|
<label for="access-rank">Access rank:</label>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<label>Safety:</label>
|
<label>Safety:</label>
|
||||||
<div class="input-wrapper">
|
<div class="input-wrapper">
|
||||||
<?php foreach (PostSafety::getAll() as $safety): ?>
|
<?php foreach (PostSafety::getAll() as $safety): ?>
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::ListPosts, PostSafety::toString($safety))): ?>
|
<?php if (Access::check(Privilege::ListPosts, PostSafety::toString($safety))): ?>
|
||||||
<label>
|
<label>
|
||||||
<?php
|
<?php
|
||||||
$attrs = [];
|
$attrs = [];
|
||||||
|
|
|
@ -49,9 +49,9 @@ Assets::addStylesheet('user-view.css');
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(
|
<?php if (Access::check(
|
||||||
Privilege::ViewUserEmail,
|
Privilege::ViewUserEmail,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
|
Access::getIdentity($this->context->transport->user))): ?>
|
||||||
|
|
||||||
<div class="key-value email">
|
<div class="key-value email">
|
||||||
<span class="key">E-mail:</span>
|
<span class="key">E-mail:</span>
|
||||||
|
@ -76,9 +76,9 @@ Assets::addStylesheet('user-view.css');
|
||||||
foreach (array_keys($userModificationPrivileges) as $privilege)
|
foreach (array_keys($userModificationPrivileges) as $privilege)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(
|
if (Access::check(
|
||||||
$privilege,
|
$privilege,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
|
Access::getIdentity($this->context->transport->user)))
|
||||||
{
|
{
|
||||||
$userModificationPrivileges[$privilege] = true;
|
$userModificationPrivileges[$privilege] = true;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ Assets::addStylesheet('user-view.css');
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::AcceptUserRegistration)
|
if (Access::check(Privilege::AcceptUserRegistration)
|
||||||
and !$this->context->transport->user->staffConfirmed
|
and !$this->context->transport->user->staffConfirmed
|
||||||
and getConfig()->registration->staffActivation)
|
and getConfig()->registration->staffActivation)
|
||||||
{
|
{
|
||||||
|
@ -111,9 +111,9 @@ Assets::addStylesheet('user-view.css');
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(
|
if (Access::check(
|
||||||
Privilege::FlagUser,
|
Privilege::FlagUser,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
|
Access::getIdentity($this->context->transport->user)))
|
||||||
{
|
{
|
||||||
if ($this->context->flagged)
|
if ($this->context->flagged)
|
||||||
{
|
{
|
||||||
|
@ -137,9 +137,9 @@ Assets::addStylesheet('user-view.css');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(
|
if (Access::check(
|
||||||
Privilege::BanUser,
|
Privilege::BanUser,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
|
Access::getIdentity($this->context->transport->user)))
|
||||||
{
|
{
|
||||||
if (!$this->context->transport->user->banned)
|
if (!$this->context->transport->user->banned)
|
||||||
{
|
{
|
||||||
|
@ -165,9 +165,9 @@ Assets::addStylesheet('user-view.css');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(
|
if (Access::check(
|
||||||
Privilege::DeleteUser,
|
Privilege::DeleteUser,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
|
Access::getIdentity($this->context->transport->user)))
|
||||||
{
|
{
|
||||||
$options []=
|
$options []=
|
||||||
[
|
[
|
||||||
|
@ -212,9 +212,9 @@ Assets::addStylesheet('user-view.css');
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(
|
<?php if (Access::check(
|
||||||
Privilege::ChangeUserSettings,
|
Privilege::ChangeUserSettings,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
|
Access::getIdentity($this->context->transport->user))): ?>
|
||||||
|
|
||||||
<?php if ($this->context->transport->tab == 'settings'): ?>
|
<?php if ($this->context->transport->tab == 'settings'): ?>
|
||||||
<li class="selected settings">
|
<li class="selected settings">
|
||||||
|
@ -241,9 +241,9 @@ Assets::addStylesheet('user-view.css');
|
||||||
</li>
|
</li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(
|
<?php if (Access::check(
|
||||||
Privilege::DeleteUser,
|
Privilege::DeleteUser,
|
||||||
PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user))): ?>
|
Access::getIdentity($this->context->transport->user))): ?>
|
||||||
<?php if ($this->context->transport->tab == 'delete'): ?>
|
<?php if ($this->context->transport->tab == 'delete'): ?>
|
||||||
<li class="selected delete">
|
<li class="selected delete">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
|
Loading…
Reference in a new issue