User:CSteipp (WMF)/Training/VulnTagging easy

WARNING: This is a vulnerable script for demonstration. Don't use it!

setHook( 'vtag', 'wfAddTags' ); return true; }

function wfAddTags( $input, $argv, $parser ) { $articleId = $parser->getTitle->getArticleID;

if ( isset( $argv['articleid'] ) ) { $articleId = $argv['articleid']; }

$dbr = wfGetDB( DB_SLAVE );

$res = $dbr->select(		'vulntags',		array( 'vt_tid', 'vt_tag_text' ),		array( "vt_article_id = $articleId" ),		__METHOD__	);

$tags = array;

foreach ( $res as $tag ) { $tags[] = "vt_tid."'>".$tag->vt_tag_text.""; }

return "". implode( "\n", $tags ). ""; }