Revision | 40 (tree) |
---|---|
Time | 2021-06-30 17:04:27 |
Author | mateuszviste |
welcome message is markdown-processed as well (like articles)
@@ -4,7 +4,7 @@ | ||
4 | 4 | ****************************************************************************** |
5 | 5 | |
6 | 6 | ver xxxxxxxx |
7 | - - articles are filtered through a markdown processor, allows for nicer styles | |
7 | + - articles and welcome message are filtered through a markdown processor | |
8 | 8 | - authentication form features a cancel link |
9 | 9 | - format and language of timestamps are configurable |
10 | 10 | - title string is properly htmlized (special characters escaped) |
@@ -135,6 +135,12 @@ | ||
135 | 135 | return(array_reverse($r)); |
136 | 136 | } |
137 | 137 | |
138 | + function markdownoutput($md) { | |
139 | + $Parsedown = new Parsedown(); | |
140 | + $Parsedown->setBreaksEnabled(true); | |
141 | + echo $Parsedown->text($md) . "\n"; | |
142 | + } | |
143 | + | |
138 | 144 | // ustaw locale dla generowania dat |
139 | 145 | setlocale(LC_TIME, $DATELOCALE); |
140 | 146 |
@@ -212,7 +218,7 @@ | ||
212 | 218 | } |
213 | 219 | |
214 | 220 | if (($p == 0) && (empty($action))) { |
215 | - readfile("welcome.txt"); | |
221 | + markdownoutput(file_get_contents('welcome.txt')); | |
216 | 222 | } else if ($action === 'nowywpis') { |
217 | 223 | echo "<p>Édition</p>\n"; |
218 | 224 | } else if ($action === 'login') { |
@@ -308,9 +314,7 @@ | ||
308 | 314 | } |
309 | 315 | echo "<h2>{$artcontent[0]}</h2>\n"; |
310 | 316 | echo '<h3>' . strftime($TIMESTAMPFORMAT, $art) . "</h3>\n"; |
311 | - $Parsedown = new Parsedown(); | |
312 | - $Parsedown->setBreaksEnabled(true); | |
313 | - echo $Parsedown->text($artcontent[1]) . "\n"; | |
317 | + markdownoutput($artcontent[1]); | |
314 | 318 | // mamy jakieś załączniki? (nie zdjęcia) |
315 | 319 | $lista_plikow = ListaPlikow($art, 2); |
316 | 320 | if (!empty($lista_plikow)) { |
@@ -1,3 +1,3 @@ | ||
1 | -<p>Welcome to ptiblogphp! This is a default welcome message. You should modify it by editing the welcome.txt file.</p> | |
1 | +Welcome to ptiblogphp! This is a default welcome message. You should modify it by editing the welcome.txt file. | |
2 | 2 | |
3 | -<p>This file contains HTML, so you may use all kinds of HTML constructs like <span style="font-style: italic; font-weight: bold; color: red;">special font effects</span>, <a href="http://ptiblogphp.osdn.io">cool links</a> or <span title="hello, I am a popup message" style="text-decoration: underline wavy;">other fancy stuff</span>.</p> | |
3 | +This file uses the markdown syntax, so you may use all kinds of markdown constructs like ***special font effects*** or [cool links](http://ptiblogphp.osdn.io). You may also use inline HTML for any <span title="hello, I am a popup message" style="text-decoration: underline wavy;">other fancy stuff</span>. |