Changeset 16119
- Timestamp:
- Jun 28, 2012, 2:03:23 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ExtendedDescription/main.inc.php
r12554 r16119 247 247 global $template, $user; 248 248 249 $query = 'SELECT 250 cat.id, cat.name, cat.comment, cat.representative_picture_id, cat.permalink, uc.nb_images, uc.count_images, uc.count_categories, img.path, img.tn_ext 249 $query = ' 250 SELECT 251 cat.id, 252 cat.name, 253 cat.comment, 254 cat.representative_picture_id, 255 cat.permalink, 256 uc.nb_images, 257 uc.count_images, 258 uc.count_categories, 259 img.path 251 260 FROM ' . CATEGORIES_TABLE . ' AS cat 252 INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' as uc253 ON cat.id = uc.cat_id ANDuser_id = '.$user['id'].'254 INNER JOIN ' . IMAGES_TABLE . ' AS img255 ON img.id = uc.user_representative_picture_id261 INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' as uc 262 ON cat.id = uc.cat_id AND uc.user_id = '.$user['id'].' 263 INNER JOIN ' . IMAGES_TABLE . ' AS img 264 ON img.id = uc.user_representative_picture_id 256 265 WHERE cat.id = ' . $elem_id . ';'; 257 266 $result = pwg_query($query); … … 264 273 array( 265 274 'ID' => $category['id'], 266 'TN_SRC' => get_thumbnail_url($category), 275 'TN_SRC' => DerivativeImage::thumb_url(array( 276 'id' => $category['representative_picture_id'], 277 'path' => $category['path'], 278 )), 267 279 'TN_ALT' => strip_tags($category['name']), 268 280 'URL' => make_index_url(array('category' => $category)), … … 304 316 { 305 317 list($a,$b)=array_pad(explode(".",$val),2,""); 306 $assoc[0][]=$a; 307 $assoc[1][]=$b; 308 } 309 310 $query = 'SELECT * FROM ' . IMAGES_TABLE . ' WHERE id in (' . implode(",",$assoc[0]). ');'; 318 $assoc[$a] = $b; 319 } 320 321 $query = 'SELECT * FROM ' . IMAGES_TABLE . ' WHERE id in (' . implode(',', array_keys($assoc)) . ');'; 311 322 $result = pwg_query($query); 312 323 … … 322 333 323 334 $img=array(); 324 for ($i=0;$i<count($assoc[0]);$i++)325 { 326 if (!empty($assoc[ 1][$i]))335 foreach ($imglist as $id => $picture) 336 { 337 if (!empty($assoc[$id])) 327 338 { 328 339 $url = make_picture_url(array( 329 'image_id' => $ imglist[$assoc[0][$i]]['id'],340 'image_id' => $picture['id'], 330 341 'category' => array( 331 'id' => $assoc[ 1][$i],342 'id' => $assoc[$id], 332 343 'name' => '', 333 344 'permalink' => ''))); … … 335 346 else 336 347 { 337 $url = make_picture_url(array('image_id' => $ imglist[$assoc[0][$i]]['id']));348 $url = make_picture_url(array('image_id' => $picture['id'])); 338 349 } 339 350 340 351 $img[]=array( 341 'ID' => $ imglist[$assoc[0][$i]]['id'],342 'IMAGE' => get_thumbnail_url($imglist[$assoc[0][$i]]),343 'IMAGE_ALT' => $ imglist[$assoc[0][$i]]['file'],344 'IMG_TITLE' => ($name=="titleName")?htmlspecialchars($ imglist[$assoc[0][$i]]['name'], ENT_QUOTES):get_thumbnail_title($imglist[$assoc[0][$i]]),352 'ID' => $picture['id'], 353 'IMAGE' => DerivativeImage::thumb_url($picture), 354 'IMAGE_ALT' => $picture['file'], 355 'IMG_TITLE' => ($name=="titleName")?htmlspecialchars($picture['name'], ENT_QUOTES):get_thumbnail_title($picture, $picture['name'], null), 345 356 'U_IMG_LINK' => $url, 346 'LEGEND' => ($name=="name")?$imglist[$assoc[0][$i]]['name']:"",347 ' FLOAT' => !empty($align) ? 'float: ' . $align . ';' : '',348 'COMMENT' => $imglist[$assoc[0][$i]]['file']);349 350 351 }352 $template->assign('img', $img);357 'LEGEND' => ($name=="name")?$picture['name']:"", 358 'COMMENT' => $picture['file'], 359 ); 360 } 361 362 $template->assign('img', $img); 363 $template->assign('FLOAT', !empty($align) ? 'float: ' . $align . ';' : ''); 353 364 return $template->parse('extended_description_content', true); 354 365 }
Note: See TracChangeset
for help on using the changeset viewer.