Commit 32f3e849 authored by Jason Frisvold's avatar Jason Frisvold
Browse files

- Dynamically create directory for gpg keys

- Remove link for report 4, not created yet
parent d9294d87
......@@ -89,6 +89,7 @@
});
// Raw XML report output
$app->get('/rawreport/:id', $isauthenticated(), function ($id) use ($app) {
global $smarty_data, $skynet_data_dir, $skynet_gpg_cmd;
......@@ -98,12 +99,20 @@
->where('id', $id)
->first();
//datadir/year/month/day
// Generate absolute path to gpg file
$scantime = localtime($result['start_time'], TRUE);
$gpgfile = $skynet_data_dir . '/' . ($scantime['tm_year'] + 1900) . '/' . ($scantime['tm_mon'] + 1) . '/' . $scantime['tm_mday'] . '/' . $result['filename'];
$cmd = $skynet_gpg_cmd . ' --batch --no-tty --decrypt --no-default-keyring --keyring /Users/xenophage/Code/skynet/gui/app/key.pub --secret-keyring /Users/xenophage/Code/skynet/gui/app/key.sec ' . $gpgfile;
$gpgfile = $skynet_data_dir . '/' . ($scantime['tm_year'] + 1900) . '/' .
($scantime['tm_mon'] + 1) . '/' . $scantime['tm_mday'] . '/' .
$result['filename'];
// Generate full gpg command and execute it
$cmd = $skynet_gpg_cmd . ' --batch --no-tty --decrypt ' .
'--no-default-keyring --keyring ' . $_SERVER['DOCUMENT_ROOT'] .
'/../app/key.pub ' . '--secret-keyring ' .
$_SERVER['DOCUMENT_ROOT'] . '/../app/key.sec ' . $gpgfile;
exec($cmd, $output, $returnval);
// Remove the top two lines, nixing the xml declarations
unset($output[0]);
unset($output[1]);
$smarty_data['output'] = $output;
......@@ -115,7 +124,7 @@
prep_smarty($app);
$app->render('rawreport.tpl', $smarty_data);
});
});
$app->get('/resultlist/:cid/:tid/:sid', $isauthenticated(),
function ($cid, $tid, $sid) use ($app) {
......
......@@ -55,10 +55,9 @@
{/if}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Reports <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="/resultsum">Results Summary</a></li>
<li><a href="/resultlist">Raw Results List</a></li>
<li><a href="/resultminmax">Min/Max Results</a></li>
<li><a href="/resultsum">Results Summary</a></li>
<li><a href="/report4">Report 4</a></li>
</ul>
</li>
{/if}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment