/**
  * 上传,html5拖拽  flash 多文件
  */
 public function fileUpload()
 {
     //show('error',false);
     $save_path = $this->path;
     if (!is_writeable($save_path)) {
         show_json($this->L['no_permission_write'], false);
     }
     if ($save_path == '') {
         show_json($this->L['upload_error_big'], false);
     }
     if (strlen($this->in['fullPath']) > 1) {
         //folder drag upload
         $full_path = _DIR_CLEAR(rawurldecode($this->in['fullPath']));
         $full_path = get_path_father($full_path);
         $full_path = iconv_system($full_path);
         if (mk_dir($save_path . $full_path)) {
             $save_path = $save_path . $full_path;
         }
     }
     //upload('file',$save_path);
     //分片上传
     $temp_dir = USER_TEMP;
     mk_dir($temp_dir);
     if (!is_writeable($temp_dir)) {
         show_json($this->L['no_permission_write'], false);
     }
     upload_chunk('file', $save_path, $temp_dir);
 }
예제 #2
0
function path_search($path, $search, $is_content = false, $file_ext = '', $is_case = false)
{
    $ext_arr = explode("|", $file_ext);
    recursion_dir($path, $dirs, $files, -1, 0);
    $strpos = 'stripos';
    //是否区分大小写
    if ($is_case) {
        $strpos = 'strpos';
    }
    $filelist = array();
    $folderlist = array();
    foreach ($files as $f) {
        $ext = get_path_ext($f);
        $path_this = get_path_this($f);
        if ($file_ext != '' && !in_array($ext, $ext_arr)) {
            continue;
        }
        //文件类型不在用户限定内
        if ($strpos($path_this, $search) !== false) {
            //搜索文件名;搜到就返回;搜不到继续
            $filelist[] = file_info($f);
            continue;
        }
        if ($is_content && is_file($f)) {
            $fp = fopen($f, "r");
            $content = @fread($fp, get_filesize($f));
            fclose($fp);
            if ($strpos($content, iconv_app($search)) !== false) {
                $filelist[] = file_info($f);
            }
        }
    }
    if ($file_ext == '') {
        //没限定扩展名则才搜索文件夹
        foreach ($dirs as $f) {
            $path_this = get_path_this($f);
            if ($strpos($path_this, $search) !== false) {
                $folderlist[] = array('name' => iconv_app(get_path_this($f)), 'path' => iconv_app(get_path_father($f)));
            }
        }
    }
    return array('folderlist' => $folderlist, 'filelist' => $filelist);
}
예제 #3
0
 private function zip($zip_path)
 {
     if (!isset($zip_path)) {
         show_json($this->L['share_not_download_tips'], false);
     }
     load_class('pclzip');
     ini_set('memory_limit', '2028M');
     //2G;
     $zip_list = json_decode($this->in['list'], true);
     $list_num = count($zip_list);
     for ($i = 0; $i < $list_num; $i++) {
         $zip_list[$i]['path'] = _DIR_CLEAR($this->path . $this->_clear($zip_list[$i]['path']));
     }
     //指定目录
     if ($list_num == 1) {
         $path_this_name = get_path_this($zip_list[0]['path']);
     } else {
         $path_this_name = get_path_this(get_path_father($zip_list[0]['path']));
     }
     $zipname = $zip_path . $path_this_name . '.zip';
     $zipname = get_filename_auto($zipname, date(' h.i.s'));
     $files = array();
     for ($i = 0; $i < $list_num; $i++) {
         $files[] = $zip_list[$i]['path'];
     }
     $remove_path_pre = get_path_father($zip_list[0]['path']);
     $archive = new PclZip($zipname);
     $v_list = $archive->create(implode(',', $files), PCLZIP_OPT_REMOVE_PATH, $remove_path_pre);
     return iconv_app($zipname);
 }
예제 #4
0
 /**
  * 上传,html5拖拽  flash 多文件
  */
 public function fileUpload()
 {
     $save_path = $this->path;
     if ($save_path == '') {
         show_json($this->L['upload_error_big'], false);
     }
     if (strlen($this->in['fullPath']) > 1) {
         //folder drag upload
         $full_path = _DIR_CLEAR(rawurldecode($this->in['fullPath']));
         $full_path = get_path_father($full_path);
         $full_path = iconv_system($full_path);
         if (mk_dir($save_path . $full_path)) {
             $save_path = $save_path . $full_path;
         }
     }
     upload('file', $save_path);
 }
예제 #5
0
function path_search($path, $search, $is_content = false, $file_ext = '', $is_case = false)
{
    $ext_arr = explode("|", $file_ext);
    recursion_dir($path, $dirs, $files, -1, 0);
    $strpos = 'stripos';
    //是否区分大小写
    if ($is_case) {
        $strpos = 'strpos';
    }
    $filelist = array();
    $folderlist = array();
    foreach ($files as $f) {
        $ext = get_path_ext($f);
        $path_this = get_path_this($f);
        if ($file_ext != '' && !in_array($ext, $ext_arr)) {
            continue;
        }
        //User-defined file type is not within
        if ($strpos($path_this, $search) !== false) {
            //Search for file names; search to return; not search continues
            $filelist[] = file_info($f);
            continue;
        }
        if ($is_content && is_file($f)) {
            $fp = fopen($f, "r");
            $content = @fread($fp, get_filesize($f));
            fclose($fp);
            if ($strpos($content, iconv_app($search)) !== false) {
                $filelist[] = file_info($f);
            }
        }
    }
    if ($file_ext == '') {
        //Extension is not limited only to search folders
        foreach ($dirs as $f) {
            $path_this = get_path_this($f);
            if ($strpos($path_this, $search) !== false) {
                $folderlist[] = array('name' => iconv_app(get_path_this($f)), 'path' => iconv_app(get_path_father($f)));
            }
        }
    }
    return array('folderlist' => $folderlist, 'filelist' => $filelist);
}
예제 #6
0
파일: util.php 프로젝트: WPG/KODExplorer
function php_env_check()
{
    $L = $GLOBALS['L'];
    $error = '';
    $base_path = get_path_this(BASIC_PATH) . '/';
    if (!function_exists('iconv')) {
        $error .= '<li>' . $L['php_env_error_iconv'] . '</li>';
    }
    if (!function_exists('mb_convert_encoding')) {
        $error .= '<li>' . $L['php_env_error_mb_string'] . '</li>';
    }
    if (!version_compare(PHP_VERSION, '5.0', '>=')) {
        $error .= '<li>' . $L['php_env_error_version'] . '</li>';
    }
    if (!function_exists('file_get_contents')) {
        $error .= '<li>' . $L['php_env_error_file'] . '</li>';
    }
    if (!path_writable(BASIC_PATH)) {
        $error .= '<li>' . $base_path . '	' . $L['php_env_error_path'] . '</li>';
    }
    if (!path_writable(BASIC_PATH . 'data')) {
        $error .= '<li>' . $base_path . 'data	' . $L['php_env_error_path'] . '</li>';
    }
    $parent = get_path_father(BASIC_PATH);
    $arr_check = array(BASIC_PATH, BASIC_PATH . 'data', BASIC_PATH . 'data/system', BASIC_PATH . 'data/User', BASIC_PATH . 'data/thumb');
    foreach ($arr_check as $value) {
        if (!path_writable($value)) {
            $error .= '<li>' . str_replace($parent, '', $value) . '/	' . $L['php_env_error_path'] . '</li>';
        }
    }
    if (!function_exists('imagecreatefromjpeg') || !function_exists('imagecreatefromgif') || !function_exists('imagecreatefrompng') || !function_exists('imagecolorallocate')) {
        $error .= '<li>' . $L['php_env_error_gd'] . '</li>';
    }
    return $error;
}