Beispiel #1
0
 public function init_app($user_info)
 {
     $list = $this->sql->get();
     $new_user_app = $this->config['setting_system']['new_user_app'];
     $default = explode(',', $new_user_app);
     $info = array();
     foreach ($default as $key) {
         $info[$key] = $list[$key];
     }
     $desktop = USER_PATH . $user_info['name'] . '/home/desktop/';
     mk_dir($desktop);
     foreach ($info as $key => $data) {
         if (!is_array($data)) {
             continue;
         }
         $path = iconv_system($desktop . $key . '.oexe');
         unset($data['name']);
         unset($data['desc']);
         unset($data['group']);
         file_put_contents($path, json_encode($data));
     }
     $user_info['status'] = 1;
     $member = new fileCache(USER_SYSTEM . 'member.php');
     $member->update($user_info['name'], $user_info);
 }
Beispiel #2
0
function _DIR($path)
{
    $path = _DIR_CLEAR(rawurldecode($path));
    $path = iconv_system($path);
    if (substr($path, 0, strlen(PUBLIC_PATH)) == PUBLIC_PATH) {
        return $path;
    }
    $path = HOME . $path;
    if (is_dir($path)) {
        $path .= '/';
    }
    return $path;
}
Beispiel #3
0
function _DIR($path, $pre_path = HOME)
{
    $path = _DIR_CLEAR(rawurldecode($path));
    $path = iconv_system($path);
    if (is_dir($path)) {
        $path .= '/';
    }
    //公共目录处理
    $share_len = strlen(PUBLIC_PATH);
    if (substr($path, 0, $share_len) == PUBLIC_PATH) {
        $pre_path = '';
        //如果为共享目录 则不追加普通用户的目录前缀
    }
    return $pre_path . $path;
}
Beispiel #4
0
function _DIR($path)
{
    $path = _DIR_CLEAR(rawurldecode($path));
    $path = iconv_system($path);
    if (substr($path, 0, strlen('*recycle*/')) == '*recycle*/') {
        return USER_RECYCLE . str_replace('*recycle*/', '', $path);
    }
    if (substr($path, 0, strlen('*public*/')) == '*public*/') {
        return PUBLIC_PATH . str_replace('*public*/', '', $path);
    }
    if (substr($path, 0, strlen('*share*/')) == '*share*/') {
        return "*share*/";
    }
    $path = HOME . $path;
    if (is_dir($path)) {
        $path = rtrim($path, '/') . '/';
    }
    return $path;
}
Beispiel #5
0
 /**
  * 用户app初始化
  */
 private function init_app($user)
 {
     $sql = new fileCache($this->config['system_file']['apps']);
     $list = $sql->get();
     $desktop = USER_PATH . $user['name'] . '/home/desktop/';
     foreach ($list as $key => $data) {
         $path = iconv_system($desktop . $key . '.oexe');
         unset($data['name']);
         unset($data['desc']);
         unset($data['group']);
         file_put_contents($path, json_encode($data));
     }
     $user['status'] = 1;
     $member = new fileCache($this->config['system_file']['member']);
     $member->update($user['name'], $user);
 }
 private function path($dir, $list_file = true, $check_children = false)
 {
     $path_hidden = $this->config['setting_system']['path_hidden'];
     $ex_name = explode(',', $path_hidden);
     if (strstr($dir, "*share*")) {
         return $this->path_share();
     }
     $list = path_list($dir, $list_file, $check_children);
     $filelist_new = array();
     $folderlist_new = array();
     foreach ($list['filelist'] as $key => $val) {
         if (in_array($val['name'], $ex_name)) {
             continue;
         }
         if ($val['ext'] == 'oexe') {
             $path = iconv_system($val['path']) . '/' . iconv_system($val['name']);
             $json = json_decode(file_get_contents($path), true);
             if (is_array($json)) {
                 $val = array_merge($val, $json);
             }
         }
         $filelist_new[] = $val;
     }
     foreach ($list['folderlist'] as $key => $val) {
         if (in_array($val['name'], $ex_name)) {
             continue;
         }
         $folderlist_new[] = $val;
     }
     $list['filelist'] = $filelist_new;
     $list['folderlist'] = $folderlist_new;
     //读写权限判断
     $list['path_type'] = 'readable';
     if (is_writable($dir)) {
         $list['path_type'] = 'writeable';
     } else {
         if (!is_readable($dir)) {
             $list['path_type'] = 'not_readable';
         }
     }
     _DIR_OUT($list);
     return $list;
 }
Beispiel #7
0
 /**
  * 用户app初始化
  */
 public function init_app($user)
 {
     $sql = new fileCache($this->config['system_file']['apps']);
     $list = $sql->get();
     $default = array('365日历', 'pptv直播', 'ps', 'qq音乐', '搜狐影视', '时钟', '水果忍者', '计算器', '豆瓣电台', '音悦台');
     $info = array();
     foreach ($default as $key) {
         $info[$key] = $list[$key];
     }
     $desktop = USER_PATH . $user['name'] . '/home/desktop/';
     foreach ($info as $key => $data) {
         //touch($path);
         $path = iconv_system($desktop . $key . '.oexe');
         unset($data['name']);
         unset($data['desc']);
         unset($data['group']);
         file_put_contents($path, json_encode($data));
     }
     $user['status'] = 1;
     $member = new fileCache($this->config['system_file']['member']);
     $member->update($user['name'], $user);
 }
Beispiel #8
0
function upload_chunk($fileInput, $path = './', $temp_path)
{
    global $config, $L;
    $file = $_FILES[$fileInput];
    $chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
    $chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 1;
    if (!isset($file)) {
        show_json($L['upload_error_null'], false);
    }
    $file_name = iconv_system($file['name']);
    if ($chunks > 1) {
        //并发上传,不一定有前后顺序
        $temp_file_pre = $temp_path . md5($temp_path . $file_name) . '.part';
        if (get_filesize($file['tmp_name']) == 0) {
            show_json($L['upload_success'], false, 'chunk_' . $chunk . ' error!');
        }
        if (move_uploaded_file($file['tmp_name'], $temp_file_pre . $chunk)) {
            $done = true;
            for ($index = 0; $index < $chunks; $index++) {
                if (!file_exists($temp_file_pre . $index)) {
                    $done = false;
                    break;
                }
            }
            if (!$done) {
                show_json($L['upload_success'], true, 'chunk_' . $chunk . ' success!');
            }
            $save_path = $path . $file_name;
            $out = fopen($save_path, "wb");
            if ($done && flock($out, LOCK_EX)) {
                for ($index = 0; $index < $chunks; $index++) {
                    if (!($in = fopen($temp_file_pre . $index, "rb"))) {
                        break;
                    }
                    while ($buff = fread($in, 4096)) {
                        fwrite($out, $buff);
                    }
                    fclose($in);
                    unlink($temp_file_pre . $index);
                }
                flock($out, LOCK_UN);
                fclose($out);
            }
            show_json($L['upload_success'], true, iconv_app($save_path));
        } else {
            show_json($L['move_error'], false);
        }
    }
    //正常上传
    $save_path = get_filename_auto($path . $file_name);
    //自动重命名
    if (move_uploaded_file($file['tmp_name'], $save_path)) {
        show_json($L['upload_success'], true, iconv_app($save_path));
    } else {
        show_json($L['move_error'], false);
    }
}
 private function path($dir, $list_file = true, $check_children = false)
 {
     $list = path_list($dir, $list_file, $check_children);
     $file_parem = array('filelist' => array(), 'folderlist' => array());
     $path_hidden = $this->config['setting_system']['path_hidden'];
     $ex_name = explode(',', $path_hidden);
     foreach ($list['filelist'] as $key => $val) {
         if (in_array($val['name'], $ex_name)) {
             continue;
         }
         if ($val['ext'] == 'oexe') {
             $path = iconv_system($val['path']) . '/' . iconv_system($val['name']);
             $json = json_decode(file_get_contents($path), true);
             if (is_array($json)) {
                 $val = array_merge($val, $json);
             }
         }
         $file_parem['filelist'][] = $val;
     }
     foreach ($list['folderlist'] as $key => $val) {
         if (in_array($val['name'], $ex_name)) {
             continue;
         }
         $file_parem['folderlist'][] = $val;
     }
     _DIR_OUT($file_parem);
     return $file_parem;
 }
/**
 * 文件上传处理。单个文件上传,多个分多次请求
 * 调用demo
 * upload('file','D:/www/');
 */
function upload($fileInput, $path = './')
{
    global $config, $L;
    $file = $_FILES[$fileInput];
    if (!isset($file)) {
        show_json($L['upload_error_null'], false);
    }
    $file_name = iconv_system($file['name']);
    $info = _upload($file['tmp_name'], $file['size'], $path . $file_name);
    show_json($info['data'], $info['code'], $info['path']);
}
Beispiel #11
0
 private function path($dir, $list_file = true, $check_children = false)
 {
     $list = path_list($dir, $list_file, $check_children);
     foreach ($list['filelist'] as $key => $val) {
         if ($val['ext'] == 'oexe') {
             $path = iconv_system($val['path']) . '/' . iconv_system($val['name']);
             $json = json_decode(file_get_contents($path), true);
             if (is_array($json)) {
                 $list['filelist'][$key] = array_merge($val, $json);
             }
         }
     }
     _DIR_OUT($list);
     return $list;
 }
Beispiel #12
0
 /**
  * 用户app初始化
  */
 public function init_app($user)
 {
     $sql = new fileCache($this->config['system_file']['apps']);
     $list = $sql->get();
     $desktop = USER_PATH . $user . '/home/desktop/';
     foreach ($list as $key => $data) {
         //touch($path);
         $path = iconv_system($desktop . $key . '.oexe');
         unset($data['name']);
         unset($data['desc']);
         unset($data['group']);
         file_put_contents($path, json_encode($data));
     }
 }