Exemplo n.º 1
0
 public function fetch_by_id($id)
 {
     $value = self::fetch($id);
     $cloud = DB::fetch_first("select * from " . DB::table('connect') . " where bz='{$value['bz']}'");
     $data = array('id' => $value['id'], 'fid' => md5($cloud['bz'] . ':' . $value['id'] . ':' . $cloud['root']), 'pfid' => 0, 'fname' => $value['cloudname'], 'ficon' => 'dzz/images/default/system/' . $cloud['bz'] . '.png', 'bz' => $cloud['bz'] . ':' . $value['id'] . ':', 'path' => $cloud['bz'] . ':' . $value['id'] . ':' . $cloud['root'], 'type' => 'ftp', 'fsperm' => perm_FolderSPerm::flagPower($cloud['bz']), 'perm' => perm_binPerm::getGroupPower('all'), 'flag' => $cloud['bz'], 'iconview' => 1, 'disp' => '0');
     return $data;
 }
Exemplo n.º 2
0
 public function fetch_by_id($id)
 {
     $value = self::fetch($id);
     $cloud = DB::fetch_first("select * from " . DB::table('connect') . " where bz='{$value['bz']}'");
     $value['access_id'] = authcode($value['access_id'], 'DECODE', $value['bz']) ? authcode($value['access_id'], 'DECODE', $value['bz']) : $value['access_id'];
     if (!$value['cloudname']) {
         $value['cloudname'] = $cloud['name'] . ':' . ($value['bucket'] ? $value['bucket'] : cutstr($value['access_id'], 4, ''));
     }
     if ($value['bucket']) {
         $value['bucket'] .= '/';
     }
     $data = array('id' => $value['id'], 'fid' => md5($cloud['bz'] . ':' . $value['id'] . ':' . $value['bucket']), 'pfid' => 0, 'fname' => $value['cloudname'], 'ficon' => 'dzz/images/default/system/' . $cloud['bz'] . '.png', 'bz' => $cloud['bz'] . ':' . $value['id'] . ':', 'path' => $cloud['bz'] . ':' . $value['id'] . ':' . $value['bucket'], 'type' => 'storage', 'fsperm' => $value['bucket'] ? '0' : perm_FolderSPerm::flagPower($cloud['bz'] . '_root'), 'perm' => perm_binPerm::getGroupPower('all'), 'flag' => $cloud['bz'], 'iconview' => 1, 'disp' => '0');
     return $data;
 }
Exemplo n.º 3
0
 function getFolderByIcosdata($icosdata)
 {
     global $_GET;
     $folder = array();
     if ($icosdata['type'] == 'folder') {
         $folder = array('fid' => $icosdata['oid'], 'path' => $icosdata['path'], 'fname' => $icosdata['name'], 'uid' => $icosdata['uid'], 'pfid' => $icoadata['pfid'], 'iconview' => $_GET['iconview'] ? intval($_GET['iconview']) : 1, 'disp' => $_GET['disp'] ? intval($_GET['disp']) : 1, 'perm' => $this->perm, 'hash' => $icosdata['hash'], 'bz' => $icosdata['bz'], 'gid' => $icosdata['gid'], 'fsperm' => perm_FolderSPerm::flagPower('baiduPCS'));
     }
     return $folder;
 }
Exemplo n.º 4
0
 function getFolderByIcosdata($icosdata)
 {
     global $_GET;
     $folder = array();
     //通过path判断是否为bucket
     $path = $icosdata['path'];
     $arr = self::parsePath($path);
     if (!$arr['bucket']) {
         //根目录
         $fsperm = perm_FolderSPerm::flagPower('bucklist');
     } else {
         $fsperm = perm_FolderSPerm::flagPower('external');
     }
     if ($icosdata['type'] == 'folder') {
         $folder = array('fid' => $icosdata['oid'], 'path' => $icosdata['path'], 'fname' => $icosdata['name'], 'uid' => $icosdata['uid'], 'pfid' => $icosdata['pfid'], 'ppath' => $icosdata['ppath'], 'iconview' => $_GET['iconview'] ? intval($_GET['iconview']) : 0, 'disp' => $_GET['disp'] ? intval($_GET['disp']) : 0, 'perm' => $this->perm, 'hash' => $icosdata['hash'], 'bz' => $icosdata['bz'], 'gid' => $icosdata['gid'], 'fsperm' => $fsperm, 'nextMarker' => $icosdata['nextMarker'], 'IsTruncated' => $icosdata['IsTruncated']);
         //print_r($folder);
     }
     return $folder;
 }
Exemplo n.º 5
0
                $value1['bucket'] .= '/';
            }
            $value1['icoid'] = md5($value['bz'] . ':' . $value1['id'] . ':' . $value1['bucket']);
            $value1['img'] = 'dzz/images/default/system/' . $value['bz'] . '.png';
            $mycloud[] = $value1;
            $icosdata[md5($value['bz'] . ':' . $value1['id'] . ':' . $value1['bucket'])] = array('icoid' => md5($value['bz'] . ':' . $value1['id'] . ':' . $value1['bucket']), 'name' => $value1['cloudname'], 'img' => 'dzz/images/default/system/' . $value['bz'] . '.png', 'bz' => $value['bz'] . ':' . $value1['id'] . ':', 'path' => $value['bz'] . ':' . $value1['id'] . ':' . $value1['bucket'], 'type' => 'storage', 'oid' => md5($value['bz'] . ':' . $value1['id'] . ':' . $value1['bucket']));
            $folderdata[md5($value['bz'] . ':' . $value1['id'] . ':' . $value1['bucket'])] = array('fid' => md5($value['bz'] . ':' . $value1['id'] . ':' . $value1['bucket']), 'pfid' => 0, 'fname' => $value1['cloudname'], 'icon' => 'dzz/images/default/system/' . $value['bz'] . '.png', 'bz' => $value['bz'] . ':' . $value1['id'] . ':', 'path' => $value['bz'] . ':' . $value1['id'] . ':' . $value1['bucket'], 'type' => 'storage', 'fsperm' => $value1['bucket'] ? '0' : perm_FolderSPerm::flagPower($value['bz'] . '_root'), 'perm' => perm_binPerm::getGroupPower('all'));
        }
    } elseif ($value['type'] == 'ftp') {
        foreach (DB::fetch_all("select id,bz,cloudname,dateline from " . DB::table($value['dname']) . " where bz='{$value[bz]}' and uid='{$_G[uid]}'") as $value1) {
            $value1['bz'] = $value['bz'];
            $value1['icoid'] = md5($value['bz'] . ':' . $value1['id'] . ':');
            $value1['img'] = 'dzz/images/default/system/' . $value['bz'] . '.png';
            $mycloud[] = $value1;
            $icosdata[md5($value['bz'] . ':' . $value1['id'] . ':')] = array('icoid' => md5($value['bz'] . ':' . $value1['id'] . ':' . $value1['bucket']), 'name' => $value1['cloudname'], 'img' => 'dzz/images/default/system/' . $value['bz'] . '.png', 'bz' => $value['bz'] . ':' . $value1['id'] . ':', 'path' => $value['bz'] . ':' . $value1['id'] . ':', 'type' => 'ftp', 'oid' => md5($value['bz'] . ':' . $value1['id'] . ':'));
            $folderdata[md5($value['bz'] . ':' . $value1['id'] . ':')] = array('fid' => md5($value['bz'] . ':' . $value1['id'] . ':'), 'pfid' => 0, 'fname' => $value1['cloudname'], 'icon' => 'dzz/images/default/system/' . $value['bz'] . '.png', 'bz' => $value['bz'] . ':' . $value1['id'] . ':', 'path' => $value['bz'] . ':' . $value1['id'] . ':', 'type' => 'ftp', 'fsperm' => perm_FolderSPerm::flagPower($value['bz']), 'perm' => perm_binPerm::getGroupPower('all'));
        }
    }
}
//按创建时间排序时间排序
function sortcloud($a, $b)
{
    if ($a['dateline'] == $b['dateline']) {
        return 0;
    }
    return $a['dateline'] > $b['dateline'] ? -1 : 1;
}
usort($mycloud, "sortcloud");
$icosdata_json = json_encode($icosdata);
$folderdata_json = json_encode($folderdata);
include template("connect_index");
Exemplo n.º 6
0
 function checkperm_Container($pfid, $action = '', $bz = '')
 {
     //检查容器是否有权限操作;
     global $_G;
     if ($_G['uid'] < 1) {
         //游客没有权限
         return false;
     }
     if ($bz) {
         if (!perm_FolderSPerm::isPower(perm_FolderSPerm::flagPower($bz), $action)) {
             return false;
         }
         return true;
     } else {
         if ($folder = C::t('folder')->fetch_by_fid($pfid)) {
             //首先判断目录的超级权限;
             if (!perm_FolderSPerm::isPower($folder['fsperm'], $action)) {
                 return false;
             }
             //默认目录只有管理员有权限改变排列
             //if($action=='admin' && $_G['adminid']!=1 && $folder['flag']!='folder') return false;
         }
         if ($_G['adminid'] == 1) {
             return true;
         }
         //网址管理员 有权限;
         if ($folder['gid']) {
             return self::groupPerm($pfid, $action, $folder['gid']);
         } else {
             return self::userPerm($pfid, $action);
         }
     }
 }
Exemplo n.º 7
0
function dzz_default_folder_init()
{
    global $_G, $space;
    //建立默认目录
    //创建此用户的根目录
    $root = array('pfid' => 0, 'uid' => $_G['uid'], 'username' => $_G['username'], 'perm' => 0, 'fname' => DB::result_first("select name from " . DB::table('connect') . " where bz='dzz'"), 'flag' => 'home', 'innav' => 1, 'fsperm' => perm_FolderSPerm::flagPower('home'));
    if ($rootfid = DB::result_first("select fid from " . DB::table('folder') . " where uid='{$_G[uid]}' and flag='home' ")) {
        C::t('folder')->update($rootfid, array('fname' => $root['fname'], 'isdelete' => 0, 'pfid' => 0, 'fsperm' => $root['fsperm'], 'perm' => $root['perm']));
    } else {
        $rootfid = C::t('folder')->insert($root, true);
    }
    if ($rootfid) {
        $space['typefid']['home'] = $rootfid;
        foreach (C::t('folder_default')->fetch_all() as $value) {
            unset($value['fid']);
            if ($fid = DB::result_first("select fid from " . DB::table('folder') . " where uid='{$_G[uid]}' and flag='{$value[flag]}'")) {
                C::t('folder')->update($fid, array('pfid' => $rootfid, 'default' => $value['default']));
            } else {
                $value['fsperm'] = perm_FolderSPerm::flagPower($value['flag']);
                $value['pfid'] = $rootfid;
                $value['uid'] = $_G['uid'];
                $value['username'] = $_G['username'];
                $fid = C::t('folder')->insert($value, true);
            }
            $space['typefid'][$value['flag']] = $fid;
        }
    }
}
Exemplo n.º 8
0
 function getFolderByIcosdata($icosdata)
 {
     global $_GET;
     $folder = array();
     //通过path判断是否为bucket
     $path = $icosdata['path'];
     $arr = self::parsePath($path);
     if (!$arr['bucket']) {
         //根目录
         $fsperm = perm_FolderSPerm::flagPower('qiniu_root');
     } else {
         $fsperm = perm_FolderSPerm::flagPower('qiniu');
     }
     if ($icosdata['type'] == 'folder') {
         $folder = array('fid' => $icosdata['oid'], 'path' => $icosdata['path'], 'fname' => $icosdata['name'], 'uid' => $icosdata['uid'], 'pfid' => $icosdata['pfid'], 'ppath' => $icosdata['ppath'], 'iconview' => $_GET['iconview'] ? intval($_GET['iconview']) : 0, 'disp' => $_GET['disp'] ? intval($_GET['disp']) : 0, 'perm' => $this->perm, 'hash' => $icosdata['hash'], 'bz' => $icosdata['bz'], 'gid' => $icosdata['gid'], 'fsperm' => $fsperm, 'icon' => $icosdata['flag'] ? 'dzz/images/default/system/' . $icosdata['flag'] . '.png' : '', 'nextMarker' => $icosdata['nextMarker'], 'IsTruncated' => $icosdata['IsTruncated']);
     }
     return $folder;
 }