rss locker + themes rss links updated
This commit is contained in:
parent
91e519fd96
commit
6e9d448e96
6 changed files with 44 additions and 31 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,3 +2,5 @@ photos/
|
|||
thumbs/
|
||||
db_feed_source
|
||||
db_old_files
|
||||
rss.locker
|
||||
new_files_list
|
||||
|
|
27
rss.php
27
rss.php
|
@ -69,38 +69,49 @@
|
|||
$to_store = "";
|
||||
// Init files
|
||||
if (!file_exists($old_files_list))
|
||||
{
|
||||
file_put_contents($old_files_list, "");
|
||||
}
|
||||
if (!file_exists($db_feed_source))
|
||||
{
|
||||
file_put_contents($db_feed_source, "");
|
||||
}
|
||||
|
||||
/*===================*/
|
||||
/*Computing*/
|
||||
/*===================*/
|
||||
#Todo : ajouter une condition : dois-je regénérer le flux ou utiliser les anciens fichiers ?
|
||||
$temp = file_get_contents($db_feed_source);
|
||||
|
||||
//If the RSS generation is already launched, don't do à second generation at the same time
|
||||
if (file_exists("rss.locker") == false)
|
||||
{
|
||||
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++) {
|
||||
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 = $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*/
|
||||
/*===================*/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<meta name="generator" content="MinigalNano <% version %>" />
|
||||
<title><% title %></title>
|
||||
<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" />
|
||||
<style type="text/css">
|
||||
|
@ -206,7 +206,7 @@
|
|||
<a href="https://github.com/sebsauvage/MinigalNano" title="Powered by MiniGal Nano" target="_blank">
|
||||
Powered by MiniGal Nano <% version %>
|
||||
</a> |
|
||||
<a title="<% title %> RSS" href="rss/">
|
||||
<a title="<% title %> RSS" href="rss.php">
|
||||
RSS
|
||||
</a>
|
||||
</footer>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<meta name="generator" content="MinigalNano <% version %>" />
|
||||
<title><% title %></title>
|
||||
<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" />
|
||||
<style type="text/css">
|
||||
|
@ -193,7 +193,7 @@
|
|||
<a href="http://tomcanac.com/minigal/" title="Tom Canac" target="_blank">
|
||||
Board theme by Tom Canac
|
||||
</a> /
|
||||
<a title="<% title %> RSS" href="rss/">
|
||||
<a title="<% title %> RSS" href="rss.php">
|
||||
RSS
|
||||
</a>
|
||||
</footer>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<meta name="generator" content="MinigalNano <% version %>" />
|
||||
<title><% title %></title>
|
||||
<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" />
|
||||
<style type="text/css">
|
||||
|
@ -209,7 +209,7 @@
|
|||
<a href="http://tomcanac.com/minigal/" title="Tom Canac" target="_blank">
|
||||
Rounded theme by Tom Canac
|
||||
</a> /
|
||||
<a title="<% title %> RSS" href="rss/">
|
||||
<a title="<% title %> RSS" href="rss.php">
|
||||
RSS
|
||||
</a>
|
||||
</footer>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<meta name="generator" content="MinigalNano <% version %>" />
|
||||
<title><% title %></title>
|
||||
<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" />
|
||||
<style type="text/css">
|
||||
|
@ -187,7 +187,7 @@
|
|||
<a href="http://tomcanac.com/minigal/" title="Tom Canac" target="_blank">
|
||||
Squares theme by Tom Canac
|
||||
</a> /
|
||||
<a title="<% title %> RSS" href="rss/">
|
||||
<a title="<% title %> RSS" href="rss.php">
|
||||
RSS
|
||||
</a>
|
||||
</footer>
|
||||
|
|
Loading…
Reference in a new issue