Ejemplo n.º 1
0
function tdomf_show_form_export_menu()
{
    global $wpdb, $wp_roles;
    $form_id = tdomf_get_first_form_id();
    $new_form_id = tdomf_handle_form_export_actions();
    if ($new_form_id != false) {
        $form_id = $new_form_id;
    } else {
        if (isset($_REQUEST['form'])) {
            $form_id = intval($_REQUEST['form']);
        }
    }
    tdomf_forms_top_toolbar($form_id, 'tdomf_show_form_export_menu');
    tdomf_show_form_export(intval($form_id));
}
Ejemplo n.º 2
0
 function tdomf_theme_widget_form($args, $params)
 {
     extract($args);
     $form_id = $params;
     if (!tdomf_form_exists($form_id)) {
         $form_id = tdomf_get_first_form_id();
     }
     echo $before_widget;
     echo $before_title;
     echo tdomf_get_option_form(TDOMF_OPTION_NAME, $form_id);
     echo $after_title;
     tdomf_the_form($form_id);
     echo "<br/><br/>\n";
     echo $after_widget;
 }
Ejemplo n.º 3
0
function tdomf_notify_poster_rejected($post_id)
{
    global $wpdb;
    if (wp_is_post_revision($post_id)) {
        tdomf_log_message_extra("tdomf_notify_poster_rejected: post {$post_id} is a revision -- do nothing.");
        return $post_id;
    }
    $email = get_post_meta($post_id, TDOMF_KEY_NOTIFY_EMAIL, true);
    tdomf_log_message_extra("tdomf_notify_poster_rejected: {$email}");
    delete_post_meta($post_id, TDOMF_KEY_NOTIFY_EMAIL);
    if (get_post_meta($post_id, TDOMF_KEY_SPAM, true)) {
        tdomf_log_message_extra("tdomf_notify_poster_rejected: post {$post_id} is spam -- do nothing.");
        return $post_id;
    }
    if (tdomf_check_email_address($email)) {
        tdomf_log_message("Attempting to send notification email to {$email} for rejected post {$post_id}!");
        $postdata = get_postdata($post_id);
        $title = $postdata['Title'];
        $form_id = get_post_meta($post_id, TDOMF_KEY_FORM_ID, true);
        if ($form_id == false || !tdomf_form_exists($form_id)) {
            $form_id = tdomf_get_first_form_id();
        }
        $subject = tdomf_widget_notify_get_message($form_id, 'rejected_subject', true, $post_id);
        $notify_message = tdomf_widget_notify_get_message($form_id, 'rejected', true, $post_id);
        // Use custom from field
        //
        if (tdomf_get_option_form(TDOMF_OPTION_FROM_EMAIL, $form_id)) {
            // We can modify the "from" field by using the "header" option at the end!
            //
            $headers = "MIME-Version: 1.0\n" . "From: " . tdomf_get_option_form(TDOMF_OPTION_FROM_EMAIL, $form_id) . "\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
            return @wp_mail($email, $subject, $notify_message, $headers);
        } else {
            return @wp_mail($email, $subject, $notify_message);
        }
    }
    return $post_id;
}
Ejemplo n.º 4
0
function tdomf_new_features()
{
    $last_version = get_option(TDOMF_VERSION_LAST);
    $features = "";
    if ($last_version == false) {
        return false;
    }
    // 29 = 0.10.4
    if ($last_version <= 29) {
        $link = get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_options_menu#spam";
        $features .= "<li>" . sprintf(__('<a href="%s">Integration with Akismet for SPAM protection</a>', 'tdomf'), $link) . "</li>";
        $link = get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_options_menu&form=" . tdomf_get_first_form_id() . "#queue";
        $features .= "<li>" . sprintf(__('<a href="%s">Automatically schedule approved posts!</a>', 'tdomf'), $link) . "</li>";
        $link = get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_options_menu&form=" . tdomf_get_first_form_id() . "#throttle";
        $features .= "<li>" . sprintf(__('<a href="%s">Add submission throttling rules to your form!</a>', 'tdomf'), $link) . "</li>";
        if (current_user_can('manage_options')) {
            $link = "admin.php?page=" . TDOMF_FOLDER . DIRECTORY_SEPARATOR . "admin" . DIRECTORY_SEPARATOR . "tdomf-info.php&text";
            $link2 = "admin.php?page=" . TDOMF_FOLDER . DIRECTORY_SEPARATOR . "admin" . DIRECTORY_SEPARATOR . "tdomf-info.php&html";
            $features .= "<li>" . sprintf(__('View tdomfinfo() in <a href="%s">text</a> and <a href="%s">html-code</a>. Useful for copying and pasting!', "tdomf"), $link, $link2) . "</li>";
        }
        $link = get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_options_menu&form=" . tdomf_get_first_form_id() . "#import";
        $features .= "<li>" . sprintf(__('<a href="%s">Import and export individual form settings</a>', 'tdomf'), $link) . "</li>";
        $link = get_bloginfo('wpurl') . "/wp-admin/widgets.php";
        $features .= "<li>" . sprintf(__('New widget for your theme: <a href="%s">Top Submitters</a>', 'tdomf'), $link) . "</li>";
    }
    // 30 = 0.11b
    // 31 = 0.11
    // 32 = 0.11.1 (bug fixes)
    if ($last_version <= 32) {
        $link = get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_options_menu&form=" . tdomf_get_first_form_id() . "#ajax";
        $features .= "<li>" . sprintf(__('<a href="%s">AJAX support for forms!</a>', 'tdomf'), $link) . "</li>";
        $link = get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_form_hacker";
        $features .= "<li>" . sprintf(__('<a href="%s">Hack the appearance of your form!</a>', 'tdomf'), $link) . "</li>";
        $link = get_bloginfo('wpurl') . "/wp-admin/admin.phppage=tdomf_show_form_menu&form=" . tdomf_get_first_form_id();
        $features .= "<li>" . sprintf(__('<a href="%s">Text widget updated to support macros and php code</a>', 'tdomf'), $link) . "</li>";
        $link = get_bloginfo('wpurl') . "/wp-admin/admin.phppage=tdomf_show_form_menu&form=" . tdomf_get_first_form_id();
        $features .= "<li>" . sprintf(__('<a href="%s">Categories widget can now be displayed as checkboxes or radio buttons</a>', 'tdomf'), $link) . "</li>";
        $link = get_bloginfo('wpurl') . "/wp-admin/admin.phppage=tdomf_show_form_menu&form=" . tdomf_get_first_form_id();
        $features .= "<li>" . sprintf(__('<a href="%s">New Widget: Append. Allows you add text to a submitted post. It can even run PHP code.</a>', 'tdomf'), $link) . "</li>";
        $features .= "<li>" . __('New Template Tags: tdomf_get_the_submitter_email and tdomf_the_submitter_email', 'tdomf') . "</li>";
    }
    // 33 = 0.12b
    // 34 = 0.12
    // 40 = 0.12.3
    if ($last_version < 40) {
        $features .= "<li>" . __("Auto Respond Email widget for your form", "tdomf") . "</li>";
        $features .= "<li>" . __("Ban User and IP links directly from the moderation email", "tdomf") . "</li>";
        $features .= "<li>" . __("The moderation emails that are sent for admins can now be left turned on even if moderation is turned off", "tdomf") . "</li>";
    }
    // 41 = 0.12.4
    if ($last_version < 41) {
        $features .= "<li>" . __("Improved Error Reporting", "tdomf") . "</li>";
        $features .= "<li>" . __("Form toolbar on all form pages (Widgets and Form Hacker)", "tdomf") . "</li>";
        $features .= "<li>" . __("Include option implemented for Categories widget", "tdomf") . "</li>";
        $features .= "<li>" . __("Import/Export restored and improved", "tdomf") . "</li>";
        $features .= "<li>" . __("Default Generated Forms are now W3C compliant", "tdomf") . "</li>";
        $features .= "<li>" . __("Comment Notification from Submitted Posts no longer go to the Submitter unless they can modify the comments", "tdomf") . "</li>";
    }
    // 43 = 0.12.5
    if ($last_version < 43) {
        $features .= "<li>" . __("Excerpt Widget", "tdomf") . "</li>";
        $features .= "<li>" . __("Comments Management Widget", "tdomf") . "</li>";
        $features .= "<li>" . __("Include option implemented for Categories widget (fixed)", "tdomf") . "</li>";
        $features .= "<li>" . __("Order by and Sort options for Categories widget", "tdomf") . "</li>";
        $features .= "<li>" . __("Integration with Subscribe to Comments plugin via widget", "tdomf") . "</li>";
        $features .= "<li>" . __("Publish now button", "tdomf") . "</li>";
        $features .= "<li>" . __("Specify Email Addresses instead of Roles to recieve Moderation notifications", "tdomf") . "</li>";
        $features .= "<li>" . __('Default tags, required and enable/disable user adding tags options for Tags widget', 'tdomf') . '</li>';
    }
    // 44 = pre-0.13 release
    if ($last_version < 44) {
        $features .= "<li>" . __("More powerful form access configuration. Now you can select by capability and user as well as role!", "tdomf") . "</li>";
        $features .= "<li>" . __("2.7 Wordpress Compatibility", "tdomf") . "</li>";
        $features .= "<li>" . __("Can now turn off auto-publishing of users with publishing rights", "tdomf") . "</li>";
        $features .= "<li>" . __("New Permalink Widget", "tdomf") . "</li>";
        $features .= "<li>" . __("New GeoMashup Integration Widget", "tdomf") . "</li>";
    }
    // 46 = 0.12.7
    if ($last_version < 46) {
        $features .= "<li>" . __("Auto Respond Email widget can now provide a link to flag posts using a Custom Field", "tdomf") . "</li>";
    }
    // 47 = 0.13
    if ($last_version < 47) {
        $features .= "<li>" . __("<b>You can now created forms to edit posts and pages!</b>", "tdomf") . "</li>";
    }
    // 48 = 0.13.1
    // 49 = 0.13.2
    if ($last_version < 49) {
        $features .= "<li>" . __("<b>More Spam Checking options added. Can now be configured per form!</b>", "tdomf") . "</li>";
    }
    // 50 = 0.13.3
    if ($last_version < 50) {
        $features .= "<li>" . __("<b>Filter by user, ip and form on moderations screen</b>", "tdomf") . "</li>";
        $features .= "<li>" . __("<b>Enable syntax code highlighting on Form Hacker and messages</b>", "tdomf") . "</li>";
        $features .= "<li>" . __("<b>Special revision page for comparing revisions created by TDOMF</b>", "tdomf") . "</li>";
    }
    // 51 = 0.13.4
    // 52 = 0.13.5
    // 53 = 0.13.6
    if ($last_version < 53) {
        $features .= "<li>" . __("<b>Custom Field widget for Edit Forms</b>", "tdomf") . "</li>";
        $features .= "<li>" . __("<b>Restrict Custom Field Text Field to a number</b>", "tdomf") . "</li>";
        $features .= "<li>" . __("<b>Execute PHP code in Custom Field Hidden Field</b>", "tdomf") . "</li>";
        $features .= "<li>" . __("<b>Custom Fields modified by TDOMF Forms are stored in revision history</b>", "tdomf") . "</li>";
        $features .= "<li>" . __("<b>Allow multiple instances of the Upload Files widget</b>", "tdomf") . "</li>";
    }
    // 54 = 0.13.7
    if (!empty($features)) {
        return "<ul>" . $features . "</ul>";
    }
    return false;
}
function tdomf_content_adminbuttons_filter($content = '')
{
    global $post;
    $post_ID = 0;
    if (isset($post)) {
        $post_ID = $post->ID;
    } else {
        if ($post_ID == 0) {
            return $content;
        }
    }
    // use some form of the form_id
    $form_id = get_post_meta($post_ID, TDOMF_KEY_FORM_ID, true);
    if ($form_id == false || !tdomf_form_exists($form_id)) {
        $form_id = tdomf_get_first_form_id();
    }
    if (get_post_meta($post_ID, TDOMF_KEY_FLAG, true) && $post->post_status == 'draft' && current_user_can('publish_posts')) {
        $output = "<p>";
        $queue = intval(tdomf_get_option_form(TDOMF_OPTION_QUEUE_PERIOD, $form_id));
        if ($queue > 0) {
            $queue = true;
        } else {
            $queue = false;
        }
        if ($queue) {
            $publishnow_link = get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_mod_posts_menu&action=publish&post={$post_ID}&nofuture=1";
            $publishnow_link = wp_nonce_url($publishnow_link, 'tdomf-publish_' . $post_ID);
        }
        $publish_link = get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_mod_posts_menu&action=publish&post={$post_ID}";
        $publish_link = wp_nonce_url($publish_link, 'tdomf-publish_' . $post_ID);
        $delete_link = get_bloginfo('wpurl') . "/wp-admin/post.php?action=delete&post={$post_ID}";
        $delete_link = wp_nonce_url($delete_link, 'delete-post_' . $post_ID);
        if ($queue) {
            $output .= sprintf(__('[<a href="%s">Publish Now</a>] [<a href="%s">Add to Queue</a>] [<a href="%s">Delete</a>]', "tdomf"), $publishnow_link, $publish_link, $delete_link);
        } else {
            $output .= sprintf(__('[<a href="%s">Publish</a>] [<a href="%s">Delete</a>]', "tdomf"), $publish_link, $delete_link);
        }
        if (get_option(TDOMF_OPTION_SPAM)) {
            $spam_link = get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_mod_posts_menu&action=spamit&post={$post_ID}";
            $spam_link = wp_nonce_url($spam_link, 'tdomf-spamit_' . $post_ID);
            $ham_link = get_bloginfo('wpurl') . "/wp-admin/admin.php?page=tdomf_show_mod_posts_menu&action=hamit&post={$post_ID}";
            $ham_link = wp_nonce_url($ham_link, 'tdomf-hamit_' . $post_ID);
            if (get_post_meta($post_ID, TDOMF_KEY_SPAM)) {
                $output .= sprintf(__(' [<a href="%s">Not Spam</a>]', "tdomf"), $ham_link);
            } else {
                return $content . sprintf(__(' [<a href="%s">Spam</a>]', "tdomf"), $spam_link);
            }
        }
        $output .= '</p>';
        return $content . $output;
    }
    return $content;
}
Ejemplo n.º 6
0
function tdomf_show_form_hacker()
{
    global $wp_version;
    $form_id = false;
    if (isset($_REQUEST['form'])) {
        $form_id = $_REQUEST['form'];
    } else {
        $form_id = tdomf_get_first_form_id();
    }
    if ($form_id == false || !tdomf_form_exists($form_id)) {
        ?>
    <div class="wrap">
       <h2><?php 
        _e('Form Hacker', 'tdomf');
        ?>
</h2>
       <p><?php 
        if (is_numeric($form_id)) {
            printf(__('Invalid Form ID %s specified!'), $form_id);
        } else {
            _e('No Form ID specified!');
        }
        ?>
</p>
    </div>
  <?php 
    } else {
        if (isset($_REQUEST['diff'])) {
            ?>
    <div class="wrap">
          <?php 
            tdomf_form_hacker_diff($form_id);
            ?>
    </div> <!-- wrap -->
  <?php 
        } else {
            $mode = tdomf_generate_default_form_mode($form_id);
            $mode .= '-hack';
            tdomf_form_hacker_actions($form_id);
            $message = tdomf_get_error_messages(true, $form_id);
            if (!empty($message)) {
                ?>
        <div id="message" class="updated fade"><p><?php 
                echo $message;
                ?>
</p></div>
    <?php 
            }
            tdomf_forms_top_toolbar($form_id, 'tdomf_show_form_hacker');
            $form_ids = tdomf_get_form_ids();
            ?>
        
        <div class="wrap">
        <?php 
            if (!isset($_REQUEST['text'])) {
                ?>
          <h2><?php 
                printf(__("Form Hacker for Form %d: \"%s\"", "tdomf"), $form_id, tdomf_get_option_form(TDOMF_OPTION_NAME, $form_id));
                ?>
</h2>            
        <?php 
            } else {
                ?>
          <h2><?php 
                printf(__("Message Hacker for Form %d: \"%s\"", "tdomf"), $form_id, tdomf_get_option_form(TDOMF_OPTION_NAME, $form_id));
                ?>
</h2>            
        <?php 
            }
            ?>

          <script type="text/javascript">
            function tdomfHideHelp() {
                jQuery('#tdomf_help').attr('class','hidden');
                jQuery('#tdomf_show_help').attr('class','');
                jQuery('#tdomf_hide_help').attr('class','hidden');
            }
            function tdomfShowHelp() {
                jQuery('#tdomf_help').attr('class','');
                jQuery('#tdomf_show_help').attr('class','hidden');
                jQuery('#tdomf_hide_help').attr('class','');
            }
          </script>
          
          <?php 
            tdomf_forms_under_title_toolbar($form_id, 'tdomf_show_form_hacker');
            ?>
    
          <?php 
            if (isset($_REQUEST['text'])) {
                ?>
           
          <!-- <div id="tdomf_help" class='hidden'> -->
          
          <?php 
                $code_on = false;
                if (isset($_REQUEST['code'])) {
                    $code_on = true;
                }
                ?>
          
          <p><?php 
                _e("You can use this page to modify any messages outputed from TDOMF for your form. From here you can change the post published messages, post held in moderation, etc. etc.", "tdomf");
                ?>
</p>
            
          <?php 
                if (version_compare($wp_version, "2.8-beta2", ">=")) {
                    if (!$code_on) {
                        ?>
              <p><a href="admin.php?page=tdomf_show_form_hacker&text&code&form=<?php 
                        echo $form_id;
                        ?>
"><?php 
                        _e("Enable Code Syntax Highlighting...", 'tdomf');
                        ?>
</a></p>
          <?php 
                    } else {
                        ?>
              <p><a href="admin.php?page=tdomf_show_form_hacker&text&form=<?php 
                        echo $form_id;
                        ?>
"><?php 
                        _e("Disable Code Syntax Highlighting...", 'tdomf');
                        ?>
</a></p>
          <?php 
                    }
                }
                ?>
          
          <?php 
                $form_edit = tdomf_get_option_form(TDOMF_OPTION_FORM_EDIT, $form_id);
                ?>
 
          
          <p><?php 
                _e("PHP code can be included in the hacked messages. Also TDOMF will automatically expand these macro strings:", "tdomf");
                ?>
             <ul>
             <li><?php 
                printf(__("<code>%s</code> - User name of the currently logged in user", "tdomf"), TDOMF_MACRO_USERNAME);
                ?>
             <li><?php 
                printf(__("<code>%s</code> - IP of the current visitor", "tdomf"), TDOMF_MACRO_IP);
                ?>
             <li><?php 
                printf(__("<code>%s</code> - The ID of the current form (which is currently %d)", "tdomf"), TDOMF_MACRO_FORMID, $form_id);
                ?>
             <li><?php 
                printf(__("<code>%s</code> - Name of the Form (set in options)", "tdomf"), TDOMF_MACRO_FORMNAME);
                ?>
             <li><?php 
                printf(__("<code>%s</code> - Form Description (set in options)", "tdomf"), TDOMF_MACRO_FORMDESCRIPTION);
                ?>
             <li><?php 
                printf(__("<code>%s</code> - Submission Errors", "tdomf"), TDOMF_MACRO_SUBMISSIONERRORS);
                ?>
             <?php 
                if ($form_edit) {
                    ?>
             <li><?php 
                    printf(__("<code>%s</code> - URL of Post/Page being edited", "tdomf"), TDOMF_MACRO_SUBMISSIONURL);
                    ?>
             <li><?php 
                    printf(__("<code>%s</code> - Original Submission Date", "tdomf"), TDOMF_MACRO_SUBMISSIONDATE);
                    ?>
             
             <li><?php 
                    printf(__("<code>%s</code> - Original Submission Time", "tdomf"), TDOMF_MACRO_SUBMISSIONTIME);
                    ?>
             <li><?php 
                    printf(__("<code>%s</code> - Title of Post/Page being edited", "tdomf"), TDOMF_MACRO_SUBMISSIONTITLE);
                    ?>
             <?php 
                } else {
                    ?>
             <li><?php 
                    printf(__("<code>%s</code> - URL of Submission", "tdomf"), TDOMF_MACRO_SUBMISSIONURL);
                    ?>
             <li><?php 
                    printf(__("<code>%s</code> - Date of Submission", "tdomf"), TDOMF_MACRO_SUBMISSIONDATE);
                    ?>
             
             <li><?php 
                    printf(__("<code>%s</code> - Time of Submission", "tdomf"), TDOMF_MACRO_SUBMISSIONTIME);
                    ?>
             <li><?php 
                    printf(__("<code>%s</code> - Title of Submission", "tdomf"), TDOMF_MACRO_SUBMISSIONTITLE);
                    ?>
             <?php 
                }
                ?>
             </ul>
          </p>
          
          <!-- </div> -->
          
          <form method="post" name="formhackermsgs" id="formhackermsgs">
          <?php 
                if (function_exists('wp_nonce_field')) {
                    wp_nonce_field('tdomf-form-hacker');
                }
                ?>
          
          <p class="submit">
          <input type="submit" value="<?php 
                _e('Save &raquo;', 'tdomf');
                ?>
" id="tdomf_hack_messages_save" name="tdomf_hack_messages_save" />
          <input type="submit" value="<?php 
                _e('Reset &raquo;', 'tdomf');
                ?>
" id="tdomf_hack_messages_reset" name="tdomf_hack_messages_reset" />
          </p>
          
          <?php 
                if (!tdomf_get_option_form(TDOMF_OPTION_MODERATION, $form_id) && !tdomf_get_option_form(TDOMF_OPTION_REDIRECT, $form_id)) {
                    ?>
              <h3><?php 
                    if ($form_edit) {
                        _e('Contribution Approved', 'tdomf');
                    } else {
                        _e('Submission Published', 'tdomf');
                    }
                    ?>
</h3>
              <textarea title="true" rows="5" cols="70" name="tdomf_msg_sub_publish" id="tdomf_msg_sub_publish" <?php 
                    if ($code_on) {
                        ?>
class="codepress .php"<?php 
                    }
                    ?>
 ><?php 
                    echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_SUB_PUBLISH, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
              <br/><br/>
          <?php 
                }
                ?>
                    
          <?php 
                if (intval(tdomf_get_option_form(TDOMF_OPTION_QUEUE_PERIOD, $form_id)) > 0 && !tdomf_get_option_form(TDOMF_OPTION_MODERATION, $form_id)) {
                    ?>
              <h3><?php 
                    _e('Submission Queued', 'tdomf');
                    ?>
</h3>
              <textarea title="true" rows="5" cols="70" name="tdomf_msg_sub_future" id="tdomf_msg_sub_future" <?php 
                    if ($code_on) {
                        ?>
class="codepress .php"<?php 
                    }
                    ?>
 ><?php 
                    echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_SUB_FUTURE, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
              <br/><br/>
          <?php 
                }
                ?>
          
          <?php 
                if (get_option(TDOMF_OPTION_SPAM)) {
                    ?>
              <h3><?php 
                    if ($form_edit) {
                        _e('Contribution is Spam', 'tdomf');
                    } else {
                        _e('Submission is Spam', 'tdomf');
                    }
                    ?>
</h3>
              <textarea title="true" rows="5" cols="70" name="tdomf_msg_sub_spam" id="tdomf_msg_sub_spam" <?php 
                    if ($code_on) {
                        ?>
class="codepress .php"<?php 
                    }
                    ?>
 ><?php 
                    echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_SUB_SPAM, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
              <br/><br/>
          <?php 
                }
                ?>
          
          <?php 
                if (tdomf_get_option_form(TDOMF_OPTION_MODERATION, $form_id)) {
                    ?>
              <h3><?php 
                    if ($form_edit) {
                        _e('Contribution awaiting Moderation', 'tdomf');
                    } else {
                        _e('Submission awaiting Moderation', 'tdomf');
                    }
                    ?>
</h3>
              <textarea title="true" rows="5" cols="70" name="tdomf_msg_sub_mod" id="tdomf_msg_sub_mod" <?php 
                    if ($code_on) {
                        ?>
class="codepress .php"<?php 
                    }
                    ?>
 ><?php 
                    echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_SUB_MOD, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
              <br/><br/>
          <?php 
                }
                ?>
          
          <h3><?php 
                if ($form_edit) {
                    _e('Contribution contains Errors', 'tdomf');
                } else {
                    _e('Submission contains Errors', 'tdomf');
                }
                ?>
</h3>
          <textarea title="true" rows="5" cols="70" name="tdomf_msg_sub_error" id="tdomf_msg_sub_error" <?php 
                if ($code_on) {
                    ?>
class="codepress .php"<?php 
                }
                ?>
 ><?php 
                echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_SUB_ERROR, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                ?>
</textarea>
          <br/><br/>
          
          <h3><?php 
                _e('Banned User', 'tdomf');
                ?>
</h3>
          <textarea title="true" rows="5" cols="70" name="tdomf_msg_perm_banned_user" id="tdomf_msg_perm_banned_user" <?php 
                if ($code_on) {
                    ?>
class="codepress .php"<?php 
                }
                ?>
 ><?php 
                echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_PERM_BANNED_USER, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                ?>
</textarea>
          <br/><br/>

          <h3><?php 
                _e('Banned IP', 'tdomf');
                ?>
</h3>          
          <textarea title="true" rows="5" cols="70" name="tdomf_msg_perm_banned_ip" id="tdomf_msg_perm_banned_ip" <?php 
                if ($code_on) {
                    ?>
class="codepress .php"<?php 
                }
                ?>
 ><?php 
                echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_PERM_BANNED_IP, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                ?>
</textarea>
          <br/><br/>
          
          <?php 
                $throttle_rules = tdomf_get_option_form(TDOMF_OPTION_THROTTLE_RULES, $form_id);
                if (is_array($throttle_rules) && !empty($throttle_rules)) {
                    ?>
              <h3><?php 
                    _e('Throttled Submission', 'tdomf');
                    ?>
</h3>
              <textarea title="true" rows="5" cols="70" name="tdomf_msg_perm_throttle" id="tdomf_msg_perm_throttle" <?php 
                    if ($code_on) {
                        ?>
class="codepress .php"<?php 
                    }
                    ?>
 ><?php 
                    echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_PERM_THROTTLE, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
              <br/><br/>
          <?php 
                }
                ?>
          
          <?php 
                if (!tdomf_get_option_form(TDOMF_OPTION_ALLOW_EVERYONE, $form_id)) {
                    ?>
              <h3><?php 
                    _e('Denied User', 'tdomf');
                    ?>
</h3>
              <textarea title="true" rows="5" cols="70" name="tdomf_msg_perm_invalid_user" id="tdomf_msg_perm_invalid_user" <?php 
                    if ($code_on) {
                        ?>
class="codepress .php"<?php 
                    }
                    ?>
 ><?php 
                    echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_PERM_INVALID_USER, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
              <br/><br/>
          <?php 
                }
                ?>
          
          <?php 
                if (!tdomf_get_option_form(TDOMF_OPTION_ALLOW_EVERYONE, $form_id)) {
                    ?>
              <h3><?php 
                    _e('Banned Unregistered User', 'tdomf');
                    ?>
</h3>
              <textarea title="true" rows="5" cols="70" name="tdomf_msg_perm_invalid_nouser" id="tdomf_msg_perm_invalid_nouser" <?php 
                    if ($code_on) {
                        ?>
class="codepress .php"<?php 
                    }
                    ?>
 ><?php 
                    echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_PERM_INVALID_NOUSER, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
              <br/><br/>
          <?php 
                }
                ?>

          <?php 
                if ($form_edit) {
                    ?>

              <?php 
                    /*if(tdomf_get_option_form(TDOMF_OPTION_AJAX_EDIT,$form_id)) {*/
                    ?>
              
                 <h3><?php 
                    _e('\'Edit Post\' Link Text', 'tdomf');
                    ?>
</h3>
                 <textarea title="true" rows="5" cols="70" name="tdomf_msg_edit_post_link" id="tdomf_msg_edit_post_link" <?php 
                    if ($code_on) {
                        ?>
class="codepress .php"<?php 
                    }
                    ?>
 ><?php 
                    echo htmlentities(tdomf_get_message(TDOMF_OPTION_ADD_EDIT_LINK_TEXT, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
                 <br/><br/>
             
              <?php 
                    /*}*/
                    ?>
              
              <h3><?php 
                    _e('Invalid Post for Form', 'tdomf');
                    ?>
</h3>
              <textarea title="true" rows="5" cols="70" name="tdomf_msg_invalid_post" id="tdomf_msg_invalid_post" <?php 
                    if ($code_on) {
                        ?>
class="codepress .php"<?php 
                    }
                    ?>
 ><?php 
                    echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_INVALID_POST, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
              <br/><br/>
              
              <h3><?php 
                    _e('Invalid Form for Post', 'tdomf');
                    ?>
</h3>
              <textarea title="true" rows="5" cols="70" name="tdomf_msg_invalid_form" id="tdomf_msg_invalid_form" <?php 
                    if ($code_on) {
                        ?>
class="codepress .php"<?php 
                    }
                    ?>
 ><?php 
                    echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_INVALID_FORM, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
              <br/><br/>
              
              <h3><?php 
                    _e('Locked Post', 'tdomf');
                    ?>
</h3>
              <textarea title="true" rows="5" cols="70" name="tdomf_msg_locked_post" id="tdomf_msg_locked_post" <?php 
                    if ($code_on) {
                        ?>
class="codepress .php"<?php 
                    }
                    ?>
 ><?php 
                    echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_LOCKED_POST, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
              <br/><br/>
              
              <?php 
                    if (get_option(TDOMF_OPTION_SPAM)) {
                        ?>

                 <h3><?php 
                        _e('Spam Edit on Post', 'tdomf');
                        ?>
</h3>
                 <textarea title="true" rows="5" cols="70" name="tdomf_msg_spam_edit_on_post" id="tdomf_msg_spam_edit_on_post" <?php 
                        if ($code_on) {
                            ?>
class="codepress .php"<?php 
                        }
                        ?>
 ><?php 
                        echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_SPAM_EDIT_ON_POST, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                        ?>
</textarea>
                 <br/><br/>
                  
              <?php 
                    }
                    ?>
              
             <h3><?php 
                    _e('Unapproved Edit on Post', 'tdomf');
                    ?>
</h3>
             <textarea title="true" rows="5" cols="70" name="tdomf_msg_unapproved_edit_on_post" id="tdomf_msg_unapproved_edit_on_post" <?php 
                    if ($code_on) {
                        ?>
class="codepress .php"<?php 
                    }
                    ?>
 ><?php 
                    echo htmlentities(tdomf_get_message(TDOMF_OPTION_MSG_UNAPPROVED_EDIT_ON_POST, $form_id), ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
             <br/><br/>

          <?php 
                }
                ?>
          
          <?php 
                do_action('tdomf_form_hacker_messages_bottom', $form_id, $mode);
                ?>
                    
          <span class="submit">
          <input type="submit" value="<?php 
                _e('Save &raquo;', 'tdomf');
                ?>
" id="tdomf_hack_messages_save" name="tdomf_hack_messages_save" />
          <input type="submit" value="<?php 
                _e('Reset &raquo;', 'tdomf');
                ?>
" id="tdomf_hack_messages_reset" name="tdomf_hack_messages_reset" />
          </span>
          
          </form>
          
          <?php 
            } else {
                ?>
          
          <!-- <div id="tdomf_help" class='hidden'> -->
          
          <p><?php 
                _e("You can use this page to hack the generated HTML code for your form without modifing the code of TDOMF. Please only do this if you know what you are doing. From here you can modify titles, default values, re-arrange fields, etc. etc.", "tdomf");
                ?>
</p>
             
          <p><?php 
                _e('Do not modify or remove the "name" and "id" attributes of fields as this is what the widgets and TDOMF use to get input values for processing', 'tdomf');
                ?>
</p>
             
          <p><?php 
                printf(__("Every time a form is generated, it creates a unique key. If you hack the form, make sure you keep <code>%s</code> (and also <code>%s</code>) within the form. TDOMF will replace this string with the unique key.", "tdomf"), TDOMF_MACRO_FORMKEY, TDOMF_MACRO_FORMURL);
                ?>
</p>
          
          <p><?php 
                _e("PHP code can be included in the hacked form. Also TDOMF will automatically expand these macro strings:", "tdomf");
                ?>
             <ul>
             <li><?php 
                printf(__("<code>%s</code> - User name of the currently logged in user", "tdomf"), TDOMF_MACRO_USERNAME);
                ?>
             <li><?php 
                printf(__("<code>%s</code> - IP of the current visitor", "tdomf"), TDOMF_MACRO_IP);
                ?>
             <li><?php 
                printf(__("<code>%s</code> - The form's unique key", "tdomf"), TDOMF_MACRO_FORMKEY);
                ?>
             <li><?php 
                printf(__("<code>%s</code> - The current URL of the form", "tdomf"), TDOMF_MACRO_FORMURL);
                ?>
             <li><?php 
                printf(__("<code>%s</code> - The ID of the current form (which is currently %d)", "tdomf"), TDOMF_MACRO_FORMID, $form_id);
                ?>
             <li><?php 
                printf(__("<code>%s</code> - Name of the Form (set in options)", "tdomf"), TDOMF_MACRO_FORMNAME);
                ?>
             <li><?php 
                printf(__("<code>%s</code> - Form Description (set in options)", "tdomf"), TDOMF_MACRO_FORMDESCRIPTION);
                ?>
             <li><?php 
                printf(__("<code>%s</code> - Form Output (such as preview, errors, etc.). This is automatically encapsulated in a div called tdomf_form_message (and tdomf_form_preview for preview)", "tdomf"), TDOMF_MACRO_FORMMESSAGE);
                ?>
             <li><?php 
                printf(__("<code>%swidget-name%s</code> - Original, unmodified output from 'widget-name'", "tdomf"), TDOMF_MACRO_WIDGET_START, TDOMF_MACRO_END);
                ?>
             </ul>
          </p>
          
          <!-- </div> -->
 
          <form method="post" name="formhacker" id="formhacker">
          <?php 
                if (function_exists('wp_nonce_field')) {
                    wp_nonce_field('tdomf-form-hacker');
                }
                ?>
      
          <p class="submit">
          <input type="submit" value="<?php 
                _e('Save &raquo;', 'tdomf');
                ?>
" id="tdomf_form_hack_save" name="tdomf_form_hack_save" />
          <input type="submit" value="<?php 
                _e('Reset &raquo;', 'tdomf');
                ?>
" id="tdomf_form_hack_reset" name="tdomf_form_hack_reset" />
          </p>
          
          <?php 
                if (tdomf_widget_is_preview_avaliable($form_id)) {
                    ?>
          
              <h3><?php 
                    _e('Core Form', 'tdomf');
                    ?>
</h3>
              
          <?php 
                }
                ?>
          
            <?php 
                $cur_form = tdomf_generate_form($form_id, $mode);
                $form = $cur_form;
                $hacked_form = tdomf_get_option_form(TDOMF_OPTION_FORM_HACK, $form_id);
                if ($hacked_form != false) {
                    $form = $hacked_form;
                }
                ?>
                  
            <?php 
                if ($hacked_form != false) {
                    ?>
              <?php 
                    _e("You can diff the hacked form to see what you have changed", "tdomf");
                    ?>
              <ul>
              <li><a href="admin.php?page=tdomf_show_form_hacker&form=<?php 
                    echo $form_id;
                    ?>
&mode=<?php 
                    echo $mode;
                    ?>
&diff&form1=hack&form2=cur"><?php 
                    _e("Diff Hacked Form with Current Form", "tdomf");
                    ?>
</a></li>
              <?php 
                    $org_form = tdomf_get_option_form(TDOMF_OPTION_FORM_HACK_ORIGINAL, $form_id);
                    if (trim($cur_form) != trim($org_form)) {
                        ?>
              <li><a href="admin.php?page=tdomf_show_form_hacker&form=<?php 
                        echo $form_id;
                        ?>
&mode=<?php 
                        echo $mode;
                        ?>
&diff&form2=hack&form1=org"><?php 
                        _e("Diff Hacked Form with Previous Form", "tdomf");
                        ?>
</a></li>
              <li><a href="admin.php?page=tdomf_show_form_hacker&form=<?php 
                        echo $form_id;
                        ?>
&mode=<?php 
                        echo $mode;
                        ?>
&diff&form2=cur&form1=org"><?php 
                        _e("Diff Current Form with Previous Form", "tdomf");
                        ?>
</a></li>
                    <?php 
                    }
                    ?>
              </ul>
            <?php 
                }
                ?>
                  
            <textarea title="true" rows="30" cols="100" name="tdomf_form_hack" id="tdomf_form_hack" class="codepress .php" ><?php 
                echo htmlentities($form, ENT_NOQUOTES, get_bloginfo('charset'));
                ?>
</textarea>
            
          <br/><br/>
          
          <?php 
                if (tdomf_widget_is_preview_avaliable($form_id)) {
                    ?>
          
              <h3><?php 
                    _e('Form Preview', 'tdomf');
                    ?>
</h3>
              
              <?php 
                    $cur_preview = tdomf_preview_form(array('tdomf_form_id' => $form_id), $mode);
                    $preview = $cur_preview;
                    $hacked_preview = tdomf_get_option_form(TDOMF_OPTION_FORM_PREVIEW_HACK, $form_id);
                    if ($hacked_preview != false) {
                        $preview = $hacked_preview;
                    }
                    ?>
              
              <?php 
                    if ($hacked_preview != false) {
                        ?>
              <?php 
                        _e("You can diff the hacked preview to see what you have changed", "tdomf");
                        ?>
              <ul>
              <li><a href="admin.php?page=tdomf_show_form_hacker&form=<?php 
                        echo $form_id;
                        ?>
&mode=<?php 
                        echo $mode;
                        ?>
&diff&form1=hack&form2=cur&type=preview"><?php 
                        _e("Diff Hacked Preview with Current Preview", "tdomf");
                        ?>
</a></li>
              <?php 
                        $org_preview = tdomf_get_option_form(TDOMF_OPTION_FORM_PREVIEW_HACK_ORIGINAL, $form_id);
                        if (trim($cur_preview) != trim($org_preview)) {
                            ?>
              <li><a href="admin.php?page=tdomf_show_form_hacker&form=<?php 
                            echo $form_id;
                            ?>
&mode=<?php 
                            echo $mode;
                            ?>
&diff&form2=hack&form1=org&type=preview"><?php 
                            _e("Diff Hacked Preview with Previous Preview", "tdomf");
                            ?>
</a></li>
              <li><a href="admin.php?page=tdomf_show_form_hacker&form=<?php 
                            echo $form_id;
                            ?>
&mode=<?php 
                            echo $mode;
                            ?>
&diff&form2=cur&form1=org&type=preview"><?php 
                            _e("Diff Current Preview with Previous Preview", "tdomf");
                            ?>
</a></li>
                    <?php 
                        }
                        ?>
              </ul>
            <?php 
                    }
                    ?>
                    
                    
              <textarea title="true" rows="15" cols="100" name="tdomf_form_preview_hack" id="tdomf_form_preview_hack" class="codepress .php"><?php 
                    echo htmlentities($preview, ENT_NOQUOTES, get_bloginfo('charset'));
                    ?>
</textarea>
                
              <br/><br/>
                
          <?php 
                }
                ?>

          <!-- @TODO Validation Message Hacker -->
          <!-- @TODO Upload Form Hacker -->     
          <?php 
                do_action('tdomf_form_hacker_bottom', $form_id, $mode);
                ?>
          
          <span class="submit">
          <input type="submit" value="<?php 
                _e('Save &raquo;', 'tdomf');
                ?>
" id="tdomf_form_hack_save" name="tdomf_form_hack_save" />
          <input type="submit" value="<?php 
                _e('Reset &raquo;', 'tdomf');
                ?>
" id="tdomf_form_hack_reset" name="tdomf_form_hack_reset" />
          </span>
          
          </form>
          
          <!-- @TODO: warning about updated form (with dismiss link) -->
          
          <?php 
            }
            ?>
          
        </div>
    <?php 
        }
    }
}