Esempio n. 1
0
 public function fetch_all_by_appid($appids, $havecount = false)
 {
     //返回数据同时加载统计表数据
     global $_G;
     if (!$appids) {
         return false;
     }
     if (!is_array($appids)) {
         $appids = array($appids);
     }
     $return = array();
     foreach ($appids as $appid) {
         $appid = intval($appid);
         if (!($data = self::fetch($appid))) {
             continue;
         }
         if ($data['appico'] != 'dzz/images/default/icodefault.png' && !preg_match("/^(http|ftp|https|mms)\\:\\/\\/(.+?)/i", $data['appico'])) {
             $data['appico'] = $_G['setting']['attachurl'] . $data['appico'];
         }
         $data['fileext'] = $data['fileext'] ? explode(',', $data['fileext']) : array();
         $data['icon'] = $data['appico'];
         $data['title'] = $data['appname'];
         $data['url'] = replace_canshu($data['appurl']);
         $data['noticeurl'] = replace_canshu($data['noticeurl']);
         if ($havecount) {
             $count = C::t('count')->fetch_by_type($appid, 'app');
             $data['viewnum'] = intval($count['viewnum']);
             $data['replynum'] = intval($count['replynum']);
             $data['downnum'] = intval($count['downnum']);
             $data['star'] = intval($count['star']);
             $data['starnum'] = intval($count['starnum']);
         }
         $return[$appid] = $data;
     }
     return $return;
 }
Esempio n. 2
0
    $sql .= " and (`group` = '2' OR `group`='0' OR (" . $l . "))";
} else {
    //普通成员
    $l = " (`group` = '1')";
    if ($notappids = C::t('app_organization')->fetch_notin_appids_by_uid($_G['uid'])) {
        $l .= " and appid  NOT IN (" . dimplode($notappids) . ") ";
    }
    $sql .= " and (`group`='0' OR (" . $l . "))";
}
if ($count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('app_market') . " WHERE  {$sql} ")) {
    $apps = DB::fetch_all("SELECT * FROM " . DB::table('app_market') . " WHERE  {$sql}  {$order} limit {$start},{$perpage}");
    $multi = multi($count, $perpage, $page, $theurl, 'pull-right');
}
$list = array();
//$grouptitle=array('0'=>'全部','-1'=>'仅游客可用','1'=>'成员可用','2'=>'部门管理员可用','3'=>'仅系统管理员可用');
foreach ($apps as $value) {
    if ($value['isshow'] < 1) {
        continue;
    }
    $value['tags'] = C::t('app_relative')->fetch_all_by_appid($value['appid']);
    if ($value['appico'] != 'dzz/images/default/icodefault.png' && !preg_match("/^(http|ftp|https|mms)\\:\\/\\/(.+?)/i", $value['appico'])) {
        $value['appico'] = $_G['setting']['attachurl'] . $value['appico'];
    }
    $value['url'] = replace_canshu($value['appurl']);
    if (in_array($value['appid'], $applist)) {
        $value['isinstall'] = true;
    }
    $list[$value['appid']] = $value;
}
$jsondata = json_encode_gbk($list);
include template('market');
Esempio n. 3
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;
 }
Esempio n. 4
0
 public function fetch_all_ext()
 {
     $data = array();
     if (($data = $this->fetch_cache('all')) === false) {
         $data = array();
         $query = DB::query("SELECT * FROM %t WHERE 1 ", array($this->_table));
         while ($value = DB::fetch($query)) {
             if ($value['appid']) {
                 if ($app = C::t('app_market')->fetch_by_appid($value['appid'], false)) {
                     if ($app['available'] < 1) {
                         continue;
                     }
                     if (!$value['icon']) {
                         $value['icon'] = $app['appico'];
                     }
                     if (!$value['name']) {
                         $value['name'] = $app['appname'];
                     }
                     if (!$value['url']) {
                         $value['url'] = $app['appurl'];
                     }
                     if (!$value['nodup']) {
                         $value['nodup'] = $app['nodup'];
                     }
                     if (!$value['feature']) {
                         $value['feature'] = $app['feature'];
                     }
                 } else {
                     continue;
                 }
             }
             $value['url'] = replace_canshu($value['url']);
             $data[$value['extid']] = $value;
         }
         if (!empty($data)) {
             $this->store_cache('all', $data);
         }
     }
     return $data;
 }
Esempio n. 5
0
} elseif ($do == 'filemanage') {
    $perpage = isset($_GET['perpage']) ? intval($_GET['perpage']) : 100;
    $page = empty($_GET['page']) ? 1 : intval($_GET['page']);
    $start = ($page - 1) * $perpage;
    $total = 0;
    $winid = $_GET['winid'];
    $sid = empty($_GET['id']) ? 0 : $_GET['id'];
    $marker = empty($_GET['marker']) ? '' : trim($_GET['marker']);
    $bz = empty($_GET['bz']) ? '' : urldecode($_GET['bz']);
    $path = rawurldecode($_GET['path']);
    $arr = array();
    $icoid = intval($_GET['icoid']);
    $uid = empty($_GET['uid']) ? 0 : intval($_GET['uid']);
    if ($icoid && ($icoarr = DB::fetch_first("select * from " . DB::table('icos') . " where icoid='{$icoid}'"))) {
        $icoarr = replace_remote($icoarr);
        $icoarr['url'] = replace_canshu($icoarr['url']);
        $icoarr['fsize'] = formatsize($icoarr['size']);
        $icoarr['ftype'] = getFileTypeName($icoarr['type'], $icoarr['ext']);
        $icoarr['fdateline'] = dgmdate($icoarr['dateline']);
        $data1[$icoarr['icoid']] = $icoarr;
        $json_data1 = json_encode_gbk($data1);
    }
    $data = array();
    $userdata = array();
    $folderids = $folderdata = $baiduids = $storageids = array();
    $force = intval($_GET['force']);
    if ($bz) {
        $keyword = urldecode($_GET['keyword']);
        $asc = intval($_GET['asc']);
        list($prex, $id) = explode('-', $sid);
        $container = 'icosContainer_folder_' . $id;