[vscweb-commit] SF.net SVN: vscweb: [461] branches/vsc-2.0/Main/tpl
Brought to you by:
cirrusrex
|
From: <cir...@us...> - 2006-08-06 06:25:20
|
Revision: 461 Author: cirrusrex Date: 2006-08-05 23:25:13 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/vscweb/?rev=461&view=rev Log Message: ----------- Added preliminary support for downloading reports, also removed print-view option from report select page. Reporting system is still horribly broken. Modified Paths: -------------- branches/vsc-2.0/Main/Host/Scan/include/libscan.inc branches/vsc-2.0/Main/Host/Scan/scan_viewer.php branches/vsc-2.0/Main/tpl/Host_Scan-scan_proc-scan_report.tpl branches/vsc-2.0/Main/tpl/Reports/single_scan_controls.tpl branches/vsc-2.0/Main/tpl/Reports/single_scan_csv.tpl Modified: branches/vsc-2.0/Main/Host/Scan/include/libscan.inc =================================================================== --- branches/vsc-2.0/Main/Host/Scan/include/libscan.inc 2006-08-04 20:22:05 UTC (rev 460) +++ branches/vsc-2.0/Main/Host/Scan/include/libscan.inc 2006-08-06 06:25:13 UTC (rev 461) @@ -39,6 +39,7 @@ $SCAN_format_opts = array('text', 'html','csv'); +$SCAN_format_exts = array('text'=>'txt', 'html'=>'html', 'fhtml'=>'html', 'csv'=>'csv'); $SCAN_scope_opts = array('any','info','hole'); $SCAN_mode_opts = array('diff', 'single'); $SCAN_OPTS_FORMAT = array('text'=>"Text", 'html'=>'HTML', 'fhtml'=>'Fancy HTML', 'csv'=>'CSV'); Modified: branches/vsc-2.0/Main/Host/Scan/scan_viewer.php =================================================================== --- branches/vsc-2.0/Main/Host/Scan/scan_viewer.php 2006-08-04 20:22:05 UTC (rev 460) +++ branches/vsc-2.0/Main/Host/Scan/scan_viewer.php 2006-08-06 06:25:13 UTC (rev 461) @@ -22,6 +22,7 @@ $input[] = "format"; $input[] = "print_view"; $input[] = "scope"; +$input[] = "action"; $i =& new CORE_FormInput($input); SESSION_PDATA_Register("scan_id", $i->scan_id); @@ -210,27 +211,40 @@ } -UI_Header(); +if (in_array($i->action, array("View Report", "Update"))) { + /* display report */ + UI_Header(); -UI_Form(); + UI_Form(); -$smarty->assign('scan_id', $i->scan_id); -$smarty->assign('report_host', $i->report_host); -$smarty->assign('format', $i->format); -$smarty->assign('print_view', $i->print_view); -$smarty->assign('format_opts', $SCAN_OPTS_FORMAT); -$smarty->assign('scope_opts', $SCAN_OPTS_SCOPE); -$smarty->assign('scope', $i->scope); -$smarty->assign('mode', $i->mode); -$smarty->assign('diff_id', $i->diff_id); -$smarty->display('single_scan_controls.tpl'); -echo "<hr>"; + $smarty->assign('scan_id', $i->scan_id); + $smarty->assign('report_host', $i->report_host); + $smarty->assign('format', $i->format); + $smarty->assign('print_view', $i->print_view); + $smarty->assign('format_opts', $SCAN_OPTS_FORMAT); + $smarty->assign('scope_opts', $SCAN_OPTS_SCOPE); + $smarty->assign('scope', $i->scope); + $smarty->assign('mode', $i->mode); + $smarty->assign('diff_id', $i->diff_id); + $smarty->display('single_scan_controls.tpl'); + echo "<hr>"; -$report_data['print_view'] = false; -$smarty->assign('result_data', $report_data); -if ($i->format == 'text') echo "<pre>"; -$smarty->display("{$i->mode}_scan_{$i->format}.tpl"); -if ($i->format == 'text') echo "</pre>"; -UI_Footer(); + $report_data['print_view'] = false; + $smarty->assign('result_data', $report_data); + if (in_array($i->format, array('text', 'csv'))) echo "<pre>"; + $smarty->display("{$i->mode}_scan_{$i->format}.tpl"); + if (in_array($i->format, array('text', 'csv'))) echo "</pre>"; + UI_Footer(); +} else { + /* download report */ + $smarty->assign('result_data', $report_data); + $output = $smarty->fetch("{$i->mode}_scan_{$i->format}.tpl"); + $output_len = strlen($output); + header("Content-length: $output_len"); + header("Content-type: application/octet-stream"); + header("Content-Disposition: attachment; filename=".$i->scan_id."-report.".$SCAN_format_exts[$i->format]); + print $output; +} + ?> Modified: branches/vsc-2.0/Main/tpl/Host_Scan-scan_proc-scan_report.tpl =================================================================== --- branches/vsc-2.0/Main/tpl/Host_Scan-scan_proc-scan_report.tpl 2006-08-04 20:22:05 UTC (rev 460) +++ branches/vsc-2.0/Main/tpl/Host_Scan-scan_proc-scan_report.tpl 2006-08-06 06:25:13 UTC (rev 461) @@ -107,18 +107,21 @@ </select> </td> </tr> - <tr> + <!--tr> <td style='font-size: 10px;'> Print View </td> <td style='font-size: 10px;'> <input type='checkbox' name='print_view' value='yes'> </td> - </tr> + </tr--> <tr> - <td colspan='2' style='font-size: 10px;'> - <input type='submit' value='View Report'> + <td style='font-size: 10px;'> + <input type='submit' name='action' value='View Report'> </td> + <td style='font-size: 10px;'> + <input type='submit' name='action' value='Download Report'> + </td> </tr> </table> {/if} Modified: branches/vsc-2.0/Main/tpl/Reports/single_scan_controls.tpl =================================================================== --- branches/vsc-2.0/Main/tpl/Reports/single_scan_controls.tpl 2006-08-04 20:22:05 UTC (rev 460) +++ branches/vsc-2.0/Main/tpl/Reports/single_scan_controls.tpl 2006-08-06 06:25:13 UTC (rev 461) @@ -32,9 +32,12 @@ </td> <td align='right'>Print View On</td> <td><input type='checkbox' name='print_view' value='yes' {if $print_view == "yes"}checked="checked"{/if}></td> - <td align=left' colspan='2'> - <input type='submit' value='Update'> + <td align=left'> + <input type='submit' name='action' value='Update'> </td> + <td align=left'> + <input type='submit' name='action' value='Download'> + </td> </tr> </table> </form> Modified: branches/vsc-2.0/Main/tpl/Reports/single_scan_csv.tpl =================================================================== --- branches/vsc-2.0/Main/tpl/Reports/single_scan_csv.tpl 2006-08-04 20:22:05 UTC (rev 460) +++ branches/vsc-2.0/Main/tpl/Reports/single_scan_csv.tpl 2006-08-06 06:25:13 UTC (rev 461) @@ -1,8 +1,6 @@ -<pre> "IP Address", "Hostname", "Plugin ID", "Port Info", "Family", "Risk Factor", "Description" {foreach name=hostid item=hostd from=$result_data.hosts} {foreach item=vuln from=$hostd.results} {$hostd.address},{$host.dns_name},{$vuln.plugin_id},{$vuln.prot}/{$vuln.port} {$vuln.service},{$vuln.family},{$vuln.severity},"{$vuln.body|replace:"\"":"'"|replace:"\n":" "}" {/foreach} {/foreach} -</pre> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |