<!--#
##
#	Project: PHPDISK File Storage Solution
#	This is NOT a freeware, use is subject to license terms.
#
#	Site: http://www.phpdisk.com
#
#	$Id: files.tpl.php 69 2016-08-09 01:14:58Z along $
#
#	Copyright (C) 2008-2016 PHPDisk Team. All Rights Reserved.
#
##
#-->
<?php !defined('IN_PHPDISK') && exit('[PHPDisk] Access Denied!'); ?>
<!--#
if($action =='total_del'){
#-->
<div class="info_box">
<div class="info_box_tit"><img src="images/light.gif" align="absmiddle" border="0" /> <?=__('tips')?></div>
<div class="info_box_msg">
{$msg}
<br />
<a href="javascript:document.location.reload();"><?=__('run_del_tip')?></a>
</div>
<br />

</div>
<!--#
}elseif($action =='index' || $action =='search'){
#-->
<div id="container">
<h1><?=__('file_list')?><!--#sitemap_tag(__('file_list'));#--></h1>
<div>
<div class="tips_box"><img class="img_light" src="images/light.gif" align="absmiddle" /> <b><?=__('tips')?>: </b>
<span class="txtgray"><?=__('public_title_tips')?></span>
</div>
<form name="search_frm" action="{#urr(ADMINCP,"")#}" method="get" onsubmit="return dosearch(this);">
<input type="hidden" name="item" value="files" />
<input type="hidden" name="menu" value="file" />
<input type="hidden" name="action" value="search" />
<div class="search_box">
<div class="l"><img src="{$admin_tpl_dir}images/it_nav.gif" align="absbottom" />
<?=__('view_mode')?>: 
<select name="view" id="view" onchange="chg_view();">
<option value="mydisk_file" {#ifselected('mydisk_file',$view,'str');#}><?=__('mydisk_file')?></option>
<option value="mydisk_recycle" {#ifselected('mydisk_recycle',$view,'str');#}>用户文件回收站</option>
<option value="user_del" {#ifselected('user_del',$view,'str');#} style="color:#FF0000">系统回收站</option>
</select>
</div>
<div class="r"><input type="text" name="word" value="{$word}" title="<?=__('search_files_tips')?>" /> <input type="submit" class="btn" value="<?=__('search_files')?>" /></div>
</div>
</form>
<div class="clear"></div>
<script language="javascript">
function chg_view(){
	var view = getId('view').value.strtrim();
	document.location.href = '{#urr(ADMINCP,"item=files&menu=file&action=index&view='+view+'")#}';
}
function dosearch(o){
	if(o.word.value.strtrim().length <1){
		o.word.focus();
		return false;
	}
}
</script>
<form name="public_frm" action="{#urr(ADMINCP,"item=files&menu=file")#}" method="post" onsubmit="return dosubmit(this);">
<input type="hidden" name="action" value="{$action}"/>
<input type="hidden" name="formhash" value="{$formhash}" />
<table align="center" width="100%" cellpadding="4" cellspacing="0" border="0" class="td_line">
<!--#
if(count($files_array)){
#-->
<tr>
	<td width="40%" class="bold"><?=__('file_name')?>|真实存储地址</td>
	<td align="center" class="bold" width="150"><?=__('username')?></td>
	<td align="center" class="bold"><?=__('file_size')?></td>
	<td align="center" width="150" class="bold"><?=__('file_upload_time')?></td>
	<td align="right" width="80" class="bold">
	<?=__('status')?>/<?=__('operation')?>
	</td>
</tr>
<!--#
	foreach($files_array as $k => $v){
		$color = ($k%2 ==0) ? 'color1' :'color4';
#-->
<tr class="{$color}">
	<td width="40%"><input type="checkbox" name="file_ids[]" id="file_ids" value="{$v['file_id']}" />&nbsp;<a href="{$v['a_downfile']}" title="<?=__('download')?>">{#file_icon($v['file_extension'])#}</a>&nbsp;
	<!--#if($v['is_image']){#-->
	<a href="{$v['a_viewfile']}" id="p_{$k}" target="_blank" title="{$v['file_name_all']} {$v['file_size']}">{$v['file_name']}</a><span class="txtgray">(标识ID:{$v[server_oid]})</span>
<div id="c_{$k}" class="menu_thumb"><img src="{$v['file_thumb']}" /></div>
<script type="text/javascript">on_menu('p_{$k}','c_{$k}','x','');</script>
	<!--#}else{#-->
	<a href="{$v['a_viewfile']}" target="_blank" title="{$v['file_name_all']} {$v['file_size']}">{$v['file_name']}</a><span class="txtgray">(标识ID:{$v[server_oid]})</span>
	<!--#}#--><br />
	<u class="txtgray">{$v[file_abs_path]}</u>
	</td>
	<td align="center"><a href="{$v['a_user_view']}">{$v['username']}</a></td>
	<td align="center">{$v['file_size']}</td>
	<td align="center" width="150" class="txtgray">{$v['file_time']}</td>
	<td align="center">
	<!--#if($view=='user_del'){#--> 	
	<a href="{#urr("admincp","item=files&menu=file&action=total_del&task=safe&file_id=$v[file_id]")#}" class="txtred" target="_blank" title="安全删除">安删</a> / <a href="{#urr("admincp","item=files&menu=file&action=total_del&file_id=$v[file_id]")#}" class="txtred" target="_blank" title="非安全删除">非删</a>
	<!--#}else{#-->
	{$v['status_txt']} / 
	<a href="javascript:;" onclick="aconfirm('<?=__('recycle_delete_confirm')?>','{$v['a_recycle_delete']}');"><?=__('delete')?></a>
	<!--#}#-->
	</td>
</tr>
<!--#		
	}
	unset($files_array);
#-->
<!--#if($page_nav){#-->
<tr>
	<td colspan="6">{$page_nav}</td>
</tr>
<!--#}#-->
<tr>
	<td colspan="6"><a href="javascript:void(0);" onclick="reverse_ids(document.public_frm.file_ids);"><?=__('select_all')?></a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="cancel_ids(document.public_frm.file_ids);"><?=__('select_cancel')?></a>&nbsp;&nbsp;
	<!--#if($view=='user_del'){#-->
	<input type="radio" name="task" value="restore_del_file" checked="checked" />恢复&nbsp;&nbsp;
	<input type="submit" class="btn" value="<?=__('btn_submit')?>"/><br /><br />
	<a href="{#urr("admincp","item=files&menu=file&action=total_del&task=safe")#}" class="f14 bold" target="_blank">安全删除<i class="txtred">[当删除文件不成功时，数据库不会删除相应的记录] </i></a>&nbsp;<br /><br />
	<a href="{#urr("admincp","item=files&menu=file&action=total_del")#}" class="f14 bold" target="_blank">非安全删除 <i class="txtred">[当删除文件不成功时，数据库会删除相应的记录] </i></a>&nbsp;<br /><br />
	<span class="txtred">(此操作将彻底删除文件，删除后将不能恢复文件！！)  </span>&nbsp;
	<!--#}else{#-->
	<input type="radio" name="task" value="check_public" checked="checked" onclick="dis()" /><?=__('check_public')?>&nbsp;&nbsp;
	<input type="radio" name="task" value="file_to_locked" onclick="dis()" /><?=__('file_to_locked')?>&nbsp;&nbsp;
	<input type="radio" name="task" value="file_to_unlocked" onclick="dis()" /><?=__('file_to_unlocked')?>&nbsp;&nbsp;
	<input type="radio" name="task" value="delete_file_complete" onclick="dis()" /><?=__('delete_complete')?>&nbsp;&nbsp;
	<input type="radio" name="task" value="move_all" onclick="dis()" />转移选定文件给用户&nbsp;&nbsp;
	<input type="text" name="tousername" title="输入用户名" placeholder="输入用户名" size="6" style="display:none" />&nbsp;&nbsp;
	<input type="radio" name="task" value="move_depart" onclick="dis()" />转移选定文件的公司、部门文件给用户&nbsp;&nbsp;
	<input type="text" name="tousername2" title="输入用户名" placeholder="输入用户名" size="6" style="display:none" />&nbsp;&nbsp;
	<input type="submit" class="btn" value="<?=__('btn_submit')?>"/>&nbsp;&nbsp;
	<!--#}#-->
</tr>
<!--#		
}else{
#-->
<tr>
	<td colspan="6"><?=__('file_not_found')?></td>
</tr>
<!--#
}
#-->
</table>
</form>
</div>
</div>
<script language="javascript">
function dosubmit(o){
	if(checkbox_ids("file_ids[]") != true){
		atips("<?=__('please_select_operation_files')?>");
		return false;
	}
}
function dis(){
	$("input[name='tousername']").hide();
	$("input[name='tousername2']").hide();
	if($("input[name='task']:checked").val()=='move_all'){
		$("input[name='tousername']").show();
	}
	if($("input[name='task']:checked").val()=='move_depart'){
		$("input[name='tousername2']").show();
	}
}
</script>
<!--#}elseif($action=='stats'){#-->
<div id="container">
<h1>文件访问日志<!--#sitemap_tag('文件访问日志');#--></h1>
<div>
<div class="tips_box"><img class="img_light" src="images/light.gif" align="absmiddle" /> <b><?=__('tips')?>: </b>
<span class="txtgray">可查看整个系统文件的下载及浏览记录</span>
</div>
</div>
<form action="{#urr(ADMINCP,"item=$item&menu=file")#}" method="post">
<input type="hidden" name="action" value="{$action}" />
<input type="hidden" name="task" value="update_setting" />
<input type="hidden" name="formhash" value="{$formhash}" />
<table align="center" width="100%" cellpadding="4" cellspacing="0" border="0" class="td_line">
<tr>
	<td width="40%"><span class="bold">是否启用日志</span>: <br /><span class="txtgray">是否启用文件访问日志</span></td>
	<td><input type="radio" name="setting[open_file_logs]" value="1" {#ifchecked(1,$settings['open_file_logs'])#} /> <?=__('yes')?>&nbsp;&nbsp;<input type="radio" name="setting[open_file_logs]" value="0" {#ifchecked(0,$settings['open_file_logs'])#}/> <?=__('no')?></td>
</tr>
<tr>
	<td>&nbsp;</td>
	<td><input type="submit" class="btn" value="<?=__('btn_submit')?>" /></td>
</tr>
</table>
</form>
<br />

<img src="{$admin_tpl_dir}images/it_nav.gif" align="absbottom" />
选择日志时间： 
<select id="credit_table" onchange="chg_log();">
<!--#
if($tables){
	for($i=0;$i<count($tables);$i++){
#-->
<option value="{#$tables[$i]#}" {#ifselected($tables[$i],$curr_table,'str')#}>{#$tables[$i]#}</option>
<!--#
	}
}#-->
</select>月&nbsp;&nbsp;
<script language="javascript">
function chg_log(){
	var credit_table = $('#credit_table').val();
	document.location.href = '{#urr(ADMINCP,"item=files&menu=file&action=stats&log='+credit_table+'")#}';
}
</script>
<table align="center" width="100%" cellpadding="4" cellspacing="0" border="0" class="td_line">
<tr>
	<td width="40%" class="bold"><?=__('file_name')?></td>
	<td align="center" width="150" class="bold">日志行为</td>
	<td align="center" width="150" class="bold">操作时间</td>
	<td align="right" width="180" class="bold">操作人</td>
	<td align="right" width="150" class="bold">操作IP</td>
</tr>
<!--#
if(count($logs)){
	foreach($logs as $k => $v){
		$color = ($k%2 ==0) ? 'color1' :'color4';
#-->
<tr class="{$color}">
	<td>{#file_icon($v[file_extension])#}{$v[file_name]}<span class="txtgray" title="文件ID">({$v[file_id]})</span></td>
	<td align="center">{#$log_action[$v[action]]#}</td>
	<td align="center" class="txtgray">{$v['file_time']}</td>
	<td align="right"><span style="cursor:pointer" id="vu_{$k}" onclick="view_user({$v[touserid]},{$k})"><u>查看用户</u></span></td>
	<td align="right">{$v[ip]}</td>
</tr>
<!--#		
	}
	unset($logs);
}else{
#-->
<tr>
	<td colspan="6" align="center">暂无文件日志</td>
</tr>
<!--#}#-->
<!--#if($page_nav){#-->
<tr>
	<td colspan="6">{$page_nav}</td>
</tr>
<!--#}#-->
</table>
</div>
<script type="text/javascript">
function view_user(uid,id){
	$('#vu_'+id).html('<img src="images/ajax_loading.gif" align="absmiddle" border="0" />');
	$.ajax({
		type : 'post',
		url : 'ajax.php',
		data : 'action=view_user&uid='+uid+'&adm=1&t='+Math.random(),
		dataType : 'text',
		success:function(msg){
			var arr = msg.split('|');
			if(arr[0] == 'true'){
				$('#vu_'+id).html(arr[1]);
				$('#vu_'+id).attr('onclick','');
				$('#vu_'+id).addClass('txtblue');
			}else{
				atips(msg);
			}
		},
		error:function(){
		}

	});
}
</script>

<!--#}#-->