From f33fdc91b2a5cb4ce0681df52b37ca5781660503 Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 4 Apr 2006 00:35:12 +0000 Subject: fix: sql query erros when: no items for the selected tag, search returns no result, caddie is empty fix: tag cloud was showing least used tags fix: strip html tags from head/title element on the page (tag index page title contained ...) improvement: added 5 tag levels in css for "ready to use" tags fix: corrected png icon calendar_created.png for IE fix: english language for nbm git-svn-id: http://piwigo.org/svn/trunk@1120 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/section_init.inc.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'include/section_init.inc.php') diff --git a/include/section_init.inc.php b/include/section_init.inc.php index e2ed07b42..176ebf0f0 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -161,7 +161,7 @@ else if (0 === strpos($tokens[$next_token], 'tag')) break; } } - + array_push( $page['tags'], array( @@ -305,7 +305,7 @@ if ('categories' == $page['section']) 'cat_id_uppercat' => $result['id_uppercat'], 'uppercats' => $result['uppercats'], - 'title' => get_cat_display_name($result['name'], null, false), + 'title' => get_cat_display_name($result['name'], '', false), ) ); @@ -360,7 +360,7 @@ else // permissions depends on category, so to only keep images that are // reachable to the connected user, we need to check category // associations - if (!empty($user['forbidden_categories'])) + if (!empty($user['forbidden_categories']) and !empty($items) ) { $query = ' SELECT image_id @@ -381,7 +381,7 @@ SELECT name, url_name, id ;'; $result = pwg_query($query); $tag_infos = array(); - + while ($row = mysql_fetch_array($result)) { $tag_infos[ $row['id'] ]['name'] = $row['name']; @@ -428,20 +428,28 @@ SELECT name, url_name, id { include_once( PHPWG_ROOT_PATH .'include/functions_search.inc.php' ); - $query = ' + $search_items = get_search_items($page['search']); + if ( !empty($search_items) ) + { + $query = ' SELECT DISTINCT(id) FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id - WHERE id IN ('.implode(',', get_search_items($page['search'])).') + WHERE id IN ('.implode(',', $search_items).') AND '.$forbidden.' '.$conf['order_by'].' -;'; +;'; + $page['items'] = array_from_query($query, 'id'); + } + else + { + $page['items'] = array(); + } $page = array_merge( $page, array( 'title' => $lang['search_result'], - 'items' => array_from_query($query, 'id'), 'thumbnails_include' => 'include/category_default.inc.php', ) ); -- cgit v1.2.3