Changeset 12154 for extensions/ExtendedDescription/main.inc.php
- Timestamp:
- Sep 13, 2011, 10:51:56 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ExtendedDescription/main.inc.php
r10754 r12154 118 118 $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_img_thumb("$1", "$2", "$3")'; 119 119 120 // [random album=xx] 121 $patterns[] = '#\[random\s+(?:album|cat)=\s*?(\d+)\s*?\]#ie'; 122 $replacements[] = 'extdesc_get_random_photo("$1")'; 120 123 121 124 // Balises <!--complete-->, <!--more--> et <!--up-down--> … … 347 350 348 351 352 function extdesc_get_random_photo($category_id) 353 { 354 $query = ' 355 SELECT 356 path 357 FROM '.IMAGES_TABLE.' 358 JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id 359 WHERE category_id = '.$category_id.' 360 ORDER BY '.DB_RANDOM_FUNCTION.'() 361 LIMIT 1 362 ;'; 363 $result = pwg_query($query); 364 while ($row = pwg_db_fetch_assoc($result)) 365 { 366 return '<img src="'.$row['path'].'">'; 367 } 368 369 return ''; 370 } 371 349 372 if (script_basename() == 'admin' or script_basename() == 'popuphelp') 350 373 {
Note: See TracChangeset
for help on using the changeset viewer.