Cheetah
callback.php
Go to the documentation of this file.
1 <?php
2 
13 $aPathInfo = pathinfo(__FILE__);
14 require_once ($aPathInfo['dirname'] . '/../base/callback.php');
15 
17 
18 $f->getUserPerm = 'getUserPermEvents';
19 
20 function getUserPermEvents ($sUser, $sType, $sAction, $iForumId)
21 {
23 
24  $aPerm = ChWsbService::call('events', 'get_forum_permission', array ($iMemberId, $iForumId));
25  $isOrcaAdmin = $aPerm['admin'];
26 
27  $isLoggedIn = $iMemberId || $isOrcaAdmin ? 1 : 0;
28 
29  $isPublicForumReadAllowed = $aPerm['read'];
30  $isPublicForumPostAllowed = $isLoggedIn && $aPerm['post'];
31  $isPrivateForumReadAllowed = $isPublicForumReadAllowed;
32  $isPrivateForumPostAllowed = $isPublicForumPostAllowed;
33  $isEditAllAllowed = false;
34  $isDelAllAllowed = false;
35 
36  return array (
37  'read_public' => $isOrcaAdmin || $isPublicForumReadAllowed,
38  'post_public' => $isOrcaAdmin || $isPublicForumPostAllowed ? 1 : 0,
39  'edit_public' => $isOrcaAdmin || $isEditAllAllowed ? 1 : 0,
40  'del_public' => $isOrcaAdmin || $isEditAllAllowed ? 1 : 0,
41 
42  'read_private' => $isOrcaAdmin || $isPrivateForumReadAllowed ? 1 : 0,
43  'post_private' => $isOrcaAdmin || $isPrivateForumPostAllowed ? 1 : 0,
44  'edit_private' => $isOrcaAdmin || $isEditAllAllowed ? 1 : 0,
45  'del_private' => $isOrcaAdmin || $isDelAllAllowed ? 1 : 0,
46 
47  'edit_own' => 1,
48  'del_own' => 1,
49 
50  'download_' => $isOrcaAdmin || $isPublicForumReadAllowed ? 1 : 0,
51  'search_' => 0,
52  'sticky_' => $isOrcaAdmin,
53 
54  'del_topics_' => $isOrcaAdmin || $isEditAllAllowed ? 1 : 0,
55  'move_topics_' => isAdmin() ? 1 : 0,
56  'hide_topics_' => $isOrcaAdmin || $isEditAllAllowed ? 1 : 0,
57  'unhide_topics_' => $isOrcaAdmin || $isEditAllAllowed ? 1 : 0,
58  'hide_posts_' => $isOrcaAdmin || $isEditAllAllowed ? 1 : 0,
59  'unhide_posts_' => $isOrcaAdmin || $isEditAllAllowed ? 1 : 0,
60  );
61 }
getUserPermEvents
getUserPermEvents($sUser, $sType, $sAction, $iForumId)
Definition: callback.php:20
$iMemberId
$iMemberId
Definition: profile.php:91
$f
global $f
Definition: callback.php:13
php
isAdmin
isAdmin()
Definition: index.php:649
$sType
$sType
Definition: actions.inc.php:11
getLoggedId
getLoggedId()
Definition: profiles.inc.php:32
$aPathInfo
$aPathInfo
Definition: callback.php:13
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
$sAction
$sAction
Definition: categories.php:274
ChWsbService\call
static call($mixed, $sMethod, $aParams=array(), $sClass='Module')
Definition: ChWsbService.php:32
$sUser
$sUser
Definition: r.php:13