Exemplo n.º 1
0
        $icoarr['fsize'] = formatsize($icoarr['size']);
        $icoarr['ftype'] = getFileTypeName($icoarr['type'], $icoarr['ext']);
        $icoarr['fdateline'] = dgmdate($icoarr['dateline']);
        echo json_encode($icoarr);
        exit;
    } elseif ($icoarr['icoid'] = DB::insert('icos', $icoarr, 1)) {
        //$icoarr=array_merge($sourcedata,$icoarr);
        $icoarr['url'] = $app['url'];
        $icoarr = array_merge($app, $icoarr);
        addtoconfig($icoarr);
        $icoarr['img'] = $app['appico'];
        $icoarr['bz'] = '';
        $icoarr['fsize'] = formatsize($icoarr['size']);
        $icoarr['ftype'] = getFileTypeName($icoarr['type'], $icoarr['ext']);
        $icoarr['fdateline'] = dgmdate($icoarr['dateline']);
        $icoarr['sperm'] = perm_FileSPerm::typePower($icoarr['type'], '');
        echo json_encode($icoarr);
        exit;
    } else {
        echo json_encode(array('error' => '添加快捷方式失败'));
        exit;
    }
} elseif ($do == 'appuninstall') {
    //删除用户应用
    $appid = intval($_GET['appid']);
    $return = array();
    if ($icoid = DB::result_first("select icoid from %t where oid=%d and uid=%d and type='app'", array('icos', $appid, $_G['uid']))) {
        C::t('icos')->delete($icoid);
        $return['icoid'] = $icoid;
    }
    $applist = DB::result_first("select applist from %t where uid=%d", array('user_field', $_G['uid']));
Exemplo n.º 2
0
 public function fetch_by_icoid($icoid)
 {
     //返回一条数据同时加载资源表数据
     global $_G;
     $icoid = intval($icoid);
     $data = $icodata = $soucedata = array();
     //if($force_from_db || ($data = $this->fetch_cache('parse_'.$icoid)) === false) {
     if (!($icodata = self::fetch($icoid))) {
         return array();
     }
     if (!($sourcedata = self::getsourcedata($icodata['type'], $icodata['oid']))) {
         return array();
     }
     if ($icodata['type'] == 'pan' || $icodata['type'] == 'storage') {
         $icodata['oid'] = $sourcedata['fid'];
     }
     $data = array_merge($sourcedata, $icodata);
     $data['size'] = isset($sourcedata['filesize']) ? $sourcedata['filesize'] : 0;
     if ($data['type'] == 'image') {
         $data['img'] = DZZSCRIPT . '?mod=io&op=thumbnail&width=256&height=256&path=' . dzzencode($data['icoid']);
         $data['url'] = DZZSCRIPT . '?mod=io&op=thumbnail&width=1440&height=900&original=1&path=' . dzzencode($data['icoid']);
     } elseif ($data['type'] == 'attach' || $data['type'] == 'document') {
         $data['img'] = geticonfromext($data['ext'], $data['type']);
         $data['url'] = DZZSCRIPT . '?mod=io&op=getStream&path=' . dzzencode($data['icoid']);
     } elseif ($data['type'] == 'shortcut') {
         $data['img'] = isset($data['tdata']['img']) ? $data['tdata']['img'] : geticonfromext($data['tdata']['ext'], $data['tdata']['type']);
         $data['ttype'] = $data['tdata']['type'];
         $data['ext'] = $data['tdata']['ext'];
     } elseif ($data['type'] == 'dzzdoc') {
         $data['url'] = DZZSCRIPT . '?mod=document&icoid=' . dzzencode($data['icoid']);
         $data['img'] = isset($data['icon']) ? $data['icon'] : geticonfromext($data['ext'], $data['type']);
     } else {
         $data['img'] = isset($data['icon']) ? $data['icon'] : geticonfromext($data['ext'], $data['type']);
     }
     if (empty($data['name'])) {
         $data['name'] = $data['title'];
     }
     $data['url'] = isset($data['url']) ? replace_canshu($data['url']) : '';
     $data['ftype'] = getFileTypeName($data['type'], $data['ext']);
     $data['fdateline'] = dgmdate($data['dateline']);
     $data['fsize'] = formatsize($data['size']);
     $data['path'] = $data['icoid'];
     $data['bz'] = '';
     if ($data['remote'] > 1) {
         $data['rbz'] = io_remote::getBzByRemoteid($data['remote']);
     }
     //增加安全相关的路径
     $data['dpath'] = dzzencode($data['path']);
     $data['apath'] = $data['aid'] ? dzzencode('attach::' . $data['aid']) : $data['dpath'];
     //$data['like']=C::t('icos_like')->fetch_by_icoid_uid($icoid,$data['uid']);
     //获取sperm
     if (!$data['sperm']) {
         $data['sperm'] = perm_FileSPerm::typePower($data['type'], $data['ext']);
     }
     //if(!empty($data)) $this->store_cache('parse_'.$icoid, $data);
     //}
     return $data;
 }