diff options
author | rvelices <rv-github@modusoptimus.com> | 2007-01-11 05:10:16 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2007-01-11 05:10:16 +0000 |
commit | 7397c8d4c23533e2e33caae273da83ada3970b23 (patch) | |
tree | 570f3cfbdb659899f26d957ffeceaf0615524c37 /include/section_init.inc.php | |
parent | 2a9c48225dc8e065de71a9b077b1e935e10aa077 (diff) |
- better code in filter.inc.php (remove unused code + filter is not reseted
when going to an unfiltered page)
- removed unnecessary filtered pages from config_default (especially admin !!!)
- removed flat recent category icon from irrelevant pages
- mysterious code comment appeared in picture.php
git-svn-id: http://piwigo.org/svn/trunk@1711 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/section_init.inc.php | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/include/section_init.inc.php b/include/section_init.inc.php index 3e2e39187..cb963f3e1 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -278,7 +278,8 @@ while (isset($tokens[$i])) $page['start'] = $matches[1]; } - if (preg_match('/^flat_recent_cat-(\d+)/', $tokens[$i], $matches)) + if ('categories'==$page['section'] and + preg_match('/^flat_recent_cat-(\d+)/', $tokens[$i], $matches)) { // indicate a special list of images $page['flat_recent_cat'] = $matches[1]; @@ -326,6 +327,16 @@ if (pwg_get_session_var('image_order',0) > 0) $page['super_order_by'] = true; } +$forbidden = get_sql_condition_FandF( + array + ( + 'forbidden_categories' => 'category_id', + 'visible_categories' => 'category_id', + 'visible_images' => 'image_id' + ), + 'AND' + ); + // +-----------------------------------------------------------------------+ // | category | // +-----------------------------------------------------------------------+ @@ -401,16 +412,7 @@ WHERE CURRENT_DATE,INTERVAL '.$page['flat_recent_cat'].' DAY)'. (isset($page['category']) ? ' AND uppercats REGEXP \'(^|,)'.$page['category'].'(,|$)\'' : '' ).' -'.get_sql_condition_FandF - ( - array - ( - 'forbidden_categories' => 'category_id', - 'visible_categories' => 'category_id', - 'visible_images' => 'image_id' - ), - 'AND' - ).' +'.$forbidden.' ;'; $where_sql = array_from_query($query, 'image_id'); @@ -429,21 +431,12 @@ WHERE { // Main query $query = ' -SELECT distinct image_id +SELECT DISTINCT(image_id) FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON id = image_id WHERE '.$where_sql.' -'.get_sql_condition_FandF - ( - array - ( - 'forbidden_categories' => 'category_id', - 'visible_categories' => 'category_id', - 'visible_images' => 'image_id' - ), - 'AND' - ).' +'.$forbidden.' '.$conf['order_by'].' ;'; @@ -458,18 +451,6 @@ SELECT distinct image_id // special sections else { - $forbidden = - get_sql_condition_FandF - ( - array - ( - 'forbidden_categories' => 'category_id', - 'visible_categories' => 'category_id', - 'visible_images' => 'image_id' - ), - 'AND' - ); - // +-----------------------------------------------------------------------+ // | tags section | // +-----------------------------------------------------------------------+ |