Example #1
0
 function ftp_chmod($filename, $mod = 0777)
 {
     $filename = discuz_ftp::clear($filename);
     if (function_exists('ftp_chmod')) {
         return @ftp_chmod($this->connectid, $mod, $filename);
     } else {
         return @ftp_site($this->connectid, 'CHMOD ' . $mod . ' ' . $filename);
     }
 }
Example #2
0
 function ftp_get($local_file, $remote_file, $mode, $resumepos = 0)
 {
     $upyun = new UpYun($this->upyun_config['bucket_name'], $this->upyun_config['operator_name'], $this->upyun_config['operator_pwd']);
     $remote_file = discuz_ftp::clear($remote_file);
     $local_file = discuz_ftp::clear($local_file);
     try {
         if ($fh = fopen($local_file, 'wb')) {
             $rsp = $upyun->readFile($this->upyun_dir . ltrim($remote_file, '/'), $fh);
             fclose($fh);
             return $rsp;
         } else {
             return 0;
         }
     } catch (Exception $e) {
         return 0;
     }
 }
Example #3
0
 function ftp_delete($path)
 {
     #print_r("-----------------------<br>");
     #die("die");
     $path = discuz_ftp::clear($path);
     return $this->bos_util->deleteObject($path);
 }
Example #4
0
 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);
 }