mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-09 18:23:18 +02:00
RSS feed improvements:
- send 404 when feed id missing/unknown - added a guid element for each feed item (make the difference between 2 different 0/1 items - they have the same link element) - don't update last_check unless some news are available - new images/updated albums removed from the 0/1 feed item - added 5 different feed items for new images/updated albums (generated by grouping post date) with more information, thumbnails and links git-svn-id: http://piwigo.org/svn/trunk@1549 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -127,7 +127,7 @@ function custom_notification_query($action, $type, $start, $end)
|
||||
'.$query;
|
||||
list($count) = mysql_fetch_array(pwg_query($query));
|
||||
return $count;
|
||||
|
||||
|
||||
break;
|
||||
case 'info':
|
||||
switch($type)
|
||||
@@ -152,12 +152,12 @@ function custom_notification_query($action, $type, $start, $end)
|
||||
break;
|
||||
}
|
||||
|
||||
$query = 'SELECT distinct '.implode(', ', $fields).'
|
||||
$query = 'SELECT distinct '.implode(', ', $fields).'
|
||||
'.$query;
|
||||
$result = pwg_query($query);
|
||||
|
||||
$infos = array();
|
||||
|
||||
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
array_push($infos, $row);
|
||||
@@ -344,6 +344,22 @@ function news_exists($start, $end)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a news line and adds it to the array (e.g. '5 new elements')
|
||||
*/
|
||||
function add_news_line(&$news, $count, $format, $url='', $add_url=false)
|
||||
{
|
||||
if ($count > 0)
|
||||
{
|
||||
$line = sprintf($format, $count);
|
||||
if ($add_url and !empty($url) )
|
||||
{
|
||||
$line = '<a href="'.$url.'">'.$line.'</a>';
|
||||
}
|
||||
array_push($news, $line);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* What's new between two dates ?
|
||||
*
|
||||
@@ -354,58 +370,51 @@ function news_exists($start, $end)
|
||||
*
|
||||
* @param string start date (mysql datetime format)
|
||||
* @param string end date (mysql datetime format)
|
||||
* @param bool exclude_img_cats if true, no info about new images/categories
|
||||
* @param bool add_url add html A link around news
|
||||
*
|
||||
* @return array of news
|
||||
*/
|
||||
function news($start, $end)
|
||||
function news($start, $end, $exclude_img_cats=false, $add_url=false)
|
||||
{
|
||||
$news = array();
|
||||
|
||||
$nb_new_comments = nb_new_comments($start, $end);
|
||||
if ($nb_new_comments > 0)
|
||||
if (!$exclude_img_cats)
|
||||
{
|
||||
array_push($news, sprintf(l10n('%d new comments'), $nb_new_comments));
|
||||
$nb_new_elements = nb_new_elements($start, $end);
|
||||
if ($nb_new_elements > 0)
|
||||
{
|
||||
array_push($news, sprintf(l10n('%d new elements'), $nb_new_elements));
|
||||
}
|
||||
}
|
||||
|
||||
$nb_new_elements = nb_new_elements($start, $end);
|
||||
if ($nb_new_elements > 0)
|
||||
if (!$exclude_img_cats)
|
||||
{
|
||||
array_push($news, sprintf(l10n('%d new elements'), $nb_new_elements));
|
||||
$nb_updated_categories = nb_updated_categories($start, $end);
|
||||
if ($nb_updated_categories > 0)
|
||||
{
|
||||
array_push($news, sprintf(l10n('%d categories updated'),
|
||||
$nb_updated_categories));
|
||||
}
|
||||
}
|
||||
|
||||
$nb_updated_categories = nb_updated_categories($start, $end);
|
||||
if ($nb_updated_categories > 0)
|
||||
{
|
||||
array_push($news, sprintf(l10n('%d categories updated'),
|
||||
$nb_updated_categories));
|
||||
}
|
||||
|
||||
add_news_line( $news,
|
||||
nb_new_comments($start, $end), l10n('%d new comments'),
|
||||
get_root_url().'comments.php', $add_url );
|
||||
|
||||
if (is_admin())
|
||||
{
|
||||
$nb_unvalidated_comments = nb_unvalidated_comments($end);
|
||||
if ($nb_unvalidated_comments > 0)
|
||||
{
|
||||
array_push($news, sprintf(l10n('%d comments to validate'),
|
||||
$nb_unvalidated_comments));
|
||||
}
|
||||
add_news_line( $news,
|
||||
nb_unvalidated_comments($end), l10n('%d comments to validate'),
|
||||
get_root_url().'admin.php?page=comments', $add_url );
|
||||
|
||||
$nb_new_users = nb_new_users($start, $end);
|
||||
if ($nb_new_users > 0)
|
||||
{
|
||||
array_push($news, sprintf(l10n('%d new users'), $nb_new_users));
|
||||
}
|
||||
add_news_line( $news,
|
||||
nb_new_users($start, $end), l10n('%d new users'),
|
||||
PHPWG_ROOT_PATH.'admin.php?page=user_list', $add_url );
|
||||
|
||||
$nb_waiting_elements = nb_waiting_elements();
|
||||
if ($nb_waiting_elements > 0)
|
||||
{
|
||||
array_push(
|
||||
$news,
|
||||
sprintf(
|
||||
l10n('%d waiting elements'),
|
||||
$nb_waiting_elements
|
||||
)
|
||||
);
|
||||
}
|
||||
add_news_line( $news,
|
||||
nb_waiting_elements(), l10n('%d waiting elements'),
|
||||
PHPWG_ROOT_PATH.'admin.php?page=waiting', $add_url );
|
||||
}
|
||||
|
||||
return $news;
|
||||
|
||||
Reference in New Issue
Block a user