From 60cc244595d0052fefbf7eb83e9519dd50ed9ba9 Mon Sep 17 00:00:00 2001 From: Lucas Cimon Date: Tue, 30 Dec 2014 16:05:25 +0100 Subject: [PATCH 1/4] Fixing unescaped . in the file extension detection regex --- index.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index 94cf65b..bbdf879 100755 --- a/index.php +++ b/index.php @@ -312,16 +312,16 @@ if (is_dir($currentdir) && $handle = opendir($currentdir)) { } // Other filetypes $extension = ""; - if (preg_match("/.pdf$/i", $file)) $extension = "PDF"; // PDF - if (preg_match("/.zip$/i", $file)) $extension = "ZIP"; // ZIP archive - if (preg_match("/.rar$|.r[0-9]{2,}/i", $file)) $extension = "RAR"; // RAR Archive - if (preg_match("/.tar$/i", $file)) $extension = "TAR"; // TARball archive - if (preg_match("/.gz$/i", $file)) $extension = "GZ"; // GZip archive - if (preg_match("/.doc$|.docx$/i", $file)) $extension = "DOCX"; // Word - if (preg_match("/.ppt$|.pptx$/i", $file)) $extension = "PPTX"; //Powerpoint - if (preg_match("/.xls$|.xlsx$/i", $file)) $extension = "XLXS"; // Excel - if (preg_match("/.ogv$|.mp4$|.mpg$|.mpeg$|.mov$|.avi$|.wmv$|.flv$|.webm$/i", $file)) $extension = "VIDEO"; // video files - if (preg_match("/.aiff$|.aif$|.wma$|.aac$|.flac$|.mp3$|.ogg$|.m4a$/i", $file)) $extension = "AUDIO"; // audio files + if (preg_match("/\.pdf$/i", $file)) $extension = "PDF"; // PDF + if (preg_match("/\.zip$/i", $file)) $extension = "ZIP"; // ZIP archive + if (preg_match("/\.rar$|\.r[0-9]{2,}/i", $file)) $extension = "RAR"; // RAR Archive + if (preg_match("/\.tar$/i", $file)) $extension = "TAR"; // TARball archive + if (preg_match("/\.gz$/i", $file)) $extension = "GZ"; // GZip archive + if (preg_match("/\.doc$|\.docx$/i", $file)) $extension = "DOCX"; // Word + if (preg_match("/\.ppt$|\.pptx$/i", $file)) $extension = "PPTX"; //Powerpoint + if (preg_match("/\.xls$|\.xlsx$/i", $file)) $extension = "XLXS"; // Excel + if (preg_match("/\.ogv$|\.mp4$|\.mpg$|\.mpeg$|\.mov$|\.avi$|\.wmv$|\.flv$|\.webm$/i", $file)) $extension = "VIDEO"; // video files + if (preg_match("/\.aiff$|\.aif$|\.wma$|\.aac$|\.flac$|\.mp3$|\.ogg$|\.m4a$/i", $file)) $extension = "AUDIO"; // audio files if ($extension != "") { $files[] = array( From a108d8da78206416bba49c1d61dd1ba53cd2e143 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 22 Dec 2014 07:37:38 +0100 Subject: [PATCH 2/4] rss: declare UTF-8 charset --- rss.php | 1 + 1 file changed, 1 insertion(+) diff --git a/rss.php b/rss.php index a3083cc..917ff71 100644 --- a/rss.php +++ b/rss.php @@ -153,6 +153,7 @@ if (is_writeable(".")) { /* XML Gen */ /*===================*/ $temp = explode("\n", $content); +echo "\n"; echo "\n"; echo "$title"; echo "$gallery_link"; From 65c0ce6233195d3bf82f441df1e7ef775a5ca570 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 22 Dec 2014 07:54:09 +0100 Subject: [PATCH 3/4] rss: set content-type to xml * Work on https://github.com/sebsauvage/MinigalNano/issues/48 --- rss.php | 1 + 1 file changed, 1 insertion(+) diff --git a/rss.php b/rss.php index 917ff71..c13ec02 100644 --- a/rss.php +++ b/rss.php @@ -152,6 +152,7 @@ if (is_writeable(".")) { /*===================*/ /* XML Gen */ /*===================*/ +header('Content-Type: text/xml'); $temp = explode("\n", $content); echo "\n"; echo "\n"; From 6f32ce1202f0d8020eac82abadcdd176b4f46bac Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 22 Dec 2014 08:02:23 +0100 Subject: [PATCH 4/4] rss: add guid element for each item Work on https://github.com/sebsauvage/MinigalNano/issues/48 --- rss.php | 1 + 1 file changed, 1 insertion(+) diff --git a/rss.php b/rss.php index c13ec02..b9fbe75 100644 --- a/rss.php +++ b/rss.php @@ -165,6 +165,7 @@ for ($i=0; $i < $nb_items_rss && $i < count($temp); $i++) { echo "\n"; echo " " . basename($temp[$i]) . "\n"; echo " ". $temp[$i] . "\n"; + echo " ". $temp[$i] . "\n"; echo " ]]>\n"; echo "\n"; }