1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-04 14:47:52 +02:00

[feature/soft-delete] Change order of functions

PHPBB3-9567
This commit is contained in:
Joas Schilling 2012-10-08 15:03:54 +02:00
parent c525e900d3
commit 91398c9e48

View File

@ -22,6 +22,30 @@ if (!defined('IN_PHPBB'))
*/ */
class phpbb_content_visibility class phpbb_content_visibility
{ {
/**
* Can the current logged-in user soft-delete posts?
*
* @param $forum_id int Forum ID whose permissions to check
* @param $poster_id int Poster ID of the post in question
* @param $post_locked bool Is the post locked?
* @return bool
*/
static function can_soft_delete($forum_id, $poster_id, $post_locked)
{
global $auth, $user;
if ($auth->acl_get('m_softdelete', $forum_id))
{
return true;
}
else if ($auth->acl_get('f_softdelete', $forum_id) && $poster_id == $user->data['user_id'] && !$post_locked)
{
return true;
}
return false;
}
/** /**
* Create topic/post visibility SQL for a given forum ID * Create topic/post visibility SQL for a given forum ID
* *
@ -207,7 +231,7 @@ class phpbb_content_visibility
} }
/** /**
* Change visibility status of one post or a hole topic * Change visibility status of one post or all posts of a topic
* *
* @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED} * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED}
* @param $post_id mixed Post ID or array of post IDs to act on, * @param $post_id mixed Post ID or array of post IDs to act on,
@ -298,30 +322,6 @@ class phpbb_content_visibility
} }
} }
/**
* Can the current logged-in user soft-delete posts?
*
* @param $forum_id int Forum ID whose permissions to check
* @param $poster_id int Poster ID of the post in question
* @param $post_locked bool Is the post locked?
* @return bool
*/
static function can_soft_delete($forum_id, $poster_id, $post_locked)
{
global $auth, $user;
if ($auth->acl_get('m_softdelete', $forum_id))
{
return true;
}
else if ($auth->acl_get('f_softdelete', $forum_id) && $poster_id == $user->data['user_id'] && !$post_locked)
{
return true;
}
return false;
}
/** /**
* Remove topic from forum statistics * Remove topic from forum statistics
* *