Permalink
Browse files

Bug 1736 fixed : Complete RSS Feed returns error

start or end dates can be null

git-svn-id: http://piwigo.org/svn/trunk@6597 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information...
nikrou
nikrou committed Jun 24, 2010
1 parent e1ecc62 commit 3aaa5b2dfd3434e62d4116cba48853c8293a7f78
Showing with 57 additions and 19 deletions.
  1. +57 −19 include/functions_notification.inc.php
@@ -71,40 +71,78 @@ function custom_notification_query($action, $type, $start, $end)
$query = '
FROM '.COMMENTS_TABLE.' AS c
, '.IMAGE_CATEGORY_TABLE.' AS ic
WHERE c.image_id = ic.image_id
AND c.validation_date > \''.$start.'\'
AND c.validation_date <= \''.$end.'\'
'.get_std_sql_where_restrict_filter('AND').'
WHERE c.image_id = ic.image_id';
if (!empty($start))
{
$query .= '
AND c.validation_date > \''.$start.'\'';
}
if (!empty($end))
{
$query .= '
AND c.validation_date <= \''.$end.'\'';
}
$query .= get_std_sql_where_restrict_filter('AND').'
;';
break;
case 'unvalidated_comments':
$query = '
FROM '.COMMENTS_TABLE.'
WHERE date> \''.$start.'\' AND date <= \''.$end.'\'
AND validated = \'false\'
WHERE 1=1';
if (!empty($start))
{
$query .= ' AND date> \''.$start.'\'';
}
if (!empty($end))
{
$query .= ' AND date <= \''.$end.'\'';
}
$query .= ' AND validated = \'false\'
;';
break;
case 'new_elements':
$query = '
FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON image_id = id
WHERE date_available > \''.$start.'\'
AND date_available <= \''.$end.'\'
'.get_std_sql_where_restrict_filter('AND', 'id').'
WHERE 1=1';
if (!empty($start))
{
$query .= ' AND date_available > \''.$start.'\'';
}
if (!empty($end))
{
$query .= ' AND date_available <= \''.$end.'\'';
}
$query .= get_std_sql_where_restrict_filter('AND', 'id').'
;';
break;
case 'updated_categories':
$query = '
FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON image_id = id
WHERE date_available > \''.$start.'\'
AND date_available <= \''.$end.'\'
'.get_std_sql_where_restrict_filter('AND', 'id').'
WHERE 1=1';
if (!empty($start))
{
$query .= ' AND date_available > \''.$start.'\'';
}
if (!empty($end))
{
$query .= ' AND date_available <= \''.$end.'\'';
}
$query .= get_std_sql_where_restrict_filter('AND', 'id').'
;';
break;
case 'new_users':
$query = '
FROM '.USER_INFOS_TABLE.'
WHERE registration_date > \''.$start.'\'
AND registration_date <= \''.$end.'\'
WHERE 1=1';
if (!empty($start))
{
$query .= ' AND registration_date > \''.$start.'\'';
}
if (!empty($end))
{
$query .= ' AND registration_date <= \''.$end.'\'';
}
$query .= '
;';
break;
case 'waiting_elements':
@@ -458,10 +496,10 @@ function get_recent_post_dates($max_dates, $max_elements, $max_cats)
if ($max_elements>0)
{ // get some thumbnails ...
$query = '
SELECT DISTINCT id, path, name, tn_ext, file
SELECT id, path, name, tn_ext, file
FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id
'.$where_sql.'
AND date_available="'.$dates[$i]['date_available'].'"
AND date_available=\''.$dates[$i]['date_available'].'\'
AND tn_ext IS NOT NULL
ORDER BY '.DB_RANDOM_FUNCTION.'()
LIMIT '.$max_elements.'
@@ -477,12 +515,12 @@ function get_recent_post_dates($max_dates, $max_elements, $max_cats)
if ($max_cats>0)
{// get some categories ...
$query = '
SELECT DISTINCT c.uppercats, COUNT(DISTINCT i.id) img_count
SELECT c.uppercats, COUNT(DISTINCT i.id) img_count
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
'.$where_sql.'
AND date_available="'.$dates[$i]['date_available'].'"
GROUP BY category_id
AND date_available=\''.$dates[$i]['date_available'].'\'
GROUP BY category_id, c.uppercats
ORDER BY img_count DESC
LIMIT '.$max_cats.'
;';

0 comments on commit 3aaa5b2

Please sign in to comment.