function getremotefile($file) { global $authkey, $ftp, $attachdir; @set_time_limit(0); if(!@readfile($ftp['attachurl'].'/'.$file)) { require_once DISCUZ_ROOT.'./include/ftp.func.php'; if(!($ftp['connid'] = dftp_connect($ftp['host'], $ftp['username'], authcode($ftp['password'], 'DECODE', md5($authkey)), $ftp['attachdir'], $ftp['port'], $ftp['ssl']))) { return FALSE; } $tmpfile = @tempnam($attachdir, ''); if(dftp_get($ftp['connid'], $tmpfile, $file, FTP_BINARY)) { @readfile($tmpfile); @unlink($tmpfile); } else { @unlink($tmpfile); return FALSE; } } return TRUE; }
function getremotefile($file) { global $_G; @set_time_limit(0); if (!@readfile($_G['setting']['ftp']['attachurl'] . '/forum/' . $file)) { require_once libfile('function/ftp'); if (!($_G['setting']['ftp']['connid'] = dftp_connect($_G['setting']['ftp']['host'], $_G['setting']['ftp']['username'], authcode($_G['setting']['ftp']['password'], 'DECODE', md5($_G['config']['security']['authkey'])), $_G['setting']['ftp']['attachdir'], $_G['setting']['ftp']['port'], $_G['setting']['ftp']['ssl']))) { return FALSE; } $tmpfile = @tempnam($_G['setting']['attachdir'], ''); if (dftp_get($_G['setting']['ftp']['connid'], $tmpfile, $file, FTP_BINARY)) { @readfile($tmpfile); @unlink($tmpfile); } else { @unlink($tmpfile); return FALSE; } } return TRUE; }