version 1.1.1.1, 2012/02/21 23:47:56
|
version 1.1.1.2, 2012/05/29 12:34:39
|
Line 41
|
Line 41
|
#include "php_ftp.h" |
#include "php_ftp.h" |
#include "ftp.h" |
#include "ftp.h" |
|
|
static int le_ftpbuf; | static int le_ftpbuf; |
#define le_ftpbuf_name "FTP Buffer" |
#define le_ftpbuf_name "FTP Buffer" |
|
|
/* {{{ arginfo */ |
/* {{{ arginfo */ |
Line 607 PHP_FUNCTION(ftp_chmod)
|
Line 607 PHP_FUNCTION(ftp_chmod)
|
int filename_len; |
int filename_len; |
long mode; |
long mode; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls", &z_ftp, &mode, &filename, &filename_len) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlp", &z_ftp, &mode, &filename, &filename_len) == FAILURE) { |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
Line 660 PHP_FUNCTION(ftp_nlist)
|
Line 660 PHP_FUNCTION(ftp_nlist)
|
char **nlist, **ptr, *dir; |
char **nlist, **ptr, *dir; |
int dir_len; |
int dir_len; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &dir, &dir_len) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp", &z_ftp, &dir, &dir_len) == FAILURE) { |
return; |
return; |
} |
} |
|
|
Line 857 PHP_FUNCTION(ftp_get)
|
Line 857 PHP_FUNCTION(ftp_get)
|
int local_len, remote_len; |
int local_len, remote_len; |
long mode, resumepos=0; |
long mode, resumepos=0; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { |
return; |
return; |
} |
} |
|
|
Line 874 PHP_FUNCTION(ftp_get)
|
Line 874 PHP_FUNCTION(ftp_get)
|
#endif |
#endif |
|
|
if (ftp->autoseek && resumepos) { |
if (ftp->autoseek && resumepos) { |
outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); | outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", REPORT_ERRORS, NULL); |
if (outstream == NULL) { |
if (outstream == NULL) { |
outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); | outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", REPORT_ERRORS, NULL); |
} |
} |
if (outstream != NULL) { |
if (outstream != NULL) { |
/* if autoresume is wanted seek to end */ |
/* if autoresume is wanted seek to end */ |
Line 888 PHP_FUNCTION(ftp_get)
|
Line 888 PHP_FUNCTION(ftp_get)
|
} |
} |
} |
} |
} else { |
} else { |
outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); | outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", REPORT_ERRORS, NULL); |
} |
} |
|
|
if (outstream == NULL) { |
if (outstream == NULL) { |
Line 935 PHP_FUNCTION(ftp_nb_get)
|
Line 935 PHP_FUNCTION(ftp_nb_get)
|
mode = FTPTYPE_IMAGE; |
mode = FTPTYPE_IMAGE; |
#endif |
#endif |
if (ftp->autoseek && resumepos) { |
if (ftp->autoseek && resumepos) { |
outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); | outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt+" : "rb+", REPORT_ERRORS, NULL); |
if (outstream == NULL) { |
if (outstream == NULL) { |
outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); | outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", REPORT_ERRORS, NULL); |
} |
} |
if (outstream != NULL) { |
if (outstream != NULL) { |
/* if autoresume is wanted seek to end */ |
/* if autoresume is wanted seek to end */ |
Line 949 PHP_FUNCTION(ftp_nb_get)
|
Line 949 PHP_FUNCTION(ftp_nb_get)
|
} |
} |
} |
} |
} else { |
} else { |
outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); | outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "wt" : "wb", REPORT_ERRORS, NULL); |
} |
} |
|
|
if (outstream == NULL) { |
if (outstream == NULL) { |
Line 1124 PHP_FUNCTION(ftp_put)
|
Line 1124 PHP_FUNCTION(ftp_put)
|
long mode, startpos=0; |
long mode, startpos=0; |
php_stream *instream; |
php_stream *instream; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { |
return; |
return; |
} |
} |
|
|
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); |
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); |
XTYPE(xtype, mode); |
XTYPE(xtype, mode); |
|
|
if (!(instream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt" : "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL))) { | if (!(instream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt" : "rb", REPORT_ERRORS, NULL))) { |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
Line 1177 PHP_FUNCTION(ftp_nb_put)
|
Line 1177 PHP_FUNCTION(ftp_nb_put)
|
long mode, startpos=0; |
long mode, startpos=0; |
php_stream *instream; |
php_stream *instream; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { |
return; |
return; |
} |
} |
|
|
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); |
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); |
XTYPE(xtype, mode); |
XTYPE(xtype, mode); |
|
|
if (!(instream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt" : "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL))) { | if (!(instream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt" : "rb", REPORT_ERRORS, NULL))) { |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
Line 1233 PHP_FUNCTION(ftp_size)
|
Line 1233 PHP_FUNCTION(ftp_size)
|
char *file; |
char *file; |
int file_len; |
int file_len; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &file, &file_len) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp", &z_ftp, &file, &file_len) == FAILURE) { |
return; |
return; |
} |
} |
|
|
Line 1253 PHP_FUNCTION(ftp_mdtm)
|
Line 1253 PHP_FUNCTION(ftp_mdtm)
|
char *file; |
char *file; |
int file_len; |
int file_len; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ftp, &file, &file_len) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp", &z_ftp, &file, &file_len) == FAILURE) { |
return; |
return; |
} |
} |
|
|