cvs: php4 /ext/fdf fdf.c php_fdf.h
| From: | Uwe Steinmann | Date: | Mon, 07 Aug 2000 11:37:42 +0000 |
| Subject: | cvs: php4 /ext/fdf fdf.c php_fdf.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1082@lists.php.net to get a copy of this message | ||
steinm Mon Aug 7 04:37:42 2000 EDT
Modified files:
/php4/ext/fdf fdf.c php_fdf.h
Log:
- added functions fdf_set_flags(), fdf_set_opt(), fdf_set_submit_form_action()
as proposed by <gweisz@l-speed.com>
Index: php4/ext/fdf/fdf.c
diff -u php4/ext/fdf/fdf.c:1.28 php4/ext/fdf/fdf.c:1.29
--- php4/ext/fdf/fdf.c:1.28 Thu Jul 6 07:47:02 2000
+++ php4/ext/fdf/fdf.c Mon Aug 7 04:37:42 2000
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fdf.c,v 1.28 2000/07/06 14:47:02 andi Exp $ */
+/* $Id: fdf.c,v 1.29 2000/08/07 11:37:42 steinm Exp $ */
/* FdfTk lib 2.0 is a Complete C/C++ FDF Toolkit available from
http://beta1.adobe.com/ada/acrosdk/forms.html.
*/
@@ -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 @@
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}
};
@@ -592,6 +579,102 @@
RETURN_TRUE;
}
/* }}} */
+
+/* {{{ 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
Index: php4/ext/fdf/php_fdf.h
diff -u php4/ext/fdf/php_fdf.h:1.8 php4/ext/fdf/php_fdf.h:1.9
--- php4/ext/fdf/php_fdf.h:1.8 Sun Jul 23 18:39:45 2000
+++ php4/ext/fdf/php_fdf.h Mon Aug 7 04:37:42 2000
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_fdf.h,v 1.8 2000/07/24 01:39:45 david Exp $ */
+/* $Id: php_fdf.h,v 1.9 2000/08/07 11:37:42 steinm Exp $ */
#ifndef PHP_FDF_H
#define PHP_FDF_H
@@ -49,6 +49,9 @@
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