<?php
/*
PTK - DFLabs
Copyright (C) 2008 - DFLabs srl - All rights reserved
hide@address.com
*/
include("check_session.php");
include("lib_std.php");
include("sanitize.php");
include("loggerClass.php");
if (isset($_SESSION['user']) && strcmp($_SESSION['user'],"admin")==0){
$id = sanitize($_GET['id'],INT);
$image = image_info($id);
$partition = partition_info($id);
$case_name = case_name_from_id($image['id_case']);
$operations = $partition[0]['performed_operations'];
if(preg_match("/TML(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $operations, $o)){
$date_timeline = $o[1]."-".$o[2]."-".$o[3]." ".$o[4].":".$o[5].":".$o[6];
}
if(preg_match("/TYP(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $operations, $o)){
$date_filetype = $o[1]."-".$o[2]."-".$o[3]." ".$o[4].":".$o[5].":".$o[6];
}
if(preg_match("/MD5(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $operations, $o)){
$date_md5 = $o[1]."-".$o[2]."-".$o[3]." ".$o[4].":".$o[5].":".$o[6];
}
if(preg_match("/SH1(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $operations, $o)){
$date_sha1 = $o[1]."-".$o[2]."-".$o[3]." ".$o[4].":".$o[5].":".$o[6];
}
if(preg_match("/KYW(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $operations, $o)){
$date_keyword = $o[1]."-".$o[2]."-".$o[3]." ".$o[4].":".$o[5].":".$o[6];
}
if($partition[0]['is_partition']==1){
for($i=0; $i<sizeof($partition); $i++){
$offset .= $partition[$i]['offset']."|";
$part_id .= $partition[$i]['id']."|";
$time_zone .= $partition[$i]['timezone']."|";
}
}else{
$offset = 'null';
$part_id = $partition[0]['id'];
$time_zone = $partition[0]['timezone'];
}
?>
<img src='../img/progress.gif' class="progress" id="progress">
<img src='../img/indexing.png' style='float:left'>
<b style="float:left"> Image indexing operations</b><img id="close_box" style="float:right; cursor: pointer" src="../img/cancel.png" onclick="window.location = 'goto_home.php?id=1'">
<br><hr>
<b>Case: </b><?=$case_name;?>
<br>
<b>Image: </b><?=$image['name'];?>
<br>
<br>
<table class='indexing' style="width: 100%">
<th>Operation</th><th>Performed on</th>
<?if($date_timeline!=''){?>
<tr><td style="width: 200px"> Timeline generation</td><td id="date_timeline"><?= $date_timeline;?></td></tr>
<?}else{?>
<tr><td style="width: 200px"><input type="checkbox" id="indx_timeline"> Timeline generation</td><td id="date_timeline"></td></tr>
<?}?>
<?if($date_filetype!=''){?>
<tr><td style="width: 200px"> File type</td><td id="date_filetype"><?= $date_filetype;?></td></tr>
<?}else{?>
<tr><td style="width: 200px"><input type="checkbox" id="indx_filetype"> File type</td><td id="date_filetype"></td></tr>
<?}?>
<?if($date_md5!=''){?>
<tr><td style="width: 200px"> MD5</td><td id="date_md5"><?= $date_md5;?></td></tr>
<?}else{?>
<tr><td style="width: 200px"><input type="checkbox" id="indx_md5"> MD5</td><td id="date_md5"></td></tr>
<?}?>
<?if($date_sha1!=''){?>
<tr><td style="width: 200px"> SHA1</td><td id="date_sha1"><?= $date_sha1;?></td></tr>
<?}else{?>
<tr><td style="width: 200px"><input type="checkbox" id="indx_sha1"> SHA1</td><td id="date_sha1"></td></tr>
<?}?>
<?if($date_keyword!=''){?>
<tr><td style="width: 200px"> Keyword</td><td id="date_keyword"><?= $date_keyword;?></td></tr>
<?}else{?>
<tr><td style="width: 200px"><input type="checkbox" id="indx_keyword"> Keyword</td><td id="date_keyword"></td></tr>
<?}?>
</table>
<br>
<button style="float:right" onclick="get_indexing('<?=$image['image_path'];?>', '<?=$offset;?>', '<?=$part_id;?>','<?=$time_zone;?>')"> Start </button>
<button style="float:right; margin-right: 10px; display: none" onclick="window.location = 'goto_home.php?id=1'" id="close_button"> Close </button>
<?}else{
new AuditLog('Unauthorized access to get_indexing');
header("location: goto_home.php");
}?>