Piwigo / piwigo-openstreetmap

OpenStreetMap integration for Piwigo
http://piwigo.org/ext/extension_view.php?eid=701
GNU General Public License v3.0
35 stars 35 forks source link

use a default category #219

Open vincedchart opened 1 year ago

vincedchart commented 1 year ago

Please help me hardcode variable category=35 by default using !isset

I need to hide all categories by default besides category 35.

here an example url point to category familie https://nissennetz.de/galerie/osmmap.php?/category/familie&v=2

Thanks by avance

Relevant code from include/functions_map.php should be:

function osm_get_items($page) { // Limit search by category, by tag, by smartalbum $LIMIT_SEARCH=""; $INNER_JOIN=""; if (isset($page['section'])) { if ($page['section'] === 'categories' and isset($page['category']) and isset($page['category']['id']) ) { $LIMIT_SEARCH = "FIND_IN_SET(".$page['category']['id'].", c.uppercats) AND "; $INNER_JOIN = "INNER JOIN ".CATEGORIES_TABLE." AS c ON ic.category_id = c.id"; } if ($page['section'] === 'tags' and isset($page['tags']) and isset($page['tags'][0]['id']) ) { $items = get_image_ids_for_tags( array_reduce( $page['tags'], 'osm_get_page_tag_id' ) ); if ( !empty($items) ) { $LIMIT_SEARCH = "ic.image_id IN (".implode(',', $items).") AND "; } } if ($page['section'] === 'tags' and isset($page['category']) and isset($page['category']['id']) ) { $LIMIT_SEARCH = "FIND_IN_SET(".$page['category']['id'].", c.uppercats) AND "; $INNER_JOIN = "INNER JOIN ".CATEGORIES_TABLE." AS c ON ic.category_id = c.id"; } }

$forbidden = get_sql_condition_FandF( array ( 'forbidden_categories' => 'ic.category_id', 'visible_categories' => 'ic.category_id', 'visible_images' => 'i.id' ), "\n AND" );