frst rss draft

This commit is contained in:
Tom Canac 2014-02-25 10:24:36 +01:00
parent 7880ce7faa
commit 9df67440ae
5 changed files with 412 additions and 2 deletions

4
config.php Normal file → Executable file
View file

@ -37,6 +37,10 @@ $label_all = "All"; //Text used for link to display all images in one page
$label_noimages = "No images"; //Empty folder text
$label_loading = "Loading..."; //Thumbnail loading text
//RSS SETTINGS
$gallery_link = "http://localhost/work/fred";
$description = "Description of the John Doe Gallery";
$nb_items_rss = 25;
//ADVANCED SETTINGS
$thumb_size = 320; //Thumbnail height/width (square thumbs). Changing this will most likely require manual altering of the template file to make it look properly!
$label_max_length = 40; //Maximum chars of a folder name that will be displayed on the folder thumbnail

136
db_feed_source Normal file
View file

@ -0,0 +1,136 @@
http://localhost/work/fred/photos/interfaces/20131202-1602_tilling-gala.png
http://localhost/work/fred/photos/interfaces/20140119-0953_conky.png
http://localhost/work/fred/photos/animaux/20131218-0714_pars-polairejpg.jpg
http://localhost/work/fred/photos/animaux/20131211-2057_bisougif.gif
http://localhost/work/fred/photos/animaux/20131201-1101_fox.jpg
http://localhost/work/fred/photos/animaux/20131201-1104_macro.jpg
http://localhost/work/fred/photos/animaux/20140129-2255_birds.jpg
http://localhost/work/fred/photos/animaux/20140114-1611_syperain_flying_squirel.jpg
http://localhost/work/fred/photos/animaux/20131127-0818_foanjpg.jpg
http://localhost/work/fred/photos/animaux/20140114-1621_wolf.png
http://localhost/work/fred/photos/animaux/20131130-1340_foxypng.png
http://localhost/work/fred/photos/animaux/20131208-2240_renard.jpg
http://localhost/work/fred/photos/animaux/20140129-2302_fox.png
http://localhost/work/fred/photos/animaux/20131209-1834_fenec.jpg
http://localhost/work/fred/photos/animaux/20140114-1609_tumblr_biche_500.jpg
http://localhost/work/fred/photos/animaux/20131201-1110_owl.jpg
http://localhost/work/fred/photos/animaux/20131125-2147_faons.jpg
http://localhost/work/fred/photos/animaux/20131220-0710_tigre.jpg
http://localhost/work/fred/photos/animaux/20131201-1049_owl.jpg
http://localhost/work/fred/photos/animaux/20140114-1609_grizzly_bear.jpg
http://localhost/work/fred/photos/animaux/20131130-1340_squirell.jpg
http://localhost/work/fred/photos/animaux/20131219-0723_lapin.jpg
http://localhost/work/fred/photos/animaux/20140107-0841_tigre.jpg
http://localhost/work/fred/photos/animaux/20131221-1403_little-owl.jpg
http://localhost/work/fred/photos/animaux/20131219-1856_baby-owl.jpg
http://localhost/work/fred/photos/animaux/20140106-2250_wolfs.png
http://localhost/work/fred/photos/animaux/20140107-0840_owl2.gif
http://localhost/work/fred/photos/animaux/20131209-1834_renard2.jpg
http://localhost/work/fred/photos/animaux/20131215-1602_cuteness-overlod.jpg
http://localhost/work/fred/photos/animaux/20131126-0030_red-fox-shaking.jpg
http://localhost/work/fred/photos/animaux/20131218-0714_ours.jpg
http://localhost/work/fred/photos/animaux/20131201-1104_gecko.jpg
http://localhost/work/fred/photos/animaux/20140109-1820_dog.jpg
http://localhost/work/fred/photos/animaux/20131216-2124_lion.jpg
http://localhost/work/fred/photos/animaux/20140111-2215_cat-waking-up-gif.gif
http://localhost/work/fred/photos/animaux/20140106-2249_cat.jpg
http://localhost/work/fred/photos/animaux/20131125-2143_elan.png
http://localhost/work/fred/photos/animaux/20131201-1104_puppy-massacrejpg.jpg
http://localhost/work/fred/photos/animaux/20140107-0840_owl.jpg
http://localhost/work/fred/photos/animaux/20131214-1116_owl.jpg
http://localhost/work/fred/photos/animaux/20140114-1607_animaux.jpg
http://localhost/work/fred/photos/animaux/20140114-1609_tumblr_owl.png
http://localhost/work/fred/photos/animaux/20140114-1621_fox.jpg
http://localhost/work/fred/photos/animaux/20131218-0714_mouton.jpg
http://localhost/work/fred/photos/animaux/20131213-1834_ours.png
http://localhost/work/fred/photos/animaux/20131130-1339_herisson.jpg
http://localhost/work/fred/photos/animaux/20131215-1603_tigre.jpg
http://localhost/work/fred/photos/animaux/20140106-2250_fox.jpg
http://localhost/work/fred/photos/animaux/20131209-1834_renard1.jpg
http://localhost/work/fred/photos/animaux/20140106-2246_foxpng.png
http://localhost/work/fred/photos/animaux/20131214-1114_cow.jpg
http://localhost/work/fred/photos/animaux/20131218-0725_lapin.jpg
http://localhost/work/fred/photos/animaux/20131211-2120_dalma.gif
http://localhost/work/fred/photos/animaux/20131218-0713_renard.jpg
http://localhost/work/fred/photos/animaux/20131201-1102_firefox.jpg
http://localhost/work/fred/photos/animaux/20131126-2339_chouette.jpg
http://localhost/work/fred/photos/animaux/20131219-0725_biche.png
http://localhost/work/fred/photos/animaux/20131221-1403_owl.jpg
http://localhost/work/fred/photos/animaux/20131219-2152_cute-baby-owl.jpg
http://localhost/work/fred/photos/animaux/20131201-1052_pearycaribou.jpg
http://localhost/work/fred/photos/animaux/20140109-1820_dogs.jpg
http://localhost/work/fred/photos/animaux/20131201-1049_foxjpg.jpg
http://localhost/work/fred/photos/animaux/20140106-2246_tiger.png
http://localhost/work/fred/photos/animaux/20131209-1834_Renard3.jpg
http://localhost/work/fred/photos/animaux/20131130-1339_fox.png
http://localhost/work/fred/photos/animaux/20131211-2100_walk.jpg
http://localhost/work/fred/photos/animaux/20140114-1623_bears.jpg
http://localhost/work/fred/photos/animaux/20131213-1837_renard.gif
http://localhost/work/fred/photos/animaux/20131125-2148_tigre.jpg
http://localhost/work/fred/photos/animaux/20131220-0033_renard.jpg
http://localhost/work/fred/photos/animaux/20140114-1606_dancing_bear.jpg
http://localhost/work/fred/photos/animaux/20140106-2249_tiger.jpg
http://localhost/work/fred/photos/animaux/20140129-2303_bird.jpg
http://localhost/work/fred/photos/jeux/20140127-2111_Legend_of_Grimrock_2_screenshot_2.jpg
http://localhost/work/fred/photos/jeux/20140127-2111_Legend_of_Grimrock_2_screenshot_3.jpg
http://localhost/work/fred/photos/jeux/20140127-2112_LoG_2_logo_small.jpg
http://localhost/work/fred/photos/jeux/20140102-2047_grim.jpg
http://localhost/work/fred/photos/jeux/20140127-2111_Legend_of_Grimrock_2_screenshot_1.jpg
http://localhost/work/fred/photos/jeux/20140127-2111_Legend_of_Grimrock_2_screenshot_4.jpg
http://localhost/work/fred/photos/20131126-0018_luna.jpg
http://localhost/work/fred/photos/folder/20131125-2113_galaxy01.jpg
http://localhost/work/fred/photos/folder/20131126-0021_mars8.jpg
http://localhost/work/fred/photos/folder/20131125-2113_Saturne2013.jpg
http://localhost/work/fred/photos/folder/20131126-0018_luna.jpg
http://localhost/work/fred/photos/folder/20131126-0021_mars6.jpg
http://localhost/work/fred/photos/nature/20131219-0724_yukon.png
http://localhost/work/fred/photos/nature/20131125-1913_lake-tahoe-sierra-nevada-united-states.jpg
http://localhost/work/fred/photos/nature/20140112-1125_zion.jpg
http://localhost/work/fred/photos/nature/20131216-2124_fall.jpg
http://localhost/work/fred/photos/nature/20140119-0958_china-karst.jpg
http://localhost/work/fred/photos/nature/20140112-1124_nature.jpg
http://localhost/work/fred/photos/nature/20131216-2123_montagneux.jpg
http://localhost/work/fred/photos/nature/20140106-2245_volcano_500.png
http://localhost/work/fred/photos/nature/20131213-1836_bear.png
http://localhost/work/fred/photos/nature/20131125-1913_mountain.jpg
http://localhost/work/fred/photos/nature/20131125-1913_Mountain-Tianmen-National-Park-Zhangjiajie-Hunan-Province-China.jpg
http://localhost/work/fred/photos/nature/20131125-1913_volcano_02.png
http://localhost/work/fred/photos/nature/20131125-1913_Landwasser-Viaduct-Graubunden-Switzerland2.jpg
http://localhost/work/fred/photos/nature/20131125-1913_autumn_forest.jpg
http://localhost/work/fred/photos/nature/20131125-1913_switzerlan.jpg
http://localhost/work/fred/photos/nature/20131125-1913_water-fall.jpg
http://localhost/work/fred/photos/nature/20131125-1913_entwined.jpg
http://localhost/work/fred/photos/nature/20131126-2326_colorado.jpg
http://localhost/work/fred/photos/nature/20131125-1913_Landwasser-Viaduct-Graubunden-Switzerland4.jpeg
http://localhost/work/fred/photos/nature/20140114-1610_mountain.jpg
http://localhost/work/fred/photos/nature/20131125-1913_Landwasser-Viaduct-Graubunden-Switzerland5.jpg
http://localhost/work/fred/photos/nature/20140129-2259_indian-summer.jpg
http://localhost/work/fred/photos/nature/20131125-1913_biche.jpg
http://localhost/work/fred/photos/nature/20131216-2123_relief.jpg
http://localhost/work/fred/photos/nature/20140106-2250_fire.jpg
http://localhost/work/fred/photos/nature/20131125-1913_meteora_monastere.jpg
http://localhost/work/fred/photos/nature/20131216-2123_fluvial.jpg
http://localhost/work/fred/photos/nature/20140106-2246_dolomites.png
http://localhost/work/fred/photos/nature/20131125-1913_Landwasser-Viaduct-Graubunden-Switzerland3.jpg
http://localhost/work/fred/photos/nature/20140112-1125_zion3.jpg
http://localhost/work/fred/photos/nature/20131125-1913_lake_hd.jpg
http://localhost/work/fred/photos/nature/20140106-2248_sunpawatajpg.jpg
http://localhost/work/fred/photos/nature/20131125-1913_giant-tortoises-galpagos-island.jpg
http://localhost/work/fred/photos/nature/20131125-1913_heaven_sky.jpg
http://localhost/work/fred/photos/nature/20131125-1913_mountain.png
http://localhost/work/fred/photos/nature/20131126-2325_colorado.jpg
http://localhost/work/fred/photos/nature/20131126-2327_sky.jpg
http://localhost/work/fred/photos/nature/20140114-1623_volcane-and-lights.jpg
http://localhost/work/fred/photos/nature/20131201-1050_landscape.jpg
http://localhost/work/fred/photos/nature/20131125-1913_mountain_flowers.jpg
http://localhost/work/fred/photos/nature/20131221-1403_volcan.jpg
http://localhost/work/fred/photos/nature/20131125-1913_forest.jpg
http://localhost/work/fred/photos/nature/20131125-1913_volcano.jpg
http://localhost/work/fred/photos/nature/20131130-1339_etna.jpg
http://localhost/work/fred/photos/nature/20131125-1913_ecureuil.jpg
http://localhost/work/fred/photos/nature/20131125-1913_Autumn-Railway.png
http://localhost/work/fred/photos/nature/20131125-1913_lake.jpg
http://localhost/work/fred/photos/nature/20140114-1626_bird.jpg
http://localhost/work/fred/photos/nature/20131125-1913_Landwasser-Viaduct-Graubunden-Switzerland1.jpg
http://localhost/work/fred/photos/nature/20140129-2257_alpinism.jpg
http://localhost/work/fred/photos/nature/20131125-1913_bridge-mount-tai-china.jpg

136
db_old_files Normal file
View file

@ -0,0 +1,136 @@
http://localhost/work/fred/photos/interfaces/20131202-1602_tilling-gala.png
http://localhost/work/fred/photos/interfaces/20140119-0953_conky.png
http://localhost/work/fred/photos/animaux/20131218-0714_pars-polairejpg.jpg
http://localhost/work/fred/photos/animaux/20131211-2057_bisougif.gif
http://localhost/work/fred/photos/animaux/20131201-1101_fox.jpg
http://localhost/work/fred/photos/animaux/20131201-1104_macro.jpg
http://localhost/work/fred/photos/animaux/20140129-2255_birds.jpg
http://localhost/work/fred/photos/animaux/20140114-1611_syperain_flying_squirel.jpg
http://localhost/work/fred/photos/animaux/20131127-0818_foanjpg.jpg
http://localhost/work/fred/photos/animaux/20140114-1621_wolf.png
http://localhost/work/fred/photos/animaux/20131130-1340_foxypng.png
http://localhost/work/fred/photos/animaux/20131208-2240_renard.jpg
http://localhost/work/fred/photos/animaux/20140129-2302_fox.png
http://localhost/work/fred/photos/animaux/20131209-1834_fenec.jpg
http://localhost/work/fred/photos/animaux/20140114-1609_tumblr_biche_500.jpg
http://localhost/work/fred/photos/animaux/20131201-1110_owl.jpg
http://localhost/work/fred/photos/animaux/20131125-2147_faons.jpg
http://localhost/work/fred/photos/animaux/20131220-0710_tigre.jpg
http://localhost/work/fred/photos/animaux/20131201-1049_owl.jpg
http://localhost/work/fred/photos/animaux/20140114-1609_grizzly_bear.jpg
http://localhost/work/fred/photos/animaux/20131130-1340_squirell.jpg
http://localhost/work/fred/photos/animaux/20131219-0723_lapin.jpg
http://localhost/work/fred/photos/animaux/20140107-0841_tigre.jpg
http://localhost/work/fred/photos/animaux/20131221-1403_little-owl.jpg
http://localhost/work/fred/photos/animaux/20131219-1856_baby-owl.jpg
http://localhost/work/fred/photos/animaux/20140106-2250_wolfs.png
http://localhost/work/fred/photos/animaux/20140107-0840_owl2.gif
http://localhost/work/fred/photos/animaux/20131209-1834_renard2.jpg
http://localhost/work/fred/photos/animaux/20131215-1602_cuteness-overlod.jpg
http://localhost/work/fred/photos/animaux/20131126-0030_red-fox-shaking.jpg
http://localhost/work/fred/photos/animaux/20131218-0714_ours.jpg
http://localhost/work/fred/photos/animaux/20131201-1104_gecko.jpg
http://localhost/work/fred/photos/animaux/20140109-1820_dog.jpg
http://localhost/work/fred/photos/animaux/20131216-2124_lion.jpg
http://localhost/work/fred/photos/animaux/20140111-2215_cat-waking-up-gif.gif
http://localhost/work/fred/photos/animaux/20140106-2249_cat.jpg
http://localhost/work/fred/photos/animaux/20131125-2143_elan.png
http://localhost/work/fred/photos/animaux/20131201-1104_puppy-massacrejpg.jpg
http://localhost/work/fred/photos/animaux/20140107-0840_owl.jpg
http://localhost/work/fred/photos/animaux/20131214-1116_owl.jpg
http://localhost/work/fred/photos/animaux/20140114-1607_animaux.jpg
http://localhost/work/fred/photos/animaux/20140114-1609_tumblr_owl.png
http://localhost/work/fred/photos/animaux/20140114-1621_fox.jpg
http://localhost/work/fred/photos/animaux/20131218-0714_mouton.jpg
http://localhost/work/fred/photos/animaux/20131213-1834_ours.png
http://localhost/work/fred/photos/animaux/20131130-1339_herisson.jpg
http://localhost/work/fred/photos/animaux/20131215-1603_tigre.jpg
http://localhost/work/fred/photos/animaux/20140106-2250_fox.jpg
http://localhost/work/fred/photos/animaux/20131209-1834_renard1.jpg
http://localhost/work/fred/photos/animaux/20140106-2246_foxpng.png
http://localhost/work/fred/photos/animaux/20131214-1114_cow.jpg
http://localhost/work/fred/photos/animaux/20131218-0725_lapin.jpg
http://localhost/work/fred/photos/animaux/20131211-2120_dalma.gif
http://localhost/work/fred/photos/animaux/20131218-0713_renard.jpg
http://localhost/work/fred/photos/animaux/20131201-1102_firefox.jpg
http://localhost/work/fred/photos/animaux/20131126-2339_chouette.jpg
http://localhost/work/fred/photos/animaux/20131219-0725_biche.png
http://localhost/work/fred/photos/animaux/20131221-1403_owl.jpg
http://localhost/work/fred/photos/animaux/20131219-2152_cute-baby-owl.jpg
http://localhost/work/fred/photos/animaux/20131201-1052_pearycaribou.jpg
http://localhost/work/fred/photos/animaux/20140109-1820_dogs.jpg
http://localhost/work/fred/photos/animaux/20131201-1049_foxjpg.jpg
http://localhost/work/fred/photos/animaux/20140106-2246_tiger.png
http://localhost/work/fred/photos/animaux/20131209-1834_Renard3.jpg
http://localhost/work/fred/photos/animaux/20131130-1339_fox.png
http://localhost/work/fred/photos/animaux/20131211-2100_walk.jpg
http://localhost/work/fred/photos/animaux/20140114-1623_bears.jpg
http://localhost/work/fred/photos/animaux/20131213-1837_renard.gif
http://localhost/work/fred/photos/animaux/20131125-2148_tigre.jpg
http://localhost/work/fred/photos/animaux/20131220-0033_renard.jpg
http://localhost/work/fred/photos/animaux/20140114-1606_dancing_bear.jpg
http://localhost/work/fred/photos/animaux/20140106-2249_tiger.jpg
http://localhost/work/fred/photos/animaux/20140129-2303_bird.jpg
http://localhost/work/fred/photos/jeux/20140127-2111_Legend_of_Grimrock_2_screenshot_2.jpg
http://localhost/work/fred/photos/jeux/20140127-2111_Legend_of_Grimrock_2_screenshot_3.jpg
http://localhost/work/fred/photos/jeux/20140127-2112_LoG_2_logo_small.jpg
http://localhost/work/fred/photos/jeux/20140102-2047_grim.jpg
http://localhost/work/fred/photos/jeux/20140127-2111_Legend_of_Grimrock_2_screenshot_1.jpg
http://localhost/work/fred/photos/jeux/20140127-2111_Legend_of_Grimrock_2_screenshot_4.jpg
http://localhost/work/fred/photos/20131126-0018_luna.jpg
http://localhost/work/fred/photos/folder/20131125-2113_galaxy01.jpg
http://localhost/work/fred/photos/folder/20131126-0021_mars8.jpg
http://localhost/work/fred/photos/folder/20131125-2113_Saturne2013.jpg
http://localhost/work/fred/photos/folder/20131126-0018_luna.jpg
http://localhost/work/fred/photos/folder/20131126-0021_mars6.jpg
http://localhost/work/fred/photos/nature/20131219-0724_yukon.png
http://localhost/work/fred/photos/nature/20131125-1913_lake-tahoe-sierra-nevada-united-states.jpg
http://localhost/work/fred/photos/nature/20140112-1125_zion.jpg
http://localhost/work/fred/photos/nature/20131216-2124_fall.jpg
http://localhost/work/fred/photos/nature/20140119-0958_china-karst.jpg
http://localhost/work/fred/photos/nature/20140112-1124_nature.jpg
http://localhost/work/fred/photos/nature/20131216-2123_montagneux.jpg
http://localhost/work/fred/photos/nature/20140106-2245_volcano_500.png
http://localhost/work/fred/photos/nature/20131213-1836_bear.png
http://localhost/work/fred/photos/nature/20131125-1913_mountain.jpg
http://localhost/work/fred/photos/nature/20131125-1913_Mountain-Tianmen-National-Park-Zhangjiajie-Hunan-Province-China.jpg
http://localhost/work/fred/photos/nature/20131125-1913_volcano_02.png
http://localhost/work/fred/photos/nature/20131125-1913_Landwasser-Viaduct-Graubunden-Switzerland2.jpg
http://localhost/work/fred/photos/nature/20131125-1913_autumn_forest.jpg
http://localhost/work/fred/photos/nature/20131125-1913_switzerlan.jpg
http://localhost/work/fred/photos/nature/20131125-1913_water-fall.jpg
http://localhost/work/fred/photos/nature/20131125-1913_entwined.jpg
http://localhost/work/fred/photos/nature/20131126-2326_colorado.jpg
http://localhost/work/fred/photos/nature/20131125-1913_Landwasser-Viaduct-Graubunden-Switzerland4.jpeg
http://localhost/work/fred/photos/nature/20140114-1610_mountain.jpg
http://localhost/work/fred/photos/nature/20131125-1913_Landwasser-Viaduct-Graubunden-Switzerland5.jpg
http://localhost/work/fred/photos/nature/20140129-2259_indian-summer.jpg
http://localhost/work/fred/photos/nature/20131125-1913_biche.jpg
http://localhost/work/fred/photos/nature/20131216-2123_relief.jpg
http://localhost/work/fred/photos/nature/20140106-2250_fire.jpg
http://localhost/work/fred/photos/nature/20131125-1913_meteora_monastere.jpg
http://localhost/work/fred/photos/nature/20131216-2123_fluvial.jpg
http://localhost/work/fred/photos/nature/20140106-2246_dolomites.png
http://localhost/work/fred/photos/nature/20131125-1913_Landwasser-Viaduct-Graubunden-Switzerland3.jpg
http://localhost/work/fred/photos/nature/20140112-1125_zion3.jpg
http://localhost/work/fred/photos/nature/20131125-1913_lake_hd.jpg
http://localhost/work/fred/photos/nature/20140106-2248_sunpawatajpg.jpg
http://localhost/work/fred/photos/nature/20131125-1913_giant-tortoises-galpagos-island.jpg
http://localhost/work/fred/photos/nature/20131125-1913_heaven_sky.jpg
http://localhost/work/fred/photos/nature/20131125-1913_mountain.png
http://localhost/work/fred/photos/nature/20131126-2325_colorado.jpg
http://localhost/work/fred/photos/nature/20131126-2327_sky.jpg
http://localhost/work/fred/photos/nature/20140114-1623_volcane-and-lights.jpg
http://localhost/work/fred/photos/nature/20131201-1050_landscape.jpg
http://localhost/work/fred/photos/nature/20131125-1913_mountain_flowers.jpg
http://localhost/work/fred/photos/nature/20131221-1403_volcan.jpg
http://localhost/work/fred/photos/nature/20131125-1913_forest.jpg
http://localhost/work/fred/photos/nature/20131125-1913_volcano.jpg
http://localhost/work/fred/photos/nature/20131130-1339_etna.jpg
http://localhost/work/fred/photos/nature/20131125-1913_ecureuil.jpg
http://localhost/work/fred/photos/nature/20131125-1913_Autumn-Railway.png
http://localhost/work/fred/photos/nature/20131125-1913_lake.jpg
http://localhost/work/fred/photos/nature/20140114-1626_bird.jpg
http://localhost/work/fred/photos/nature/20131125-1913_Landwasser-Viaduct-Graubunden-Switzerland1.jpg
http://localhost/work/fred/photos/nature/20140129-2257_alpinism.jpg
http://localhost/work/fred/photos/nature/20131125-1913_bridge-mount-tai-china.jpg

134
rss.php Normal file
View file

@ -0,0 +1,134 @@
<?php
/*===================*/
/*Functions*/
/*===================*/
# Hardly inspired from here : codes-sources.commentcamarche.net/source/35937-creation-d-une-arborescenceI
# Listing all files of a folder and sub folders.
function ListFiles($gallery_link, &$content, $Folder, $SkipFileExts, $SkipObjects)
{
$dir = opendir($Folder);
while (false !== ($Current = readdir($dir))) // Loop on all contained on the folder
{
if ($Current !='.' && $Current != '..' && in_array($Current, $SkipObjects)===false)
{
if(is_dir($Folder.'/'.$Current)) // If the current element is a folder
{
ListFiles($gallery_link, $content, $Folder.'/'.$Current, $SkipFileExts, $SkipObjects); // Recursivity
}
else
{
$FileExt = strtolower(substr(strrchr($Current ,'.'),1));
if (in_array($FileExt, $SkipFileExts)===false) // Should we display this extension ?
$current_adress = $gallery_link . "/" . $Folder.'/'. $Current;
#debug echo "display current_adress : ". $current_adress . "<br>";
$content .= $current_adress. "\n";
}
}
}
closedir($dir);
return $content;
}
# Paul's Simple Diff Algorithm v 0.1 : http://paulbutler.org/archives/a-simple-diff-algorithm-in-php/
function diff($old, $new){
$matrix = array();
$maxlen = 0;
foreach($old as $oindex => $ovalue){
$nkeys = array_keys($new, $ovalue);
foreach($nkeys as $nindex){
$matrix[$oindex][$nindex] = isset($matrix[$oindex - 1][$nindex - 1]) ?
$matrix[$oindex - 1][$nindex - 1] + 1 : 1;
if($matrix[$oindex][$nindex] > $maxlen){
$maxlen = $matrix[$oindex][$nindex];
$omax = $oindex + 1 - $maxlen;
$nmax = $nindex + 1 - $maxlen;
}
}
}
if($maxlen == 0) return array(array('d'=>$old, 'i'=>$new));
return array_merge(
diff(array_slice($old, 0, $omax), array_slice($new, 0, $nmax)),
array_slice($new, $nmax, $maxlen),
diff(array_slice($old, $omax + $maxlen), array_slice($new, $nmax + $maxlen)));
}
function print_array($array_to_display) {
echo '<pre>';
print_r($array_to_display);
echo '</pre>';
}
/*===================*/
/*Variables*/
/*===================*/
require("config.php");
#$content = "";
$old_files_list = "db_old_files"; //list of files in ./photos
$new_files_list = "new_files_list";
$db_feed_source = "db_feed_source";
$Folder = 'photos';
$SkipExts = array('html', 'txt', 'php');
$SkipObjects = array('UnDossier', 'UnFichier');
$content = ListFiles($gallery_link, $content, $Folder, $SkipExts, $SkipObjects);
$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 ?
// 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 = $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);
/*===================*/
/*XML Gen*/
/*===================*/
$temp = explode("\n", $temp);
echo "
<rss version=\"2.0\">
<channel>
<title>".$title."</title>
<link>".$gallery_link."</link>
<description>".$description."</description>
";
for ($i=0; $i <= $nb_items_rss; $i++) {
echo
"<item>
<title>" . $temp[$i] . "</title>
<link>". $temp[$i] . "</link>
<description>
<![CDATA[ <img src=\"" . $temp[$i] . "\"> ]]>
</description>
</item>"
;
}
echo"
</channel>
</rss>
";
?>

View file

@ -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">
@ -191,7 +191,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>