Location: PHPKode > projects > Ptk-forensics > ptk/lib/get_folder_gallery.php
<?
/*
PTK  - DFLabs
Copyright (C) 2008 - DFLabs srl - All rights reserved
hide@address.com
*/
include("check_session.php");
include("lib_commands.php");
include("lib_std.php");
include("loggerClass.php");

$token = sanitize($_GET['tk'],PARANOID);
$offset = sanitize($_GET['arg1'],INT);
$inode = sanitize($_GET['arg2'],PARANOID);
$inode_folder = $inode;
$tz = preg_replace("/[^a-zA-Z0-9\/\_\-\+\|]/", "", $_GET['arg4']);
$partition = sanitize($_GET['arg3'],INT);
if ($_SESSION['listall']=='true'){
        $listall="-r";
}else{
        $listall="";
}
$output = get_folder_content($_SESSION['image_path'], $offset, $inode,$tz,$listall);
$lines = explode("\n", $output);
$img = array();
$j=0; $tot=0;
for($i=0;$i<$_SESSION['len_partitions'];$i++){
	$partition_id .= $_SESSION["partition".$i."_id"].",";
}
$partition_id = preg_replace("/\,$/", "", $partition_id);
?>

<div id="image_div" style="margin-top:50px">

<table class="gallery">
<?
unset($_SESSION['folder_token']);
$fol_token = md5(uniqid(rand(), TRUE));
$_SESSION['folder_token'] = $fol_token;

foreach($lines as $line){
	preg_match("/(\S{3})\s(\*?)\s?(\S+):\s([^\t]*)\t(\S{10}\s\S{8}\s\(\S+\))\s(\S{10}\s\S{8}\s\(\S+\))\s(\S{10}\s\S{8}\s\(\S+\))\s(\S{10}\s\S{8}\s\(\S+\))\s(\d*)\s(\d*)\s(\d*)/", $line, $arr);
	$name = $arr[4];

	$name = preg_replace("/^\//", "", $name);
        $name = preg_replace("/\'/", "", $name);

	$bn = basename($name);
	
	$bn = urlencode($bn);
	$nm = $name;
	$nm = urlencode($nm);
	$nm1 = $name;
	$nm1 = preg_replace("/\//", "", $nm1);
	$inode = $arr[3];
	$permissions = $arr[1];
	$uid = $arr[10];
	$gid = $arr[11];
	$size = $arr[9];
	$accessed = $arr[5]; $acc = $arr[5];
	$written = $arr[6]; $wri = $arr[6];
	$changed = $arr[7]; $cha = $arr[7];
	$birth = $arr[8]; $bir = $arr[8];
	$file = file_info($inode, $name);
	$is_bookmark = check_bookmark($_SESSION['user'], $_SESSION['case_id'], $partition_id, $inode, 3, '');
	$result = get_file_type($_SESSION['image_path'], $offset, $inode);
	if(preg_match("/(image data)|(PC bitmap data)/", $result)){
		$tot +=1;
		$j += 1;
		if($j==0) echo "<tr>";
		?>		
		<td onmouseover="showDiv('panel<?=$offset."#".$inode;?>')" onmouseout="hideDiv('panel<?=$offset."#".$inode;?>')">			
			<div id="panel<?=$offset."#".$inode;?>" class="gallery_panel" style="display:none">
			<?
			echo "<img style='cursor:pointer' src='../img/file_info.png' title='Show file details' onclick=\"displayMessage('modal_file_info.php?arg1=$inode&arg2=$permissions&arg3=$wri&arg4=$acc&arg5=$cha&arg6=$bir&arg7=$size&arg8=$uid&arg9=$gid&arg10=$nm', '600', '400');return false\">";
			echo "<img style='cursor:pointer' src='../img/view_file.png' title='Show file content' onclick=\"displayMessage('modal_file_content.php?arg1=$offset&arg2=$inode&arg3=".urlencode($name)."', '800', '500');return false\">";
			echo "<img style='cursor:pointer' src='../img/export.png' title='Export' onclick=\"window.location = 'export_file.php?arg1=$offset&arg2=$inode&arg3=$nm';\">";
			?>
			</div>		
			<a id="picture" href="picture.php?offset=<?=$offset;?>&inode=<?=$inode;?>&name=img" class="menu" target="blank">
			<img class="gallery" src="picture.php?offset=<?=$offset;?>&inode=<?=$inode;?>&name=img">			
			</a>
			<br>
			<?
			echo "<input type='checkbox' name='bookmark_it' value='$inode|$bn'>";				
			if($is_bookmark==0){
				echo "<img id='star$inode' src='../img/star_empty.png' style='cursor:pointer' onclick=\"displayMessage('modal_bookmark.php?arg1=3&arg2=$inode&arg3=$partition&arg4=$bn', '340', '250');return false\">";
			}else{
				echo "<img id='star$inode' src='../img/star.png' style='cursor:pointer' onclick=\"delete_bookmark('3', '$inode', '$partition', '$bn');\">";				
			}		
			echo "&nbsp;";
			echo $name;
			?>
		</td>
		<?
		if($j==6){
			echo "</tr>";
			$j=0;
		}
	}	
}
if($tot==0) echo "<br><br>No graphic files.";
?>
</table>

<p class='gallery_info'>
	<?if($tot>0){?>
		<input type='checkbox' id='bookmark_all' onclick="check_uncheck_all()"> Select all
		 | 
		If selected: <u style="cursor:pointer" onclick="goto_multiple_bookmarks(3, '<?=$partition_id?>')">bookmark all</u>
		&nbsp;&nbsp;
	<?}?>	
	<?if($listall==""){?>
		<img onclick="listAllDescendantGallery('true',<?=$offset?>,'<?=$inode_folder?>',<?=$partition_id?>,'<?=$tz?>','<?=$token?>');return false;" title="Recursive" src="../img/recursive.png" style="cursor:pointer; vertical-align: middle"/>	
	<?}else{?>
		<img onclick="listAllDescendantGallery('false',<?=$offset?>,'<?=$inode_folder?>',<?=$partition_id?>,'<?=$tz?>','<?=$token?>');return false;" title="Recursive" src="../img/recursive_down.png" style="cursor:pointer; vertical-align: middle"/>
	<?}?>	
</p>


</div>
Return current item: Ptk-forensics