aboutsummaryrefslogtreecommitdiffstats
path: root/include/category_cats.inc.php
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2012-09-23 11:19:26 +0000
committermistic100 <mistic@piwigo.org>2012-09-23 11:19:26 +0000
commit4e65d9af4667f3d8556522843f776f1fa074ea21 (patch)
treeea39e514f64b1cea7cd8df375eae4f1fc38e3682 /include/category_cats.inc.php
parent7e33b84e770ddab61ef1d5c67061cd41c189f20e (diff)
feature 2614: pagination on albums
git-svn-id: http://piwigo.org/svn/trunk@18165 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/category_cats.inc.php')
-rw-r--r--include/category_cats.inc.php38
1 files changed, 15 insertions, 23 deletions
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php
index c8b728e5a..b09f4eaec 100644
--- a/include/category_cats.inc.php
+++ b/include/category_cats.inc.php
@@ -22,11 +22,19 @@
// +-----------------------------------------------------------------------+
/**
- * This file is included by the main page to show thumbnails for a category
- * that have only subcategories or to show recent categories
+ * This file is included by the main page to show subcategories of a category
+ * or to show recent categories or main page categories list
*
*/
+$selection = array_slice(
+ $page['categories'],
+ $page['starta'],
+ $conf['nb_categories_page']
+ );
+
+$selection = trigger_event('loc_index_categories_selection', $selection);
+
// $user['forbidden_categories'] including with USER_CACHE_CATEGORIES_TABLE
$query = '
SELECT
@@ -38,27 +46,11 @@ SELECT
count_images,
count_categories
FROM '.CATEGORIES_TABLE.' c
- INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ucc ON id = cat_id AND user_id = '.$user['id'];
-
-if ('recent_cats' == $page['section'])
-{
- $query.= '
- WHERE date_last >= '.pwg_db_get_recent_period_expression($user['recent_period']);
-}
-else
-{
- $query.= '
- WHERE id_uppercat '.(!isset($page['category']) ? 'is NULL' : '= '.$page['category']['id']);
-}
-
-$query.= '
- '.get_sql_condition_FandF(
- array(
- 'visible_categories' => 'id',
- ),
- 'AND'
- );
-
+ INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ucc
+ ON id = cat_id
+ AND user_id = '.$user['id'].'
+ WHERE c.id IN('.implode(',', $selection).')';
+
if ('recent_cats' != $page['section'])
{
$query.= '