merge -r 2158 from branch-1_7 to trunk

fix: in page_header.php U_HOME template var was overwriting the ones from every page -> now it is always make_index_url
fix: unvalidated comments use start end for RSS instead of end only (otherwise google reader creates a new item every time it downloads the feed)

git-svn-id: http://piwigo.org/svn/trunk@2159 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices 2007-11-01 23:08:27 +00:00
parent 279f14eff9
commit 711018af5e
2 changed files with 14 additions and 26 deletions

View file

@ -29,7 +29,7 @@
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
/* /*
* get standard sql where in order to * get standard sql where in order to
* restict an filter caregories and images * restict an filter caregories and images
* *
* IMAGE_CATEGORY_TABLE muste named ic in the query * IMAGE_CATEGORY_TABLE muste named ic in the query
@ -83,9 +83,8 @@ function custom_notification_query($action, $type, $start, $end)
case 'unvalidated_comments': case 'unvalidated_comments':
$query = ' $query = '
FROM '.COMMENTS_TABLE.' FROM '.COMMENTS_TABLE.'
WHERE date <= \''.$end.'\' WHERE date> \''.$start.'\' AND date <= \''.$end.'\'
AND (validated = \'false\' AND validated = \'false\'
OR validation_date > \''.$end.'\')
;'; ;';
break; break;
case 'new_elements': case 'new_elements':
@ -226,26 +225,15 @@ function new_comments($start, $end)
* *
* Comments that are registered and not validated yet on a precise date * Comments that are registered and not validated yet on a precise date
* *
* @param string date (mysql datetime format) * @param string start (mysql datetime format)
* @param string end (mysql datetime format)
* @return count comment ids * @return count comment ids
*/ */
function nb_unvalidated_comments($date) function nb_unvalidated_comments($start, $end)
{ {
return custom_notification_query('count', 'unvalidated_comments', $date, $date); return custom_notification_query('count', 'unvalidated_comments', $start, $end);
} }
/**
* unvalidated at a precise date
*
* Comments that are registered and not validated yet on a precise date
*
* @param string date (mysql datetime format)
* @return array comment ids
*/
function unvalidated_comments($date)
{
return custom_notification_query('info', 'unvalidated_comments', $start, $end);
}
/** /**
* new elements between two dates, according to authorized categories * new elements between two dates, according to authorized categories
@ -362,7 +350,7 @@ function news_exists($start, $end)
(nb_new_comments($start, $end) > 0) or (nb_new_comments($start, $end) > 0) or
(nb_new_elements($start, $end) > 0) or (nb_new_elements($start, $end) > 0) or
(nb_updated_categories($start, $end) > 0) or (nb_updated_categories($start, $end) > 0) or
((is_admin()) and (nb_unvalidated_comments($end) > 0)) or ((is_admin()) and (nb_unvalidated_comments($start, $end) > 0)) or
((is_admin()) and (nb_new_users($start, $end) > 0)) or ((is_admin()) and (nb_new_users($start, $end) > 0)) or
((is_admin()) and (nb_waiting_elements() > 0)) ((is_admin()) and (nb_waiting_elements() > 0))
); );
@ -424,7 +412,7 @@ function news($start, $end, $exclude_img_cats=false, $add_url=false)
if (is_admin()) if (is_admin())
{ {
add_news_line( $news, add_news_line( $news,
nb_unvalidated_comments($end), '%d comment to validate', '%d comments to validate', nb_unvalidated_comments($start, $end), '%d comment to validate', '%d comments to validate',
get_root_url().'admin.php?page=comments', $add_url ); get_root_url().'admin.php?page=comments', $add_url );
add_news_line( $news, add_news_line( $news,
@ -513,9 +501,9 @@ SELECT DISTINCT c.uppercats, COUNT(DISTINCT i.id) img_count
} }
/* /*
Call function get_recent_post_dates but Call function get_recent_post_dates but
the parameters to be passed to the function, as an indexed array. the parameters to be passed to the function, as an indexed array.
*/ */
function get_recent_post_dates_array($args) function get_recent_post_dates_array($args)
{ {
@ -538,7 +526,7 @@ function get_html_description_recent_post_date($date_detail)
global $conf; global $conf;
$description = ''; $description = '';
$description .= $description .=
'<li>' '<li>'
.l10n_dec('%d new element', '%d new elements', $date_detail['nb_elements']) .l10n_dec('%d new element', '%d new elements', $date_detail['nb_elements'])

View file

@ -53,7 +53,7 @@ $template->assign_vars(
'TAG_INPUT_ENABLED' => 'TAG_INPUT_ENABLED' =>
((is_adviser()) ? 'disabled onclick="return false;"' : ''), ((is_adviser()) ? 'disabled onclick="return false;"' : ''),
'U_HOME' => get_absolute_root_url(), 'U_HOME' => make_index_url(),
)); ));
// picture header infos // picture header infos
@ -103,4 +103,4 @@ header('Content-Type: text/html; charset='.get_pwg_charset());
$template->parse('header'); $template->parse('header');
trigger_action('loc_after_page_header'); trigger_action('loc_after_page_header');
?> ?>