View file new_fo/edit/file.php

File size: 5.51Kb
<?php
if (!defined('SECURED'))
{
	die("Unknown Error!");
}

$id=intval($_GET['id']);
include'includes/func_formatsize.php';

$file=mysql_fetch_array(mysql_query("select * from files where id='".$id."';"));
if(mysql_affected_rows()==0)
{
	title('error!');
	div('error!','b');
	echo'File does not exist or has been deleted by moderator!';
	footer();
	exit;
}

$filename=basename($file['filename']);
$ext=pathinfo($file['filename'],PATHINFO_EXTENSION);

title($filename);
div('View File','b');
echo'<img src="images/up.gif" alt="[UP]"/><a href="'.$_SERVER['PHP_SELF'].'?mode=cat&amp;id='.$file['cat'].'&amp;'.SID.'">Up</a><br/>';
echo $separator;
if(isset($_GET['abuse']) && $_SESSION['abuse_id']!=$id)
{
	mysql_query("update `files` set `abuse` = `abuse` + 1 where `id`='$id';");
	$_SESSION['abuse_id']=$id;
	$file['abuse']+=1;
	echo 'Your complaint to file adoption! Thank you for complicity in the maintenance of cleanliness and order in the File share!<br/>';
	echo $separator;
}
echo'<b>File:</b> '.$filename.'<br/>';


if(in_array($ext,$extensions['audio']))
{
	include'includes/inc_mp3_class.php';
	$id3 = new MP3_Id();
	$result = $id3->read($file['filename']);
	$result = $id3->study();
	echo "<b>Channels:</b>" . $id3->getTag('mode') . "<br/>";
	if ($id3->getTag('bitrate') != 0)
	{
		echo "<b>Duration:</b> " . $id3->getTag('length') . "<br/>
			  <b>Bitrate:</b> " . $id3->getTag('bitrate') . " Kb/?<br/>";
	}
}
if(in_array($ext,$extensions['video']))
{
	if(class_exists('ffmpeg_movie'))
	{
		$movie = new ffmpeg_movie($file['filename']);
		$length = round($movie->getDuration());
		if($length>59)
		{
			$minutes=floor($length/60);
			$seconds=$length-($minutes*60);
			$length="$minutes:$seconds";
		} else
		{
			$length="0:$length";
		}
		//echo'<img src="'.$file['screen'].'" alt="'.$filename.'"/><br/>';
		echo'<img src="ffmpeg_file.php?pic='.$file['filename'].'" alt="'.$filename.'"/><br/>';
		echo"<b>Duration:</b> $length min.<br/>";
		echo"<b>Resolution:</b> ".$movie->getFrameHeight()."x".$movie->getFrameWidth()." px<br/>";
	}
}
if(in_array($ext,$extensions['pics']))
{
	list($w_src,$h_src)=getimagesize($file['filename']);
	echo'<img src="'.$file['screen'].'" alt="'.$filename.'"/><br/>';
	echo"<b>Resolution:</b> ".$w_src."x".$h_src." px<br/>";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
if($ext == 'thm') {
echo '<img src="them_file.php?f='.$file['filename'].'" alt="'.$filename.'" /><br/>';
echo'<b>For phone:</b> SonyEricsson<br/>';
}
if($ext == 'nth') {
echo '<img src="them_file.php?f='.$file['filename'].'" alt="'.$filename.'" /><br/>';
echo'<b>For phone:</b> Nokia<br/>';
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo'<b>Description:</b> '.$file['desc'].'<br/>';
echo'<b>Size:</b> '.formatsize(@filesize($file['filename'])).'<br/>';
echo'<b>Uploaded:</b> '.date("d-m-Y, H:i",$file['uploaded']).'<br/>';
echo'<b>Downloads:</b> '.$file['downloads'].' times<br/>';
echo $separator;
///////////////////////////////////////////////////////////////////////////
echo'<b>Download:</b> <a href="'.$_SERVER['PHP_SELF'].'?mode=get&amp;id='.$id.'&amp;'.SID.'">'.$filename.'</a>';
if($ext=='jar') echo'<br/>&#187; <a href="'.$_SERVER['PHP_SELF'].'?mode=get&amp;id='.$id.'&amp;jad&amp;'.SID.'">Download JAD</a>';
echo'<br/><b>Direct Link:</b> ';

if($ver=='wml')
{
	echo'</small><input type="text" name="path" title="path" value="http://'.$config['fs_path'].$file['filename'].'"/><br/><small>';
} else
{
	echo'<input type="text" name="path" title="path" value="http://'.$config['fs_path'].$file['filename'].'"/><br/>';
}
///////////////////////////////////////////////////////////////////////////
echo $separator;
list($author_id,$author)=explode('|',$file['author']);
echo'<b>Added:</b> ';
if($author_id!=0) echo'<a href="'.$_SERVER['PHP_SELF'].'?mode=user&amp;id='.$author_id.'&amp;'.SID.'">'.$author.'</a><br/>';
else echo $author.'<br/>';
//echo'<b>IP:</b> '.$file['ip'].'<br/>';
echo'<b>Mobile:</b> '.$file['soft'].'<br/>';
echo $separator;
echo'<img src="images/k.gif" alt="[K]"/> <a href="'.$_SERVER['PHP_SELF'].'?mode=comment&amp;id='.$id.'&amp;'.SID.'">Comments</a> ('.mysql_result(mysql_query("select count(id) from comments where fid='".$id."';"),0).')<br/>';
echo'<img src="images/co.gif" alt="[CO]"/> <a href="'.$_SERVER['PHP_SELF'].'?mode=file&amp;id='.$id.'&amp;abuse&amp;'.SID.'">ABUSE</a> ('.$file['abuse'].')<br/>';
/*
if(($author_id && $author_id==$user['id']) || $level==2){
echo'<img src="images/co.gif" alt="[CO]"/> <a href="'.$_SERVER['PHP_SELF'].'?mode=cat&amp;id='.$file['cat'].'&amp;del='.$id.'&amp;'.SID.'">Delete file</a><br/>';
}
*/
echo $separator;
if($level>0)
{
	echo'&#187; <a href="'.$_SERVER['PHP_SELF'].'?mode=mpanel&amp;id='.$id.'&amp;act=del&amp;'.SID.'">Delete file</a><br/>';
	//echo'&#187; <a href="'.$_SERVER['PHP_SELF'].'?mode=mpanel&amp;id='.$id.'&amp;act=edit&amp;'.SID.'">Edit file</a><br/>';
	echo $separator;
}
list($cat_name)=mysql_fetch_array(mysql_query("select name from categorys where id='".$file['cat']."';"));
list($refcat_name)=mysql_fetch_array(mysql_query("select name from categorys where id='".$file['refcat']."';"));
echo '&#187; <a href="'.$_SERVER['PHP_SELF'].'?mode=cat&amp;id='.$file['cat'].'&amp;'.SID.'">'.$cat_name.'</a><br/>';
echo '&#187; <a href="'.$_SERVER['PHP_SELF'].'?mode=cat&amp;id='.$file['refcat'].'&amp;'.SID.'">'.$refcat_name.'</a><br/>';
echo $separator;
echo $goback;
?>