Changeset 11486


Ignore:
Timestamp:
Jun 22, 2011, 6:00:56 PM (9 years ago)
Author:
mistic100
Message:

merge r11481 from trunk
feature:2358 allow non-recursive mode for get_random_image_in_category

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/include/functions_category.inc.php

    r11152 r11486  
    502502 * we need $category['uppercats'], $category['id'], $category['count_images']
    503503 */
    504 function get_random_image_in_category($category)
     504function get_random_image_in_category($category, $recursive=true)
    505505{
    506506  $image_id = null;
     
    511511  FROM '.CATEGORIES_TABLE.' AS c
    512512    INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.category_id = c.id
    513   WHERE (c.id='.$category['id'].' OR uppercats LIKE \''.$category['uppercats'].',%\')'
    514     .get_sql_condition_FandF
     513  WHERE ';
     514    if ($recursive)
     515    {
     516      $query.= '
     517    (c.id='.$category['id'].' OR uppercats LIKE \''.$category['uppercats'].',%\')';
     518    }
     519    else
     520    {
     521      $query.= '
     522    c.id='.$category['id'];
     523    }
     524    $query.= '
     525    '.get_sql_condition_FandF
    515526    (
    516527      array
Note: See TracChangeset for help on using the changeset viewer.