aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_category.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions_category.inc.php')
-rw-r--r--include/functions_category.inc.php87
1 files changed, 0 insertions, 87 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 330137d6d..d46ddc104 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -828,93 +828,6 @@ SELECT COUNT(1) AS count
pwg_debug( 'end initialize_category' );
}
-// get_non_empty_subcat_ids returns an array with sub-categories id
-// associated with their first non empty category id.
-//
-// example :
-//
-// - catname [cat_id]
-// - cat1 [1] -> given uppercat
-// - cat1.1 [12] (empty)
-// - cat1.1.1 [5] (empty)
-// - cat1.1.2 [6]
-// - cat1.2 [3]
-// - cat1.3 [4]
-//
-// get_non_empty_sub_cat_ids will return :
-// $ids[12] = 6;
-// $ids[3] = 3;
-// $ids[4] = 4;
-function get_non_empty_subcat_ids( $id_uppercat )
-{
- global $user;
-
- $ids = array();
-
- $query = 'SELECT id,nb_images';
- $query.= ' FROM '.CATEGORIES_TABLE;
- $query.= ' WHERE id_uppercat ';
- if ( !is_numeric( $id_uppercat ) ) $query.= 'is NULL';
- else $query.= '= '.$id_uppercat;
- // we must not show pictures of a forbidden category
- if ( $user['forbidden_categories'] != '' )
- {
- $query.= ' AND id NOT IN ('.$user['forbidden_categories'].')';
- }
- $query.= ' ORDER BY rank';
- $query.= ';';
-
- $result = pwg_query( $query );
- while ( $row = mysql_fetch_array( $result ) )
- {
- // only categories with findable picture in any of its subcats is
- // represented.
- if ( ( $row['nb_images'] != 0 and $non_empty_cat = $row['id'] )
- or $non_empty_cat = get_first_non_empty_cat_id( $row['id'] ) )
- {
- $ids[$row['id']] = $non_empty_cat;
- }
- }
- return $ids;
-}
-
-// get_first_non_empty_cat_id returns the id of the first non empty
-// sub-category to the given uppercat. If no picture is found in any
-// subcategory, false is returned.
-function get_first_non_empty_cat_id( $id_uppercat )
-{
- global $user;
-
- $query = 'SELECT id,nb_images';
- $query.= ' FROM '.CATEGORIES_TABLE;
- $query.= ' WHERE id_uppercat = '.$id_uppercat;
- // we must not show pictures of a forbidden category
- if ( $user['forbidden_categories'] != '' )
- {
- $query.= ' AND id NOT IN ('.$user['forbidden_categories'].')';
- }
- $query.= ' ORDER BY RAND()';
- $query.= ';';
- $result = pwg_query( $query );
- while ( $row = mysql_fetch_array( $result ) )
- {
- if ( $row['nb_images'] > 0 )
- {
- return $row['id'];
- }
- }
- $result = pwg_query( $query );
- while ( $row = mysql_fetch_array( $result ) )
- {
- // recursive call
- if ( $subcat = get_first_non_empty_cat_id( $row['id'] ) )
- {
- return $subcat;
- }
- }
- return false;
-}
-
function display_select_categories($categories,
$indent,
$selecteds,