version 1.1.1.1, 2012/02/21 23:48:02
|
version 1.1.1.2, 2012/05/29 12:34:43
|
Line 31
|
Line 31
|
#endif |
#endif |
|
|
#include "php_globals.h" |
#include "php_globals.h" |
#include "safe_mode.h" |
|
|
|
|
|
/* Implementation of the language Header() function */ |
/* Implementation of the language Header() function */ |
Line 123 PHPAPI int php_setcookie(char *name, int name_len, cha
|
Line 122 PHPAPI int php_setcookie(char *name, int name_len, cha
|
} else { |
} else { |
snprintf(cookie, len + 100, "Set-Cookie: %s=%s", name, value ? encoded_value : ""); |
snprintf(cookie, len + 100, "Set-Cookie: %s=%s", name, value ? encoded_value : ""); |
if (expires > 0) { |
if (expires > 0) { |
char *p; | const char *p; |
strlcat(cookie, "; expires=", len + 100); |
strlcat(cookie, "; expires=", len + 100); |
dt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, expires, 0 TSRMLS_CC); |
dt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, expires, 0 TSRMLS_CC); |
/* check to make sure that the year does not exceed 4 digits in length */ |
/* check to make sure that the year does not exceed 4 digits in length */ |
Line 221 PHP_FUNCTION(setrawcookie)
|
Line 220 PHP_FUNCTION(setrawcookie)
|
PHP_FUNCTION(headers_sent) |
PHP_FUNCTION(headers_sent) |
{ |
{ |
zval *arg1 = NULL, *arg2 = NULL; |
zval *arg1 = NULL, *arg2 = NULL; |
char *file=""; | const char *file=""; |
int line=0; |
int line=0; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zz", &arg1, &arg2) == FAILURE) |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zz", &arg1, &arg2) == FAILURE) |
return; |
return; |
|
|
if (SG(headers_sent)) { |
if (SG(headers_sent)) { |
line = php_get_output_start_lineno(TSRMLS_C); | line = php_output_get_start_lineno(TSRMLS_C); |
file = php_get_output_start_filename(TSRMLS_C); | file = php_output_get_start_filename(TSRMLS_C); |
} |
} |
|
|
switch(ZEND_NUM_ARGS()) { |
switch(ZEND_NUM_ARGS()) { |
Line 278 PHP_FUNCTION(headers_list)
|
Line 277 PHP_FUNCTION(headers_list)
|
} |
} |
array_init(return_value); |
array_init(return_value); |
zend_llist_apply_with_argument(&SG(sapi_headers).headers, php_head_apply_header_list_to_hash, return_value TSRMLS_CC); |
zend_llist_apply_with_argument(&SG(sapi_headers).headers, php_head_apply_header_list_to_hash, return_value TSRMLS_CC); |
|
} |
|
/* }}} */ |
|
|
|
/* {{{ proto long http_response_code([int response_code]) |
|
Sets a response code, or returns the current HTTP response code */ |
|
PHP_FUNCTION(http_response_code) |
|
{ |
|
long response_code = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &response_code) == FAILURE) { |
|
return; |
|
} |
|
|
|
if (response_code) |
|
{ |
|
long old_response_code; |
|
|
|
old_response_code = SG(sapi_headers).http_response_code; |
|
SG(sapi_headers).http_response_code = response_code; |
|
|
|
if (old_response_code) { |
|
RETURN_LONG(old_response_code); |
|
} |
|
|
|
RETURN_TRUE; |
|
} |
|
|
|
if (!SG(sapi_headers).http_response_code) { |
|
RETURN_FALSE; |
|
} |
|
|
|
RETURN_LONG(SG(sapi_headers).http_response_code); |
} |
} |
/* }}} */ |
/* }}} */ |
|
|