JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
raise limit on listings 100 -> 1000
[wfpl.git] / metaform / template.php
index d7fd3da..30c0de8 100644 (file)
@@ -75,7 +75,7 @@ function ~file_name~_get_fields() {
 
 
 function ~public_file_name~_main() {~opt_public_display {~
-       $id = _REQUEST_cut('~public_file_name~_id');
+       $id = _REQUEST_cut('id');
        if($id) {
                return ~file_name~_main_display($id);~opt_public_form unset {~
        } else {
@@ -86,7 +86,7 @@ function ~public_file_name~_main() {~opt_public_display {~
 }~}~
 
 
-function ~file_name~_main(~opt_display unset {~~opt_public_form {~$new_only = false~}~~}~) {~opt_pass {~
+function ~file_name~_main() {~opt_pass {~
        if(logged_in_as_admin()) {
                tem_set('admin_privs');
        } else {
@@ -94,7 +94,7 @@ function ~file_name~_main(~opt_display unset {~~opt_public_form {~$new_only = fa
                return 'admin_login';
        }
 ~}~~opt_db {~
-       $id = _REQUEST_cut('~file_name~_edit_id');
+       $id = _REQUEST_cut('edit_id');
        if($id) {
                return ~file_name~_main_form($id);
        }
@@ -104,15 +104,15 @@ function ~file_name~_main(~opt_display unset {~~opt_public_form {~$new_only = fa
                return ~file_name~_main_delete($id);
        }
 
-       if(_REQUEST_cut('~file_name~_new')) {
+       if(_REQUEST_cut('new')) {
                return ~file_name~_main_form();
        }
 ~}~~opt_listing {~
-       if(_REQUEST_cut('~file_name~_list')) {
+       if(_REQUEST_cut('list')) {
                return ~file_name~_main_listing();
        }
 ~}~~opt_display {~
-       $id = _REQUEST_cut('~file_name~_id');
+       $id = _REQUEST_cut('id');
        if($id) {
                return ~file_name~_main_display($id);
        }
@@ -143,7 +143,7 @@ function ~file_name~_main_delete($id) {
 }~}~~opt_listing {~
 
 function ~file_name~_main_listing() {
-       $listing_rows = db_get_assocs('~table_name~', 'id~listing_fields_1 {~,~name~~}~', 'order by ~always_field~ limit 100');
+       $listing_rows = db_get_assocs('~table_name~', 'id~listing_fields_1 {~,~name~~}~', 'order by ~always_field~ limit 1000');
        tem_set('listings', $listing_rows);
 }~}~
 
@@ -151,12 +151,7 @@ function ~file_name~_main_form($id = false) {~pulldowns {~
        pulldown('~name~', ~pulldown_options~);~}~~has_pulldowns {~
 ~}~~opt_db {~
        if($id) {
-               # add hidden field for database id of row we're editing
-               tem_set('~file_name~_edit_id', $id);
-               tem_set('editing');
-               tem_set('edit_msg');
-       } else {
-               tem_set('new_msg');
+               tem_set('id', $id);
        }
 ~}~
        if(isset($_POST['~always_field~'])) {
@@ -174,10 +169,10 @@ function ~file_name~_main_form($id = false) {~pulldowns {~
                                $to = $GLOBALS['~file_name~_form_recipient'];
                                $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) {
-                                               $reply_to = "$_REQUEST[name] <$reply_to>";
+                               if(isset($data['email']) and valid_email($data['email'])) {
+                                       $reply_to = $data['email'];
+                                       if($data['name'] and ereg('^[a-zA-Z0-9_\' -]*$', $data['name']) !== false) {
+                                               $reply_to = "$data[name] <$reply_to>";
                                        }
                                }
                                $subject = '~plural cap~ form submitted';
@@ -221,5 +216,5 @@ function ~file_name~_main_form($id = false) {~pulldowns {~
        tem_set('upload_max_filesize', upload_max_filesize());~}~
 
        tem_set('form', $data);~show_extra_headers {~
-       tem_set('extra_headers');~}~
+       tem_set('$head');~}~
 }