<!--#
##
#	Project: PHPDISK File Storage Solution
#	This is NOT a freeware, use is subject to license terms.
#
#	Site: http://www.phpdisk.com
#
#	$Id: pd_viewfile.tpl.html 2 2011-05-27 02:59:23Z along $
#
#	Copyright (C) 2008-2011 PHPDisk Team. All Rights Reserved.
#
##
#-->
<!--#if($settings['open_thunder']){#-->
<script src="http://pstatic.xunlei.com/js/webThunderDetect.js"></script>
<!--#}#-->
<!--#if($settings['open_flashget']){#-->
<script src="http://ufile.qushimeiti.com/Flashget_union.php?fg_uid={$settings['flashget_uid']}"></script>
<script type="text/javascript">
function ConvertURL2FG(url,fUrl,uid){	
	try{
		FlashgetDown(url,uid);
	}catch(e){
		location.href = fUrl;
	}
}
function Flashget_SetHref(obj,uid){obj.href = obj.fg;}
</script>
<!--#}#-->
<!--#if($settings['open_vote']){#-->
	<script type="text/javascript">
	var lang = new Array();
	lang['vote_just'] = "{$L['vote_just']}";
	</script>
	<script type="text/javascript" src="includes/js/digg.js"></script>
<!--#}#-->
<div class="layout_box">
<!--#if(!$action){#-->
<div class="l">
<!--#if($file['is_del']){#-->
<div class="msg_box f14"><img src="images/light.gif" align="absmiddle" border="0"/> {$L['file_is_del']}</div>
<script type="text/javascript">
setTimeout('function re(){top.location = "{$settings['phpdisk_url']}"};re();',5000);
</script>
<!--#}elseif($file['is_locked'] && $pd_gid<>1){#-->
<div class="msg_box f14"><img src="images/light.gif" align="absmiddle" border="0"/> {$L['locked_msg']}</div>
<!--#}elseif(!$file['in_share'] && ($file['userid'] <> $pd_uid) && !$file['is_public'] && $pd_gid<>1 && !$file['in_extract']){#-->
<div class="msg_box f14"><img src="images/light.gif" align="absmiddle" border="0"/> {$L['not_share_msg']}</div>
<!--#}else{#-->
<div class="file_box">
	<div class="fb_l">
		<h3 id="file_tit">{#file_icon($file['file_extension'],'filetype_32','absbottom')#} {$file['file_name']}</h3>
		<!--#if($file['file_description']){#-->
		<div id="file_desc" class="txtgray f14">{$L['description']}:<br />{$file['file_description']}</div>
		<br /><br />
		<!--#}#-->
		<div class="file_item">
			<li id="file_uploader">{$L['uploader']}: {$file['username']}</li>
			<li id="file_size">{$L['file_size']}: {$file['file_size']}&nbsp;&nbsp;
			<!--#if($settings['open_tag'] && $file['tags']){#-->
			<span id="file_tag">{$L['file_tag']}: {$file['tags']}</span>
			<!--#}#-->
			</li>
			<!--#if($file['file_md5']){#-->
			<li>{$L['file_check']}: <span class="txtgray">{$file['file_md5']}</span></li>
			<!--#}#-->
			<li>{$L['down_credit']}: <span class="txtblue" id="file_credit_down">{$settings['credit_down']}</span></li>
			<li>{$L['upload_time']}: <span id="file_upload_time">{$file['file_time']}</span> , <span id="file_downs">{$file['file_downs']}</span> {$L['downloads']}, <span id="file_views">{$file['file_views']}</span> {$L['views']}</li>
			<li>{#base64_decode($settings['share_tool'])#}</li>
		</div>
	</div>
	<div class="fb_r">
	<br />
	<br />
	<!--#show_adv_data('adv_viewfile_right');#-->
	</div>
</div>
<div class="clear"></div>
<br />
{#preview_file($file)#}
<div class="file_item">
</li>
	<!--#show_adv_data('adv_viewfile_hits_bottom');#-->
	<!--#if($settings['open_file_url']){#-->
	<li>&nbsp;</li>
	<li class="txtgray">{$L['file_view_url']}: <input type="text" class="txtgray" value="{$file['file_view_url']}" id="f_view" size="60" onclick="getId('f_view').select();copy_text('f_view');" readonly/></li>
	<li class="txtgray">{$L['file_ubb_url']}: <input type="text" class="txtgray" value="{$file['file_ubb_url']}" id="f_ubb" size="60" onclick="getId('f_ubb').select();copy_text('f_ubb');" readonly /></li>
	<li class="txtgray">{$L['file_html_url']}: <input type="text" class="txtgray" value="{$file['file_html_url']}" id="f_html" size="60" onclick="getId('f_html').select();copy_text('f_html');" readonly /></li>
	<!--#}#-->
</div>
<!--#if($settings['open_vote']){#-->
<div class="digg">
	<div id="digg0" onmouseover="this.style.backgroundPosition='0 0'" onmouseout="this.style.backgroundPosition='-189px 0'" onfocus="this.blur()" onClick="pdVote({$file['file_id']},1)">
		<div class="digg_bar"><div id="eimg1" style="width:{$file['g_px']}px"></div></div>
		<span id="barnum1"><span id="sp1">{$file['good_rate']}%</span> (<span id="s1">{$file['good_count']}</span>)</span>
	</div>
	<div id="digg1" onmouseover="this.style.backgroundPosition='-567px 0'" onmouseout="this.style.backgroundPosition='-378px 0'" onfocus="this.blur()" onclick="pdVote({$file['file_id']},2)">
		<div class="digg_bar"><div id="eimg2" style="width:{$file['b_px']}px"></div></div>
		<span id="barnum2"><span id="sp2">{$file['bad_rate']}%</span> (<span id="s2">{$file['bad_count']}</span>)</span>
	</div>
</div>
<!--#}#-->
<!--#show_adv_data('adv_viewfile_download_top');#-->
<div class="file_item">
	<li>&nbsp;</li>
	<li>
	<!--#if($settings['login_down_file'] && !$pd_uid && $file['userid']){#-->
	<span class="file_login">{$L['file_down_tips']}</span>
	<!--#}elseif(!$file['is_checked'] && $pd_gid<>1){#-->
	<span class="file_status">{$L['file_checking']}</span>
	<!--#}else{#-->
		<!--#if(display_plugin('time_link','open_time_link_plugin',$settings['open_time_link'],0)){#-->
			<!--#if(get_download_link('local_download')){#-->
				<!--#if($file['is_image']){#-->
				<a href="{$file['a_viewfile']}" target="_blank"><img src="images/view.gif" border="0" align="absbottom" /> {$L['view_file_online']}</a>&nbsp;&nbsp;
				<!--#}#-->
				<span id="down_link"></span>&nbsp;&nbsp;
				<script type="text/javascript">
				var secs = {$loading_secs};
				var wait = secs * 1000;
				var data_loading = "<img src=\"images/ajax_loading.gif\" align=\"absmiddle\" border=\"0\" />{$L['data_loading']}";
				getId('down_link').innerHTML = data_loading + " (" + secs + ")";
				for(i = 1; i <= secs; i++) {
					window.setTimeout("update_sec(" + i + ")", i * 1000);
				}
				window.setTimeout("down_file_link()", wait);
				function update_sec(num, value) {
					if(num == (wait/1000)) {
						getId('down_link').innerHTML = data_loading;
					} else {
						echo = (wait / 1000) - num;
						getId('down_link').innerHTML = data_loading + " (" + echo + ")";
					}
				}
				function down_file_link() {
					getId('down_link').innerHTML = "<a href=\"{$file['a_downfile']}\" onclick=\"down_process('{$file['file_id']}');\"><img src=\"images/down.gif\" border=\"0\" align=\"absbottom\" /> {$L['download_this_file']}</a>";
				}
				function down_process(file_id){
					var xmlhttp = createHttpRequest();
					xmlhttp.open("get","ajax.php?action=down_process&file_id="+file_id,true);
					xmlhttp.onreadystatechange = function(){
						if(xmlhttp.readyState == 4 && xmlhttp.status == 200){						
							if(xmlhttp.responseText == 'true'){
								getId('down_link').innerHTML = "<img src=\"images/ajax_loading.gif\" align=\"absmiddle\" border=\"0\" /><span class='txtred'>{$L['data_loading']}</span>";
								setTimeout('down_file_link()',3000);
							}
						}
					}
					xmlhttp.send(null);
				}
				</script>
			<!--#}#-->	
			<!--#if(get_download_link('thunder_download')){#-->
				<!--#if($settings['open_thunder']){#-->
				<span id="file_thunder"><a oncontextmenu=ThunderNetwork_SetHref(this) onclick="return OnDownloadClick_Simple(this,2,4)" href="#" thunderResTitle="{$file['file_name']}" thunderType="" thunderPid="{$settings['thunder_pid']}" thunderHref="{$file['thunder_url']}"><img src="images/thunder.gif" border="0" align="absbottom" /> {$L['thunder_download']}</a></span>
				<!--#}#-->
			<!--#}#-->
			<!--#if(get_download_link('flashget_download')){#-->
				<!--#if($settings['open_flashget']){#-->
				<span id="file_flashget"><a href="#" onClick="ConvertURL2FG('{$file['flashget_url']}','{$file['url']}',{$settings['flashget_uid']})" oncontextmenu="Flashget_SetHref(this)" fg="{$file['flashget_url']}"><img src="images/flashget.gif" border="0" align="absbottom" /> {$L['flashget_download']}</a></span>
				<!--#}#-->
			<!--#}#-->
		<!--#}else{#-->
			<!--#if($file['is_image']){#-->
			<a href="{$file['a_viewfile']}" target="_blank"><img src="images/view.gif" border="0" align="absbottom" /> {$L['view_file_online']}</a>&nbsp;&nbsp;
			<!--#}#-->
			<span id="down_link"></span>&nbsp;&nbsp;
			<!--#if($settings['open_thunder']){#-->
			<span id="file_thunder"><a oncontextmenu=ThunderNetwork_SetHref(this) onclick="return OnDownloadClick_Simple(this,2,4)" href="#" thunderResTitle="{$file['file_name']}" thunderType="" thunderPid="{$settings['thunder_pid']}" thunderHref="{$file['thunder_url']}"><img src="images/thunder.gif" border="0" align="absbottom" /> {$L['thunder_download']}</a></span>
			<!--#}#-->
			<!--#if($settings['open_flashget']){#-->
			<span id="file_flashget"><a href="#" onClick="ConvertURL2FG('{$file['flashget_url']}','{$file['url']}',{$settings['flashget_uid']})" oncontextmenu="Flashget_SetHref(this)" fg="{$file['flashget_url']}"><img src="images/flashget.gif" border="0" align="absbottom" /> {$L['flashget_download']}</a></span>
			<!--#}#-->
			<script type="text/javascript">
			var secs = {$loading_secs};
			var wait = secs * 1000;
			var data_loading = "<img src=\"images/ajax_loading.gif\" align=\"absmiddle\" border=\"0\" />{$L['data_loading']}";
			getId('down_link').innerHTML = data_loading + " (" + secs + ")";
			for(i = 1; i <= secs; i++) {
				window.setTimeout("update_sec(" + i + ")", i * 1000);
			}
			window.setTimeout("down_file_link()", wait);
			function update_sec(num, value) {
				if(num == (wait/1000)) {
					getId('down_link').innerHTML = data_loading;
				} else {
					echo = (wait / 1000) - num;
					getId('down_link').innerHTML = data_loading + " (" + echo + ")";
				}
			}
			function down_file_link() {
				getId('down_link').innerHTML = "<a href=\"{$file['a_downfile']}\" onclick=\"down_process('{$file['file_id']}');\"><img src=\"images/down.gif\" border=\"0\" align=\"absbottom\" /> {$L['download_this_file']}</a>";
			}
			function down_process(file_id){
				var xmlhttp = createHttpRequest();
				xmlhttp.open("get","ajax.php?action=down_process&file_id="+file_id,true);
				xmlhttp.onreadystatechange = function(){
					if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
						if(xmlhttp.responseText == 'true'){
							getId('down_link').innerHTML = "<img src=\"images/ajax_loading.gif\" align=\"absmiddle\" border=\"0\" /><span class='txtred'>{$L['data_loading']}</span>";
							setTimeout('down_file_link()',3000);
						}
					}
				}
				xmlhttp.send(null);
			}
			</script>
	<!--#}#-->
	<!--#}#-->
	</li>
	<!--#show_adv_data('adv_viewfile_download_bottom');#-->
	<li style="margin-top:8px;">
	<!--#if($settings['open_report']){#-->
	<a href="javascript:void(0);" onclick="display_box('report_box');" title="{$L['report_title']}"><img src="images/report.gif" border="0" align="absbottom" /> {$L['report_title']}</a>
	<!--#}#-->
	<!--#if($settings['open_comment']){#-->
	<a href="javascript:void(0);" onclick="display_box('cmt_box');" title="{$L['cmt_title']}"><img src="images/cmt.gif" border="0" align="absbottom" /> {$L['cmt_title']}</a>
	<!--#}#-->
	</li>
</div>
<div id="report_box" style="display:none">
<!--#if($has_report){#-->
<div class="warning">{$L['report_already_exists']}</div>
<!--#}else{#-->
<form action="viewfile.php" method="post" onsubmit="return doreport(this);">
<input type="hidden" name="action" value="report" />
<input type="hidden" name="file_id" value="{$file['file_id']}" />
<input type="hidden" name="file_key" value="{$file['file_key']}" />
<input type="hidden" name="formhash" value="{$formhash}" />
<li class="txtgray">{$L['report_content']}:</li>
<li><textarea name="content" rows="8" cols="60">{$login_txt}</textarea></li>
<li><input type="submit" value="{$L['btn_report']}" class="btn" {$disabled} />&nbsp;&nbsp;<a href="javascript:void(0);" onclick="cb('report_box');" title="{$L['close']}">[X]</a></li>
</form>
<!--#}#-->
</div>
<div id="cmt_box" style="display:none">
<form action="viewfile.php" method="post" onsubmit="return docmt(this);">
<input type="hidden" name="action" value="comment" />
<input type="hidden" name="file_id" value="{$file['file_id']}" />
<input type="hidden" name="file_key" value="{$file['file_key']}" />
<input type="hidden" name="formhash" value="{$formhash}" />
<li class="txtgray">{$L['cmt_content']}:</li>
<li><textarea name="content" rows="8" cols="60">{$login_txt}</textarea></li>
<li><input type="submit" value="{$L['btn_submit']}" class="btn" {$disabled} />&nbsp;&nbsp;<a href="javascript:void(0);" onclick="cb('cmt_box');" title="{$L['close']}">[X]</a></li>
</form>
</div>
<br />
<!--#if($settings['open_comment']){#-->
	<div class="cmt_u_box">
	<div class="cmt_title"><img src="images/ico_cmt.gif" align="absmiddle" border="0" />{$L['user_cmts']}:</div>
	<!--#
	if(count($cmts)){
		foreach($cmts as $v){
	#-->
	<div class="cmt_cts">
		<div class="cmt_name"><a href="{$v['a_space']}" target="_blank"><img src="images/ico_home.gif" align="absmiddle" border="0" />{$v['username']}</a> <span class="f11 txtgray">@ {$v['in_time']}</span></div>
		<div class="cmt_content">{$v['content']}</div>
	</div>
	<!--#
		}
		unset($cmts);
	#-->
	<div align="right"><a href="{$a_comment}">{$L['view_all_cmts']}</a></div>
	<!--#
	}else{
	#-->
	<div class="cmt_cts">{$L['cmt_not_found']}</div>
	<!--#
	}
	#-->
	</div>
<!--#}#-->
<script language="javascript">
function display_box(id){
	if(id =='cmt_box'){
		getId('cmt_box').style.display = '';
		getId('report_box').style.display = 'none';
	}else{
		getId('cmt_box').style.display = 'none';
		getId('report_box').style.display = '';
	}
}
function cb(id){
	getId(id).style.display = 'none';
}
function doreport(o){
	if(o.content.value.strtrim().length <2 || o.content.value.strtrim().length >100){
		alert("{$L['report_content_error']}");
		o.content.focus();
		return false;
	}
}
function docmt(o){
	if(o.content.value.strtrim().length <2 || o.content.value.strtrim().length >200){
		alert("{$L['cmt_content_error']}");
		o.content.focus();
		return false;
	}
}
function copy_text(id){
	var field = getId(id);
	if (field){
		if (document.all){
			field.createTextRange().execCommand('copy');
			alert("{$L['txt_copy_success']}");
		}	
	}
}
</script>
<!--#}#-->
</div>
<div class="r">
<!--#
if(count($relate_file) && $settings['show_relative_file']){
#-->
<br />
<div class="common_box">
<div class="tit2">{$L['relate_file']}</div>
<ul>
<!--#
	foreach($relate_file as $v){
#-->
<li>{#file_icon($v['file_extension'])#} <a href="{$v['a_viewfile']}">{$v['file_name']}</a></li>
<!--#
	}
	unset($relate_file);
#-->
</ul>
</div>
<!--#
}
#-->
<div class="clear"></div>
<br />
<!--#show_adv_data('adv_right');#-->
</div>
<!-- end not action -->
<!--#}#-->
<div class="clear"></div>
</div>
