Changeset 9444 for extensions
- Timestamp:
- Mar 1, 2011, 11:09:35 AM (14 years ago)
- Location:
- extensions/community
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/community/include/functions_community.inc.php
r9376 r9444 26 26 global $conf; 27 27 28 if (is_admin()) 29 { 30 return array( 31 'upload_whole_gallery' => true, 32 'create_whole_gallery' => true, 33 'create_categories' => array(), 34 'upload_categories' => array(), 35 'permission_ids' => array(), 36 ); 37 } 38 28 39 $return = array( 29 40 'upload_whole_gallery' => false, … … 33 44 'permission_ids' => array(), 34 45 ); 35 36 $user_permissions = array();37 46 38 47 // what are the user groups? … … 96 105 } 97 106 98 if (!$return['upload_whole_gallery'] )107 if (!$return['upload_whole_gallery'] and count($return['upload_categories']) > 0) 99 108 { 100 109 $return['upload_categories'] = get_subcat_ids($return['upload_categories']); -
extensions/community/main.inc.php
r9372 r9444 20 20 define('COMMUNITY_PERMISSIONS_TABLE', $prefixeTable.'community_permissions'); 21 21 define('COMMUNITY_PENDINGS_TABLE', $prefixeTable.'community_pendings'); 22 23 include_once(COMMUNITY_PATH.'include/functions_community.inc.php'); 22 24 23 25 /* Plugin admin */ … … 66 68 // conditional : depending on community permissions, display the "Add 67 69 // photos" link in the gallery menu 70 $user_permissions = community_get_user_permissions($user['id']); 68 71 69 // admins are not concerned about community permissions 70 if (!is_admin()) 72 if (!$user_permissions['upload_whole_gallery'] and count($user_permissions['upload_categories']) == 0) 71 73 { 72 // what are the user groups? 73 $query = ' 74 SELECT 75 group_id 76 FROM '.USER_GROUP_TABLE.' 77 WHERE user_id = '.$user['id'].' 78 ;'; 79 $user_group_ids = array_from_query($query, 'group_id'); 80 81 $query = ' 82 SELECT 83 COUNT(*) 84 FROM '.COMMUNITY_PERMISSIONS_TABLE.' 85 WHERE (type = \'any_visitor\')'; 86 87 if ($user['id'] != $conf['guest_id']) 88 { 89 $query.= ' 90 OR (type = \'any_registered_user\') 91 OR (type = \'user\' AND user_id = '.$user['id'].') 92 OR (type = \'group\' AND group_id IN ('.implode(',', $user_group_ids).')) 93 '; 94 } 95 96 $query.= ' 97 ;'; 98 99 list($counter) = pwg_db_fetch_row(pwg_query($query)); 100 if (0 == $counter) 101 { 102 return; 103 } 74 return; 104 75 } 105 76
Note: See TracChangeset
for help on using the changeset viewer.