This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ // File cannot be called directly if (isset($_SERVER['SCRIPT_FILENAME']) && 'tpl-contact.php' == basename($_SERVER['SCRIPT_FILENAME'])) { die (''); // Silence is gold } // Process post if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) // If page is called from the form's post { // Prepare Strings Translation $msg_strings = array( 'status' => __('Visitor type:', 'aktheme'), 'name' => __('Contact name:', 'aktheme'), 'email' => __('Email:', 'aktheme'), 'url' => __('Site URL', 'aktheme')); // Get Form Data $user = wp_get_current_user(); if ( $user->ID ) { $form_data = array( 'status' => __('Registered', 'aktheme'), 'name' => $user->display_name, 'email' => $user->user_email, 'url' => $user->user_url); } else { $form_data = array( 'status' => __('Anonymous', 'aktheme'), 'name' => trim(strip_tags($_POST['user_name'])), 'email' => trim($_POST['user_email']), 'url' => trim($_POST['user_url'])); $captcha_code = strtoupper(trim($_POST['captcha_code'])); } $msg_text = stripslashes(trim(strip_tags($_POST['user_message']))); // Check all user data $form_error = ''; // There are no error at this moment // Check Captcha if ( !$user->ID ) { @session_start(); if ($captcha_code != $_SESSION['captcha_code']) { $form_error .= __('CAPTCHA code error. Please, reenter the new code.', 'aktheme') . '
'; } } // Check Contact Name if ( 3 > strlen($form_data['name']) ) { $form_error .= __('Please, fill your name.', 'aktheme') . '
'; } // Check Contact Email if ( empty($form_data['email']) || 6 > strlen($form_data['email']) ) { $form_error .= __('Please, fill your email address.', 'aktheme') . '
'; } elseif ( !is_email($form_data['email']) || eregi("\r", $form_data['email']) || eregi("\n", $form_data['email']) || eregi("%0a", $form_data['email']) || eregi("%0d", $form_data['email']) ) { $form_error .= __('The email address doesn\'t look correct.', 'aktheme') . '
'; } // Extra Email address Security. Probably it was alredy done in is_email() function. $injection = array( "/bcc\:/i", "/Content\-Type\:/i", "/Mime\-Version\:/i", "/cc\:/i", "/from\:/i", "/to\:/i", "/Content\-Transfer\-Encoding\:/i"); $form_data['email'] = ( preg_replace ($injection, '', $form_data['email']) ); // Check there is a message if ( 10 > strlen($msg_text) ) { $form_error .= __('Your message is too short. Write something longer.', 'aktheme') . '
'; } // Send the form data if ( !isset($form_error) || empty($form_error) ) // If no errors { // Compose Message $mail_extra_headers = 'From: ' . $form_data['name'] . ' <' . $form_data['email'] . ">\n"; $mail_body = ''; foreach ($form_data as $key => $value) { $mail_body .= $msg_strings[$key] . " $value\n"; } $mail_body .= "\n" . __('MESSAGE:', 'aktheme') . "\n\n{$msg_text}\n\n"; $subject = apply_filters('ak_chameleon_contact_subject', get_the_title()); // Send Mail if ( wp_mail(get_bloginfo('admin_email'), $subject, $mail_body, $mail_extra_headers) ) { $mail_end = 'ok'; } else { $mail_end = 'error'; } } } else // If not processing the form (when page shows first time) { $form_data = array( 'name' => '', 'email' => '', 'url' => ''); $msg_text = ''; } // End of form post check // HERE STARTS THE PAGE TEMPLATE get_header(); if ( 'left' == ak_theme_option('sidebar-pos') ) { get_sidebar(); } ?>

$form_error

"; } ?>

  |  »

:  
:  
:
:     »  
: