{PostSearchSuggestion} dort ein, wo das Formular erscheinen soll. Author: Stevie Hoth Version: 1.0de Author URI: http://www.weareroot.de */ //------------------------------------------------------ // ACKNOWLEDGEMENTS //------------------------------------------------------ // This Plugin is based on "PSX MailForm". // Thanks to Shane Marriott (http://www.phrixus.co.uk) for the original. // Thanks to Frank Bueltge (http://bueltge.de/) for the german version. // The original ist based at the kontaktform from Ryan Duff. //------------------------------------------------------ /*This function embeds the Contact Form submenu under the Options tab.*/ function postSearchSuggestion_admin_menu() { if (function_exists('add_options_page')) { add_options_page('options-general.php', 'PostSearchSuggestion', 8, basename(__FILE__), 'postSearchSuggestion_options_subpanel'); } } function postSearchSuggestion_ValidateEmail($e) { global $verbose; /* Return codes: 0: appears to be a valid email 1: didn't match pattern of a valid email 2: domain-check failed */ if (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{1,4}$/i", $e)) { return 1; // }else if (!checkdnsrr(array_pop(explode("@",$e)),"MX")){ // return 2; } return 0; } // Function written to create arrays for the recipient information if more than one is required function postSearchSuggestion_multimail($info){ $testlist = explode(";", $info); foreach ($testlist as $index=>$items) { $testlist[$index] = explode (",", $items); } return $testlist; } /*Wrapper function which calls the form.*/ function postSearchSuggestion_callback( $content ) { $div_error = '
'; $secure = 0; $check = 0; $postSearchSuggestion_mmt = get_option('postSearchSuggestion_email'); if (strpos($postSearchSuggestion_mmt, ";") > 0) { $postSearchSuggestion_mm = 1; $listing = postSearchSuggestion_multimail($postSearchSuggestion_mmt); } // This section sets the subject for the message based on options and information set in the form if (get_option('postSearchSuggestion_user_subject') != 1){ $subject = get_option('postSearchSuggestion_subject'); $show_subject = 0; } else { $show_subject = 1; $subject = ''; if (empty($_POST['your_subject'])) { $subject = get_option('postSearchSuggestion_subject'); $subject = stripslashes($subject); $subject_mm = ''; } else { $subject = $_POST['your_subject']; $subject = stripslashes($subject); $subject_mm = ': '.$subject; } } if(!(empty($_POST['email']))){ $postSearchSuggestion_mail = postSearchSuggestion_ValidateEmail($_POST['email'],$v=-1); } //let's be nice and let the name and mail fields be optional if(!( empty($_POST['msg']) || empty($_POST['pxscheck'])) && $postSearchSuggestion_mail == 0) { $postSearchSuggestion_redirect = get_option('postSearchSuggestion_redirect_loc'); $postSearchSuggestion_redirect = stripslashes($postSearchSuggestion_redirect); $postSearchSuggestion_time = get_option('postSearchSuggestion_redirect_time'); if ($postSearchSuggestion_redirect){ $success_redirect = ''; $hack_redirect = ''; } if ($_POST['pxscheck'] !== $_SESSION["pxscheck"]) { echo $hack_redirect; exit(); } if ($postSearchSuggestion_mm == 1) { $postSearchSuggestion_mmr = $_POST['recipient']; $recipient = $listing[$postSearchSuggestion_mmr]['0']; if ($recipient == 'all') { $bodyCount = count($listing)-2; $bodyStart = 0; $recipient = ''; do { $recipient .= $listing[$bodyStart]['0'] . ','; $bodyStart = $bodyStart + 1; } while ($bodyCount >= $bodyStart); } $subject = $listing[$postSearchSuggestion_mmr]['2'].$subject_mm; } else { $recipient = get_option('postSearchSuggestion_email'); } $success_msg = get_option('postSearchSuggestion_success_msg'); $success_msg = stripslashes($success_msg); // Hack prevention code: Stop spammers exploiting the plugin. Will try to kill the script if it detects an attack but will also safely proceed if nothing is actually detected by stripping out what it ought to have found earlier!!. if (preg_match("/(\r|\n)/", $_POST['your_name'])!==0) { echo $hack_redirect; exit(); } $name = stripslashes($_POST['your_name']); if (preg_match("/(\r|\n)/", $_POST['email'])!==0){ echo $hack_redirect; exit(); } $email = stripslashes($_POST['email']); if (preg_match("/(\r|\n)/", $_POST['blog'])!==0){ echo $hack_redirect; exit(); } $blog = $_POST['blog']; if (preg_match("/(\r|\n)/", $_POST['your_subject'])!==0) { echo $hack_redirect; exit(); } $blog_chars = get_option('blog_charset'); if($name == "") $name="anonymous blog visitor"; if($email == "") $email=get_option('admin_email'); //More check with Akismet-plugin //Before we send the email, we need to check with Akismet if (function_exists(akismet_manage_page)) { global $akismet_api_host, $akismet_api_port; $c['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] ); $c['user_agent'] = $_SERVER['HTTP_USER_AGENT']; $c['referrer'] = $_SERVER['HTTP_REFERER']; $c['blog'] = get_option('home'); $c['permalink'] = $c['blog'].$_SERVER['REQUEST_URI']; $c['comment_type'] = 'pxsmail'; $c['comment_author'] = $name; $c['comment_author_email'] = $email; $c['comment_author_url'] = $blog; $c['comment_content'] = $_POST['msg']; $ignore = array( 'HTTP_COOKIE' ); foreach ( $_SERVER as $key => $value ) if ( !in_array( $key, $ignore ) ) $c["$key"] = $value; $query_string = ''; foreach ( $c as $key => $data ) $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); } else { $response[1] == 'false'; } if ( 'true' == $response[1] ) { die('sorry, this was considered spam'); } else { $headers = ''; $headers = "From: $name <$email>\n"; // your email client will show the person's email address like normal $headers .= "Content-Type: text/plain; charset=$blog_chars Content-Transfer-Encoding: quoted-printable\n"; // sets the mime type $fullmsg = "$name schrieb:\n"; $fullmsg .= $_POST['msg'] . "\n\n"; $fullmsg .= "Website: " . $blog . "\n"; $fullmsg .= "IP: " . postSearchSuggestion_getip(); mail($recipient, $subject, stripslashes($fullmsg), $headers); // check for admin-email as sender - no CC needed then if ($_POST['ccme'] == 1 && $email != get_option('admin_email') ){ mail($email, $subject, stripslashes($fullmsg), $headers); } $results = '