// Create a fake, temporary comment. $comment = array('comment_post_ID' => $post->ID, 'comment_author' => '(Name)', 'comment_author_email' => $send_sample_email, 'comment_author_url' => get_option('siteurl'), 'comment_author_IP' => $_SERVER['REMOTE_ADDR'], 'comment_date' => date('Y-m-d H:i:s'), 'comment_date_gmt' => gmdate('Y-m-d H:i:s'), 'comment_content' => 'This is just a sample comment that I\'ve written', 'comment_approved' => 1, 'comment_agent' => $_SERVER['HTTP_USER_AGENT'], 'comment_type' => '', 'comment_parent' => 0, 'user_id' => 0); $comment = get_comment(wp_insert_comment($comment), OBJECT); $email_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . $tml->table_name("emails") . " WHERE email = %s", $send_sample_email)); if ($email_id === NULL) { // no row was found in the table: insert one; get an ID $wpdb->insert($tml->table_name("emails"), array("email" => $send_sample_email, "subscribed" => true), array("%s", "%b")); $email_id = $wpdb->insert_id; } $wpdb->insert($tml->table_name("queue"), array("email_ID" => $email_id, "comment_ID" => $comment->comment_ID, "send_time" => time() - 3600, "message_uid" => $values["uid"]), array("%d", "%d", "%d", "%d")); $sched_id = $wpdb->insert_id; $tml->send_mail($sched_id); // delete the comment wp_delete_comment($comment->comment_ID); $message = sprintf(__("A sample e-mail was sent to %s", 'thankmelater'), wp_specialchars($send_sample_email)); TML_form::show_message($message, TML_form::MESSAGE_UPDATED); } } else { // show error message ?> <p><div id="message" class="error"><p><strong> <?php $tml_form_errors->list_errors(); ?> </strong></p></div></p> <?php // include the form to fix errors require_once TML_DIR . "/" . TML_INCLUDES_DIR . "admin/messages/edit_message/message_form.php"; } } else { // no POST
<tr valign="top"> <th scope="row"> <?php _e("Restrict by Users", "thankmelater"); ?> </th> <td> <fieldset> <legend class="hidden"><?php _e("Restrict by Users", "thankmelater"); ?> </legend> <?php printf(__("%1\$s Only send e-mails to %2\$slogged in%3\$slogged out%4\$s users", "thankmelater") . "</label>", '<label for="allow_opt_out">' . TML_form::input_checkbox("restrict_by_users", 1, $restrict_by_users, 9), '<select name="restrict_by_users_type" tabindex="10">' . '<option value="logged-in"' . ("logged-in" == $restrict_by_users_type ? ' selected="selected"' : '') . '>', '<option value="logged-out"' . ("logged-out" == $restrict_by_users_type ? ' selected="selected"' : '') . '>', '</select>'); ?> </fieldset> </td> </tr> </tbody> </table> <p class="submit"> <input type="submit" name="Submit" value="<?php _e("Update Options", "thankmelater"); ?> " tabindex="11" />
} if (!isset($send_sample_email)) { $send_sample_email = get_bloginfo("admin_email"); } ?> <tr valign="top"> <th scope="row"> <label for="send_sample"><?php _e("Sample E-mail", "thankmelater"); ?> </label> </th> <td> <?php printf(__("%1\$s Send sample e-mail to %2\$s", "thankmelater") . "</label>", '<label for="send_sample">' . TML_form::input_checkbox("send_sample", 1, $send_sample, 21), TML_form::input_text("send_sample_email", $send_sample_email, 22)); ?> </td> </tr> </tbody> </table> <script type="text/javascript"> function show_hide_defaults(val) { if (document.getElementById(val+"_use_default").checked) { document.getElementById(val+"_values").style.display = "none"; } else { document.getElementById(val+"_values").style.display = "";
<input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHosted"> <table class="form-table tml-form"> <tbody> <tr valign="top"> <th scope="row"> <label for="amount"><?php _e("Donation Amount", "thankmelater"); ?> </label> </th> <td style="font-size:2em;"> $<?php echo TML_form::input_text("amount", "30.00", 1000, array("style" => 'font-size: 1.5em;vertical-align:middle;width:170px;color:#008000;')); ?> </td> </tr> <tr valign="top"> <th scope="row"> </th> <td> <input type="submit" name="Donate »" value="<?php _e("Donate »", "thankmelater"); ?> " /> Thanks! </td> </tr> </tbody> </table>
</strong></p></div></p> <?php } // does table need update? (checks table structure, existance) $needs_update = $tml_install->needs_update($table_name, $table["structure"]); $error = false; $status = '<span class="ok">' . __("OK", "thankmelater") . '</span>'; if ($needs_update) { $error = true; // table needs update; give link to fix table $status = '<span class="not_ok">' . sprintf(__("Error: %sRepair Table%s.", "thankmelater"), '<a href="?' . attribute_escape(TML_admin_pages_hierarchy::build_query()) . '&repair_table=' . attribute_escape(urlencode($table_name)) . '">', '</a>') . '</span>'; } // add row $parameters[] = array("error" => $error, "param_name" => sprintf(__("Table '%s'", "thankmelater"), $table_name), "status" => $status); } TML_form::show_message(sprintf(__("Need help? %sVisit the support forum%s.", 'thankmelater'), '<a href="http://infinity-infinity.com/forums/forum/3" target="_blank">', '</a>'), TML_form::MESSAGE_INFO); ?> <h3><?php _e("Environment Status", "thankmelater"); ?> </h3> <p><?php _e("The following parameters have been tested. Any parameter which may cause a problem with TML's operation will be labelled 'Error'.", "thankmelater"); ?> </p> <table class="tml-table widefat"> <thead>
<tr valign="top"> <th scope="row"> <?php _e("Promote TML", "thankmelater"); ?> </th> <td> <fieldset> <legend class="hidden"><?php _e("Promote TML", "thankmelater"); ?> </legend> <label for="promote"><?php echo TML_form::input_checkbox("promote", 1, TRUE, 2); ?> <?php _e("Add the 'We are using Thank Me Later' link back in the homepage footer.", "thankmelater"); ?> </label> </fieldset> </td> </tr> </tbody> </table> <p class="submit"> <input type="submit" name="Submit" value="<?php
exit; } require_once "admin_pages.php"; require_once "form_functions.php"; // admin pages are typically forms; $tml_form_errors will allow // errors to be recorded/displayed/managed $tml_form_errors = new TML_form_errors(); class TML_admin extends TML_admin_pages { } $pages = array("messages" => array("display" => __("Messages", "thankmelater")), "additional_options" => array("display" => __("Additional Options", "thankmelater")), "help" => array("display" => __("Installation and Information", "thankmelater"))); $tml_admin = new TML_admin($pages, "messages"); $last_cron = $tml->get_option("last_wpcron_tick"); if ($last_cron < time() - 3600 * 1.2) { //echo date("Y-m-d H:i:s", $last_cron); TML_form::show_message(__("WP-Cron doesn't seem to be working. Thank Me Later is emulating the behaviour of WP-Cron, which may slightly slow down some page loads. You may wish to seek a solution to this problem, although the impact is usually negligible.", "thankmelater"), TML_form::MESSAGE_ERROR); } ?> <div class="wrap"> <h2><?php _e("Thank Me Later", "thankmelater"); ?> </h2> <?php $tml_admin->nav(); ?> <?php $tml_admin->content();