rss locker + themes rss links updated

This commit is contained in:
tmos 2014-05-04 16:02:31 +02:00
parent 91e519fd96
commit 6e9d448e96
6 changed files with 44 additions and 31 deletions

2
.gitignore vendored
View file

@ -2,3 +2,5 @@ photos/
thumbs/ thumbs/
db_feed_source db_feed_source
db_old_files db_old_files
rss.locker
new_files_list

57
rss.php
View file

@ -69,38 +69,49 @@
$to_store = ""; $to_store = "";
// Init files // Init files
if (!file_exists($old_files_list)) if (!file_exists($old_files_list))
{
file_put_contents($old_files_list, ""); file_put_contents($old_files_list, "");
}
if (!file_exists($db_feed_source)) if (!file_exists($db_feed_source))
{
file_put_contents($db_feed_source, ""); file_put_contents($db_feed_source, "");
}
/*===================*/ /*===================*/
/*Computing*/ /*Computing*/
/*===================*/ /*===================*/
#Todo : ajouter une condition : dois-je regénérer le flux ou utiliser les anciens fichiers ? #Todo : ajouter une condition : dois-je regénérer le flux ou utiliser les anciens fichiers ?
// Load the list from files.
$old_files_list_content = explode("\n", file_get_contents($old_files_list));
$new_files_list_content = explode("\n", $content); #debug
// Generate and stock new elements
$differences = diff($old_files_list_content, $new_files_list_content);
for ($i=0; $i < count($differences); $i++) {
if (is_array($differences[$i])){
for ($j=0; $j < count($differences[$i]["i"]); $j++) {
if (strlen($differences[$i]["i"][$j]) > 2)
$to_store .= $differences[$i]["i"][$j] . "\n";
}
}
}
//Add new elements at the top of the feed's source
$temp = file_get_contents($db_feed_source); $temp = file_get_contents($db_feed_source);
$temp = $to_store . $temp;
file_put_contents($db_feed_source, $temp); //If the RSS generation is already launched, don't do à second generation at the same time
if (file_exists("rss.locker") == false)
// Store the current file list for the next generation {
file_put_contents($old_files_list, $content); file_put_contents("rss.locker", "");
// Load the list from files.
$old_files_list_content = explode("\n", file_get_contents($old_files_list));
$new_files_list_content = explode("\n", $content); #debug
// Generate and stock new elements
$differences = diff($old_files_list_content, $new_files_list_content);
for ($i=0; $i < count($differences); $i++)
{
if (is_array($differences[$i]))
{
for ($j=0; $j < count($differences[$i]["i"]); $j++)
{
if (strlen($differences[$i]["i"][$j]) > 2)
{
$to_store .= $differences[$i]["i"][$j] . "\n";
}
}
}
}
//Add new elements at the top of the feed's source
$temp = $to_store . $temp;
file_put_contents($db_feed_source, $temp);
// Store the current file list for the next generation
file_put_contents($old_files_list, $content);
unlink("rss.locker");
}
/*===================*/ /*===================*/
/*XML Gen*/ /*XML Gen*/
/*===================*/ /*===================*/

View file

@ -6,7 +6,7 @@
<meta name="generator" content="MinigalNano <% version %>" /> <meta name="generator" content="MinigalNano <% version %>" />
<title><% title %></title> <title><% title %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="alternate" type="application/rss+xml" title="<% title %>" href="rss/" /> <link rel="alternate" type="application/rss+xml" title="<% title %>" href="rss.php" />
<link rel="stylesheet" href="<% gallery_root %>css/mediaboxWhite.css" type="text/css" media="screen" /> <link rel="stylesheet" href="<% gallery_root %>css/mediaboxWhite.css" type="text/css" media="screen" />
<style type="text/css"> <style type="text/css">
@ -206,7 +206,7 @@
<a href="https://github.com/sebsauvage/MinigalNano" title="Powered by MiniGal Nano" target="_blank"> <a href="https://github.com/sebsauvage/MinigalNano" title="Powered by MiniGal Nano" target="_blank">
Powered by MiniGal Nano <% version %> Powered by MiniGal Nano <% version %>
</a> | </a> |
<a title="<% title %> RSS" href="rss/"> <a title="<% title %> RSS" href="rss.php">
RSS RSS
</a> </a>
</footer> </footer>

View file

@ -6,7 +6,7 @@
<meta name="generator" content="MinigalNano <% version %>" /> <meta name="generator" content="MinigalNano <% version %>" />
<title><% title %></title> <title><% title %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="alternate" type="application/rss+xml" title="<% title %>" href="rss/" /> <link rel="alternate" type="application/rss+xml" title="<% title %>" href="rss.php" />
<link rel="stylesheet" href="<% gallery_root %>css/mediaboxWhite.css" type="text/css" media="screen" /> <link rel="stylesheet" href="<% gallery_root %>css/mediaboxWhite.css" type="text/css" media="screen" />
<style type="text/css"> <style type="text/css">
@ -193,7 +193,7 @@
<a href="http://tomcanac.com/minigal/" title="Tom Canac" target="_blank"> <a href="http://tomcanac.com/minigal/" title="Tom Canac" target="_blank">
Board theme by Tom Canac Board theme by Tom Canac
</a> / </a> /
<a title="<% title %> RSS" href="rss/"> <a title="<% title %> RSS" href="rss.php">
RSS RSS
</a> </a>
</footer> </footer>

View file

@ -6,7 +6,7 @@
<meta name="generator" content="MinigalNano <% version %>" /> <meta name="generator" content="MinigalNano <% version %>" />
<title><% title %></title> <title><% title %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="alternate" type="application/rss+xml" title="<% title %>" href="rss/" /> <link rel="alternate" type="application/rss+xml" title="<% title %>" href="rss.php" />
<link rel="stylesheet" href="<% gallery_root %>css/mediaboxWhite.css" type="text/css" media="screen" /> <link rel="stylesheet" href="<% gallery_root %>css/mediaboxWhite.css" type="text/css" media="screen" />
<style type="text/css"> <style type="text/css">
@ -209,7 +209,7 @@
<a href="http://tomcanac.com/minigal/" title="Tom Canac" target="_blank"> <a href="http://tomcanac.com/minigal/" title="Tom Canac" target="_blank">
Rounded theme by Tom Canac Rounded theme by Tom Canac
</a> / </a> /
<a title="<% title %> RSS" href="rss/"> <a title="<% title %> RSS" href="rss.php">
RSS RSS
</a> </a>
</footer> </footer>

View file

@ -6,7 +6,7 @@
<meta name="generator" content="MinigalNano <% version %>" /> <meta name="generator" content="MinigalNano <% version %>" />
<title><% title %></title> <title><% title %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="alternate" type="application/rss+xml" title="<% title %>" href="rss/" /> <link rel="alternate" type="application/rss+xml" title="<% title %>" href="rss.php" />
<link rel="stylesheet" href="<% gallery_root %>css/mediaboxWhite.css" type="text/css" media="screen" /> <link rel="stylesheet" href="<% gallery_root %>css/mediaboxWhite.css" type="text/css" media="screen" />
<style type="text/css"> <style type="text/css">
@ -187,7 +187,7 @@
<a href="http://tomcanac.com/minigal/" title="Tom Canac" target="_blank"> <a href="http://tomcanac.com/minigal/" title="Tom Canac" target="_blank">
Squares theme by Tom Canac Squares theme by Tom Canac
</a> / </a> /
<a title="<% title %> RSS" href="rss/"> <a title="<% title %> RSS" href="rss.php">
RSS RSS
</a> </a>
</footer> </footer>