X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=inline;f=metaform.php;h=cee8033d4c4f6ba2798c4dbbf3aa5e55e23b6232;hb=71258ffcb40b1d507855f2fb62f76aa8d583acfc;hp=92941897e8627a521e9b81575dab550f827f074b;hpb=7ed4e19f49230c9ac8c0d1eb5a80cbae46d6c61b;p=wfpl.git diff --git a/metaform.php b/metaform.php index 9294189..cee8033 100644 --- a/metaform.php +++ b/metaform.php @@ -82,9 +82,11 @@ function tem_set_globals(&$tem) { 'opt_db', 'opt_listing', 'opt_display', - 'opt_pass'); + 'opt_pass', + 'opt_public_form', + 'opt_public_display'); foreach($bools as $bool) { - if(format_bool($GLOBALS[$bool])) { + if($GLOBALS[$bool]) { $tem->set($bool); } } @@ -101,11 +103,13 @@ function metaform() { } $GLOBALS['singular'] = format_oneline($_REQUEST['singular']); - $GLOBALS['opt_email'] = format_yesno($_REQUEST['opt_email']); - $GLOBALS['opt_db'] = format_yesno($_REQUEST['opt_db']); - $GLOBALS['opt_listing'] = format_yesno($_REQUEST['opt_listing']); - $GLOBALS['opt_display'] = format_yesno($_REQUEST['opt_display']); - $GLOBALS['opt_pass'] = format_yesno($_REQUEST['opt_pass']); + $GLOBALS['opt_email'] = format_bool($_REQUEST['opt_email']); + $GLOBALS['opt_db'] = format_bool($_REQUEST['opt_db']); + $GLOBALS['opt_listing'] = format_bool($_REQUEST['opt_listing']); + $GLOBALS['opt_display'] = format_bool($_REQUEST['opt_display']); + $GLOBALS['opt_pass'] = format_bool($_REQUEST['opt_pass']); + $GLOBALS['opt_public_form'] = format_bool($_REQUEST['opt_public_form']); + $GLOBALS['opt_public_display'] = format_bool($_REQUEST['opt_public_display']); tem_init(); tem_set_globals($GLOBALS['wfpl_template']); @@ -232,7 +236,7 @@ function view_sql() { function find_always_field($fields) { foreach($fields as $field) { list($name, $type, $input, $format, $sql) = $field; - if($input != 'submit' && $input != 'image' && $input != 'file' && $input != 'checkbox' && $input != 'radio') { + if($input != 'submit' && $input != 'image' && $input != 'file' && $input != 'checkbox' && $input != 'radio' && $type != '{') { return $name; } } @@ -307,7 +311,7 @@ function make_html($whole_file = true) { } # Submit/Send button - if($GLOBALS['opt_email'] == 'Yes' && $GLOBALS['opt_db'] != 'Yes') { + if($GLOBALS['opt_email'] == 'Yes' && !$GLOBALS['opt_db']) { $visible_fields[] = array('submit' => array( 'name' => 'send', 'caption' => 'Send')); @@ -317,9 +321,12 @@ function make_html($whole_file = true) { 'caption' => 'Save')); } - $tem->set('form', array( - 'visible_fields' => $visible_fields, - 'hidden_fields' => $hidden_fields)); + $form_fields = array(); + $form_fields['visible_fields'] = $visible_fields; + if($hidden_fields) { + $form_fields['hidden_fields'] = $hidden_fields; + } + $tem->set('form', $form_fields); # opt_display and opt_listing control whether these are actually displayed $tem->set('display_fields', $display_fields); @@ -426,7 +433,7 @@ function make_php() { } } - if($GLOBALS['opt_listing'] == 'Yes') { + if($GLOBALS['opt_listing']) { if(show_in_listing($type, $input, $format, $sql)) { $tem->show('listing_fields_1'); $tem->show('listing_fields_2'); @@ -447,7 +454,7 @@ function make_php() { $tem->set('always_field', $always_field); $tem->set('db_fields', $db_fields); $tem->set('metaform_url', edit_url()); - if($GLOBALS['opt_email'] == 'Yes') { + if($GLOBALS['opt_email']) { $this_domain = $_SERVER['HTTP_HOST']; if(substr($this_domain, -2) == '.l') { $this_domain = substr($this_domain, 0, -1) . 'com'; @@ -510,7 +517,7 @@ function preview() { tem_set('fields', $_REQUEST['fields']); $preview_tem = new tem(); $preview_tem->load_str(make_html(false)); - if($GLOBALS['opt_db'] == 'Yes') { + if($GLOBALS['opt_db']) { $preview_tem->show('new_msg'); } $fields = get_fields(); @@ -535,13 +542,14 @@ function download_tar() { "INSTALL" => read_whole_file('code/wfpl/metaform/INSTALL'), ".htaccess" => make_htaccess(), #"run.php ->" => 'code/wfpl/run.php', - "style.css" => read_whole_file('code/wfpl/metaform/style.css'), + "style.less" => read_whole_file('code/wfpl/metaform/style.less'), + "template.html" => read_whole_file('code/wfpl/metaform/site-template.html'), "$name.html" => make_html(), "$name.php" => make_php()); - if($GLOBALS['opt_db'] == 'Yes') { + if($GLOBALS['opt_db']) { $data["$name.sql"] = make_sql(); } - if($GLOBALS['opt_email'] == 'Yes') { + if($GLOBALS['opt_email']) { $data["$name.email.txt"] = make_email(); } make_tar($name, $data);