X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=metaform%2Ftemplate.php;h=520ca576098bbe16d0abac14a48864b31c8022da;hb=6d9765bdf97af8351ed09c4187869cf05e74e2af;hp=aed60548f9fc19dcfaa23bf4653909e94f46647b;hpb=75be750e3413ca96736f78adcfdc8fcf7db9f91e;p=wfpl.git diff --git a/metaform/template.php b/metaform/template.php index aed6054..520ca57 100644 --- a/metaform/template.php +++ b/metaform/template.php @@ -11,7 +11,7 @@ # SETUP # To send results by e-mail, all you have to do is set your e-mail address here: -$GLOBALS['~file_name~_form_recipient'] = "fixme@example.com"; +$GLOBALS['~file_name~_form_recipient'] = 'fixme@example.com'; # To save results to a database, you'll need to create the ~table_name~ table # (the file ~file_name~.sql should help with this), and create the file @@ -31,12 +31,7 @@ $GLOBALS['~name~_max_height'] = '400'; $GLOBALS['~name~_thumb_max_width'] = '70'; $GLOBALS['~name~_thumb_max_height'] = '70'; $GLOBALS['~name~_file_name'] = uniqid() . getmypid() . '.jpg'; # comment this out to use uploader's filename - -# Define the username and password required to view this form: -define('AUTH_REALM', '~file_name~ administration area'); -define('AUTH_USER', 'fixme'); -define('AUTH_PASS', 'fixme'); - + require_once('code/wfpl/template.php'); require_once('code/wfpl/format.php'); @@ -109,8 +104,6 @@ function ~file_name~_main() { return $ret; } - # sections displayed with tem_show() will be coppied to the main template if you have one. - tem_show('main_body'); } function ~file_name~_display_main() { @@ -133,13 +126,10 @@ function ~file_name~_display_main() { function ~file_name~_edit_main() { -function _~file_name~_main() { - # To remove password protection, just delete this block: - if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != AUTH_USER || $_SERVER['PHP_AUTH_PW'] != AUTH_PASS) { - header('WWW-Authenticate: Basic realm="' . AUTH_REALM . '"'); - header('HTTP/1.0 401 Unauthorized'); - echo '401 Unauthorized'; - exit; +function _~file_name~_main() { + if(!logged_in_as_admin()) { + $GLOBALS['url'] = this_url(); + return 'admin_login'; } pulldown('~name~', array('option 1', 'option 2', 'option 3')); @@ -181,10 +171,10 @@ function _~file_name~_main() { db_insert('~table_name~', ~file_name upper~_DB_FIELDS, ~php_fields~); message('~singular cap~ saved.'); } - if($GLOBALS['~file_name~_form_recipient'] != "fixme@example.com") { + if($GLOBALS['~file_name~_form_recipient'] != 'fixme@example.com') { $to = $GLOBALS['~file_name~_form_recipient']; - $from = $to; - $reply_to = ''; + $from = 'noreply@~this_domain~'; + $reply_to = $to; if(isset($_REQUEST['email']) and valid_email($_REQUEST['email'])) { $reply_to = $_REQUEST['email']; if($_REQUEST['name'] and ereg('^[a-zA-Z0-9_\' -]*$', $_REQUEST['name']) !== false) {