diff options
author | Uwe Steinmann <steinm@php.net> | 2000-08-07 11:37:42 +0000 |
---|---|---|
committer | Uwe Steinmann <steinm@php.net> | 2000-08-07 11:37:42 +0000 |
commit | b5d39b4820f6409b8ca4e305a8189caf1ad99efd (patch) | |
tree | da2cfaf482a3fd37375b283a61fed16214f0a562 /ext/fdf | |
parent | 8289c85438c21aa3658a9998825ced758d6d00d6 (diff) | |
download | php-git-b5d39b4820f6409b8ca4e305a8189caf1ad99efd.tar.gz |
- added functions fdf_set_flags(), fdf_set_opt(), fdf_set_submit_form_action()
as proposed by <gweisz@l-speed.com>
Diffstat (limited to 'ext/fdf')
-rw-r--r-- | ext/fdf/fdf.c | 115 | ||||
-rw-r--r-- | ext/fdf/php_fdf.h | 3 |
2 files changed, 102 insertions, 16 deletions
diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c index 08ee765497..3aa02da548 100644 --- a/ext/fdf/fdf.c +++ b/ext/fdf/fdf.c @@ -27,22 +27,6 @@ #undef THREAD_SAFE #endif - -#if 0 - if((NULL != SG(request_info).content_type) && (0 == strcmp(SG(request_info).content_type, "application/vnd.fdf"))) { - pval *tmp; - - ALLOC_ZVAL(tmp); - tmp->value.str.len = SG(request_info).post_data_length; - tmp->value.str.val = estrndup(SG(request_info).post_data, SG(request_info).post_data_length); - tmp->type = IS_STRING; - INIT_PZVAL(tmp); - zend_hash_add(&EG(symbol_table), "HTTP_FDF_DATA", sizeof("HTTP_FDF_DATA"), &tmp, sizeof(pval *),NULL); - - } else { -#endif - - #include "php.h" #include "ext/standard/head.h" #include <math.h> @@ -95,6 +79,9 @@ function_entry fdf_functions[] = { PHP_FE(fdf_set_file, NULL) PHP_FE(fdf_get_file, NULL) PHP_FE(fdf_add_template, NULL) + PHP_FE(fdf_set_flags, NULL) + PHP_FE(fdf_set_opt, NULL) + PHP_FE(fdf_set_submit_form_action, NULL) {NULL, NULL, NULL} }; @@ -593,6 +580,102 @@ PHP_FUNCTION(fdf_add_template) { } /* }}} */ +/* {{{ proto void fdf_set_flags(int fdfdoc, string fieldname, int whichFlags, int newFlags) + modifies a flag for a field in the fdf*/ +PHP_FUNCTION(fdf_set_flags) { + pval **arg1, **arg2, **arg3, **arg4; + int id, type; + FDFDoc fdf; + FDFErc err; + FDF_TLS_VARS; + + if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2,&arg3, &arg4) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long_ex(arg1); + convert_to_string_ex(arg2); + convert_to_long_ex(arg3); + convert_to_long_ex(arg4); + id=(*arg1)->value.lval; + fdf = zend_list_find(id,&type); + if(!fdf || type!=FDF_GLOBAL(le_fdf)) { + php_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + err=FDFSetFlags(fdf,(*arg2)->value.str.val,(*arg3)->value.lval,(*arg4)->value.lval); + if(err != FDFErcOK) + printf("Error setting FDF flags: %d\n",err); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto void fdf_set_opt(int fdfdoc, string fieldname, int element, string value, string name) + Sets a value in the opt array for a field in the FDF*/ +PHP_FUNCTION(fdf_set_opt) { + pval **arg1, **arg2, **arg3, **arg4, **arg5; + int id, type; + FDFDoc fdf; + FDFErc err; + FDF_TLS_VARS; + + if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &arg1, &arg2,&arg3, &arg4, &arg5) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long_ex(arg1); + convert_to_string_ex(arg2); + convert_to_long_ex(arg3); + convert_to_string_ex(arg4); + convert_to_string_ex(arg5); + id=(*arg1)->value.lval; + fdf = zend_list_find(id,&type); + if(!fdf || type!=FDF_GLOBAL(le_fdf)) { + php_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + err = FDFSetOpt(fdf,(*arg2)->value.str.val,(*arg3)->value.lval,(*arg4)->value.str.val,(*arg5)->value.str.val); + if(err != FDFErcOK) + printf("Error setting FDF option: %d",err); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto void fdf_set_submit_form_action(int fdfdoc, string fieldname, int whichTrigger, string url, int flags) + sets the submit form action for a field in the fdf*/ +PHP_FUNCTION(fdf_set_submit_form_action) { + pval **arg1, **arg2, **arg3, **arg4, **arg5; + int id, type; + FDFDoc fdf; + FDFErc err; + FDF_TLS_VARS; + + if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &arg1, &arg2,&arg3, &arg4, &arg5) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_long_ex(arg1); + convert_to_string_ex(arg2); + convert_to_long_ex(arg3); + convert_to_string_ex(arg4); + convert_to_long_ex(arg5); + id=(*arg1)->value.lval; + fdf = zend_list_find(id,&type); + if(!fdf || type!=FDF_GLOBAL(le_fdf)) { + php_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + err = FDFSetSubmitFormAction(fdf,(*arg2)->value.str.val,(*arg3)->value.lval,(*arg4)->value.str.val,(*arg5)->value.lval); + if(err != FDFErcOK) + printf("Error setting FDF submit action: %d",err); + + RETURN_TRUE; +} + #endif /* diff --git a/ext/fdf/php_fdf.h b/ext/fdf/php_fdf.h index e6fa9b21a0..50409a2abd 100644 --- a/ext/fdf/php_fdf.h +++ b/ext/fdf/php_fdf.h @@ -49,6 +49,9 @@ PHP_FUNCTION(fdf_set_status); PHP_FUNCTION(fdf_set_file); PHP_FUNCTION(fdf_get_file); PHP_FUNCTION(fdf_add_template); +PHP_FUNCTION(fdf_set_flags); +PHP_FUNCTION(fdf_set_opt); +PHP_FUNCTION(fdf_set_submit_form_action); #else #define fdf_module_ptr NULL #endif |