コード例 #1
0
ファイル: QiniuClass.php プロジェクト: huangbinzd/kppwGit
 public function delete($key)
 {
     $err = Qiniu_RS_Delete(new Qiniu_MacHttpClient(null), $this->_Bucket, $key);
     if ($err !== null) {
         return false;
     }
     return true;
 }
コード例 #2
0
ファイル: RsTest.php プロジェクト: timelessmemory/uhkklp
 public function testBatchStat()
 {
     $key2 = 'testOp2' . getTid();
     Qiniu_RS_Delete($this->client, $this->bucket, $key2);
     $entries = array(new Qiniu_RS_EntryPath($this->bucket, $this->key), new Qiniu_RS_EntryPath($this->bucket, $key2));
     list($ret, $err) = Qiniu_RS_BatchStat($this->client, $entries);
     $this->assertNotNull($err);
     $this->assertEquals($ret[0]['code'], 200);
     $this->assertEquals($ret[1]['code'], 612);
 }
コード例 #3
0
ファイル: Plugin.php プロジェクト: Fengtalk/QiniuFile
 public static function deleteFile($filepath)
 {
     // 获取插件配置
     $option = self::getConfig();
     // 初始化 SDK
     self::initSDK($option->accesskey, $option->sercetkey);
     // 删除
     $client = new Qiniu_MacHttpClient(null);
     return Qiniu_RS_Delete($client, $option->bucket, $filepath);
 }
コード例 #4
0
ファイル: qiniu.class.php プロジェクト: sunlyliuh/myproject
 /**
  * 删除存储的文件
  * @param type $qiniuFileName 云存储里的文件名
  */
 public function deleteFile($qiniuFileName)
 {
     $key1 = $qiniuFileName;
     $client = new Qiniu_MacHttpClient(null);
     $err = Qiniu_RS_Delete($client, $this->_bucket, $key1);
     if ($err !== null) {
         var_dump($err);
     } else {
         echo "Success! \n";
     }
 }
コード例 #5
0
 public function delete($filename)
 {
     $this->setBucketAndKey($filename);
     Qiniu_SetKeys($this->accessKey, $this->secretKey);
     $client = new \Qiniu_MacHttpClient(null);
     $err = Qiniu_RS_Delete($client, $this->bucket, $this->key);
     if ($err !== null) {
         return false;
     } else {
         return true;
     }
 }
コード例 #6
0
ファイル: RsUtilsTest.php プロジェクト: timelessmemory/uhkklp
 public function testPut()
 {
     $key = 'tmp/testPut' . getTid();
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     list($ret, $err) = Qiniu_RS_Put($this->client, $this->bucket, $key, 'hello world!', null);
     $this->assertNull($err);
     $this->assertArrayHasKey('hash', $ret);
     var_dump($ret);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $key);
     $this->assertNull($err);
     var_dump($ret);
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $this->assertNull($err);
 }
コード例 #7
0
ファイル: IoTest.php プロジェクト: rwifeng/7niu
 public function testPut()
 {
     $key = 'testPut' . getTid();
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $putPolicy = new Qiniu_RS_PutPolicy($this->bucket);
     $upToken = $putPolicy->Token(null);
     list($ret, $err) = Qiniu_Put($upToken, $key, "hello world!", null);
     $this->assertNull($err);
     $this->assertArrayHasKey('hash', $ret);
     var_dump($ret);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $key);
     $this->assertNull($err);
     var_dump($ret);
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $this->assertNull($err);
 }
コード例 #8
0
ファイル: RioTest.php プロジェクト: rwifeng/7niu
 public function testLargePut()
 {
     $key = 'testRioLargePut' . getTid();
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $putPolicy = new Qiniu_RS_PutPolicy($this->bucket);
     $upToken = $putPolicy->Token(null);
     $putExtra = new Qiniu_Rio_PutExtra($this->bucket);
     $reader = new MockReader();
     list($ret, $err) = Qiniu_Rio_Put($upToken, $key, $reader, QINIU_RIO_BLOCK_SIZE + 5, $putExtra);
     $this->assertNull($err);
     $this->assertEquals($ret['hash'], "lgQEOCZ8Ievliq8XOfZmWTndgOll");
     var_dump($ret);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $key);
     $this->assertNull($err);
     var_dump($ret);
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $this->assertNull($err);
 }
コード例 #9
0
 public function testPutWithPersistentOps()
 {
     $key = 'testPutWithPersistentOps' . getTid();
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $putPolicy = new Qiniu_RS_PutPolicy($this->bucket);
     $putPolicy->PersistentOps = 'avthumb/mp3';
     $putPolicy->PersistentNotifyUrl = 'http://someurl/abc';
     $upToken = $putPolicy->Token(null);
     list($ret, $err) = Qiniu_Put($upToken, $key, "hello world!", null);
     $this->assertNull($err);
     $this->assertArrayHasKey('hash', $ret);
     $this->assertArrayHasKey('persistentId', $ret);
     var_dump($ret);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $key);
     $this->assertNull($err);
     var_dump($ret);
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $this->assertNull($err);
 }
コード例 #10
0
 public function actionDelmv($id)
 {
     Yii::import('application.vendors.*');
     require_once 'Qiniu/rs.php';
     require_once 'Qiniu/io.php';
     $bucket = Yii::app()->params['bucket'];
     $accessKey = Yii::app()->params['accessKey'];
     $secretKey = Yii::app()->params['secretKey'];
     $mvModel = new Mv();
     $mvInfo = $mvModel->findByPk($id);
     if ($mvInfo != NULL) {
         Qiniu_SetKeys($accessKey, $secretKey);
         $client = new Qiniu_MacHttpClient(null);
         $err = Qiniu_RS_Delete($client, $bucket, $mvInfo['mv']);
     }
     //上传业务数据库中数据
     if ($mvModel->deleteByPk($id)) {
         Yii::app()->user->setFlash('delmvstatus', 'YES,删除视频成功 :)');
     } else {
         Yii::app()->user->setFlash('delmvstatus', 'Sorry,系统出错,删除视频失败 :(');
     }
     $this->redirect(array("imv"));
 }
コード例 #11
0
ファイル: Qiniu.php プロジェクト: callmez/yii2-file-system
 /**
  * Delete a file
  *
  * @param $path
  * @return bool
  */
 public function delete($path)
 {
     $err = Qiniu_RS_Delete($this->getClient(), $this->bucket, $path);
     return $err === null;
 }
コード例 #12
0
ファイル: attachment.php プロジェクト: eehello/emlog_qiniu
function deleteQiNiu($filePath)
{
    //这里写入七牛的空间名
    $bucket = "1111";
    //$bucket = "gavinwen-topic";
    $key1 = basename($filePath);
    //这里写入七牛的accessKey和secretKey
    $accessKey = 'sVv4Xk-11';
    $secretKey = '333-11222';
    Qiniu_SetKeys($accessKey, $secretKey);
    $client = new Qiniu_MacHttpClient(null);
    $err = Qiniu_RS_Delete($client, $bucket, $key1);
    if ($err !== null) {
        return false;
    } else {
        return true;
    }
}
コード例 #13
0
ファイル: W2Qiniu.php プロジェクト: alonexy/lea
 public static function deleteFile($key)
 {
     Qiniu_SetKeys(W2Config::$Qiniu_accessKey, W2Config::$Qiniu_secretKey);
     $client = new Qiniu_MacHttpClient(null);
     $err = Qiniu_RS_Delete($client, W2Config::$Qiniu_bucket, $key);
     if ($err !== null) {
         if (defined('IS_SQL_PRINT') && IS_SQL_PRINT) {
             var_dump($err);
         }
         return false;
     } else {
         return true;
     }
 }
コード例 #14
0
ファイル: qiniutek-options.php プロジェクト: yszar/linuxwp
function wpjam_qiniutek_update_file($file, $echo = true)
{
    global $qiniutek_client;
    if (!$qiniutek_client) {
        $qiniutek_client = wpjam_get_qiniutek_client();
    }
    $wpjam_qiniutek = get_option('wpjam-qiniutek');
    $qiniutek_bucket = $wpjam_qiniutek['bucket'];
    $file_array = parse_url($file);
    $key = str_replace($file_array['scheme'] . '://' . $file_array['host'] . '/', '', $file);
    $err = Qiniu_RS_Delete($qiniutek_client, $qiniutek_bucket, $key);
    if ($echo) {
        if ($err !== null) {
            $msg = ' 发生错误:<span style="color:red">' . $err->Err . '</span><br />';
        } else {
            $msg = ' 清理成功<br />';
        }
    }
    return $msg;
}
コード例 #15
0
ファイル: demo.php プロジェクト: timelessmemory/uhkklp
    var_dump($err);
} else {
    var_dump($ret);
}
# @endgist
# @gist copy
$err = Qiniu_RS_Copy($client, $bucket, $key1, $bucket, $key2);
echo "\n\n====> Qiniu_RS_Copy result: \n";
if ($err !== null) {
    var_dump($err);
} else {
    echo "Success! \n";
}
# @endgist
# @gist delete
$err = Qiniu_RS_Delete($client, $bucket, $key1);
echo "\n\n====> Qiniu_RS_Delete result: \n";
if ($err !== null) {
    var_dump($err);
} else {
    echo "Success! \n";
}
# @endgist
# @gist move
$err = Qiniu_RS_Move($client, $bucket, $key2, $bucket, $key1);
echo "\n\n====> Qiniu_RS_Move result: \n";
if ($err !== null) {
    var_dump($err);
} else {
    echo "Success! \n";
}
コード例 #16
0
ファイル: Qiniu.php プロジェクト: Doweidu/DWDQiniuSdkBundle
 public function delete($key)
 {
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     if ($err !== null) {
         throw new QiniuDeleteException($err->Err, $err->Code, $key);
     } else {
         return true;
     }
 }
コード例 #17
0
ファイル: delete.php プロジェクト: sungf/mmfei
<?php 
/**
 * 删除文件
 *
 * @version $VersionId$ @ $UpdateTime$
 * @author 404 <*****@*****.**>
 * @copyright Copyright (c) 2011-2012 404 <*****@*****.**>
 * @license MIT License {@link http://www.opensource.org/licenses/mit-license.php}
 */
require_once 'bootstrap.php';
if (empty($_COOKIE["uid"]) || (int) $_COOKIE["uid"] < 1) {
    header("Location: login.php");
    exit;
}
$uid = $_COOKIE["uid"];
if (isset($_GET["id"])) {
    $id = trim($_GET["id"]);
    # check user is valid or not
    $userRow = $db->getOne("SELECT id FROM users WHERE id='{$uid}' LIMIT 1");
    # if is this user ok, then
    if ((int) $userRow["id"] > 0 && !empty($id)) {
        $fileRow = $db->getOne("SELECT file_key FROM uploads WHERE id='{$id}' LIMIT 1");
        $err = Qiniu_RS_Delete($client, $bucket, $fileRow['file_key']);
        if ($err == null) {
            $res = $db->execute("DELETE FROM uploads WHERE id='{$id}' AND user_id='{$uid}'");
        }
    }
}
header("Location: index.php");
exit;
コード例 #18
0
ファイル: Plugin.php プロジェクト: duxiangfei/plugins
 /**
  * 图片裁切处理
  *
  * @access public
  * @param string $imagename,$width,$height,$xset,$yset 基本参数
  * @param string $path 附件源路径
  * @param string $url 附件源地址
  * @return string
  */
 public static function crophandle($imgname, $width, $height, $xset, $yset, $path = NULL, $url = NULL)
 {
     $options = Helper::options();
     $settings = $options->plugin('HighSlide');
     $filedata = self::filedata($path, $url);
     $imgdir = $settings->storage == 'local' ? $filedata->dir : $filedata->url;
     $imgfile = $url ? $url : $imgdir . $imgname;
     $thumbdir = $settings->storage == 'local' ? $imgdir : __TYPECHO_ROOT_DIR__ . __TYPECHO_PLUGIN_DIR__ . '/HighSlide/tmp/';
     if (!is_dir($thumbdir)) {
         if (!self::makehsdir($thumbdir)) {
             return false;
         }
     }
     $thumbfile = $thumbdir . 'thumb_' . $imgname;
     $thumbpath = $filedata->dir . 'thumb_' . $imgname;
     //预览尺寸适应
     list($imgwidth, $imgheight, $imgtype) = getimagesize($imgfile);
     $imgtype = image_type_to_mime_type($imgtype);
     $adjust = $imgwidth > 442 ? $imgwidth / 442 : 1;
     if ($url) {
         $adjust = $imgwidth > 248 ? $imgwidth / 248 : 1;
     }
     $xset *= $adjust;
     $yset *= $adjust;
     $width *= $adjust;
     $height *= $adjust;
     //缩放规格
     switch ($settings->thumbfix) {
         case 'fixedwidth':
             $scale = $settings->fixedwidth / $width;
             break;
         case 'fixedheight':
             $scale = $settings->fixedheight / $height;
             break;
         case 'fixedratio':
             $fix = explode(':', $settings->fixedratio);
             $scale = $fix[0] / $fix[1];
             break;
     }
     $newwidth = $width * $scale;
     $newheight = $height * $scale;
     //采样
     $newimg = imagecreatetruecolor($newwidth, $newheight);
     switch ($imgtype) {
         case "image/gif":
             $source = imagecreatefromgif($imgfile);
             break;
         case "image/pjpeg":
         case "image/jpeg":
         case "image/jpg":
             $source = imagecreatefromjpeg($imgfile);
             break;
         case "image/png":
         case "image/x-png":
             $source = imagecreatefrompng($imgfile);
             break;
     }
     //渲染
     imagecopyresampled($newimg, $source, 0, 0, $xset, $yset, $newwidth, $newheight, $width, $height);
     switch ($imgtype) {
         case "image/gif":
             imagegif($newimg, $thumbfile);
             break;
         case "image/pjpeg":
         case "image/jpeg":
         case "image/jpg":
             imagejpeg($newimg, $thumbfile, 100);
             break;
         case "image/png":
         case "image/x-png":
             imagepng($newimg, $thumbfile);
             break;
     }
     chmod($thumbfile, 0777);
     $thumbsize = filesize($thumbfile);
     if (strpos($url, $options->siteUrl) === false) {
         //七牛上传
         if ($settings->storage == 'qiniu') {
             self::qiniuset($settings->qiniuaccesskey, $settings->qiniusecretkey);
             $client = new Qiniu_MacHttpClient(null);
             Qiniu_RS_Delete($client, $settings->qiniubucket, $thumbpath);
             $policy = new Qiniu_RS_PutPolicy($settings->qiniubucket);
             $token = $policy->Token(null);
             $extra = new Qiniu_PutExtra();
             $extra->Crc32 = 1;
             list($result, $error) = Qiniu_PutFile($token, $thumbpath, $thumbfile, $extra);
             if ($error !== null) {
                 return false;
             }
             unlink($thumbfile);
         }
         //又拍云上传
         if ($settings->storage == 'upyun') {
             $upyun = self::upyunset();
             $upyun->delete($thumbpath);
             $upyun->writeFile($thumbpath, file_get_contents($thumbfile), TRUE);
             unlink($thumbfile);
         }
         //百度BCS上传
         if ($settings->storage == 'bcs') {
             $bcs = self::bcsset();
             $bcs->delete_object($settings->bcsbucket, $thumbpath);
             $result = $bcs->create_object($settings->bcsbucket, $thumbpath, $thumbfile, array("acl" => "public-read"));
             if (!$result->isOK()) {
                 return false;
             }
             unlink($thumbfile);
         }
         //本地附件源移动
     } else {
         rename($thumbfile, $thumbpath);
     }
     return $thumbsize;
 }
コード例 #19
0
ファイル: upfile.php プロジェクト: returncn/chen-xia-cms
 */
if (!empty($_SESSION['uid'])) {
    $uid = $_SESSION['uid'];
    require_once '../qiniu/io.php';
    require_once '../qiniu/rs.php';
    $qiniu = (include '../qiniu/qiniu.php');
    require_once '../connect/PdoConnect.class.php';
    $db = (include '../connect/dbconfig.php');
    $accessKey = $qiniu['accessKey'];
    $secretKey = $qiniu['secretKey'];
    $bucket = $qiniu['bucket'];
    $pdo = new PDO_CON($db['dbtype'], $db['host'], $db['user'], $db['pasw'], $db['dbname']);
    $conn = $pdo->get_conId();
    Qiniu_SetKeys($accessKey, $secretKey);
    //1
    $sql = "select headpicture from ws_user where id = {$uid} ";
    $res = $pdo->ExceSQL($sql, $conn);
    if (!empty($res[0]['headpicture'])) {
        $client = new Qiniu_MacHttpClient(null);
        $err = Qiniu_RS_Delete($client, $bucket, $res[0]['headpicture']);
    }
    //2
    $newname = time() . rand(10000, 99999) . '.jpg';
    $putPolicy = new Qiniu_RS_PutPolicy($bucket);
    $upToken = $putPolicy->Token(null);
    list($ret, $err) = Qiniu_Put($upToken, $newname, $pic1, null);
    $sql = "update ws_user set headpicture = '{$newname}' where id = {$uid} ";
    $pdo->ExceSQL($sql, $conn);
    //3省
}
print json_encode($rs);
コード例 #20
0
ファイル: include.php プロジェクト: ijustyce/zblogphp
/**
 * @param $upload
 */
function CloudStorage_Del(&$upload)
{
    global $zbp;
    $bucket = $zbp->Config('CloudStorage')->CS_Bucket;
    switch ($upload->Metas->CS_Tpye) {
        case '1':
            define('OSS_ACCESS_ID', $zbp->Config('CloudStorage')->CS_Ali_KeyID);
            //ACCESS_ID
            define('OSS_ACCESS_KEY', $zbp->Config('CloudStorage')->CS_Ali_KeySecret);
            //ACCESS_KEY
            require_once dirname(__FILE__) . '/api/oss/sdk.class.php';
            $os_service = new ALIOSS();
            $os_service->set_debug_mode(FALSE);
            $object = str_replace("http://" . $bucket . ".oss.aliyuncs.com/", '', $upload->Metas->CS_URL);
            $os_service->delete_object($bucket, $object);
            break;
        case '2':
            require_once dirname(__FILE__) . '/api/qiniu/io.php';
            require_once dirname(__FILE__) . '/api/qiniu/rs.php';
            $accessKey = $zbp->Config('CloudStorage')->CS_QNiu_KeyID;
            $secretKey = $zbp->Config('CloudStorage')->CS_QNiu_KeySecret;
            Qiniu_SetKeys($accessKey, $secretKey);
            $client = new Qiniu_MacHttpClient(null);
            $object = str_replace("http://" . $bucket . ".u.qiniudn.com/", '', $upload->Metas->CS_URL);
            Qiniu_RS_Delete($client, $bucket, $object);
            break;
        case '3':
            define('BCS_AK', $zbp->Config('CloudStorage')->CS_Baidu_KeyID);
            //AK 公钥
            define('BCS_SK', $zbp->Config('CloudStorage')->CS_Baidu_KeySecret);
            //SK 私钥
            require_once dirname(__FILE__) . '/api/bcs/bcs.class.php';
            $baidu_bcs = new BaiduBCS();
            $object = str_replace("http://bcs.duapp.com/" . $bucket, '', $upload->Metas->CS_URL);
            $baidu_bcs->delete_object($bucket, $object);
            break;
        default:
            break;
    }
    return true;
    $GLOBALS['Filter_Plugin_Upload_DelFile']['CloudStorage_Del'] = PLUGIN_EXITSIGNAL_RETURN;
}
コード例 #21
0
 public function actionEditblog($id)
 {
     $label = new Article();
     $labels = $label->findAll('userid=:uid', array(':uid' => Yii::app()->session['uid']));
     //$labesArray是对应于id,label键值的一维数组
     $labesArray[0] = '--请选择--';
     foreach ($labels as $l) {
         $labesArray[$l->id] = $l->label;
     }
     $blog = Blog::model();
     $blogInfo = $blog->findByPk($id);
     $blogInfotmp = $blogInfo;
     //存储到session[blogid] 防止imageUP后台处理时有添加一条记录到blog表中
     Yii::app()->session['blogid'] = $id;
     //七牛上传类
     Yii::import('application.vendors.*');
     require_once 'Qiniu/io.php';
     require_once 'Qiniu/rs.php';
     $bucket = Yii::app()->params['bucket'];
     $accessKey = Yii::app()->params['accessKey'];
     $secretKey = Yii::app()->params['secretKey'];
     if (isset($_POST['Blog'])) {
         $post = $_POST['Blog'];
         //$post['view'] = 0;
         $post['time'] = time();
         $post['userid'] = Yii::app()->session['uid'];
         $blogInfo->attributes = $post;
         if ($blogInfo->validate()) {
             /**
              * 处理图片
              * require_once 'UPimage/UPimage.php';		//图片缩略类
              * $resizeimage = new resizeimage("1.jpg", "320", "240", "1","2.jpg");
              * 1.缩略图
              * 2.文章图片 删除就行  添加记录由后台异步处理	//删除文章时处理
              */
             //echo CheckUploadFiles($_FILES['thumb']);die;
             //1
             //a 查出缩略图片并 b删除七牛上的图片	传递一个特殊的字符串
             $images = "";
             //拼接图片以@方式
             if (CheckUploadFiles($_FILES['thumb'])) {
                 //删除图片
                 $file = $_FILES['thumb'];
                 $type = ".jpg";
                 if (count($file['name']) != 0) {
                     foreach ($file['name'] as $key => $f) {
                         if (ImageTypeCheck($file['name'][$key], $file['size'][$key])) {
                             $newname = time() . rand(10000, 99999) . $type;
                             Qiniu_SetKeys($accessKey, $secretKey);
                             $putPolicy = new Qiniu_RS_PutPolicy($bucket);
                             $upToken = $putPolicy->Token(null);
                             list($ret, $err) = Qiniu_Put($upToken, $newname, file_get_contents($file['tmp_name'][$key]), null);
                             if ($err === null) {
                                 //成功
                                 $images .= "http://" . Yii::app()->params['bucket'] . "." . Yii::app()->params['domain'] . "/" . $newname . "@";
                             } else {
                                 //失败
                             }
                         }
                     }
                 }
                 //删除图片
                 $imgs = GetImageFileName($blogInfotmp->image);
                 Qiniu_SetKeys($accessKey, $secretKey);
                 $client = new Qiniu_MacHttpClient(null);
                 foreach ($imgs as $i) {
                     if (!isset($client)) {
                         $client = new Qiniu_MacHttpClient(null);
                     }
                     $err = Qiniu_RS_Delete($client, $bucket, $i);
                 }
             } else {
                 //没有上传图片 不做任何操作 保持原来的图片
                 $images = $blogInfo->image;
             }
             //$post['image'] = $images;
             $blogInfo->attributes = $post;
             //2
             //删除文章文字配图 和业务数据库中的记录
             //					Qiniu_SetKeys($accessKey, $secretKey);
             //					$client = new Qiniu_MacHttpClient(null);
             //					$imgageModel = Image::model();
             //					$textImage = $imgageModel->findAll('blogid=:bid',array('bid'=>$id));
             //					foreach ($textImage as $ti){
             //						if(!isset($client))
             //								$client = new Qiniu_MacHttpClient(null);
             //
             //							$err = Qiniu_RS_Delete($client, $bucket, $ti->image);
             //					}
             //					$imgageModel->deleteAll('blogid=:bid',array('bid'=>$id));
             $blogInfo->image = $images;
             $blogInfo->content = $_POST['content'];
             if ($blogInfo->save()) {
                 /**
                  * 注销blogid	必须的
                  */
                 Yii::app()->session['blogid'] = null;
                 Yii::app()->user->setFlash('sendblogsuccess', '修改文章成功 :)');
                 $this->redirect(array('articles'));
             }
         }
     }
     $data = array('labels' => $labesArray, 'blogModel' => $blogInfo);
     $this->render('editblog', $data);
 }
コード例 #22
0
ファイル: Csup.php プロジェクト: djqhuan/CSCMS-v4.0-UTF8
 function qiniudel($file_path)
 {
     require_once CSCMSPATH . 'uploads/qiniu/io.php';
     require_once CSCMSPATH . 'uploads/qiniu/rs.php';
     Qiniu_SetKeys(CS_Qn_Ak, CS_Qn_Sk);
     $client = new Qiniu_MacHttpClient(null);
     if (substr($file_path, 0, 1) == '/') {
         $file_path = substr($file_path, 1);
     }
     $err = Qiniu_RS_Delete($client, CS_Qn_Bk, $file_path);
     if ($err !== null) {
         //失败
         return FALSE;
     } else {
         //成功
         return TRUE;
     }
 }
コード例 #23
0
    $sk = $row3['p_sk'];
}
function deleteShare($key1, $con)
{
    $shengji = "update sd_file set cishuo = '1' where key1 = '{$key1}'";
    mysqli_query($con, $shengji);
    $shanchu = "delete from sd_ss where filekey = '{$key1}'";
    $shanchu1 = "delete from sd_sskey where filekey = '{$key1}'";
    mysqli_query($con, $shanchu);
    mysqli_query($con, $shanchu1);
}
switch ($policyType) {
    case 'qiniu':
        Qiniu_SetKeys($ak, $sk);
        $client = new Qiniu_MacHttpClient(null);
        $err = Qiniu_RS_Delete($client, $bucketName, $ming);
        if ($err !== null) {
            echo "bad.删除失败";
        } else {
            echo "ok.删除成功";
            deleteShare($key1, $con);
        }
        break;
    case 'local':
        $deleteAction = @unlink(dirname(dirname(__FILE__)) . "/" . $fileDir . "/" . $ming);
        if ($deleteAction) {
            echo "ok.删除成功";
            deleteShare($key1, $con);
        } else {
            echo "bad.删除失败";
        }
コード例 #24
0
ファイル: io_qiniu.php プロジェクト: druphliu/dzzoffice
 public function Delete($path, $false = false)
 {
     //global $dropbox;
     $arr = self::parsePath($path);
     try {
         $client = self::init($path);
         //判断删除的对象是否为文件夹
         if (strrpos($arr['object'], '/') == strlen($arr['object']) - 1) {
             //是文件夹
             self::deleteFolder($client, $path);
         } else {
             Qiniu_RS_Delete($client, $arr['bucket'], $arr['object']);
         }
         return array('icoid' => md5($path), 'name' => substr(strrchr($path, '/'), 1));
     } catch (Exception $e) {
         return array('icoid' => md5($path), 'error' => $e->getMessage());
     }
 }
コード例 #25
0
ファイル: Qiniu.php プロジェクト: timelessmemory/uhkklp
 /**
  * Delete file from qiniu cloud
  * @param  string $fileName file name
  * @param  string $privateBucket  whether store file in private bucket
  */
 public function deleteFile($fileName, $privateBucket = false)
 {
     if ($privateBucket) {
         $this->change2Private();
     }
     Qiniu_setKeys(QINIU_ACCESS_KEY, QINIU_SECRET_KEY);
     $client = new \Qiniu_MacHttpClient(null);
     return Qiniu_RS_Delete($client, $this->bucket, $fileName);
 }
コード例 #26
0
ファイル: discuz_ftp_ext.php プロジェクト: deepziyu/JX3PVE
 function ftp_delete($path)
 {
     //
     $path = discuz_ftp::clear($path);
     switch ($this->curstorage) {
         case 'upyun':
             $path = substr($path, 0, 1) == "/" ? $path : '/' . $path;
             return $this->curobj->delete($path);
         case 'aliyun':
             $path = substr($path, 0, 1) == "/" ? substr($path, 1) : $path;
             $return = $this->curobj->delete_object($this->config_ext['bucket'], $path);
             return substr((string) $return->status, 0, 1) == 2 ? 1 : 0;
         case 'qiniu':
             $this->curobj = new Qiniu_MacHttpClient(null);
             $path = substr($path, 0, 1) == '/' ? substr($path, 1) : (substr($path, 0, 2) == './' ? substr($path, 2) : $path);
             $err = Qiniu_RS_Delete($this->curobj, $this->config_ext['bucket'], $path);
             return $err === null ? 1 : 0;
         case 'grand':
             return 0;
     }
     return @ftp_delete($this->connectid, $path);
 }
コード例 #27
0
ファイル: IoTest.php プロジェクト: timelessmemory/uhkklp
 public function testPut_mimeLimit()
 {
     $key = 'testPut_mimeLimit' . getTid();
     $scope = $this->bucket . ':' . $key;
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $putPolicy = new Qiniu_RS_PutPolicy($scope);
     $putPolicy->MimeLimit = "image/*";
     $upToken = $putPolicy->Token(null);
     list($ret, $err) = Qiniu_PutFile($upToken, $key, __FILE__, null);
     $this->assertNull($ret);
     $this->assertEquals($err->Err, "limited mimeType: this file type is forbidden to upload");
     var_dump($err);
 }