1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
<?php
/**
* @version $Header: /cvsroot/bitweaver/_bit_fisheye/edit_gallery_perms.php,v 1.5 2008/06/25 22:21:09 spiderr Exp $
* @package fisheye
* @subpackage functions
*/
/**
* required setup
*/
require_once( '../bit_setup_inc.php' );
require_once( FISHEYE_PKG_PATH.'FisheyeGallery.php');
require_once( FISHEYE_PKG_PATH.'FisheyeImage.php');
global $gBitSystem, $fisheyePermNameMap;
// Make sure an gallery has been specified
if (empty($_REQUEST['gallery_id'])) {
$gBitSmarty->assign('msg', tra("No gallery specified"));
$gBitSystem->display( "error.tpl" , NULL, array( 'display_mode' => 'edit' ));
die;
}
include_once( FISHEYE_PKG_PATH.'gallery_lookup_inc.php' );
if (empty($gContent->mContentId)) {
$gBitSmarty->assign( 'msg', tra( "The specified gallery does not exist" ));
$gBitSystem->display("error.tpl", NULL, array( 'display_mode' => 'edit' ));
die;
} elseif ($gContent->mInfo['user_id'] != $gBitUser->mUserId && $gContent->mInfo['perm_level'] < FISHEYE_PERM_ADMIN) {
// This user does not own this gallery and they have not been granted the permission to edit user permissions for this gallery
$gBitSmarty->assign( 'msg', tra( "You cannot edit this image gallery" ) );
$gBitSystem->display( "error.tpl" , NULL, array( 'display_mode' => 'edit' ));
die;
}
if (!empty($_REQUEST['submitNewPermissions'])) {
$gContent->grantUserPermissions($_REQUEST['new_perm_user_id'], $_REQUEST['new_perm_level']);
$fisheyeSuccess[] = $_REQUEST['found_username']." given ".$fisheyePermNameMap[$_REQUEST['name_perm_level']]." permissions";
}elseif (!empty($_REQUEST['remove_perm_user_id'])) {
$gContent->revokeUserPermission($_REQUEST['remove_perm_user_id']);
$fisheyeSuccess[] = tra("User permissions successfully revoked");
}
$userPerms = $gContent->loadPermissions();
$gBitSmarty->assign_by_ref('userPerms', $gContent->mPerms);
if (!empty($_REQUEST['submitUpdatePerms'])) {
$existingPerms = $_REQUEST['existingPerms'];
foreach ($userPerms as $userPerm) {
if ($existingPerms[$userPerm['user_id']]['perm_level'] != $userPerm['perm_level']) {
// Permisson level for this user has been altered
$gContent->grantUserPermissions($userPerm['user_id'], $existingPerms[$userPerm['user_id']]);
$fisheyeSuccess[] = $userPerm['real_name']." given ".$fisheyePermNameMap[$existingPerms[$userPerm['user_id']]]." permissions.";
}
}
$userPerms = $gContent->getAllUserPermissions();
}
$gBitSystem->display('bitpackage:fisheye/edit_gallery_perms.tpl', NULL, array( 'display_mode' => 'edit' ));
?>
|