Fix for #55: HTTPS URLs in the contact form are now handled correctly.
This commit is contained in:
parent
ddc2af887b
commit
eb20caebc5
29
contact.php
29
contact.php
@ -3,10 +3,7 @@
|
||||
require_once (INCLUDES_DIR . 'includes.php');
|
||||
require SMARTY_DIR . 'SmartyValidate.class.php';
|
||||
|
||||
|
||||
function contact_form_validate() {
|
||||
|
||||
|
||||
$arr ['version'] = system_ver();
|
||||
$arr ['name'] = $_POST ['name'];
|
||||
|
||||
@ -20,14 +17,11 @@
|
||||
|
||||
if (apply_filters('comment_validate', true, $arr))
|
||||
return $arr;
|
||||
else return false;
|
||||
|
||||
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function contact_form() {
|
||||
|
||||
global $smarty, $lang, $fp_config;
|
||||
|
||||
if (empty($_POST)) {
|
||||
@ -35,7 +29,6 @@
|
||||
$smarty->assign('success', system_geterr('contact'));
|
||||
$smarty->assign_by_ref('panelstrings', $lang ['contact']);
|
||||
|
||||
|
||||
// new form, we (re)set the session data
|
||||
SmartyValidate::connect($smarty, true);
|
||||
// register our validators
|
||||
@ -48,8 +41,9 @@
|
||||
// validate after a POST
|
||||
SmartyValidate::connect($smarty);
|
||||
|
||||
if (!empty($_POST['url']) && strpos($_POST['url'], 'http://')===false) $_POST['url'] = 'http://'.$_POST['url'];
|
||||
|
||||
// add http to url if not given
|
||||
if (!empty($_POST ['url']) && strpos($_POST ['url'], 'http://') === false && strpos($_POST ['url'], 'https://') === false)
|
||||
$_POST ['url'] = 'http://' . $_POST ['url'];
|
||||
|
||||
// custom hook here!!
|
||||
// we'll use comment actions, anyway
|
||||
@ -63,14 +57,7 @@
|
||||
$msg .= "WWW: {$arr['url']}\n\n";
|
||||
$msg .= "Content:\n{$arr['content']}\n";
|
||||
|
||||
$success = @utils_mail(
|
||||
(
|
||||
isset($arr['email'])?
|
||||
$arr['email']
|
||||
:
|
||||
$fp_config['general']['email']
|
||||
),
|
||||
"Contact sent through {$fp_config['general']['title']} ", $msg );
|
||||
$success = @utils_mail((isset($arr ['email']) ? $arr ['email'] : $fp_config ['general'] ['email']), "Contact sent through {$fp_config['general']['title']} ", $msg);
|
||||
|
||||
system_seterr('contact', $success ? 1 : -1);
|
||||
utils_redirect(basename(__FILE__));
|
||||
@ -80,7 +67,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function contact_main() {
|
||||
global $smarty;
|
||||
|
||||
@ -89,7 +75,6 @@
|
||||
$smarty->assign('subject', $lang ['contact'] ['head']);
|
||||
$smarty->assign('content', 'shared:contact.tpl');
|
||||
contact_form();
|
||||
|
||||
}
|
||||
|
||||
function contact_display() {
|
||||
@ -104,10 +89,8 @@
|
||||
unset($smarty);
|
||||
|
||||
do_action('shutdown');
|
||||
|
||||
}
|
||||
|
||||
|
||||
system_init();
|
||||
contact_display();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user