From f80bc8dafa26be7d6b8d01ffcb53a31430f7e878 Mon Sep 17 00:00:00 2001 From: manfromhuh Date: Wed, 27 Jul 2022 20:08:55 -0400 Subject: [PATCH] File permissions change, check for non-zero tags.csv for issue #9 The tags index.php file now checks for the tags.csv to be non-zero as well as existing. Updated the permission of the generated tags.csv file to allow the CMS to updated it with out requiring root/sudo permissions. --- blog/by_tag/index.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/blog/by_tag/index.php b/blog/by_tag/index.php index 65945cd..9966a89 100755 --- a/blog/by_tag/index.php +++ b/blog/by_tag/index.php @@ -5,6 +5,10 @@ echo "

Posts by Tag

"; echo "
"; function read_tags($tags_file){ + if (filesize($tags_vile) == 0){ + echo "
\n
"; + return; + } $tags_csv = array_map('str_getcsv', file('tags.csv')); $tags_rows = sizeof($tags_csv); $tags_coloums = sizeof($tags_csv[0]); @@ -49,6 +53,8 @@ $empty_csv = fopen("tags.csv", "w") or die("Cannot write new tags.csv file."); fwrite($empty_csv, ""); fclose($empty_csv); + chmod('./tags.csv', 0666); + read_tags('tags.csv'); } include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/footer.php'); ?>