|
- /**
- * 远程FTP使用
- */
- function ftpcmd($cmd, $arg1 = '') {
- static $ftp;
- $ftpon = getglobal('setting/ftp/on');
- if(!$ftpon) {
- return $cmd == 'error' ? -101 : 0;
- } elseif($ftp == null) {
- $ftp = & discuz_ftp::instance();
- }
- if(!$ftp->enabled) {
- return $ftp->error();
- } elseif($ftp->enabled && !$ftp->connectid) {
- $ftp->connect();
- }
- switch ($cmd) {
- case 'upload' : return $ftp->upload(getglobal('setting/attachdir').'/'.$arg1, $arg1); break;
- case 'delete' : return $ftp->ftp_delete($arg1); break;
- case 'close' : return $ftp->ftp_close(); break;
- case 'error' : return $ftp->error(); break;
- case 'object' : return $ftp; break;
- default : return false;
- }
- }
复制代码 |
|