<?php
/**
# Project: PHPDISK File Storage Solution
# This is NOT a freeware, use is subject to license terms.
#
# Site: http://www.phpdisk.com
#
# $Id: files.inc.php 10 2011-06-01 08:13:16Z along $
#
# Copyright (C) 2008-2011 PHPDisk Team. All Rights Reserved.
#
*/
if(!defined('IN_PHPDISK') || !defined('IN_MYDISK')) {
exit('[PHPDisk] Access Denied');
}
lang('files');
$option_folder_4 = super_cache('file','get_option_folders|4',1,0,$pd_uid);
$pub_menu_option = super_cache('file','get_option_public_folder',1,0,$pd_uid);
// fix set_extract_code
$a_upload_file = urr("mydisk","item=upload&is_public=$is_public&cate_id=$cate_id&subcate_id=$subcate_id&folder_node=$folder_node&folder_id=$folder_id&uid=$pd_uid");
$a_folder_create = urr("mydisk","item=folders&action=folder_create&folder_node=1");
$a_share_folder = '';
$a_list_detail = urr("mydisk","item=files&action=detail");
$group_set = $group_settings[$tmp_gid];
if(display_plugin('multi_server','open_multi_server_plugin',($settings['open_multi_server'] && $settings['upload_server_type']=='sub_server'),0)){
$server_oid = get_last_upload_server($pd_uid,$group_set['server_ids']);
if($server_oid>1){
// reload $a_upload_file
$rs = $db->fetch_one_array("select server_host,server_key from {$tpf}servers where server_oid='$server_oid'limit 1");
if($rs){
$a_upload_file = $rs['server_host'].'?'.pd_encode("is_public=$is_public&cate_id=$cate_id&subcate_id=$subcate_id&folder_node=$folder_node&folder_id=$folder_id&uid=$pd_uid&server_key={$rs['server_key']}");
}
unset($rs);
}
}
$tmp_arr = array('a_folder_create'=>$a_folder_create,'a_upload_file' =>$a_upload_file,'a_list_detail'=>$a_list_detail,'a_share_folder'=>$a_share_folder,'title'=>$L['extract_file_list']);
$nav_arr = get_my_nav($tmp_arr);
switch($action){
case 'index':
case 'detail':
if($task == 'to_folder'){
form_auth(gpc('formhash','P',''),formhash());
$file_ids = gpc('file_ids','P',array());
$dest_folder = gpc('dest_folder','P',0);
$ids_arr = get_ids_arr($file_ids,$L['please_select_operation_files']);
if($ids_arr[0]){
$error = true;
$sysmsg[] = $ids_arr[1];
}else{
$file_str = $ids_arr[1];
}
if($dest_folder == -1){
$error = true;
$sysmsg[] = $L['please_select_dest_folder'];
}else{
$dest_folder = $dest_folder ? (int)$dest_folder : -1;
}
$num = $db->result_first("select count(*) from {$tpf}files where file_name in (select file_name from {$tpf}files where folder_id='$dest_folder' and userid='$pd_uid') and file_id in ($file_str) and userid='$pd_uid'");
if($num){
$error = true;
$sysmsg[] = $L['has_same_filename'];
}
if(!$error && pd_file_move($file_str,$dest_folder)=='error'){
$error = true;
$sysmsg[] = $L['file_move_error'];
}
if(!$error){
$ins = array(
'folder_id' => $dest_folder,
'is_public' => 0,
'cate_id' => 0,
'subcate_id' => 0,
'is_checked' => (int)$settings['file_to_public_checked'],
);
$db->query_unbuffered("update {$tpf}files set ".$db->sql_array($ins)." where file_id in ($file_str) and userid='$pd_uid'");
super_cache('file','syn_folder_size',1,0,$pd_uid,$settings['cache_time']);
super_cache('file','folders_menu_cache',1,0,$pd_uid,1);
reload_leftframe('mydisk','file');
$sysmsg[] = $L['move_success'];
redirect($_SERVER['HTTP_REFERER'],$sysmsg);
}else{
redirect('back',$sysmsg);
}
}elseif($task =='to_public'){
form_auth(gpc('formhash','P',''),formhash());
$file_ids = gpc('file_ids','P',array());
$public_cate = gpc('public_cate','P',0);
$ids_arr = get_ids_arr($file_ids,$L['please_select_operation_files']);
if($ids_arr[0]){
$error = true;
$sysmsg[] = $ids_arr[1];
}else{
$file_str = $ids_arr[1];
}
if($public_cate == -1){
$error = true;
$sysmsg[] = $L['please_select_dest_folder'];
}else{
$public_cate = (int)$public_cate;
}
$pid = $db->result_first("select pid from {$tpf}categories where cate_id='$public_cate'");
if($pid){
$cate_id = $pid;
$subcate_id = $public_cate;
}else{
$cate_id = $public_cate;
$subcate_id = 0;
}
if(!$error){
$ins = array(
'folder_id' => 0,
'is_public' => 1,
'cate_id' => $cate_id,
'subcate_id' => $subcate_id,
'in_recycle' => 0,
'is_checked' => (int)$settings['file_to_public_checked'],
);
$db->query_unbuffered("update {$tpf}files set ".$db->sql_array($ins)." where file_id in ($file_str) and userid='$pd_uid' ");
super_cache('file','syn_folder_size',1,0,$pd_uid,$settings['cache_time']);
super_cache('file','folders_menu_cache',1,0,$pd_uid,1);
super_cache('public','public_menu_cache|1',1,0,0,1);
super_cache('public','public_menu_cache|0',1,0,0,1);
reload_leftframe('mydisk','file');
$sysmsg[] = $L['move_success'];
redirect($_SERVER['HTTP_REFERER'],$sysmsg);
}else{
redirect('back',$sysmsg);
}
}elseif($task == 'to_share'){
form_auth(gpc('formhash','P',''),formhash());
$file_ids = gpc('file_ids','P',array());
$ids_arr = get_ids_arr($file_ids,$L['please_select_operation_files']);
if($ids_arr[0]){
$error = true;
$sysmsg[] = $ids_arr[1];
}else{
$file_str = $ids_arr[1];
}
if(!$error){
$ins = array(
'in_share' => 1,
);
$db->query_unbuffered("update {$tpf}files set ".$db->sql_array($ins)." where file_id in ($file_str)");
$sysmsg[] = $L['share_success'];
redirect($_SERVER['HTTP_REFERER'],$sysmsg);
}else{
redirect('back',$sysmsg);
}
}elseif($task =='to_extract'){
form_auth(gpc('formhash','P',''),formhash());
$file_ids = gpc('file_ids','P',array());
$ids_arr = get_ids_arr($file_ids,$L['please_select_extract_files']);
if($ids_arr[0]){
$error = true;
$sysmsg[] = $ids_arr[1];
}else{
$file_str = $ids_arr[1];
}
if(count($file_ids) >10){
$error = true;
$sysmsg[] = $L['extract_files_limit'];
}
$q = $db->query("select * from {$tpf}files where file_id in ($file_str) order by file_id desc");
$files_array = array();
while($rs = $db->fetch_array($q)){
if($rs['folder_id']){
$rs2 = $db->fetch_one_array("select folder_name from {$tpf}folders where folder_id='{$rs['folder_id']}'");
$rs['store_at'] = $rs2['folder_name'];
unset($rs2);
}else{
$rs['store_at'] = $L['root_folder'];
}
$tmp_ext = $rs['file_extension'] ? '.'.$rs['file_extension'] : "";
$rs['file_name_all'] = $rs['file_name'].$tmp_ext;
$rs['file_name'] = cutstr($rs['file_name'].$tmp_ext,35);
$rs['file_size'] = get_size($rs['file_size']);
$rs['file_time'] = custom_time("Y-m-d",$rs['file_time']);
$files_array[] = $rs;
}
$db->free($q);
unset($rs);
$default_date = date("Y-m-d",$timestamp+86400*10);
$extract_code_status = '';
$extract_total = 0;
$action = 'set_extract_code';
require_once template_echo('files',$user_tpl_dir);
}elseif($task =='is_link_code'){
form_auth(gpc('formhash','P',''),formhash());
$file_ids = gpc('file_ids','P',array());
$ids_arr = get_ids_arr($file_ids,$L['please_select_link_files'],1);
if($ids_arr[0]){
$error = true;
$sysmsg[] = $ids_arr[1];
}else{
$file_str = $ids_arr[1];
}
if(!$error){
header('Location:'.urr("mydisk","item=$item&action=make_link_code&file_ids=$file_str&order=asc"));
}else{
redirect('back',$sysmsg);
}
}elseif($task == 'file_delete'){
form_auth(gpc('formhash','P',''),formhash());
$file_ids = gpc('file_ids','P',array());
$ids_arr = get_ids_arr($file_ids,$L['please_select_operation_files']);
if($ids_arr[0]){
$error = true;
$sysmsg[] = $ids_arr[1];
}else{
$file_str = $ids_arr[1];
}
if(!$error){
$sql = "
f553686
- 粉丝: 21
- 资源: 19
最新资源
- 旅游景点导游平台系统源代码.zip
- 美发门店管理系统项目源代码.zip
- 智能插座,个人学习整理,仅供参考
- 医院管理系统源代码.zip
- 西门子-大型堆垛机程序 真实运行案例 物流仓储 涵盖通信,算法,运动控制 实际项目程序 西门子S7-300+G120+ET200S 博途编程 采用用STL和SCL高级编程语言 无加密 仿
- 校园资源库系统源代码.zip
- 洗衣店管理系统项目源代码.zip
- 医院网站源代码.zip
- MPC5634 Bootloader
- 前后端分离的在线办公系统,项目采用 SpringBoot+Uniapp 开发,前端采用微信小程序展示.zip
- GitHub 搜索技巧与高级用法详解
- 威纶通触摸屏与三菱变频器modbus rtu通讯程序 触摸屏型号mt6103ip,变频器型号FR-D720(E700系列也可以用)
- HFSS创建SG模型的端口设置
- 微信小程序源码养老院管理系统(小程序)pf-毕业设计.zip
- 胶钉机程序 用国产三菱3U和威纶触摸屏编写 此程序已经实际设备上批量应用,程序成熟可靠,借鉴价值高,程序有注释
- 微机原理试卷及答案.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈