- Timestamp:
- Jun 4, 2013, 12:55:59 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/community/include/functions_community.inc.php
r10770 r23037 52 52 'upload_categories' => array(), 53 53 'permission_ids' => array(), 54 'nb_photos' => 0, 55 'storage' => 0, 54 56 ); 55 57 … … 68 70 category_id, 69 71 recursive, 70 create_subcategories 72 create_subcategories, 73 nb_photos, 74 storage 71 75 FROM '.COMMUNITY_PERMISSIONS_TABLE.' 72 76 WHERE (type = \'any_visitor\')'; … … 120 124 } 121 125 } 126 127 if ($return['nb_photos'] != -1) 128 { 129 if (empty($row['nb_photos']) or -1 == $row['nb_photos']) 130 { 131 // that means "no limit" 132 $return['nb_photos'] = -1; 133 } 134 elseif ($row['nb_photos'] > $return['nb_photos']) 135 { 136 $return['nb_photos'] = $row['nb_photos']; 137 } 138 } 139 140 if ($return['storage'] != -1) 141 { 142 if (empty($row['storage']) or -1 == $row['storage']) 143 { 144 // that means "no limit" 145 $return['storage'] = -1; 146 } 147 elseif ($row['storage'] > $return['storage']) 148 { 149 $return['storage'] = $row['storage']; 150 } 151 } 122 152 } 123 153 … … 126 156 $return ['upload_whole_gallery'] = true; 127 157 $return ['create_whole_gallery'] = true; 158 $return['nb_photos'] = -1; 159 $return['storage'] = -1; 128 160 } 129 161 … … 270 302 } 271 303 } 304 305 function community_get_user_limits($user_id) 306 { 307 // how many photos and storage for this user? 308 $query = ' 309 SELECT 310 COUNT(id) AS nb_photos, 311 IFNULL(FLOOR(SUM(filesize)/1024), 0) AS storage 312 FROM '.IMAGES_TABLE.' 313 WHERE added_by = '.$user_id.' 314 ;'; 315 return pwg_db_fetch_assoc(pwg_query($query)); 316 } 272 317 ?>
Note: See TracChangeset
for help on using the changeset viewer.