-require_once('code/wfpl/messages.php');
-require_once('code/wfpl/email.php');<!--~opt_db_2 start~-->
-require_once('code/wfpl/db.php');<!--~end~--><!--~image_include start~-->
-require_once('code/wfpl/upload.php');<!--~end~-->
-
-function ~form_name~_get_fields() {<!--~formats start~-->
- $~name~ = format_~format~($_REQUEST['~name~']);<!--~end~--><!--~image_upload start~-->
- if($_FILE['~name~'] && $_FILE['~name~']['error'] == 0) {
- $~name~ = substr(save_uploaded_image('~name~', $GLOBALS['upload_directory']), strlen($GLOBALS['upload_directory']));
+require_once('code/wfpl/email.php');<!--~uploads_include {~-->
+require_once('code/wfpl/upload.php');<!--~}~-->
+
+function ~file_name~_get_fields() {
+ $data = array();
+<!--~formats {~-->
+ $data['~name~'] = format_~format~($_REQUEST['~name~']<!--~pulldown_format_extra {~-->, '~name~'<!--~}~-->);<!--~}~--><!--~image_upload {~-->
+ if($_FILES['~name~'] && $_FILES['~name~']['error'] == 0) {
+ $data['~name~'] = convert_uploaded_image('~name~', $GLOBALS['upload_directory'] . $GLOBALS['~name~_file_name'], $GLOBALS['~name~_max_width'], $GLOBALS['~name~_max_height']<!--~thumb_upload_params {~-->, $GLOBALS['~name~_thumb_max_width'], $GLOBALS['~name~_thumb_max_height']<!--~}~-->);
+ } else {
+ if($_REQUEST['delete_~name~'] == 'Yes') {
+ $data['~name~'] = '';
+ } else {
+ $data['~name~'] = format_image_w_h<!--~thumb_w_h {~-->_thumb_w_h<!--~}~-->($_REQUEST['old_~name~']);
+ }
+ }<!--~}~--><!--~file_upload {~-->
+ $~name~_filename_tmp = $GLOBALS['~name~_file_name'];
+ if(!$~name~_filename_tmp) {
+ $~name~_filename_tmp = format_filename($_REQUEST['~name~']);
+ }
+ if($_FILES['~name~'] && $_FILES['~name~']['error'] == 0) {
+ $data['~name~'] = save_uploaded_file('~name~', $GLOBALS['upload_directory'] . $~name~_filename_tmp);
+ } else {
+ if($_REQUEST['delete_~name~'] == 'Yes') {
+ $data['~name~'] = '';
+ } else {
+ $data['~name~'] = format_path($_REQUEST['old_~name~']);
+ }
+ }<!--~}~-->
+
+ return $data;
+}
+
+
+function ~file_name~_main() {<!--~opt_pass {~-->
+ if(!logged_in_as_admin()) {
+ $_REQUEST['url'] = this_url();
+ return 'admin_login';
+ }
+<!--~}~--><!--~opt_display {~-->
+ if(isset($_REQUEST['~file_name~_id'])) {
+ return ~file_name~_display_main();