+
+function metaform() {
+ if(isset($_REQUEST['form_name'])) {
+ $GLOBALS['form_name'] = ereg_replace('[^a-z0-9_-]', '', $_REQUEST['form_name']);
+ $GLOBALS['opt_email'] = format_yesno($_REQUEST['opt_email']);
+ tem_set('opt_email', $GLOBALS['opt_email']);
+ $GLOBALS['opt_db'] = format_yesno($_REQUEST['opt_db']);
+ tem_set('opt_db', $GLOBALS['opt_db']);
+ $GLOBALS['opt_listing'] = format_yesno($_REQUEST['opt_listing']);
+ tem_set('opt_listing', $GLOBALS['opt_listing']);
+ $GLOBALS['opt_display'] = format_yesno($_REQUEST['opt_display']);
+ tem_set('opt_display', $GLOBALS['opt_display']);
+ $GLOBALS['opt_http_pass'] = format_yesno($_REQUEST['opt_http_pass']);
+ tem_set('opt_http_pass', $GLOBALS['opt_http_pass']);
+ } else {
+ $GLOBALS['form_name'] = 'some_form';
+ }
+
+ if(isset($_REQUEST['fields'])) {
+ if(isset($_REQUEST['view_sql'])) {
+ view_sql();
+ exit();
+ } elseif(isset($_REQUEST['view_php'])) {
+ view_php();
+ exit();
+ } elseif(isset($_REQUEST['view_html'])) {
+ view_html();
+ exit();
+ } elseif(isset($_REQUEST['view_email'])) {
+ view_email();
+ exit();
+ } elseif(isset($_REQUEST['download_tar'])) {
+ download_tar();
+ exit();
+ } elseif(isset($_REQUEST['preview'])) {
+ preview();
+ exit();
+ } elseif(isset($_REQUEST['edit'])) {
+ tem_set('fields', $_REQUEST['fields']);
+ tem_set('form_name', $GLOBALS['form_name']);
+ # fall through
+ } else {
+ die("Sorry... couldn't tell which button you pressed");
+ }
+ }
+
+
+ set_form_action();
+ list_available_types();
+ tem_output('code/wfpl/metaform/main.html');
+}