pub / kontra

Der linke Newsaggregator.
git clone src.jayvii.de/pub/kontra.git
Home | Log | Files | Exports | Refs | README | RSS

commit 5d05828a6f032a1fe4cead3ca847f152353d2dbc
parent 4205034e4cb7c84d6c2435f777621acb1c756324
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Wed, 18 Jun 2025 10:34:04 +0200

feat: name export file with more information

Diffstat:
Mindex.php | 30++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/index.php b/index.php @@ -31,9 +31,16 @@ ); } - /* Build OPML file */ + $exp_hash = md5(serialize($sources)); + $file_name = "kontra_" . date("Y-m-d") . "_" . $exp_hash . ".opml"; + + /* Set Download and content type headers */ header('Content-Type: application/xml; charset=UTF-8'); - header('Content-Disposition: Attachment;filename=kontra.opml'); + header( + 'Content-Disposition: Attachment;filename="' . $file_name . '"' + ); + + /* Build OPML file */ ?> <opml version="2.0"> @@ -44,14 +51,17 @@ <?php - /* Cycle through each source and write source entry */ - foreach ($sources as $source) { + /* Cycle through each source and write source entry */ + foreach ($sources as $source) { - /* Create category list */ - $categories = array(); - foreach ($source["categories"] as $category) { - array_push($categories, $config["categories"][$category]["name"]); - } + /* Create category list */ + $categories = array(); + foreach ($source["categories"] as $category) { + array_push( + $categories, + $config["categories"][$category]["name"] + ); + } ?> @@ -64,7 +74,7 @@ <?php - } // foreach-source + } // foreach-source ?>