aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_category.inc.php
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2003-07-01 09:27:20 +0000
committerz0rglub <z0rglub@piwigo.org>2003-07-01 09:27:20 +0000
commit0ec91d8b4834d63c65dcbef6ac49ab5a8f68ddd1 (patch)
treeb21ebe1713021f8f783f10b948acdb03878d5223 /include/functions_category.inc.php
parent1080c51deb551ec63677adb842025065fa0999ba (diff)
*** empty log message ***
git-svn-id: http://piwigo.org/svn/trunk@21 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_category.inc.php')
-rw-r--r--include/functions_category.inc.php22
1 files changed, 10 insertions, 12 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 21de2ad71..de868db82 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -14,27 +14,25 @@
* the Free Software Foundation; *
* *
***************************************************************************/
+
function get_subcats_id( $cat_id )
{
- $restricted_cat = array();
- $i = 0;
+ $restricted_cats = array();
- $query = 'select id';
- $query.= ' from '.PREFIX_TABLE.'categories';
- $query.= ' where id_uppercat = '.$cat_id;
+ $query = 'SELECT id';
+ $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query.= ' WHERE id_uppercat = '.$cat_id;
$query.= ';';
$result = mysql_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
- $restricted_cat[$i++] = $row['id'];
- $sub_restricted_cat = get_subcats_id( $row['id'] );
- for ( $j = 0; $j < sizeof( $sub_restricted_cat ); $j++ )
- {
- $restricted_cat[$i++] = $sub_restricted_cat[$j];
+ array_push( $restricted_cats, $row['id'] );
+ $sub_restricted_cats = get_subcats_id( $row['id'] );
+ foreach ( $sub_restricted_cats as $sub_restricted_cat ) {
+ array_push( $restricted_cats, $sub_restricted_cat );
}
}
-
- return $restricted_cat;
+ return $restricted_cats;
}
function check_restrictions( $category_id )