<?
/*
PTK - DFLabs
Copyright (C) 2008 - DFLabs srl - All rights reserved
hide@address.com
*/
include("check_session.php");
include("check_session_image.php");
include("lib_commands.php");
include("lib_std.php");
include("loggerClass.php");
if (isset($_SESSION['key_token']) && strcmp($_SESSION['key_token'],$_GET['tk']) == 0){
$str = time().md5($_GET['string']);
$string = mysql_real_escape_string($_GET['string']);
$src_ascii = sanitize($_GET['src_ascii'],PARANOID);
$src_unicode = sanitize($_GET['src_unicode'],PARANOID);
$src_regexp = sanitize($_GET['src_regexp'],PARANOID);
$partition = partition_info($_SESSION['image_id']);
$case_s = sanitize($_GET['src_case'],PARANOID);
if($_SESSION['is_partitioned']==1){
for($i=0; $i<sizeof($partition);$i++){
$offset .= $_SESSION["partition".$i."_offset"]."|";
$part_id .= $_SESSION["partition".$i."_id"]."|";
}
}else{
$offset = 'null';
$part_id = $partition[0]['id'];
}
$part_id = preg_replace("/\,$/", "", $part_id);
$arr_live = get_live_search($_SESSION['image_path'],$offset,$string,$src_regexp,$case_s,$src_unicode,$src_ascii,$part_id);
?>
<p style="font-size:8pt; margin-bottom:0px; margin-left:30px">
<!--<img src="../img/select_all.png" style="vertical-align: middle"> If selected: <u style="cursor:pointer" onclick="goto_multiple_bookmarks_kw('<?=$str?>', 5, '<?=$part_id?>')">bookmark all</u><!-- | <u style="cursor:pointer">export all</u>-->
</p>
<table class="keyword" id="result_table">
<th><input type='checkbox' id='bookmark_all<?=$str?>' onclick="check_uncheck_all_kw('<?=$str?>')"></th><th><img title="bookmark selected files" id='starall' style="cursor:pointer" onclick="goto_multiple_bookmarks_kw('<?=$str?>', 5, '<?=$part_id?>')" src='../img/star.png'/></th><th>File name</th><th>Sector:offset</th><th> </th>
<?for($i=0;$i<sizeof($arr_live);$i++){
$offset = $arr_live[$i][4];
$filename = $arr_live[$i][2];
$filename = htmlspecialchars($filename);
$book_name = $arr_live[$i][0]."-".$arr_live[$i][1];
$bn = basename($book_name)." *** Keyword live: ".sanitize(RemoveXSS($string),PARANOID);
//$name = preg_replace("/\//", "_", $filename);
//$name = preg_replace("/^_/", "", $name);
//$n = preg_replace("/\(deleted\)/", "", $name);
$is_bookmark = check_bookmark($_SESSION['user'], $_SESSION['case_id'], $part_id, $arr_live[$i][0], 5, $bn);
if($arr_live[$i][5]){
$color = "FF0000";
}else{
$color = "000000";
}
if($odd){
?>
<tr style="color:<?=$color;?>" class="odd" onmouseover="showPanel('<?=$str.$i;?>')" onmouseout="hidePanel('<?=$str.$i;?>')">
<?}else{?>
<tr style="color:<?=$color;?>" onmouseover="showPanel('<?=$str.$i;?>')" onmouseout="hidePanel('<?=$str.$i;?>')">
<?}?>
<td style='text-align: center'><input type='checkbox' name='bookmark_it<?=$str?>' value='<?=$arr_live[$i][0]?>|<?=$bn?>'></td>
<?if($is_bookmark==0){?>
<td style='text-align: center'><img id='star<?=$arr_live[$i][0].$bn?>' src='../img/star_empty.png' style='cursor:pointer' onclick="displayMessage('modal_bookmark.php?arg1=5&arg2=<?=$arr_live[$i][0]?>&arg3=<?=$part_id?>&arg4=<?=$bn?>', '340', '250');return false"></td>
<?}else{?>
<td style='text-align: center'><img id='star<?=$arr_live[$i][0].$bn?>' src='../img/star.png' style='cursor:pointer' onclick="delete_bookmark('5', '<?=$arr_live[$i][0]?>', '<?=$part_id?>', '<?=$bn?>');"></td>
<?}?>
<td><?=htmlspecialchars($arr_live[$i][2]);?></td>
<td><?=$arr_live[$i][0].":".$arr_live[$i][1];?></td>
<td style='text-align: center; width: 60px'>
<div id='panel<?=$str.$i;?>' style='display:none'>
<img style='cursor:pointer' src='../img/file_info.png' title='Show file details' onclick="displayMessage('modal_live_search_info.php?arg1=<?=$_SESSION['image_path'];?>&arg2=<?=$arr_live[$i][4]?>&arg3=<?=$arr_live[$i][0]?>', '600', '450');return false">
<img style='cursor:pointer' src='../img/view_file.png' title='Show file content' onclick="displayMessage('modal_live_file_content.php?arg1=<?=$arr_live[$i][4];?>&arg2=<?=$arr_live[$i][0];?>', '800', '500'); return false">
<img style='cursor:pointer' src='../img/export.png' title='Export' onclick="window.location = 'export_sector.php?arg1=<?=$arr_live[$i][4];?>&arg2=<?=$arr_live[$i][0];?>&arg3=<?=''?>'">
</div>
</td>
</tr>
<?}?>
</table>
<?}else{
new AuditLog('Unauthorized access to get_live_search ');
header("location: goto_home.php");
}?>