Esempio n. 1
0
 /**
  * 删除指定的元素
  * @param string $opath 被移动的文件路径
  * @param string $path 目标位置(可能是同一api内或跨api,这两种情况分开处理)
  * @return icosdatas
  */
 public function DeleteByData($data)
 {
     $havesubitem = 0;
     if (isset($data['contents'])) {
         foreach ($data['contents'] as $key => $value) {
             /*print_r($value);
             		echo '=====<br>';*/
             $return = self::DeleteByData($value);
             if (intval($return['delete']) < 1) {
                 $havesubitem = 1;
             }
             $data['contents'][$key] = $return;
         }
     }
     if ($data['success'] === true && !$havesubitem) {
         if ($data['icoid'] == $data['newdata']['icoid']) {
             $data['newdata']['move'] = 1;
         } else {
             $arr = IO::Delete($data['path'], true);
             if ($arr['icoid']) {
                 $data['delete'] = 1;
             } else {
                 $data['success'] = $arr['error'];
             }
         }
     }
     return $data;
 }
Esempio n. 2
0
 public function Migrate($attach, $remoteid)
 {
     global $_G;
     if (is_numeric($re = self::MoveToSpace($attach, $remoteid))) {
         $remoteid = $re;
         if (C::t('attachment')->update($attach['aid'], array('remote' => $re))) {
             //删除原文件
             $obz = io_remote::getBzByRemoteid($attach['remote']);
             if ($obz == 'dzz') {
                 @unlink($_G['setting']['attachdir'] . $attach['attachment']);
             } else {
                 $opath = $obz . '/' . $attach['attachment'];
                 IO::Delete($opath);
             }
         }
         C::t('local_storage')->update_usesize_by_remoteid($remoteid, $attach['filesize']);
         C::t('local_storage')->update_usesize_by_remoteid($attach['remote'], -$attach['filesize']);
         $attach['remote'] = $remoteid;
         return $attach;
     } else {
         if ($re['error']) {
             $attach['error'] = $re['error'];
             return $attach;
         } else {
             return false;
         }
     }
 }
Esempio n. 3
0
            $arr['msg'] = 'success';
        }
    } else {
        $arr = array();
        $arr['error'] = lang('template', '新建失败');
    }
    echo json_encode($arr);
    exit;
} elseif ($do == 'deleteIco') {
    $arr = array();
    $names = array();
    $i = 0;
    $icoids = $_GET['icoids'];
    $bz = trim($_GET['bz']);
    foreach ($icoids as $icoid) {
        $return = IO::Delete($icoid);
        if (!$return['error']) {
            //处理数据
            $arr['sucessicoids'][$return['icoid']] = $return['icoid'];
            $arr['msg'][$return['icoid']] = 'success';
            $i++;
        } else {
            $arr['msg'][$return['icoid']] = $return['error'];
        }
    }
    echo json_encode_gbk($arr);
    exit;
} elseif ($do == 'emptyFolder') {
    $arr = array();
    $fid = intval($_GET['fid']);
    if ($return = C::t('folder')->empty_by_fid($fid)) {