Changeset 1639 for trunk/feed.php
- Timestamp:
- Dec 7, 2006, 4:49:20 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/feed.php
r1637 r1639 189 189 } 190 190 191 // build items for last images/albums 192 $query = ' 193 SELECT date_available, 194 COUNT(DISTINCT id) nb_images, 195 COUNT(DISTINCT category_id) nb_cats 196 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id 197 WHERE category_id NOT IN ('.$user['forbidden_categories'].') 198 GROUP BY date_available 199 ORDER BY date_available DESC 200 LIMIT 0,5 201 ;'; 202 $result = pwg_query($query); 203 $dates = array(); 204 while ($row = mysql_fetch_assoc($result)) 205 { 206 array_push($dates, $row); 207 } 191 $dates = get_recent_post_dates( 5, 6, 6); 208 192 209 193 foreach($dates as $date_detail) … … 212 196 $exploded_date = explode_mysqldt($date); 213 197 $item = new FeedItem(); 214 $item->title = l10n_dec('%d element added', '%d elements added', $date_detail['nb_ images']);198 $item->title = l10n_dec('%d element added', '%d elements added', $date_detail['nb_elements']); 215 199 $item->title .= ' ('.$lang['month'][(int)$exploded_date['month']].' '.$exploded_date['day'].')'; 216 200 $item->link = make_index_url( … … 228 212 $item->description .= 229 213 '<li>' 230 .l10n_dec('%d element added', '%d elements added', $date_detail['nb_ images'])214 .l10n_dec('%d element added', '%d elements added', $date_detail['nb_elements']) 231 215 .' (' 232 216 .'<a href="'.make_index_url(array('section'=>'recent_pics')).'">' … … 235 219 .'</li>'; 236 220 237 // get some thumbnails ... 238 $query = ' 239 SELECT DISTINCT id, path, name, tn_ext 240 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id 241 WHERE category_id NOT IN ('.$user['forbidden_categories'].') 242 AND date_available="'.$date.'" 243 AND tn_ext IS NOT NULL 244 LIMIT 0,6 245 ;'; 246 $result = pwg_query($query); 247 while ($row = mysql_fetch_assoc($result)) 221 foreach( $date_detail['elements'] as $element ) 248 222 { 249 $tn_src = get_thumbnail_url($ row);223 $tn_src = get_thumbnail_url($element); 250 224 $item->description .= '<img src="'.$tn_src.'"/>'; 251 225 } 252 226 $item->description .= '...<br/>'; 253 227 254 255 228 $item->description .= 256 229 '<li>' 257 .l10n_dec('%d category updated', '%d categories updated', 230 .l10n_dec('%d category updated', '%d categories updated', 258 231 $date_detail['nb_cats']) 259 232 .'</li>'; 260 // get some categories ... 261 $query = ' 262 SELECT DISTINCT c.uppercats, COUNT(DISTINCT i.id) img_count 263 FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON i.id=image_id 264 INNER JOIN '.CATEGORIES_TABLE.' c ON c.id=category_id 265 WHERE category_id NOT IN ('.$user['forbidden_categories'].') 266 AND date_available="'.$date.'" 267 GROUP BY category_id 268 ORDER BY img_count DESC 269 LIMIT 0,6 270 ;'; 271 $result = pwg_query($query); 233 272 234 $item->description .= '<ul>'; 273 while ($row = mysql_fetch_array($result))235 foreach( $date_detail['categories'] as $cat ) 274 236 { 275 237 $item->description .= 276 238 '<li>' 277 .get_cat_display_name_cache($ row['uppercats'])239 .get_cat_display_name_cache($cat['uppercats']) 278 240 .' ('. 279 l10n_dec('%d element added', 280 '%d elements added', $ row['img_count']).')'241 l10n_dec('%d element added', 242 '%d elements added', $cat['img_count']).')' 281 243 .'</li>'; 282 244 }
Note: See TracChangeset
for help on using the changeset viewer.