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.
This commit is contained in:
manfromhuh 2022-07-27 20:08:55 -04:00
parent 32f7d23ee4
commit f80bc8dafa

View File

@ -5,6 +5,10 @@
echo "<article><h1 id=\"page_title\">Posts by Tag</h1></article>";
echo "<div id=\"search_inputs\"><input type=\"text\" id=\"tag_sort\" onkeyup=\"tag_search()\" placeholder=\"Search Tags...\" title=\"Type a tage to search\"><input id=\"search_toggle\" type=\"button\" value=\"Search Titles\" onclick=\"search_toggle()\"></div><!--End Div Search Inputs-->";
function read_tags($tags_file){
if (filesize($tags_vile) == 0){
echo "<br/>\n<br/>";
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');
?>