aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
Diffstat (limited to 'admin/include')
-rw-r--r--admin/include/functions.php158
1 files changed, 0 insertions, 158 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 54aa938f0..203ef37cf 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -555,164 +555,6 @@ function display_categories( $categories, $indent,
}
/**
- * Complete plain structure of the gallery
- *
- * Returns the plain structure (one level array) of the gallery. In the
- * returned array, each element is an array with jeys 'id' and
- * 'id_uppercat'. The function also fills the array $page['subcats'] which
- * associate (category_id => array of sub-categories id).
- *
- * @param bool $use_name
- * @return array
- */
-function get_plain_structure( $use_name = false )
-{
- global $page;
-
- $plain_structure = array();
-
- $query = 'SELECT id,id_uppercat';
- if ( $use_name ) $query.= ',name';
- $query.= ' FROM '.CATEGORIES_TABLE;
- $query.= ' ORDER BY id_uppercat ASC, rank ASC';
- $query.= ';';
-
- $subcats = array();
- $id_uppercat = 'NULL';
-
- $result = mysql_query( $query );
- while ( $row = mysql_fetch_array( $result ) )
- {
- $plain_structure[$row['id']]['id'] = $row['id'];
- if ( !isset( $row['id_uppercat'] ) ) $row['id_uppercat'] = 'NULL';
- $plain_structure[$row['id']]['id_uppercat'] = $row['id_uppercat'];
- if ( $use_name ) $plain_structure[$row['id']]['name'] = $row['name'];
- // subcats list
- if ( $row['id_uppercat'] != $id_uppercat )
- {
- $page['subcats'][$id_uppercat] = $subcats;
-
- $subcats = array();
- $id_uppercat = $row['id_uppercat'];
- }
- array_push( $subcats, $row['id'] );
- }
- mysql_free_result( $result );
-
- $page['subcats'][$id_uppercat] = $subcats;
-
- return $plain_structure;
-}
-
-/**
- * get N levels array representing structure under the given category
- *
- * create_structure returns the N levels array representing structure under
- * the given gategory id. It also updates the
- * $page['plain_structure'][id]['all_subcats_id'] and
- * $page['plain_structure'][id]['direct_subcats_ids'] for each sub category.
- *
- * @param int $id_uppercat
- * @return array
- */
-function create_structure( $id_uppercat )
-{
- global $page;
-
- $structure = array();
- $ids = get_subcats_ids( $id_uppercat );
- foreach ( $ids as $id ) {
- $category = $page['plain_structure'][$id];
-
- $category['subcats'] = create_structure( $id );
-
- $page['plain_structure'][$id]['all_subcats_ids'] =
- get_all_subcats_ids( $id );
-
- $page['plain_structure'][$id]['direct_subcats_ids'] =
- get_subcats_ids( $id );
-
- array_push( $structure, $category );
- }
- return $structure;
-}
-
-/**
- * returns direct sub-categories ids
- *
- * Returns an array containing all the direct sub-categories ids of the
- * given category. It uses the $page['subcats'] global array.
- *
- * @param int $id_uppercat
- * @return array
- */
-function get_subcats_ids( $id_uppercat )
-{
- global $page;
-
- if ( $id_uppercat == '' ) $id_uppercat = 'NULL';
-
- if ( isset( $page['subcats'][$id_uppercat] ) )
- return $page['subcats'][$id_uppercat];
- else
- return array();
-}
-
-/**
- * returns all sub-categories ids, not only direct ones
- *
- * Returns an array containing all the sub-categories ids of the given
- * category, not only direct ones. This function is recursive.
- *
- * @param int $category_id
- * @return array
- */
-function get_all_subcats_ids( $category_id )
-{
- $ids = array();
-
- $subcats = get_subcats_ids( $category_id );
- $ids = array_merge( $ids, $subcats );
- foreach ( $subcats as $subcat ) {
- // recursive call
- $sub_subcats = get_all_subcats_ids( $subcat );
- $ids = array_merge( $ids, $sub_subcats );
- }
- return array_unique( $ids );
-}
-
-/**
- * updates the column categories.uppercats
- *
- * @param int $category_id
- * @return void
- */
-function update_uppercats( $category_id )
-{
- global $page;
-
- $final_id = $category_id;
- $uppercats = array();
-
- array_push( $uppercats, $category_id );
- $uppercat = $page['plain_structure'][$category_id]['id_uppercat'];
-
- while ( $uppercat != 'NULL' )
- {
- array_push( $uppercats, $uppercat );
- $category_id = $page['plain_structure'][$category_id]['id_uppercat'];
- $uppercat = $page['plain_structure'][$category_id]['id_uppercat'];
- }
-
- $string_uppercats = implode( ',', array_reverse( $uppercats ) );
- $query = 'UPDATE '.CATEGORIES_TABLE;
- $query.= ' SET uppercats = '."'".$string_uppercats."'";
- $query.= ' WHERE id = '.$final_id;
- $query.= ';';
- mysql_query( $query );
-}
-
-/**
* returns an array with the ids of the restricted categories for the user
*
* Returns an array with the ids of the restricted categories for the