X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=metaform.php;h=381cb65a18a11ef7f72f1f322fb09f6f5a0e2f8a;hb=307c3b76ee89b37e48fbd04e606e2eb333822c66;hp=a0dce787236395b62f496b16a86a01a6eac764ba;hpb=f6fdd9deec6c7815f5877270e746e1bd1201a726;p=wfpl.git diff --git a/metaform.php b/metaform.php index a0dce78..381cb65 100644 --- a/metaform.php +++ b/metaform.php @@ -1,19 +1,9 @@ . +# This program is in the public domain within the United States. Additionally, +# we waive copyright and related rights in the work worldwide through the CC0 +# 1.0 Universal public domain dedication, which can be found at +# http://creativecommons.org/publicdomain/zero/1.0/ # This file writes the code for you (sql, php, html, email) to handle a form. @@ -89,7 +79,7 @@ function tem_set_globals(&$tem) { 'opt_public_display', 'opt_public_something'); foreach($bools as $bool) { - if($GLOBALS[$bool]) { + if(isset($GLOBALS[$bool]) && $GLOBALS[$bool]) { $tem->set($bool); } } @@ -97,22 +87,22 @@ function tem_set_globals(&$tem) { function metaform_main() { if(isset($_REQUEST['singular'])) { - $GLOBALS['file_name'] = format_varname($_REQUEST['file_name']); - $GLOBALS['table_name'] = format_varname($_REQUEST['table_name']); - $GLOBALS['plural'] = format_oneline($_REQUEST['plural']); + $GLOBALS['file_name'] = format_varname(_REQUEST_cut('file_name')); + $GLOBALS['table_name'] = format_varname(_REQUEST_cut('table_name')); + $GLOBALS['plural'] = format_oneline(_REQUEST_cut('plural')); # backwards compatibility: if(isset($_REQUEST['form_name'])) { - $GLOBALS['file_name'] = $GLOBALS['table_name'] = $GLOBALS['plural'] = format_varname($_REQUEST['form_name']); + $GLOBALS['file_name'] = $GLOBALS['table_name'] = $GLOBALS['plural'] = format_varname(_REQUEST_cut('form_name')); } - $GLOBALS['singular'] = format_oneline($_REQUEST['singular']); - $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']); + $GLOBALS['singular'] = format_oneline(_REQUEST_cut('singular')); + $GLOBALS['opt_email'] = format_bool(_REQUEST_cut('opt_email')); + $GLOBALS['opt_db'] = format_bool(_REQUEST_cut('opt_db')); + $GLOBALS['opt_listing'] = format_bool(_REQUEST_cut('opt_listing')); + $GLOBALS['opt_display'] = format_bool(_REQUEST_cut('opt_display')); + $GLOBALS['opt_pass'] = format_bool(_REQUEST_cut('opt_pass')); + $GLOBALS['opt_public_form'] = format_bool(_REQUEST_cut('opt_public_form')); + $GLOBALS['opt_public_display'] = format_bool(_REQUEST_cut('opt_public_display')); $GLOBALS['public_file_name'] = $GLOBALS['file_name']; if($GLOBALS['opt_public_form'] || $GLOBALS['opt_public_display']) { @@ -173,7 +163,7 @@ function get_fields() { $fields_str = unix_newlines($_REQUEST['fields']); $GLOBALS['gotten_fields'] = array(); $fields_str = rtrim($fields_str); - $fields = split("\n", $fields_str); + $fields = explode("\n", $fields_str); foreach($fields as $field) { $first_char = substr($field, 0, 1); $field = trim($field); @@ -251,7 +241,7 @@ function get_fields() { # this one, that you're using to create forms function set_form_action() { - $action = ereg_replace('.*/', '', $_SERVER['REQUEST_URI']); + $action = preg_replace('|.*/|', '', $_SERVER['REQUEST_URI']); if($action == '') $action = './'; tem_set('form_action', $action); } @@ -552,9 +542,9 @@ function make_php() { # make a URL for the edit page with all the fields filled in function edit_url() { $url = this_url(); - $url = ereg_replace('view_php=[^&]*', 'edit=yes', $url); - $url = ereg_replace('download_tar=[^&]*', 'edit=yes', $url); - $url = ereg_replace('/[a-z0-9_.]*\?', '/?', $url); + $url = preg_replace('|view_php=[^&]*|', 'edit=yes', $url); + $url = preg_replace('|download_tar=[^&]*|', 'edit=yes', $url); + $url = preg_replace('|/[a-z0-9_.]*\?|', '/?', $url); return $url; } @@ -611,7 +601,7 @@ function preview() { } $preview = $preview_tem->run(); unset($preview_tem); - $preview = ereg_replace('type="submit"', 'type="submit" disabled="disabled"', $preview); + $preview = preg_replace('|type="submit"|', 'type="submit" disabled="disabled"', $preview); tem_set('preview', $preview); tem_show('hiddens'); set_form_action();