- tem_set('always_field', $always_field);
- tem_set('db_fields', $db_fields);
- download_headers();
- tem_output();
+ $tem->set('always_field', $always_field);
+ $tem->set('db_fields', $db_fields);
+ $tem->set('php_fields', $php_fields);
+ $tem->set('metaform_url', edit_url());
+ if($GLOBALS['opt_db'] == 'Yes') {
+ $tem->sub('opt_db_1');
+ $tem->sub('opt_db_2');
+ $tem->sub('opt_db_3');
+ $tem->sub('opt_db_4');
+ $tem->sub('opt_db_5');
+ }
+ if($GLOBALS['opt_email'] == 'Yes') {
+ $tem->sub('opt_email_1');
+ $tem->sub('opt_email_2');
+ }
+ if($GLOBALS['opt_http_pass'] == 'Yes') {
+ $tem->sub('opt_http_pass_1');
+ $tem->sub('opt_http_pass_2');
+ }
+ return $tem->run();
+}
+
+# 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 = str_replace('jasonwoof.l', 'jasonwoof.com', $url); # so that code generated on Jason's home computer will display a publically accessible link.
+ return $url;
+}
+
+function view_php() {
+ view_headers();
+ echo make_php();