scanner/modules/output_text.php

28 lines
636 B
PHP
Raw Permalink Normal View History

<?php
class TextOutput extends OutputModule {
function write( $filename ) {
global $faults;
$output = fopen( $filename, 'w' );
if( $output === false ) {
err( "Cannot write to $filename\n" );
return false;
}
foreach( $faults as $fault ) {
fprintf( $output, "%s\t%d\t%s\t%d\t%s\t%d\t%s\n",
$fault['module'],
$fault['level'],
$fault['object']['file'],
$fault['object']['line'],
!empty( $fault['author'] ) ? $fault['author'] : '?',
!empty( $fault['revision'] ) ? $fault['revision'] : '0',
$fault['reason']
);
}
fclose( $output );
return true;
}
}
addModule( new TextOutput() );
?>