Changeset 813 for branches/branch-1_4/include
- Timestamp:
- Aug 15, 2005, 3:05:29 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1_4/include/functions_category.inc.php
r785 r813 156 156 } 157 157 158 /** 159 * returns the total number of elements viewable in the gallery by the 160 * connected user 161 * 162 * @return int 163 */ 158 164 function count_user_total_images() 159 165 { 160 166 global $user; 161 167 162 $query = 'SELECT SUM(nb_images) AS total'; 163 $query.= ' FROM '.CATEGORIES_TABLE; 164 if ( count( $user['restrictions'] ) > 0 ) 165 $query.= ' WHERE id NOT IN ('.$user['forbidden_categories'].')'; 166 $query.= ';'; 168 $query = ' 169 SELECT COUNT(DISTINCT(image_id)) as total 170 FROM '.IMAGE_CATEGORY_TABLE; 171 if (count($user['restrictions']) > 0) 172 { 173 $query.= ' 174 WHERE category_id NOT IN ('.$user['forbidden_categories'].')'; 175 } 176 $query.= ' 177 ;'; 167 178 168 $row = mysql_fetch_array( pwg_query( $query ) ); 169 170 if ( !isset( $row['total'] ) ) $row['total'] = 0; 171 return $row['total']; 179 $row = mysql_fetch_array(pwg_query($query)); 180 181 return isset($row['total']) ? $row['total'] : 0; 172 182 } 173 183
Note: See TracChangeset
for help on using the changeset viewer.