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
';
}
}
// 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();
}
?>