From 2e30aa481ec8c2773ce054acd39ea5ad377a638e Mon Sep 17 00:00:00 2001 From: Zachary Vance Date: Sat, 7 May 2022 21:57:26 -0400 Subject: [PATCH 1/2] Remove stderr warning message which prints in server log Fixes #18 --- index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/index.php b/index.php index e1313ac..39fee72 100644 --- a/index.php +++ b/index.php @@ -246,6 +246,7 @@ function file_put_contents($n, $d) $page = DEFAULT_PAGE; $filename = PAGES_PATH . "/$page.txt"; +$text = ""; if ( file_exists($filename) ) { From 0c09630fbcb345594bec8366e050e76783f7949c Mon Sep 17 00:00:00 2001 From: Zachary Vance Date: Sat, 7 May 2022 22:11:53 -0400 Subject: [PATCH 2/2] Colorize links to unwritten articles This is a form of dead link detection, called "red links" in MediaWiki. Links to unwritten articles are displayed in another color (red). This makes it easy for wiki authors to spot articles which need written without clicking through, or spelling errors. --- index.css | 4 ++++ index.php | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/index.css b/index.css index 4443f61..3225c4d 100644 --- a/index.css +++ b/index.css @@ -149,6 +149,10 @@ a.tool { color: #eeeeee; } +a.missing-link { + color: #ba0000; +} + input.tool { font-size: 11px; color: #000000; diff --git a/index.php b/index.php index 39fee72..4b4d5fe 100644 --- a/index.php +++ b/index.php @@ -84,7 +84,13 @@ function _handle_links($match) { - return "" . htmlentities($match[1]) . ""; + $link_page = $match[1]; + $link_filename = PAGES_PATH . "/$link_page.txt"; + $link_page_exists = file_exists($link_filename); + if ($link_page_exists) + return "" . htmlentities($link_page) . ""; + else + return "" . htmlentities($link_page) . ""; }