Feature Issue ID 0000601: Filter all public pages with only recent elements

It's a finalized version.
Obsolete code of draft are removed.

You can filter categories and images with recent date period on your screen selection.
In the future, filter could be easy done on other type data (plugin?)

You can flat categories and sub-categories with a recent date period of your choice.

Next, perhaps, a panel to choice recent date for the 2 features.

On draft, there have problem with MySql 5, be careful!

Css problem not resolved:
  - Menu "Categories" is bad centered
  - Icon on dark too on the top


git-svn-id: http://piwigo.org/svn/trunk@1677 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rub 2006-12-21 21:38:20 +00:00
commit cab8f98c4a
40 changed files with 889 additions and 344 deletions

View file

@ -81,12 +81,14 @@ if ( empty($element_info) )
do_error(404, 'Requested id not found'); do_error(404, 'Requested id not found');
} }
// $filter['visible_categories'] and $filter['visible_images']
// are not used because it's not necessary (filter <> restriction)
$query=' $query='
SELECT id FROM '.CATEGORIES_TABLE.' SELECT id FROM '.CATEGORIES_TABLE.'
INNER JOIN '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.'
ON category_id=id ON category_id=id
WHERE image_id='.$id.' WHERE image_id='.$id.'
AND category_id NOT IN ('.$user['forbidden_categories'].') .'get_sql_condition_FandF(array('forbidden_categories' => 'category_id'), 'AND').'
LIMIT 1 LIMIT 1
;'; ;';
if ( mysql_num_rows(pwg_query($query))<1 ) if ( mysql_num_rows(pwg_query($query))<1 )

View file

@ -216,13 +216,16 @@ $template->assign_block_vars(
$query = ' $query = '
SELECT id,name,uppercats,global_rank SELECT id,name,uppercats,global_rank
FROM '.CATEGORIES_TABLE; FROM '.CATEGORIES_TABLE.'
if ($user['forbidden_categories'] != '') '.get_sql_condition_FandF
{ (
$query.= ' array
WHERE id NOT IN ('.$user['forbidden_categories'].')'; (
} 'forbidden_categories' => 'id',
$query.= ' 'visible_categories' => 'id'
),
'WHERE'
).'
;'; ;';
display_select_cat_wrapper($query, array(@$_GET['cat']), $blockname, true); display_select_cat_wrapper($query, array(@$_GET['cat']), $blockname, true);
@ -308,13 +311,17 @@ SELECT COUNT(DISTINCT(id))
AND '.$page['cat_clause'].' AND '.$page['cat_clause'].'
AND '.$page['author_clause'].' AND '.$page['author_clause'].'
AND '.$page['keyword_clause'].' AND '.$page['keyword_clause'].'
AND '.$page['status_clause']; AND '.$page['status_clause'].'
if ($user['forbidden_categories'] != '') '.get_sql_condition_FandF
{ (
$query.= ' array
AND category_id NOT IN ('.$user['forbidden_categories'].')'; (
} 'forbidden_categories' => 'category_id',
$query.= ' 'visible_categories' => 'category_id',
'visible_images' => 'ic.image_id'
),
'AND'
).'
;'; ;';
list($counter) = mysql_fetch_row(pwg_query($query)); list($counter) = mysql_fetch_row(pwg_query($query));
@ -354,13 +361,17 @@ SELECT com.id AS comment_id
AND '.$page['cat_clause'].' AND '.$page['cat_clause'].'
AND '.$page['author_clause'].' AND '.$page['author_clause'].'
AND '.$page['keyword_clause'].' AND '.$page['keyword_clause'].'
AND '.$page['status_clause']; AND '.$page['status_clause'].'
if ($user['forbidden_categories'] != '') '.get_sql_condition_FandF
{ (
$query.= ' array
AND category_id NOT IN ('.$user['forbidden_categories'].')'; (
} 'forbidden_categories' => 'category_id',
$query.= ' 'visible_categories' => 'category_id',
'visible_images' => 'ic.image_id'
),
'AND'
).'
GROUP BY comment_id GROUP BY comment_id
ORDER BY '.$page['sort_by'].' '.$page['sort_order']; ORDER BY '.$page['sort_by'].' '.$page['sort_order'];
if ('all' != $page['items_number']) if ('all' != $page['items_number'])

View file

@ -42,7 +42,16 @@ SELECT
ON id = cat_id and user_id = '.$user['id'].' ON id = cat_id and user_id = '.$user['id'].'
WHERE date_last > SUBDATE( WHERE date_last > SUBDATE(
CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY
);'; )
'.get_sql_condition_FandF
(
array
(
'visible_categories' => 'id',
),
'AND'
).'
;';
} }
else else
{ {
@ -54,14 +63,15 @@ SELECT
FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
ON id = cat_id and user_id = '.$user['id'].' ON id = cat_id and user_id = '.$user['id'].'
WHERE id_uppercat '. WHERE id_uppercat '.
(!isset($page['category']) ? 'is NULL' : '= '.$page['category']); (!isset($page['category']) ? 'is NULL' : '= '.$page['category']).'
if ($page['filter_local_mode']) '.get_sql_condition_FandF
{ (
$query.= ' array
AND max_date_last > SUBDATE( (
CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'; 'visible_categories' => 'id',
} ),
$query.= ' 'AND'
).'
ORDER BY rank ORDER BY rank
;'; ;';
} }
@ -85,21 +95,18 @@ while ($row = mysql_fetch_assoc($result))
SELECT image_id SELECT image_id
FROM '.CATEGORIES_TABLE.' AS c INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic FROM '.CATEGORIES_TABLE.' AS c INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic
ON ic.category_id = c.id'; ON ic.category_id = c.id';
if ($page['filter_local_mode'] or $user['filter_global_mode'])
{
$query.= '
INNER JOIN '.IMAGES_TABLE.' AS i on ic.image_id = i.id ';
}
$query.= ' $query.= '
WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\' WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\'
AND c.id NOT IN ('.$user['forbidden_categories'].')'; '.get_sql_condition_FandF
if ($page['filter_local_mode'] or $user['filter_global_mode']) (
{ array
$query.= ' (
AND i.date_available > SUBDATE( 'forbidden_categories' => 'c.id',
CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'; 'visible_categories' => 'c.id',
} 'visible_images' => 'image_id'
$query.= ' ),
'AND'
).'
ORDER BY RAND() ORDER BY RAND()
LIMIT 0,1 LIMIT 0,1
;'; ;';
@ -116,14 +123,15 @@ SELECT representative_picture_id
FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
ON id = cat_id and user_id = '.$user['id'].' ON id = cat_id and user_id = '.$user['id'].'
WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\' WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\'
AND representative_picture_id IS NOT NULL'; AND representative_picture_id IS NOT NULL
if ($page['filter_local_mode'] or $user['filter_global_mode']) '.get_sql_condition_FandF
{ (
$query.= ' array
AND max_date_last > SUBDATE( (
CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'; 'visible_categories' => 'id',
} ),
$query.= ' 'AND'
).'
ORDER BY RAND() ORDER BY RAND()
LIMIT 0,1 LIMIT 0,1
;'; ;';
@ -161,6 +169,9 @@ SELECT id, path, tn_ext
if (count($categories) > 0) if (count($categories) > 0)
{ {
// Update filtered data
update_cats_with_filtered_data($categories);
if ($conf['subcatify']) if ($conf['subcatify'])
{ {
$template->set_filenames( $template->set_filenames(

View file

@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery | // | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far) // | branch : BSF (Best So Far)
// | file : $RCSfile$ // | file : $RCSfile$
@ -46,14 +46,8 @@ if (count($selection) > 0)
$query = ' $query = '
SELECT * SELECT *
FROM '.IMAGES_TABLE.' FROM '.IMAGES_TABLE.'
WHERE id IN ('.implode(',', $selection).')'; WHERE id IN ('.implode(',', $selection).')
if ($page['filter_local_mode'] or $user['filter_global_mode']) ;';
{
$query.= '
AND date_available > SUBDATE(
CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)';
}
$query.= ';';
$result = pwg_query($query); $result = pwg_query($query);
while ($row = mysql_fetch_assoc($result)) while ($row = mysql_fetch_assoc($result))
{ {

View file

@ -112,6 +112,7 @@ $page = array();
$user = array(); $user = array();
$lang = array(); $lang = array();
$header_msgs = array(); $header_msgs = array();
$header_notes = array();
@include(PHPWG_ROOT_PATH .'include/mysql.inc.php'); @include(PHPWG_ROOT_PATH .'include/mysql.inc.php');
if (!defined('PHPWG_INSTALLED')) if (!defined('PHPWG_INSTALLED'))
@ -228,6 +229,17 @@ if (count($header_msgs) > 0)
} }
} }
if (!defined('IN_ADMIN') or !IN_ADMIN)
{
include(PHPWG_ROOT_PATH.'include/functions_filter.inc.php');
include(PHPWG_ROOT_PATH.'include/filter.inc.php');
}
if (isset($conf['header_notes']))
{
$header_notes = array_merge($header_notes, $conf['header_notes']);
}
// default event handlers // default event handlers
add_event_handler('render_comment_content', 'parse_comment_content'); add_event_handler('render_comment_content', 'parse_comment_content');
trigger_action('init'); trigger_action('init');

View file

@ -174,6 +174,10 @@ $conf['show_version'] = true;
// page. // page.
$conf['links'] = array(); $conf['links'] = array();
// List of notes to display on all header page
// example $conf['header_notes'] = array('Test', 'Hello');
$conf['header_notes'] = array();
// show_thumbnail_caption : on thumbnails page, show thumbnail captions ? // show_thumbnail_caption : on thumbnails page, show thumbnail captions ?
$conf['show_thumbnail_caption'] = true; $conf['show_thumbnail_caption'] = true;
@ -543,7 +547,7 @@ $conf['nbm_treatment_timeout_default'] = 20;
$conf['enable_plugins']=true; $conf['enable_plugins']=true;
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | Set default for Web Service | // | Set default for Web Service |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// Web services are accepted // Web services are accepted
@ -561,4 +565,17 @@ $conf['enable_plugins']=true;
// 0 it's temporary closed (Useful for one access) // 0 it's temporary closed (Useful for one access)
$conf['ws_durations'] = array(3650,1825,730,365,182,91,30,15,10,7,5,1,0); $conf['ws_durations'] = array(3650,1825,730,365,182,91,30,15,10,7,5,1,0);
// +-----------------------------------------------------------------------+
// | Filter |
// +-----------------------------------------------------------------------+
// Pages where filter is enabled
// Other pages cancel current filter
$conf['filter_pages'] = array
(
'about.php', 'action.php', 'admin.php', 'comments.php',
'index.php', 'picture.php', 'popuphelp.php', 'profile.php',
'qsearch.php', 'random.php', 'register.php', 'search.php',
'search_rules.php', 'tags.php', 'upload.php'
);
?> ?>

117
include/filter.inc.php Normal file
View file

@ -0,0 +1,117 @@
<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2006-2007 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $Id: filter.inc.php 1651 2006-12-13 00:05:16Z rub $
// | last update : $Date: 2006-12-13 01:05:16 +0100 (mer., 13 déc. 2006) $
// | last modifier : $Author: rub $
// | revision : $Revision: 1651 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
// global variable for filter
$filter = array();
// $filter['enabled']: Filter is enabled
// $filter['categories']: Computed data of filtered categories
// $filter['visible_categories']: List of visible categories (count(visible) < count(forbidden) more often)
// $filter['visible_images']: List of visible images
$filter['enabled'] =
(in_array(basename($_SERVER['SCRIPT_FILENAME']), $conf['filter_pages'])) and
(
(isset($_GET['filter']) and ($_GET['filter'] == 'start')) or
pwg_get_session_var('filter_enabled', false)
);
if (in_array(basename($_SERVER['SCRIPT_FILENAME']), $conf['filter_pages']))
{
if (isset($_GET['filter']))
{
$filter['enabled'] = ($_GET['filter'] == 'start');
}
else
{
$filter['enabled'] = pwg_get_session_var('filter_enabled', false);
}
}
else
{
$filter['enabled'] = false;
}
if ($filter['enabled'])
{
if (
// New filter
!pwg_get_session_var('filter_enabled', false) or
// Cache data updated
$user['need_update_done'] or
// Date, period, user are changed
(pwg_get_session_var('filter_check_key', '') != get_filter_check_key())
)
{
// Need to compute dats
$filter['check_key'] = get_filter_check_key();
$filter['categories'] = get_computed_categories($user['id'], $user['forbidden_categories'], true, $user['recent_period']);
$filter['visible_categories'] = implode(',', array_keys($filter['categories']));
$query ='
SELECT
distinct image_id
FROM '.
IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON image_id = id
WHERE ';
if (!empty($filter['visible_categories']))
{
$query.= '
category_id IN ('.$filter['visible_categories'].') and';
}
$query.= '
date_available > SUBDATE(
CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)';
$filter['visible_images'] = implode(',', array_from_query($query, 'image_id'));
}
else
{
// Read only data
$filter['check_key'] = pwg_get_session_var('filter_check_key', '');
$filter['categories'] = unserialize(pwg_get_session_var('filter_categories', serialize(array())));
$filter['visible_categories'] = pwg_get_session_var('filter_visible_categories', '');
$filter['visible_images'] = pwg_get_session_var('filter_visible_images', '');
}
$header_notes[] = l10n_dec($lang['note_filter_day'], $lang['note_filter_days'], $user['recent_period']);
}
else
{
$filter['check_key'] = '';
$filter['categories'] = array();
$filter['visible_categories'] = '';
$filter['visible_images'] = '';
}
pwg_set_session_var('filter_enabled', $filter['enabled']);
pwg_set_session_var('filter_check_key', $filter['check_key']);
pwg_set_session_var('filter_categories', serialize($filter['categories']));
pwg_set_session_var('filter_visible_categories', $filter['visible_categories']);
pwg_set_session_var('filter_visible_images', $filter['visible_images']);
?>

View file

@ -29,7 +29,7 @@ define('CAL_VIEW_CALENDAR', 'calendar');
function initialize_calendar() function initialize_calendar()
{ {
global $page, $conf, $user, $template; global $page, $conf, $user, $template, $filter;
//------------------ initialize the condition on items to take into account --- //------------------ initialize the condition on items to take into account ---
$inner_sql = ' FROM ' . IMAGES_TABLE; $inner_sql = ' FROM ' . IMAGES_TABLE;
@ -58,7 +58,16 @@ WHERE category_id IN ('.implode(',',$sub_ids).')';
else else
{ {
$inner_sql .= ' $inner_sql .= '
WHERE category_id NOT IN ('.$user['forbidden_categories'].')'; '.get_sql_condition_FandF
(
array
(
'forbidden_categories' => 'category_id',
'visible_categories' => 'category_id',
'visible_images' => 'image_id'
),
'WHERE', true
);
} }
} }
else else

View file

@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery | // | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far) // | branch : BSF (Best So Far)
// | file : $Id$ // | file : $Id$
@ -44,6 +44,8 @@ function check_restrictions($category_id)
{ {
global $user; global $user;
// $filter['visible_categories'] and $filter['visible_images']
// are not used because it's not necessary (filter <> restriction)
if (in_array($category_id, explode(',', $user['forbidden_categories']))) if (in_array($category_id, explode(',', $user['forbidden_categories'])))
{ {
access_denied(); access_denied();
@ -52,7 +54,7 @@ function check_restrictions($category_id)
function get_categories_menu() function get_categories_menu()
{ {
global $page, $user; global $page, $user, $filter;
$query = ' $query = '
SELECT '; SELECT ';
@ -65,28 +67,34 @@ SELECT ';
// $user['forbidden_categories'] including with USER_CACHE_CATEGORIES_TABLE // $user['forbidden_categories'] including with USER_CACHE_CATEGORIES_TABLE
$query.= ' $query.= '
FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
ON id = cat_id and user_id = '.$user['id']; ON id = cat_id and user_id = '.$user['id'];
if ($page['filter_local_mode'])
// Always expand when filter is activated
if (!$user['expand'] and !$filter['enabled'])
{ {
$query.= ' $query.= '
where max_date_last > SUBDATE( WHERE
CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'; (id_uppercat is NULL';
if (isset($page['category']))
{
$query.= ' OR id_uppercat IN ('.$page['uppercats'].')';
}
$query.= ')';
} }
else else
{ {
// Always expand when filter_local_mode is activated $query.= '
if (!$user['expand'] and !$user['filter_global_mode']) '.get_sql_condition_FandF
{ (
$query.= ' array
WHERE (id_uppercat is NULL'; (
if (isset($page['category'])) 'visible_categories' => 'id',
{ ),
$query.= ' OR id_uppercat IN ('.$page['uppercats'].')'; 'WHERE'
} );
$query.= ')';
}
} }
$query.= ' $query.= '
;'; ;';
@ -98,6 +106,9 @@ where max_date_last > SUBDATE(
} }
usort($cats, 'global_rank_compare'); usort($cats, 'global_rank_compare');
// Update filtered data
update_cats_with_filtered_data($cats);
return get_html_menu_category($cats); return get_html_menu_category($cats);
} }

View file

@ -0,0 +1,66 @@
<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2006-2007 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $Id: functions_filter.inc.php 1651 2006-12-13 00:05:16Z rub $
// | last update : $Date: 2006-12-13 01:05:16 +0100 (mer., 13 déc. 2006) $
// | last modifier : $Author: rub $
// | revision : $Revision: 1651 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
/**
* Get a check key for filtered data
* Check key are composed of elements witch force to compute data
*
* @param null
* @return strinf check_key
*/
function get_filter_check_key()
{
global $user;
return $user['id'].$user['recent_period'].date('Ymd');
}
/**
* update data of categories with filtered values
*
* @param array list of categories
* @return null
*/
function update_cats_with_filtered_data(&$cats)
{
global $filter;
if ($filter['enabled'])
{
$upd_fields = array('max_date_last', 'count_images', 'count_categories', 'nb_images');
foreach ($cats as $cat_id => $category)
{
foreach ($upd_fields as $upd_field)
{
$cats[$cat_id][$upd_field] = $filter['categories'][$category['id']][$upd_field];
}
}
}
}
?>

View file

@ -288,11 +288,12 @@ function get_cat_display_name($cat_informations,
{ {
$output.= '<a class=""'; $output.= '<a class=""';
$output.= ' href="' $output.= ' href="'
.make_index_url( .duplicate_index_url(
array( array(
'category'=>$id, 'category'=>$id,
'cat_name'=>$name 'cat_name'=>$name
) ),
array('start')
) )
.'">'; .'">';
$output.= $name.'</a>'; $output.= $name.'</a>';

View file

@ -29,6 +29,31 @@
// | functions | // | functions |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
/*
* get standard sql where in order to
* restict an filter caregories and images
*
* IMAGE_CATEGORY_TABLE muste named ic in the query
*
* @param none
*
* @return string sql where
*/
function get_std_sql_where_restrict_filter($prefix_condition, $force_one_condition = false)
{
return get_sql_condition_FandF
(
array
(
'forbidden_categories' => 'ic.category_id',
'visible_categories' => 'ic.category_id',
'visible_images' => 'ic.image_id'
),
$prefix_condition,
$force_one_condition
);
}
/* /*
* Execute custom notification query * Execute custom notification query
* *
@ -53,7 +78,7 @@ function custom_notification_query($action, $type, $start, $end)
WHERE c.image_id = ic.image_id WHERE c.image_id = ic.image_id
AND c.validation_date > \''.$start.'\' AND c.validation_date > \''.$start.'\'
AND c.validation_date <= \''.$end.'\' AND c.validation_date <= \''.$end.'\'
AND category_id NOT IN ('.$user['forbidden_categories'].') '.get_std_sql_where_restrict_filter('AND').'
;'; ;';
break; break;
case 'unvalidated_comments': case 'unvalidated_comments':
@ -66,18 +91,18 @@ function custom_notification_query($action, $type, $start, $end)
break; break;
case 'new_elements': case 'new_elements':
$query = ' $query = '
FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON image_id = id
WHERE date_available > \''.$start.'\' WHERE date_available > \''.$start.'\'
AND date_available <= \''.$end.'\' AND date_available <= \''.$end.'\'
AND category_id NOT IN ('.$user['forbidden_categories'].') '.get_std_sql_where_restrict_filter('AND').'
;'; ;';
break; break;
case 'updated_categories': case 'updated_categories':
$query = ' $query = '
FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON image_id = id
WHERE date_available > \''.$start.'\' WHERE date_available > \''.$start.'\'
AND date_available <= \''.$end.'\' AND date_available <= \''.$end.'\'
AND category_id NOT IN ('.$user['forbidden_categories'].') '.get_std_sql_where_restrict_filter('AND').'
;'; ;';
break; break;
case 'new_users': case 'new_users':
@ -423,13 +448,13 @@ function get_recent_post_dates($max_dates, $max_elements, $max_cats)
{ {
global $conf, $user; global $conf, $user;
$where_sql = 'WHERE category_id NOT IN ('.$user['forbidden_categories'].')'; $where_sql = get_std_sql_where_restrict_filter('WHERE', true);
$query = ' $query = '
SELECT date_available, SELECT date_available,
COUNT(DISTINCT id) nb_elements, COUNT(DISTINCT id) nb_elements,
COUNT(DISTINCT category_id) nb_cats COUNT(DISTINCT category_id) nb_cats
FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id
'.$where_sql.' '.$where_sql.'
GROUP BY date_available GROUP BY date_available
ORDER BY date_available DESC ORDER BY date_available DESC
@ -448,7 +473,7 @@ SELECT date_available,
{ // get some thumbnails ... { // get some thumbnails ...
$query = ' $query = '
SELECT DISTINCT id, path, name, tn_ext SELECT DISTINCT id, path, name, tn_ext
FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id
'.$where_sql.' '.$where_sql.'
AND date_available="'.$dates[$i]['date_available'].'" AND date_available="'.$dates[$i]['date_available'].'"
AND tn_ext IS NOT NULL AND tn_ext IS NOT NULL
@ -466,7 +491,7 @@ SELECT DISTINCT id, path, name, tn_ext
{// get some categories ... {// get some categories ...
$query = ' $query = '
SELECT DISTINCT c.uppercats, COUNT(DISTINCT i.id) img_count SELECT DISTINCT c.uppercats, COUNT(DISTINCT i.id) img_count
FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON i.id=image_id FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id=image_id
INNER JOIN '.CATEGORIES_TABLE.' c ON c.id=category_id INNER JOIN '.CATEGORIES_TABLE.' c ON c.id=category_id
'.$where_sql.' '.$where_sql.'
AND date_available="'.$dates[$i]['date_available'].'" AND date_available="'.$dates[$i]['date_available'].'"

View file

@ -335,7 +335,7 @@ function get_qsearch_like_clause($q, $field)
*/ */
function get_quick_search_results($q) function get_quick_search_results($q)
{ {
global $user, $page; global $user, $page, $filter;
$search_results = array(); $search_results = array();
// first search tag names corresponding to the query $q. we could also search // first search tag names corresponding to the query $q. we could also search
@ -384,7 +384,16 @@ FROM (
) )
INNER JOIN INNER JOIN
'.CATEGORIES_TABLE.' c on c.id=ic.category_id '.CATEGORIES_TABLE.' c on c.id=ic.category_id
WHERE category_id NOT IN ('.$user['forbidden_categories'].') '.get_sql_condition_FandF
(
array
(
'forbidden_categories' => 'category_id',
'visible_categories' => 'category_id',
'visible_images' => 'ic.image_id'
),
'WHERE'
).'
GROUP BY i.id'; GROUP BY i.id';
$query = 'SELECT id, MATCH(ft) AGAINST( "'.$q.'" IN BOOLEAN MODE) AS q FROM ('.$query.') AS Y $query = 'SELECT id, MATCH(ft) AGAINST( "'.$q.'" IN BOOLEAN MODE) AS q FROM ('.$query.') AS Y
@ -427,8 +436,16 @@ SELECT DISTINCT(id)
FROM '.IMAGES_TABLE.' FROM '.IMAGES_TABLE.'
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
WHERE id IN ('.implode(',', array_keys($by_tag_weights) ).') WHERE id IN ('.implode(',', array_keys($by_tag_weights) ).')
AND category_id NOT IN ('.$user['forbidden_categories'].')'; '.get_sql_condition_FandF
(
array
(
'forbidden_categories' => 'category_id',
'visible_categories' => 'category_id',
'visible_images' => 'ic.image_id'
),
'AND'
);
$allowed_image_ids = array_from_query( $query, 'id'); $allowed_image_ids = array_from_query( $query, 'id');
$by_tag_weights = array_intersect_key($by_tag_weights, array_flip($allowed_image_ids)); $by_tag_weights = array_intersect_key($by_tag_weights, array_flip($allowed_image_ids));
arsort($by_tag_weights, SORT_NUMERIC); arsort($by_tag_weights, SORT_NUMERIC);

View file

@ -37,7 +37,7 @@
* @param array forbidden categories * @param array forbidden categories
* @return array * @return array
*/ */
function get_available_tags($forbidden_categories = null) function get_available_tags()
{ {
// we can find top fatter tags among reachable images // we can find top fatter tags among reachable images
$tags_query = ' $tags_query = '
@ -45,13 +45,25 @@ SELECT tag_id, name, url_name, count(*) counter
FROM '.IMAGE_TAG_TABLE.' FROM '.IMAGE_TAG_TABLE.'
INNER JOIN '.TAGS_TABLE.' ON tag_id = id'; INNER JOIN '.TAGS_TABLE.' ON tag_id = id';
if (!is_null($forbidden_categories)) $where_tag_img =
get_sql_condition_FandF
(
array
(
'forbidden_categories' => 'category_id',
'visible_categories' => 'category_id',
'visible_images' => 'image_id'
),
'WHERE'
);
if (!is_null($where_tag_img))
{ {
// first we need all reachable image ids // first we need all reachable image ids
$images_query = ' $images_query = '
SELECT DISTINCT image_id SELECT DISTINCT image_id
FROM '.IMAGE_CATEGORY_TABLE.' FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id NOT IN ('.implode(',', $forbidden_categories).') '.$where_tag_img.'
;'; ;';
$image_ids = array_from_query($images_query, 'image_id'); $image_ids = array_from_query($images_query, 'image_id');
if ( empty($image_ids) ) if ( empty($image_ids) )

View file

@ -264,6 +264,11 @@ function add_well_known_params_in_url($url, $params)
} }
} }
if (isset($params['flat_recent_cat']) and $params['flat_recent_cat'] > 0)
{
$url.= '/flat_recent_cat-'.$params['flat_recent_cat'];
}
if (isset($params['start']) and $params['start'] > 0) if (isset($params['start']) and $params['start'] > 0)
{ {
$url.= '/start-'.$params['start']; $url.= '/start-'.$params['start'];

View file

@ -143,12 +143,11 @@ function setup_style($style)
return new Template(PHPWG_ROOT_PATH.'template/'.$style); return new Template(PHPWG_ROOT_PATH.'template/'.$style);
} }
function build_user( $user_id, $use_cache, $filter_global_mode = false ) function build_user( $user_id, $use_cache )
{ {
global $conf; global $conf;
$user['id'] = $user_id; $user['id'] = $user_id;
$user = array_merge( $user, getuserdata($user_id, $use_cache, $filter_global_mode) ); $user = array_merge( $user, getuserdata($user_id, $use_cache) );
if ( $user['id'] == $conf['guest_id']) if ( $user['id'] == $conf['guest_id'])
{ {
$user['is_the_guest']=true; $user['is_the_guest']=true;
@ -167,7 +166,6 @@ function build_user( $user_id, $use_cache, $filter_global_mode = false )
{ {
$user['is_the_guest']=false; $user['is_the_guest']=false;
} }
// calculation of the number of picture to display per page // calculation of the number of picture to display per page
$user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page']; $user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page'];
@ -198,7 +196,7 @@ function build_user( $user_id, $use_cache, $filter_global_mode = false )
* @param boolean use_cache * @param boolean use_cache
* @param array * @param array
*/ */
function getuserdata($user_id, $use_cache, $filter_global_mode = false ) function getuserdata($user_id, $use_cache)
{ {
global $conf; global $conf;
@ -267,21 +265,20 @@ SELECT ui.*, uc.*
if ($use_cache) if ($use_cache)
{ {
$userdata['filter_global_mode'] = $filter_global_mode;
if (!isset($userdata['need_update']) if (!isset($userdata['need_update'])
or !is_bool($userdata['need_update']) or !is_bool($userdata['need_update'])
or $userdata['need_update'] == true or $userdata['need_update'] == true)
or $filter_global_mode // not optimize condition RubTag
)
{ {
$userdata['forbidden_categories'] = $userdata['forbidden_categories'] =
calculate_permissions($userdata['id'], $userdata['status']); calculate_permissions($userdata['id'], $userdata['status']);
update_user_cache_categories($userdata); update_user_cache_categories($userdata['id'], $userdata['forbidden_categories']);
// Set need update are done // Set need update are done
$userdata['need_update'] = $userdata['filter_global_mode']; // for draft always update RubTag $userdata['need_update'] = false;
// Indicate update done
$userdata['need_update_done'] = true;
$query = ' $query = '
SELECT COUNT(DISTINCT(image_id)) as total SELECT COUNT(DISTINCT(image_id)) as total
@ -306,8 +303,10 @@ INSERT INTO '.USER_CACHE_TABLE.'
;'; ;';
pwg_query($query); pwg_query($query);
} }
else
{ {
// Indicate update not done
$userdata['need_update_done'] = false;
} }
} }
@ -328,6 +327,8 @@ function check_user_favorites()
return; return;
} }
// $filter['visible_categories'] and $filter['visible_images']
// must be not used because filter <> restriction
// retrieving images allowed : belonging to at least one authorized // retrieving images allowed : belonging to at least one authorized
// category // category
$query = ' $query = '
@ -335,7 +336,14 @@ SELECT DISTINCT f.image_id
FROM '.FAVORITES_TABLE.' AS f INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic FROM '.FAVORITES_TABLE.' AS f INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic
ON f.image_id = ic.image_id ON f.image_id = ic.image_id
WHERE f.user_id = '.$user['id'].' WHERE f.user_id = '.$user['id'].'
AND ic.category_id NOT IN ('.$user['forbidden_categories'].') '.get_sql_condition_FandF
(
array
(
'forbidden_categories' => 'ic.category_id',
),
'AND'
).'
;'; ;';
$result = pwg_query($query); $result = pwg_query($query);
$authorizeds = array(); $authorizeds = array();
@ -454,7 +462,7 @@ SELECT id
} }
/** /**
* compute data of categories branches * compute data of categories branches (one branch only)
*/ */
function compute_branch_cat_data(&$cats, &$list_cat_id, &$level, &$ref_level) function compute_branch_cat_data(&$cats, &$list_cat_id, &$level, &$ref_level)
{ {
@ -496,79 +504,10 @@ function compute_branch_cat_data(&$cats, &$list_cat_id, &$level, &$ref_level)
} }
/** /**
* update data of user_cache_categories * compute data of categories branches
*
* @param array userdata
* @return null
*/ */
function update_user_cache_categories(&$userdata) function compute_categories_data(&$cats)
{ {
// delete user cache
$query = '
DELETE FROM '.USER_CACHE_CATEGORIES_TABLE.'
WHERE user_id = '.$userdata['id'].'
;';
pwg_query($query);
/*$query = '
SELECT id cat_id, date_last max_date_last, nb_images count_images, global_rank
FROM '.CATEGORIES_TABLE;
if ($userdata['forbidden_categories'] != '')
{
$query.= '
WHERE id NOT IN ('.$userdata['forbidden_categories'].')';
}
$query.= ';';*/
$query = '
SELECT c.id cat_id, date_last max_date_last, nb_images count_images, global_rank';
if (!$userdata['filter_global_mode'])
{
$query.= '
FROM '.CATEGORIES_TABLE.' as C';
}
else
{
// Count by date_available to avoid count null
$query.= ', count(date_available) filtered_count_images, max(date_available) max_date_available
FROM '.CATEGORIES_TABLE.' as C
LEFT JOIN '.IMAGE_CATEGORY_TABLE.' AS ic
ON ic.category_id = c.id LEFT JOIN '.IMAGES_TABLE.' AS i
ON ic.image_id = i.id AND i.date_available > SUBDATE(
CURRENT_DATE,INTERVAL '.$userdata['recent_period'].' DAY)';
}
if ($userdata['forbidden_categories'] != '')
{
$query.= '
WHERE C.id NOT IN ('.$userdata['forbidden_categories'].')';
}
if ($userdata['filter_global_mode'])
{
$query.= '
GROUP BY c.id';
}
$query.= ';';
$result = pwg_query($query);
$cats = array();
while ($row = mysql_fetch_assoc($result))
{
$row['user_id'] = $userdata['id'];
$row['count_categories'] = 0;
if ($userdata['filter_global_mode'])
{
$row['count_images'] = $row['filtered_count_images'];
$row['max_date_last'] = $row['max_date_available'];
}
$cats += array($row['cat_id'] => $row);
}
usort($cats, 'global_rank_compare');
$ref_level = 0; $ref_level = 0;
$level = 0; $level = 0;
$list_cat_id = array(); $list_cat_id = array();
@ -591,28 +530,122 @@ SELECT c.id cat_id, date_last max_date_last, nb_images count_images, global_rank
$level = 1; $level = 1;
compute_branch_cat_data($cats, $list_cat_id, $level, $ref_level); compute_branch_cat_data($cats, $list_cat_id, $level, $ref_level);
}
if ($userdata['filter_global_mode']) /**
* get computed array of categories
*
* @param int user_id
* @param list user_forbidden_categories
* @param bool filter_enabled
* @param int recent_period
* @return array
*/
function get_computed_categories($user_id, $user_forbidden_categories, $filter_enabled, $recent_period = 0)
{
$query = '
SELECT
c.id cat_id,
date_last max_date_last,
nb_images count_images,
global_rank';
if (!$filter_enabled)
{
$query.= '
FROM '.CATEGORIES_TABLE.' as c';
}
else
{
// Count by date_available to avoid count null
$query.= ',
count(date_available) filtered_count_images,
max(date_available) max_date_available
FROM '.CATEGORIES_TABLE.' as c
LEFT JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.category_id = c.id
LEFT JOIN '.IMAGES_TABLE.' AS i
ON ic.image_id = i.id AND
i.date_available > SUBDATE(CURRENT_DATE,INTERVAL '.$recent_period.' DAY)';
}
if ($user_forbidden_categories != '')
{
$query.= '
WHERE
c.id NOT IN ('.$user_forbidden_categories.')';
}
if ($filter_enabled)
{
$query.= '
GROUP BY
c.id';
}
$query.= ';';
$result = pwg_query($query);
$cats = array();
while ($row = mysql_fetch_assoc($result))
{
$row['user_id'] = $user_id;
$row['count_categories'] = 0;
if ($filter_enabled)
{
$row['nb_images'] = $row['filtered_count_images'];
$row['count_images'] = $row['filtered_count_images'];
$row['max_date_last'] = $row['max_date_available'];
}
$cats += array($row['cat_id'] => $row);
}
usort($cats, 'global_rank_compare');
compute_categories_data($cats);
if ($filter_enabled)
{ {
$forbidden_cats = array();
$forbidden_cats = explode(',', $userdata['forbidden_categories']);
$cat_tmp = $cats; $cat_tmp = $cats;
$cats = array(); $cats = array();
foreach ($cat_tmp as $cat_id => $category) foreach ($cat_tmp as $category)
{ {
if (empty($category['max_date_last'])) if (!empty($category['max_date_last']))
{ {
array_push($forbidden_cats, $category['cat_id']); // Re-init counters
} $category['count_categories'] = 0;
else $category['nb_images'] = $category['filtered_count_images'];
{ $category['count_images'] = $category['filtered_count_images'];
array_push($cats, $category); // Keep category
$cats[$category['cat_id']] = $category;
} }
} }
$userdata['forbidden_categories'] = implode(',', array_unique($forbidden_cats)); // Compute a second time
compute_categories_data($cats);
} }
return $cats;
}
/**
* update data of user_cache_categories
*
* @param int user_id
* @param list user_forbidden_categories
* @param bool filter_enabled
* @return null
*/
function update_user_cache_categories($user_id, $user_forbidden_categories)
{
// delete user cache
$query = '
DELETE FROM '.USER_CACHE_CATEGORIES_TABLE.'
WHERE user_id = '.$user_id.'
;';
pwg_query($query);
$cats = get_computed_categories($user_id, $user_forbidden_categories, false);
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
mass_inserts mass_inserts
( (
@ -1014,4 +1047,82 @@ function get_email_address_as_display_text($email_address)
} }
} }
/*
* Compute sql where condition with restrict and filter data
*
* FandF: Forbidden and Filters
*
* @param $condition_fields array:
* keys are condition to aply and
* values are sql field to use
* array('forbidden_categories' => 'ic.category_id')
* $prefix_condition string:
* this value are concatenated if sql is not empty
* $force_one_condition:
* if there are not condition , use this condition "1 = 1"
*
* @return string sql where/conditions
*/
function get_sql_condition_FandF($condition_fields, $prefix_condition = null, $force_one_condition = false)
{
global $user, $filter;
$sql_list = array();
foreach ($condition_fields as $condition => $field_name)
{
switch($condition)
{
case 'forbidden_categories':
if (!empty($user['forbidden_categories']))
{
$sql_list[] = $field_name.' NOT IN ('.$user['forbidden_categories'].')';
}
break;
case 'visible_categories':
if (!empty($filter['visible_categories']))
{
$sql_list[] = $field_name.' IN ('.$filter['visible_categories'].')';
}
break;
case 'visible_images':
if (!empty($filter['visible_images']))
{
$sql_list[] = $field_name.' IN ('.$filter['visible_images'].')';
}
break;
default:
die('Unknow condition');
break;
}
}
if (count($sql_list) > 0)
{
$sql = '('.implode(' AND ', $sql_list).')';
}
else
{
if ($force_one_condition)
{
$sql = '1 = 1';
}
else
{
$sql = '';
}
}
if (isset($prefix_condition) and !empty($sql))
{
$sql = $prefix_condition.' '.$sql;
}
return $sql;
}
?> ?>

View file

@ -63,6 +63,28 @@ foreach ($conf['links'] as $url => $label)
) )
); );
} }
//------------------------------------------------------------------------ filter
if ($filter['enabled'])
{
$template->assign_block_vars(
'stop_filter',
array(
'URL' => add_url_params(make_index_url(array()), array('filter' => 'stop'))
)
);
}
else
{
$template->assign_block_vars(
'start_filter',
array(
'URL' => add_url_params(make_index_url(array()), array('filter' => 'start'))
)
);
}
//------------------------------------------------------------------------ tags //------------------------------------------------------------------------ tags
if ('tags' == $page['section']) if ('tags' == $page['section'])
{ {

View file

@ -60,6 +60,18 @@ if (isset($header_infos))
{ {
$template->assign_block_vars( 'header_meta', $header_infos); $template->assign_block_vars( 'header_meta', $header_infos);
} }
// Header notes
if (count($header_notes) > 0)
{
$template->assign_block_vars('header_notes', array());
foreach ($header_notes as $header_note)
{
$template->assign_block_vars('header_notes.header_note',
array('HEADER_NOTE' => $header_note));
}
}
// refresh // refresh
if ( isset( $refresh ) and intval($refresh) >= 0 if ( isset( $refresh ) and intval($refresh) >= 0
and isset( $url_link ) and isset( $redirect_msg ) ) and isset( $url_link ) and isset( $redirect_msg ) )

View file

@ -267,6 +267,12 @@ while (isset($tokens[$i]))
$page['start'] = $matches[1]; $page['start'] = $matches[1];
} }
if (preg_match('/^flat_recent_cat-(\d+)/', $tokens[$i], $matches))
{
// indicate a special list of images
$page['flat_recent_cat'] = $matches[1];
}
if (preg_match('/^(posted|created)/', $tokens[$i] )) if (preg_match('/^(posted|created)/', $tokens[$i] ))
{ {
$chronology_tokens = explode('-', $tokens[$i] ); $chronology_tokens = explode('-', $tokens[$i] );
@ -325,59 +331,134 @@ if ('categories' == $page['section'])
$page = array_merge( $page = array_merge(
$page, $page,
array( array(
'comment' => $result['comment'], 'comment' => $result['comment'],
'cat_dir' => $result['dir'], 'cat_dir' => $result['dir'],
'cat_name' => $result['name'], 'cat_name' => $result['name'],
'cat_site_id' => $result['site_id'], 'cat_site_id' => $result['site_id'],
'cat_uploadable' => $result['uploadable'], 'cat_uploadable' => $result['uploadable'],
'cat_commentable' => $result['commentable'], 'cat_commentable' => $result['commentable'],
'cat_id_uppercat' => $result['id_uppercat'], 'cat_id_uppercat' => $result['id_uppercat'],
'uppercats' => $result['uppercats'], 'uppercats' => $result['uppercats'],
'title' =>
'title' => get_cat_display_name($result['name'], '', false), get_cat_display_name($result['name'], '', false),
'thumbnails_include' =>
(($result['nb_images'] > 0) or (isset($page['flat_recent_cat'])))
? 'include/category_default.inc.php'
: 'include/category_cats.inc.php'
) )
); );
if (!isset($page['chronology_field']))
{
if ( !empty($result['image_order']) and !isset($page['super_order_by']) )
{
$conf[ 'order_by' ] = ' ORDER BY '.$result['image_order'];
}
$query = '
SELECT image_id
FROM '.IMAGE_CATEGORY_TABLE.'
INNER JOIN '.IMAGES_TABLE.' ON id = image_id
WHERE category_id = '.$page['category'].'
'.$conf['order_by'].'
;';
$page['items'] = array_from_query($query, 'image_id');
$page['thumbnails_include'] =
$result['nb_images'] > 0
? 'include/category_default.inc.php'
: 'include/category_cats.inc.php';
} //otherwise the calendar will requery all subitems
} }
else else
{ {
$page['title'] = $lang['no_category']; $page['title'] = $lang['no_category'];
$page['thumbnails_include'] = 'include/category_cats.inc.php'; $page['thumbnails_include'] =
(isset($page['flat_recent_cat']))
? 'include/category_default.inc.php'
: 'include/category_cats.inc.php';
} }
if (isset($page['flat_recent_cat']))
{
$page['title'] = $lang['recent_pics_cat'].' : '.$page['title'] ;
}
if
(
(!isset($page['chronology_field'])) and
(
(isset($page['category'])) or
(isset($page['flat_recent_cat']))
)
)
{
if ( !empty($result['image_order']) and !isset($page['super_order_by']) )
{
$conf[ 'order_by' ] = ' ORDER BY '.$result['image_order'];
}
if (isset($page['flat_recent_cat']))
{
// flat recent categories mode
$query = '
SELECT
DISTINCT(ic.image_id)
FROM '.IMAGES_TABLE.' AS i
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id = ic.image_id
INNER JOIN '.CATEGORIES_TABLE.' AS c ON ic.category_id = c.id
WHERE
date_available > SUBDATE(
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'
).'
;';
$where_sql = array_from_query($query, 'image_id');
if (!empty($where_sql))
{
$where_sql = 'image_id in ('.implode(',', $where_sql).')';
}
}
else
{
// Normal mode
$where_sql = 'category_id = '.$page['category'];
}
if (!empty($where_sql))
{
// Main query
$query = '
SELECT 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'
).'
'.$conf['order_by'].'
;';
$page['items'] = array_from_query($query, 'image_id');
}
else
{
$page['items'] = array();
}
} //otherwise the calendar will requery all subitems
} }
// special sections // special sections
else else
{ {
if (!empty($user['forbidden_categories'])) $forbidden =
{ get_sql_condition_FandF
$forbidden = (
' category_id NOT IN ('.$user['forbidden_categories'].')'; array
} (
else 'forbidden_categories' => 'category_id',
{ 'visible_categories' => 'category_id',
$forbidden = ' 1 = 1'; 'visible_images' => 'image_id'
} ),
'AND'
);
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | tags section | // | tags section |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
@ -400,7 +481,7 @@ else
SELECT image_id SELECT image_id
FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON image_id=id FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON image_id=id
WHERE image_id IN ('.implode(',', $items).') WHERE image_id IN ('.implode(',', $items).')
AND '.$forbidden. '.$forbidden.
$conf['order_by'].' $conf['order_by'].'
;'; ;';
$items = array_unique( $items = array_unique(
@ -434,7 +515,7 @@ SELECT DISTINCT(id)
FROM '.IMAGES_TABLE.' FROM '.IMAGES_TABLE.'
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
WHERE id IN ('.implode(',', $search_result['items']).') WHERE id IN ('.implode(',', $search_result['items']).')
AND '.$forbidden.' '.$forbidden.'
'.$conf['order_by'].' '.$conf['order_by'].'
;'; ;';
$page['items'] = array_from_query($query, 'id'); $page['items'] = array_from_query($query, 'id');
@ -464,6 +545,14 @@ SELECT image_id
FROM '.FAVORITES_TABLE.' FROM '.FAVORITES_TABLE.'
INNER JOIN '.IMAGES_TABLE.' ON image_id = id INNER JOIN '.IMAGES_TABLE.' ON image_id = id
WHERE user_id = '.$user['id'].' WHERE user_id = '.$user['id'].'
'.get_sql_condition_FandF
(
array
(
'visible_images' => 'image_id'
),
'AND'
).'
'.$conf['order_by'].' '.$conf['order_by'].'
;'; ;';
@ -487,7 +576,7 @@ SELECT DISTINCT(id)
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
WHERE date_available > \''. WHERE date_available > \''.
date('Y-m-d', time() - 60*60*24*$user['recent_period']).'\' date('Y-m-d', time() - 60*60*24*$user['recent_period']).'\'
AND '.$forbidden.' '.$forbidden.'
'.$conf['order_by'].' '.$conf['order_by'].'
;'; ;';
@ -526,7 +615,7 @@ SELECT DISTINCT(id)
FROM '.IMAGES_TABLE.' FROM '.IMAGES_TABLE.'
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
WHERE hit > 0 WHERE hit > 0
AND '.$forbidden.' '.$forbidden.'
'.$conf['order_by'].' '.$conf['order_by'].'
LIMIT 0, '.$conf['top_number'].' LIMIT 0, '.$conf['top_number'].'
;'; ;';
@ -554,7 +643,7 @@ SELECT DISTINCT(id)
FROM '.IMAGES_TABLE.' FROM '.IMAGES_TABLE.'
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
WHERE average_rate IS NOT NULL WHERE average_rate IS NOT NULL
AND '.$forbidden.' '.$forbidden.'
'.$conf['order_by'].' '.$conf['order_by'].'
LIMIT 0, '.$conf['top_number'].' LIMIT 0, '.$conf['top_number'].'
;'; ;';
@ -578,7 +667,7 @@ SELECT DISTINCT(id)
FROM '.IMAGES_TABLE.' FROM '.IMAGES_TABLE.'
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
WHERE image_id IN ('.implode(',', $page['list']).') WHERE image_id IN ('.implode(',', $page['list']).')
AND '.$forbidden.' '.$forbidden.'
'.$conf['order_by'].' '.$conf['order_by'].'
;'; ;';

View file

@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery | // | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far) // | branch : BSF (Best So Far)
// | file : $RCSfile$ // | file : $RCSfile$
@ -70,19 +70,8 @@ if ($conf['apache_authentication'] and isset($_SERVER['REMOTE_USER']))
} }
} }
if (isset($_GET['filter_global_mode']))
{
$user['filter_global_mode'] = ($_GET['filter_global_mode'] == 'start');
pwg_set_session_var('filter_global_mode', $user['filter_global_mode']);
}
else
{
$user['filter_global_mode'] = pwg_get_session_var('filter_global_mode', false);
}
$user = build_user( $user['id'], $user = build_user( $user['id'],
( defined('IN_ADMIN') and IN_ADMIN ) ? false : true, // use cache ? ( defined('IN_ADMIN') and IN_ADMIN ) ? false : true // use cache ?
$user['filter_global_mode'] // filter_global_mode ?
); );
?> ?>

View file

@ -106,64 +106,22 @@ if (isset($page['cat_nb_images']) and $page['cat_nb_images'] > 0)
$template_title.= ' ['.$page['cat_nb_images'].']'; $template_title.= ' ['.$page['cat_nb_images'].']';
} }
if (isset($_GET['filter_local_mode'])) if (isset($page['flat_recent_cat']) or isset($page['chronology_field']))
{
$page['filter_local_mode'] = ($_GET['filter_local_mode'] == 'start');
}
else
{
$page['filter_local_mode'] = pwg_get_session_var('filter_local_mode', false);
}
$page['filter_local_mode'] = (($page['filter_local_mode']) and
($page['section'] == 'categories') and
(!isset($page['chronology_field'])));
pwg_set_session_var('filter_local_mode', $page['filter_local_mode']);
if ($page['filter_local_mode'])
{ {
$template->assign_block_vars( $template->assign_block_vars(
'stop_filter_local_mode', 'mode_normal',
array( array(
'URL' => add_url_params(duplicate_index_url(array(), array('start')), array('filter_local_mode' => 'stop')) 'URL' => duplicate_index_url( array(), array('chronology_field', 'start', 'flat_recent_cat') )
)
);
}
else
{
$template->assign_block_vars(
'start_filter_local_mode',
array(
'URL' => add_url_params(duplicate_index_url(array(), array('start')), array('filter_local_mode' => 'start'))
) )
); );
} }
if (isset($_GET['filter_global_mode'])) if (!isset($page['flat_recent_cat']))
{
$user['filter_global_mode'] = ($_GET['filter_global_mode'] == 'start');
pwg_set_session_var('filter_global_mode', $user['filter_global_mode']);
}
else
{
$user['filter_global_mode'] = pwg_get_session_var('filter_global_mode', false);
}
if ($user['filter_global_mode'])
{ {
$template->assign_block_vars( $template->assign_block_vars(
'stop_filter_global_mode', 'flat_recent_cat',
array( array(
'URL' => add_url_params(duplicate_index_url(array(), array('start')), array('filter_global_mode' => 'stop')) 'URL' => duplicate_index_url(array('flat_recent_cat' => $user['recent_period']), array('start', 'chronology_field'))
)
);
}
else
{
$template->assign_block_vars(
'start_filter_global_mode',
array(
'URL' => add_url_params(duplicate_index_url(array(), array('start')), array('filter_global_mode' => 'start'))
) )
); );
} }
@ -179,7 +137,7 @@ if (!isset($page['chronology_field']))
$template->assign_block_vars( $template->assign_block_vars(
'mode_created', 'mode_created',
array( array(
'URL' => duplicate_index_url( $chronology_params, array('start') ) 'URL' => duplicate_index_url( $chronology_params, array('start', 'flat_recent_cat') )
) )
); );
@ -187,19 +145,12 @@ if (!isset($page['chronology_field']))
$template->assign_block_vars( $template->assign_block_vars(
'mode_posted', 'mode_posted',
array( array(
'URL' => duplicate_index_url( $chronology_params, array('start') ) 'URL' => duplicate_index_url( $chronology_params, array('start', 'flat_recent_cat') )
) )
); );
} }
else else
{ {
$template->assign_block_vars(
'mode_normal',
array(
'URL' => duplicate_index_url( array(), array('chronology_field','start') )
)
);
if ($page['chronology_field'] == 'created') if ($page['chronology_field'] == 'created')
{ {
$chronology_field = 'posted'; $chronology_field = 'posted';
@ -210,7 +161,7 @@ else
} }
$url = duplicate_index_url( $url = duplicate_index_url(
array('chronology_field'=>$chronology_field ), array('chronology_field'=>$chronology_field ),
array('chronology_date', 'start') array('chronology_date', 'start', 'flat_recent_cat')
); );
$template->assign_block_vars( $template->assign_block_vars(
'mode_'.$chronology_field, 'mode_'.$chronology_field,

View file

@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery | // | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far) // | branch : BSF (Best So Far)
// | file : $RCSfile$ // | file : $RCSfile$
@ -490,10 +490,9 @@ $lang['maxheight'] = 'Maximum height of the pictures';
$lang['maxheight_error'] = 'Maximum height must be a number superior to 50'; $lang['maxheight_error'] = 'Maximum height must be a number superior to 50';
$lang['maxwidth'] = 'Maximum width of the pictures'; $lang['maxwidth'] = 'Maximum width of the pictures';
$lang['maxwidth_error'] = 'Maximum width must be a number superior to 50'; $lang['maxwidth_error'] = 'Maximum width must be a number superior to 50';
$lang['start_filter_local_mode_hint'] = '[local] displays only recent elements'; $lang['flat_recent_cat_hint'] = 'display recent elements of categories and sub-categories';
$lang['stop_filter_local_mode_hint'] = '[local] return to display all elements'; $lang['start_filter_hint'] = 'displays only recent elements';
$lang['start_filter_global_mode_hint'] = '[global] displays only recent elements'; $lang['stop_filter_hint'] = 'return to display all elements';
$lang['stop_filter_global_mode_hint'] = '[global] return to display all elements';
$lang['mode_created_hint'] = 'displays a calendar by creation date'; $lang['mode_created_hint'] = 'displays a calendar by creation date';
$lang['mode_normal_hint'] = 'return to normal view mode'; $lang['mode_normal_hint'] = 'return to normal view mode';
$lang['mode_posted_hint'] = 'displays a calendar by date posted'; $lang['mode_posted_hint'] = 'displays a calendar by date posted';
@ -613,4 +612,6 @@ $lang['upload_username'] = 'Username';
$lang['useful when password forgotten'] = 'useful when password forgotten'; $lang['useful when password forgotten'] = 'useful when password forgotten';
$lang['w_month'] = 'Month'; $lang['w_month'] = 'Month';
$lang['yes'] = 'Yes'; $lang['yes'] = 'Yes';
$lang['note_filter_day'] = 'The whole of the elements are filtered in order to diplay the recent elements of less %s day.';
$lang['note_filter_days'] = 'The whole of the elements are filtered in order to diplay the recent elements of less %s days.';
?> ?>

View file

@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery | // | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far) // | branch : BSF (Best So Far)
// | file : $RCSfile$ // | file : $RCSfile$
@ -490,10 +490,9 @@ $lang['maxheight'] = 'Hauteur maximum des images';
$lang['maxheight_error'] = 'La hauteur maximum des images doit être supérieure à 50'; $lang['maxheight_error'] = 'La hauteur maximum des images doit être supérieure à 50';
$lang['maxwidth'] = 'Largeur maximum des images'; $lang['maxwidth'] = 'Largeur maximum des images';
$lang['maxwidth_error'] = 'La largeur des images doit être supérieure à 50'; $lang['maxwidth_error'] = 'La largeur des images doit être supérieure à 50';
$lang['start_filter_local_mode_hint'] = '[local] afficher que les éléments récents'; $lang['flat_recent_cat_hint'] = 'affiche les éléments récents des catégories et des sous-catégories';
$lang['stop_filter_local_mode_hint'] = '[local] retourner à l\'affichage de tous les éléments'; $lang['start_filter_hint'] = 'afficher que les éléments récents';
$lang['start_filter_global_mode_hint'] = '[global] afficher que les éléments récents'; $lang['stop_filter_hint'] = 'retourner à l\'affichage de tous les éléments';
$lang['stop_filter_global_mode_hint'] = '[global] retourner à l\'affichage de tous les éléments';
$lang['mode_created_hint'] = 'afficher un calendrier par date de création'; $lang['mode_created_hint'] = 'afficher un calendrier par date de création';
$lang['mode_normal_hint'] = 'retourner à la vue normale'; $lang['mode_normal_hint'] = 'retourner à la vue normale';
$lang['mode_posted_hint'] = 'afficher un calendrier par date d\'ajout'; $lang['mode_posted_hint'] = 'afficher un calendrier par date d\'ajout';
@ -614,4 +613,6 @@ $lang['upload_username'] = 'Nom d\'utilisateur';
$lang['useful when password forgotten'] = 'utile en cas d\'oubli de mot de passe'; $lang['useful when password forgotten'] = 'utile en cas d\'oubli de mot de passe';
$lang['w_month'] = 'Mois'; $lang['w_month'] = 'Mois';
$lang['yes'] = 'Oui'; $lang['yes'] = 'Oui';
$lang['note_filter_day'] = 'L\'ensemble des éléments est filtré pour n\'afficher que les éléments récents de moins de %d jour.';
$lang['note_filter_days'] = 'L\'ensemble des éléments est filtré pour n\'afficher que les éléments récents de moins de %d jours.';
?> ?>

View file

@ -248,7 +248,15 @@ SELECT category_id,uppercats,commentable,global_rank
FROM '.IMAGE_CATEGORY_TABLE.' FROM '.IMAGE_CATEGORY_TABLE.'
INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id
WHERE image_id = '.$page['image_id'].' WHERE image_id = '.$page['image_id'].'
AND category_id NOT IN ('.$user['forbidden_categories'].') '.get_sql_condition_FandF
(
array
(
'forbidden_categories' => 'category_id',
'visible_categories' => 'category_id'
),
'AND'
).'
;'; ;';
$result = pwg_query($query); $result = pwg_query($query);
$related_categories = array(); $related_categories = array();

View file

@ -45,11 +45,16 @@ $query = '
SELECT DISTINCT(id) SELECT DISTINCT(id)
FROM '.IMAGES_TABLE.' FROM '.IMAGES_TABLE.'
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
'.( '.get_sql_condition_FandF
$user['forbidden_categories'] != '' (
? 'WHERE category_id NOT IN ('.$user['forbidden_categories'].')' array
: '' (
).' 'forbidden_categories' => 'category_id',
'visible_categories' => 'category_id',
'visible_images' => 'id'
),
'WHERE'
).'
ORDER BY RAND(NOW()) ORDER BY RAND(NOW())
LIMIT 0, '.$conf['top_number'].' LIMIT 0, '.$conf['top_number'].'
;'; ;';

View file

@ -187,11 +187,7 @@ $template->assign_vars(
) )
); );
$available_tags = get_available_tags( $available_tags = get_available_tags();
isset($user['forbidden_categories'])
? explode(',', $user['forbidden_categories'])
: null
);
if (count($available_tags) > 0) if (count($available_tags) > 0)
{ {
@ -213,13 +209,16 @@ if (count($available_tags) > 0)
//------------------------------------------------------------- categories form //------------------------------------------------------------- categories form
$query = ' $query = '
SELECT name,id,date_last,nb_images,global_rank,uppercats SELECT name,id,date_last,nb_images,global_rank,uppercats
FROM '.CATEGORIES_TABLE; FROM '.CATEGORIES_TABLE.'
if ($user['forbidden_categories'] != '') '.get_sql_condition_FandF
{ (
$query.= ' array
WHERE id NOT IN ('.$user['forbidden_categories'].')'; (
} 'forbidden_categories' => 'id',
$query.= ' 'visible_categories' => 'id'
),
'WHERE'
).'
;'; ;';
$selecteds = array(); $selecteds = array();

View file

@ -1,7 +1,16 @@
<?php <?php
$where = ( $user['forbidden_categories'] == '') ? '' : $where =
'ic.`category_id` NOT IN ('.$user['forbidden_categories'].')'; get_sql_condition_FandF
(
array
(
'forbidden_categories' => 'ic.category_id',
'visible_categories' => 'ic.category_id',
'visible_images' => 'i.id'
),
''
);
$list = implode(',', $final); $list = implode(',', $final);
if ( $where !== '' and $list !== '' ) if ( $where !== '' and $list !== '' )
{ {

View file

@ -73,7 +73,7 @@ $template->assign_vars(
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// find all tags available for the current user // find all tags available for the current user
$tags = get_available_tags(explode(',', $user['forbidden_categories'])); $tags = get_available_tags();
// we want only the first most represented tags, so we sort them by counter // we want only the first most represented tags, so we sort them by counter
// and take the first tags // and take the first tags

View file

@ -100,6 +100,20 @@ INPUT.rateButton, INPUT.rateButtonSelected, INPUT.rateButtonStarFull, INPUT.rate
padding: 1px; padding: 1px;
} }
/**
* Header notes box in public/administration
*/
.header_notes {
border: 1px solid #aaaaaa; /* border color and style */
text-align: center;
background-image: url(icon/note.png);
background-repeat: no-repeat;
background-position: top left;
font-weight: bold;
margin: 14px;
padding: 5px 00px 0px 0px;
}
LEGEND { LEGEND {
font-style: italic; font-style: italic;
} }

View file

@ -72,3 +72,10 @@ the "text/nonsense" prevents gecko based browsers to load it -->
</div> </div>
<!-- END header_msgs --> <!-- END header_msgs -->
<div id="theHeader">{PAGE_BANNER}</div> <div id="theHeader">{PAGE_BANNER}</div>
<!-- BEGIN header_notes -->
<div class="header_notes">
<!-- BEGIN header_note -->
<P>{header_notes.header_note.HEADER_NOTE}</p>
<!-- END header_note -->
</div>
<!-- END header_notes -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 B

After

Width:  |  Height:  |  Size: 360 B

Before After
Before After

BIN
template/yoga/icon/note.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

@ -27,16 +27,14 @@
<li><a href="{search_rules.URL}" style="border:none;" onclick="popuphelp(this.href); return false;" title="{lang:Search rules}"><img src="{pwg_root}{themeconf:icon_dir}/search_rules.png" class="button" alt="(?)"></a></li> <li><a href="{search_rules.URL}" style="border:none;" onclick="popuphelp(this.href); return false;" title="{lang:Search rules}"><img src="{pwg_root}{themeconf:icon_dir}/search_rules.png" class="button" alt="(?)"></a></li>
<!-- END search_rules --> <!-- END search_rules -->
<!-- BEGIN start_filter_local_mode -->
<li><a href="{start_filter_local_mode.URL}" title="{lang:start_filter_local_mode_hint}"><img src="{pwg_root}{themeconf:icon_dir}/start_filter_mode.png" class="button" alt="{lang:start_filter_local_mode_hint}"></a></li>
<!-- END start_filter_local_mode -->
<!-- BEGIN stop_filter_local_mode -->
<li><a href="{stop_filter_local_mode.URL}" title="{lang:stop_filter_local_mode_hint}"><img src="{pwg_root}{themeconf:icon_dir}/stop_filter_mode.png" class="button" alt="{lang:stop_filter_local_mode_hint}"></a></li>
<!-- END stop_filter_local_mode -->
<!-- BEGIN mode_normal --> <!-- BEGIN mode_normal -->
<li><a href="{mode_normal.URL}" title="{lang:mode_normal_hint}"><img src="{pwg_root}{themeconf:icon_dir}/normal_mode.png" class="button" alt="{lang:mode_normal_hint}"></a></li> <li><a href="{mode_normal.URL}" title="{lang:mode_normal_hint}"><img src="{pwg_root}{themeconf:icon_dir}/normal_mode.png" class="button" alt="{lang:mode_normal_hint}"></a></li>
<!-- END mode_normal --> <!-- END mode_normal -->
<!-- BEGIN flat_recent_cat -->
<li><a href="{flat_recent_cat.URL}" title="{lang:flat_recent_cat_hint}"><img src="{pwg_root}{themeconf:icon_dir}/flat_recent_cat.png" class="button" alt="{lang:flat_recent_cat_hint}"></a></li>
<!-- END flat_recent_cat -->
<!-- BEGIN mode_posted --> <!-- BEGIN mode_posted -->
<li><a href="{mode_posted.URL}" title="{lang:mode_posted_hint}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:mode_posted_hint}"></a></li> <li><a href="{mode_posted.URL}" title="{lang:mode_posted_hint}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:mode_posted_hint}"></a></li>
<!-- END mode_posted --> <!-- END mode_posted -->

View file

@ -13,12 +13,12 @@
</dl> </dl>
<!-- END links --> <!-- END links -->
<dl id="mbCategories"> <dl id="mbCategories">
<!-- BEGIN start_filter_global_mode --> <!-- BEGIN start_filter -->
<a href="{start_filter_global_mode.URL}" title="{lang:start_filter_global_mode_hint}"><img src="{pwg_root}{themeconf:icon_dir}/start_filter_mode.png" class="buttonmenu" alt="{lang:start_filter_global_mode_hint}"></a> <a href="{start_filter.URL}" title="{lang:start_filter_hint}"><img src="{pwg_root}{themeconf:icon_dir}/start_filter.png" class="buttonmenu" alt="{lang:start_filter_hint}"></a>
<!-- END start_filter_global_mode --> <!-- END start_filter -->
<!-- BEGIN stop_filter_global_mode --> <!-- BEGIN stop_filter -->
<a href="{stop_filter_global_mode.URL}" title="{lang:stop_filter_global_mode_hint}"><img src="{pwg_root}{themeconf:icon_dir}/stop_filter_mode.png" class="buttonmenu" alt="{lang:stop_filter_global_mode_hint}"></a> <a href="{stop_filter.URL}" title="{lang:stop_filter_hint}"><img src="{pwg_root}{themeconf:icon_dir}/stop_filter.png" class="buttonmenu" alt="{lang:stop_filter_hint}"></a>
<!-- END stop_filter_global_mode --> <!-- END stop_filter -->
<dt><a href="{U_HOME}">{lang:Categories}</a></dt> <dt><a href="{U_HOME}">{lang:Categories}</a></dt>
<dd> <dd>
{MENU_CATEGORIES_CONTENT} {MENU_CATEGORIES_CONTENT}

View file

@ -15,7 +15,7 @@ H2, #menubar DT, #imageHeaderBar, #imageToolBar A:hover, .row1 {
background-color: #d3d3d3; background-color: #d3d3d3;
} }
#menubar DL, #content, #imageToolBar { #menubar DL, #content, #imageToolBar, .header_notes {
background-color: #eeeeee; background-color: #eeeeee;
} }

View file

@ -26,7 +26,7 @@ H3, #the_page, #imageHeaderBar, #imageToolBar A:hover, .row1 {
background-color: #3f3f3f; background-color: #3f3f3f;
} }
#menubar DL, #content, #imageToolBar { #menubar DL, #content, #imageToolBar, .header_notes {
background-color: #5f5f5f; background-color: #5f5f5f;
} }

View file

@ -170,7 +170,17 @@ $ret_ids = array();
$query = ' $query = '
SELECT DISTINCT image_id SELECT DISTINCT image_id
FROM '.IMAGE_CATEGORY_TABLE.' FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id NOT IN ('.$user['forbidden_categories'].') WHERE
'.get_sql_condition_FandF
(
array
(
'forbidden_categories' => 'category_id',
'visible_categories' => 'category_id',
'visible_images' => 'image_id'
),
'', true
).'
AND image_id IN ('.$list.') AND image_id IN ('.$list.')
;'; ;';
$result = pwg_query($query); $result = pwg_query($query);
@ -389,7 +399,16 @@ $query='
AND i.`height` > 0 AND i.`height` > 0
AND i.`representative_ext` IS NULL AND i.`representative_ext` IS NULL
'.$cat_criterion.' '.$cat_criterion.'
AND c.`id` NOT IN ('.$user['forbidden_categories'].') '; '.get_sql_condition_FandF
(
array
(
'forbidden_categories' => 'c.id',
'visible_categories' => 'c.id',
'visible_images' => 'i.id'
),
'AND'
);
// AND c.`agreed_ws` = \'true\' (Obsolete specification replaced by force) // AND c.`agreed_ws` = \'true\' (Obsolete specification replaced by force)