} if ($type) { $sql .= ' and type=%s'; $param[] = $type; } if ($count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('icos') . " WHERE {$sql}", $param)) { $data = DB::fetch_all("SELECT uid,icoid,oid,name,type,pfid,dateline,size,ext FROM " . DB::table('icos') . " WHERE {$sql} {$order} limit {$start},{$perpage}", $param); $multi = multi($count, $perpage, $page, $theurl, 'pull-right'); } $list = array(); foreach ($data as $value) { $user = getuserbyuid($value['uid']); $value['size'] = formatsize($value['size']); $value['dateline'] = dgmdate($value['dateline'], 'u'); $value['ftype'] = getFileTypeName($value['type'], $value['ext']); $value['path'] = implode('/', array_reverse(getPathByPfid($value['pfid']))); $value['username'] = $user['username']; if (!($sourcedata = C::t('icos')->getsourcedata($value['type'], $value['oid']))) { continue; } $value = array_merge($sourcedata, $value); if ($value['type'] == 'image') { $value['img'] = DZZSCRIPT . '?mod=io&op=thumbnail&width=256&height=256&path=' . dzzencode($value['icoid']); $value['url'] = DZZSCRIPT . '?mod=io&op=thumbnail&width=1440&height=900&original=1&path=' . dzzencode($value['icoid']); } elseif ($value['type'] == 'attach' || $value['type'] == 'document') { $value['img'] = geticonfromext($value['ext'], $value['type']); $value['url'] = DZZSCRIPT . '?mod=io&op=getStream&path=' . dzzencode($value['icoid']); } elseif ($value['type'] == 'dzzdoc') { $value['url'] = DZZSCRIPT . '?mod=document&icoid=' . dzzencode($value['icoid']); $value['img'] = isset($value['icon']) ? $value['icon'] : geticonfromext($value['ext'], $value['type']); } else {
} else { $arr = getPathByPfid($icoarr['pfid']); $patharr = array(); while ($arr) { $patharr[] = array_pop($arr); } $info['path'] = implode('/', $patharr) . '/' . $icoarr['name']; switch ($icoarr['type']) { case 'shortcut': $icoarr['bz'] = $icoarr['tdata']['bz']; $icoarr['path'] = $icoarr['tdata']['path']; $info['path'] = implode('/', $patharr) . '/' . $icoarr['name']; if ($icoarr['bz']) { $info['path'] = $icoarr['path']; } else { $arr1 = getPathByPfid($icoarr['tdata']['pfid']); $patharr1 = array(); while ($arr1) { $patharr1[] = array_pop($arr1); } $info['path'] = implode('/', $patharr1) . '/' . $icoarr['tdata']['name']; } $info['size'] = '-'; if ($icoarr['tdata']['type'] == 'folder') { $info['icon'] = 'dzz/images/default/system/folder.png'; } break; case 'folder': if ($icoarr['gid'] > 0 && ($pfolder = C::t('folder')->fetch_by_fid($icoarr['pfid'])) && perm_binPerm::havePower('read2', $pfolder['perm1']) && (C::t('organization_admin')->ismoderator_by_uid_orgid($icoarr['gid'], $_G['uid']) || $_G['adminid'] == 1)) { $folder = C::t('folder')->fetch($icoarr['oid']); $ismoderator = 1;
function getPathByPfid($pfid, $arr = array(), $count = 0) { //static $arr=array(); //static $count=0; if ($count > 100) { return $arr; } else { $count++; } if ($value = DB::fetch_first("select pfid,fid,fname from " . DB::table('folder') . " where fid='{$pfid}'")) { $arr[$value['fid']] = $value['fname']; if ($value['pfid'] > 0 && $value['pfid'] != $pfid) { $arr = getPathByPfid($value['pfid'], $arr, $count); } } //$arr=array_reverse($arr); return $arr; }