function al2fb_render_debug_info($al2fb) { // Debug information if (isset($_REQUEST['debug'])) { global $user_identity, $user_email; get_currentuserinfo(); ?> <hr /> <h3><?php _e('Debug information', c_al2fb_text_domain); ?> </h3> <form method="post" action=""> <input type="hidden" name="al2fb_action" value="mail"> <?php wp_nonce_field(c_al2fb_nonce_action, c_al2fb_nonce_name); ?> <table class="form-table"> <tr valign="top"><th scope="row"> <label for="al2fb_debug_name"><strong><?php _e('Name:', c_al2fb_text_domain); ?> </strong></label> </th><td> <input id="al2fb_debug_name" class="" name="<?php echo c_al2fb_mail_name; ?> " type="text" value="<?php echo $user_identity; ?> " /> </td></tr> <tr valign="top"><th scope="row"> <label for="al2fb_debug_email"><strong><?php _e('E-mail:', c_al2fb_text_domain); ?> </strong></label> </th><td> <input id="al2fb_debug_email" class="" name="<?php echo c_al2fb_mail_email; ?> " type="text" value="<?php echo $user_email; ?> " /> <br><strong><?php _e('Please check if this is a correct, reachable e-mail address', c_al2fb_text_domain); ?> </strong> </td></tr> <tr valign="top"><th scope="row"> <label for="al2fb_debug_topic"><strong><a href="http://forum.faircode.eu/"><?php _e('Forum topic link:', c_al2fb_text_domain); ?> </a></strong></label> </th><td> <input id="al2fb_debug_topic" class="" name="<?php echo c_al2fb_mail_topic; ?> " type="text" /> <br><strong><?php _e('Mandatory', c_al2fb_text_domain); ?> </strong> </td></tr> <tr valign="top"><th scope="row"> <label for="al2fb_debug_msg"><strong><?php _e('Message:', c_al2fb_text_domain); ?> </strong></label> </th><td> <textarea id="al2fb_debug_msg" name="<?php echo c_al2fb_mail_msg; ?> " rows="10" cols="80"></textarea> <br><strong><?php _e('Please describe your problem, even if you did before', c_al2fb_text_domain); ?> </strong> </td></tr> </table> <?php $msg = __('Did you check if your problem is described in <a href="[FAQ]" target="_blank">the FAQ</a> ?', c_al2fb_text_domain); $msg = str_replace('[FAQ]', 'http://wordpress.org/extend/plugins/add-link-to-facebook/faq/', $msg); echo '<br /><strong><span style="color: red;">' . $msg . '</span></strong>'; ?> <br /> <br /><strong><span style="color: red;"><?php _e('Debug information not asked for or without valid support forum topic link will be ignored', c_al2fb_text_domain); ?> </span></strong> <p class="submit"> <input type="submit" class="button-primary" value="<?php _e('Send', c_al2fb_text_domain); ?> " /> </p> </form> <?php require_once 'add-link-to-facebook-debug.php'; echo al2fb_debug_info($al2fb); } }
function Action_mail() { // Security check check_admin_referer(c_al2fb_nonce_action, c_al2fb_nonce_name); require_once 'add-link-to-facebook-debug.php'; if (empty($_POST[c_al2fb_mail_topic]) || $_POST[c_al2fb_mail_topic] == 'http://forum.faircode.eu/' || !(strpos($_POST[c_al2fb_mail_topic], 'http://forum.faircode.eu/') === 0)) { echo '<div id="message" class="error fade al2fb_error"><p>' . __('Forum topic link is mandatory', c_al2fb_text_domain) . '</p></div>'; } else { // Build headers $headers = 'From: ' . stripslashes(sanitize_text_field($_POST[c_al2fb_mail_name])) . ' <' . stripslashes(sanitize_email($_POST[c_al2fb_mail_email])) . '>' . "\n"; $headers .= 'Reply-To: ' . stripslashes(sanitize_text_field($_POST[c_al2fb_mail_name])) . ' <' . stripslashes(sanitize_email($_POST[c_al2fb_mail_email])) . '>' . "\n"; $headers .= 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=' . get_bloginfo('charset') . "\n"; // Build message $message = '<html><head><title>Add Link to Facebook</title></head><body>'; $message .= '<p>' . nl2br(htmlspecialchars(stripslashes($_POST[c_al2fb_mail_msg]), ENT_QUOTES, get_bloginfo('charset'))) . '</p>'; $message .= '<a href="' . stripslashes(sanitize_text_field($_POST[c_al2fb_mail_topic])) . '">' . stripslashes(sanitize_text_field($_POST[c_al2fb_mail_topic])) . '</a>'; $message .= '<hr />'; $message .= al2fb_debug_info($this); $message .= '<hr />'; $message .= '</body></html>'; if (wp_mail('*****@*****.**', '[Add Link to Facebook] Debug information', $message, $headers)) { echo '<div id="message" class="updated fade al2fb_notice"><p>' . __('Debug information sent', c_al2fb_text_domain) . '</p></div>'; if ($this->debug) { echo '<pre>' . nl2br(htmlspecialchars($headers, ENT_QUOTES, get_bloginfo('charset'))) . '</pre>'; } } else { echo '<div id="message" class="error fade al2fb_error"><p>' . __('Sending debug information failed', c_al2fb_text_domain) . '</p></div>'; } } }