Skip to content

Commit 74100f6

Browse files
committed
using markdown parser
1 parent d0e6d74 commit 74100f6

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

instructions.php

+13-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
define( 'DVWA_WEB_PAGE_TO_ROOT', '' );
44
require_once DVWA_WEB_PAGE_TO_ROOT . 'dvwa/includes/dvwaPage.inc.php';
5+
require_once DVWA_WEB_PAGE_TO_ROOT . 'dvwa/includes/Parsedown.php';
56

67
dvwaPageStartup( array( 'phpids' ) );
78

@@ -10,11 +11,11 @@
1011
$page[ 'page_id' ] = 'instructions';
1112

1213
$docs = array(
13-
'readme' => array( 'legend' => 'Read Me', 'file' => 'README.md' ),
14-
'PDF' => array( 'legend' => 'PDF Guide', 'file' => 'docs/pdf.html' ),
15-
'changelog' => array( 'legend' => 'Change Log', 'file' => 'CHANGELOG.md' ),
16-
'copying' => array( 'legend' => 'Copying', 'file' => 'COPYING.txt' ),
17-
'PHPIDS-license' => array( 'legend' => 'PHPIDS License', 'file' => DVWA_WEB_PAGE_TO_PHPIDS . 'LICENSE' ),
14+
'readme' => array( 'type' => 'markdown', 'legend' => 'Read Me', 'file' => 'README.md' ),
15+
'PDF' => array( 'type' => 'html' ,'legend' => 'PDF Guide', 'file' => 'docs/pdf.html' ),
16+
'changelog' => array( 'type' => 'markdown', 'legend' => 'Change Log', 'file' => 'CHANGELOG.md' ),
17+
'copying' => array( 'type' => 'markdown', 'legend' => 'Copying', 'file' => 'COPYING.txt' ),
18+
'PHPIDS-license' => array( 'type' => 'markdown', 'legend' => 'PHPIDS License', 'file' => DVWA_WEB_PAGE_TO_PHPIDS . 'LICENSE' ),
1819
);
1920

2021
$selectedDocId = isset( $_GET[ 'doc' ] ) ? $_GET[ 'doc' ] : '';
@@ -25,6 +26,12 @@
2526

2627
$instructions = file_get_contents( DVWA_WEB_PAGE_TO_ROOT.$readFile );
2728

29+
if ($docs[ $selectedDocId ]['type'] == "markdown") {
30+
$parsedown = new ParseDown();
31+
$instructions = $parsedown->text($instructions);
32+
}
33+
34+
/*
2835
function urlReplace( $matches ) {
2936
return dvwaExternalLinkUrlGet( $matches[1] );
3037
}
@@ -37,7 +44,7 @@ function urlReplace( $matches ) {
3744
);
3845
3946
$instructions = nl2br( $instructions );
40-
47+
*/
4148
$docMenuHtml = '';
4249
foreach( array_keys( $docs ) as $docId ) {
4350
$selectedClass = ( $docId == $selectedDocId ) ? ' selected' : '';

0 commit comments

Comments
 (0)