Esempio n. 1
0
function uk86_ftpcmd($cmd, $arg1 = '')
{
    uk86_import('libraries.ftp');
    static $ftp;
    $ftpon = C('ftp_open');
    if (!$ftpon) {
        return $cmd == 'error' ? -101 : 0;
    } elseif ($ftp == null) {
        $ftp =& Uk86NcFtp::uk86_instance();
    }
    if (!$ftp->enabled) {
        return $ftp->error();
    } elseif ($ftp->enabled && !$ftp->connectid) {
        $ftp->connect();
    }
    switch ($cmd) {
        case 'upload':
            return $ftp->upload(BASE_PATH . '/' . $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;
    }
}
Esempio n. 2
0
 public function uk86_ftp_chmod($filename, $mod = 0777)
 {
     $filename = Uk86NcFtp::uk86_clear($filename);
     if (function_exists('ftp_chmod')) {
         return @ftp_chmod($this->connectid, $mod, $filename);
     } else {
         return @ftp_site($this->connectid, 'CHMOD ' . $mod . ' ' . $filename);
     }
 }