Vergleich contact.php - 1.8.4 - 1.8.28

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 11Zeile 11
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'contact.php');


define("IN_MYBB", 1);
define('THIS_SCRIPT', 'contact.php');


$templatelist = "contact,post_captcha,post_captcha_recaptcha,post_captcha_nocaptcha,post_captcha_ayah";

$templatelist = "contact,post_captcha,post_captcha_recaptcha_invisible,post_captcha_nocaptcha,post_captcha_hcaptcha_invisible,post_captcha_hcaptcha";


require_once "./global.php";
require_once MYBB_ROOT.'inc/class_captcha.php';


require_once "./global.php";
require_once MYBB_ROOT.'inc/class_captcha.php';

Zeile 27Zeile 27
if($mybb->settings['contact'] != 1 || (!$mybb->user['uid'] && $mybb->settings['contact_guests'] == 1))
{
error_no_permission();

if($mybb->settings['contact'] != 1 || (!$mybb->user['uid'] && $mybb->settings['contact_guests'] == 1))
{
error_no_permission();

 
}

if($mybb->settings['contactemail'])
{
$contactemail = $mybb->settings['contactemail'];
}
else
{
$contactemail = $mybb->settings['adminemail'];

}

// Check group limits
if($mybb->usergroup['maxemails'] > 0)

}

// Check group limits
if($mybb->usergroup['maxemails'] > 0)

{
if($mybb->user['uid'] > 0)
{
$user_check = "fromuid='{$mybb->user['uid']}'";
}
else

{
if($mybb->user['uid'] > 0)
{
$user_check = "fromuid='{$mybb->user['uid']}'";
}
else

	{
$user_check = "ipaddress=".$db->escape_binary($session->packedip);

	{
$user_check = "ipaddress=".$db->escape_binary($session->packedip);

	}


	}


	$query = $db->simple_select("maillogs", "COUNT(mid) AS sent_count", "{$user_check} AND dateline >= ".(TIME_NOW - (60*60*24)));
$sent_count = $db->fetch_field($query, "sent_count");
if($sent_count >= $mybb->usergroup['maxemails'])

	$query = $db->simple_select("maillogs", "COUNT(mid) AS sent_count", "{$user_check} AND dateline >= ".(TIME_NOW - (60*60*24)));
$sent_count = $db->fetch_field($query, "sent_count");
if($sent_count >= $mybb->usergroup['maxemails'])

Zeile 56Zeile 65
	if($mybb->user['uid'] > 0)
{
$user_check = "fromuid='{$mybb->user['uid']}'";

	if($mybb->user['uid'] > 0)
{
$user_check = "fromuid='{$mybb->user['uid']}'";

	}
else
{

	}
else
{

		$user_check = "ipaddress=".$db->escape_binary($session->packedip);
}


		$user_check = "ipaddress=".$db->escape_binary($session->packedip);
}


Zeile 66Zeile 75

$query = $db->simple_select("maillogs", "mid, dateline", "{$user_check} AND dateline > '{$timecut}'", array('order_by' => "dateline", 'order_dir' => "DESC"));
$last_email = $db->fetch_array($query);


$query = $db->simple_select("maillogs", "mid, dateline", "{$user_check} AND dateline > '{$timecut}'", array('order_by' => "dateline", 'order_dir' => "DESC"));
$last_email = $db->fetch_array($query);





	// Users last email was within the flood time, show the error

	// Users last email was within the flood time, show the error

	if($last_email['mid'])

	if(!empty($last_email['mid']))

	{
$remaining_time = ($mybb->usergroup['emailfloodtime']*60)-(TIME_NOW-$last_email['dateline']);


	{
$remaining_time = ($mybb->usergroup['emailfloodtime']*60)-(TIME_NOW-$last_email['dateline']);


Zeile 81Zeile 90
			$lang->error_emailflooding = $lang->sprintf($lang->error_emailflooding_seconds, $mybb->usergroup['emailfloodtime'], $remaining_time);
}
elseif($remaining_time > 60 && $remaining_time < 120)

			$lang->error_emailflooding = $lang->sprintf($lang->error_emailflooding_seconds, $mybb->usergroup['emailfloodtime'], $remaining_time);
}
elseif($remaining_time > 60 && $remaining_time < 120)

		{

		{

			$lang->error_emailflooding = $lang->sprintf($lang->error_emailflooding_1_minute, $mybb->usergroup['emailfloodtime']);
}
else
{
$remaining_time_minutes = ceil($remaining_time/60);
$lang->error_emailflooding = $lang->sprintf($lang->error_emailflooding_minutes, $mybb->usergroup['emailfloodtime'], $remaining_time_minutes);

			$lang->error_emailflooding = $lang->sprintf($lang->error_emailflooding_1_minute, $mybb->usergroup['emailfloodtime']);
}
else
{
$remaining_time_minutes = ceil($remaining_time/60);
$lang->error_emailflooding = $lang->sprintf($lang->error_emailflooding_minutes, $mybb->usergroup['emailfloodtime'], $remaining_time_minutes);

		}

		}


error($lang->error_emailflooding);


error($lang->error_emailflooding);

	}

	}

}

$errors = array();

}

$errors = array();

Zeile 111Zeile 120
	if(empty($mybb->input['subject']))
{
$errors[] = $lang->contact_no_subject;

	if(empty($mybb->input['subject']))
{
$errors[] = $lang->contact_no_subject;

	}


	}


	if(strlen($mybb->input['subject']) > $mybb->settings['contact_maxsubjectlength'] && $mybb->settings['contact_maxsubjectlength'] > 0)
{
$errors[] = $lang->sprintf($lang->subject_too_long, $mybb->settings['contact_maxsubjectlength'], strlen($mybb->input['subject']));

	if(strlen($mybb->input['subject']) > $mybb->settings['contact_maxsubjectlength'] && $mybb->settings['contact_maxsubjectlength'] > 0)
{
$errors[] = $lang->sprintf($lang->subject_too_long, $mybb->settings['contact_maxsubjectlength'], strlen($mybb->input['subject']));

	}


	}


	if(empty($mybb->input['message']))

	if(empty($mybb->input['message']))

	{

	{

		$errors[] = $lang->contact_no_message;

		$errors[] = $lang->contact_no_message;

	}


	}


	if(strlen($mybb->input['message']) > $mybb->settings['contact_maxmessagelength'] && $mybb->settings['contact_maxmessagelength'] > 0)
{
$errors[] = $lang->sprintf($lang->message_too_long, $mybb->settings['contact_maxmessagelength'], strlen($mybb->input['message']));

	if(strlen($mybb->input['message']) > $mybb->settings['contact_maxmessagelength'] && $mybb->settings['contact_maxmessagelength'] > 0)
{
$errors[] = $lang->sprintf($lang->message_too_long, $mybb->settings['contact_maxmessagelength'], strlen($mybb->input['message']));

	}

	}


if(strlen($mybb->input['message']) < $mybb->settings['contact_minmessagelength'] && $mybb->settings['contact_minmessagelength'] > 0)


if(strlen($mybb->input['message']) < $mybb->settings['contact_minmessagelength'] && $mybb->settings['contact_minmessagelength'] > 0)

	{

	{

		$errors[] = $lang->sprintf($lang->message_too_short, $mybb->settings['contact_minmessagelength'], strlen($mybb->input['message']));

		$errors[] = $lang->sprintf($lang->message_too_short, $mybb->settings['contact_minmessagelength'], strlen($mybb->input['message']));

	}


	}


	if(empty($mybb->input['email']))
{
$errors[] = $lang->contact_no_email;

	if(empty($mybb->input['email']))
{
$errors[] = $lang->contact_no_email;

	}

	}

	else
{
// Validate email
if(!validate_email_format($mybb->input['email']))
{
$errors[] = $lang->contact_no_email;

	else
{
// Validate email
if(!validate_email_format($mybb->input['email']))
{
$errors[] = $lang->contact_no_email;

		}
}

// Should we have a CAPTCHA? Perhaps yes...
if($mybb->settings['captchaimage'])
{

		}
}

// Should we have a CAPTCHA? Perhaps yes, but only for guests like in other pages...
if($mybb->settings['captchaimage'] && !$mybb->user['uid'])
{

		$captcha = new captcha;

if($captcha->validate_captcha() == false)

		$captcha = new captcha;

if($captcha->validate_captcha() == false)

Zeile 200Zeile 209
			require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;


			require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;


			$parser_options = array(
'filter_badwords' => 1
);

$mybb->input['subject'] = $parser->parse_message($mybb->input['subject'], $parser_options);
$mybb->input['message'] = $parser->parse_message($mybb->input['message'], $parser_options);
}

			$mybb->input['subject'] = $parser->parse_badwords($mybb->input['subject']);
$mybb->input['message'] = $parser->parse_badwords($mybb->input['message']);
}









		$user = $lang->na;

		$user = $lang->guest;

		if($mybb->user['uid'])

		if($mybb->user['uid'])

		{
$user = $mybb->user['username'].' - '.$mybb->settings['bburl'].'/'.get_profile_link($mybb->user['uid']);
}

		{
$user = htmlspecialchars_uni($mybb->user['username']).' - '.$mybb->settings['bburl'].'/'.get_profile_link($mybb->user['uid']);
}


$subject = $lang->sprintf($lang->email_contact_subject, $mybb->input['subject']);
$message = $lang->sprintf($lang->email_contact, $mybb->input['email'], $user, $session->ipaddress, $mybb->input['message']);


$subject = $lang->sprintf($lang->email_contact_subject, $mybb->input['subject']);
$message = $lang->sprintf($lang->email_contact, $mybb->input['email'], $user, $session->ipaddress, $mybb->input['message']);





		// Email the administrator

		// Email the administrator

		my_mail($mybb->settings['adminemail'], $subject, $message, $mybb->input['email']);

		my_mail($contactemail, $subject, $message, '', '', '', false, 'text', '', $mybb->get_input('email', MyBB::INPUT_STRING));


$plugins->run_hooks('contact_do_end');



$plugins->run_hooks('contact_do_end');


Zeile 232Zeile 237
				"fromuid" => $mybb->user['uid'],
"fromemail" => $db->escape_string($mybb->input['email']),
"touid" => 0,

				"fromuid" => $mybb->user['uid'],
"fromemail" => $db->escape_string($mybb->input['email']),
"touid" => 0,

				"toemail" => $db->escape_string($mybb->settings['adminemail']),

				"toemail" => $db->escape_string($contactemail),

				"tid" => 0,
"ipaddress" => $db->escape_binary($session->packedip),
"type" => 3
);
$db->insert_query("maillogs", $log_entry);
}

				"tid" => 0,
"ipaddress" => $db->escape_binary($session->packedip),
"type" => 3
);
$db->insert_query("maillogs", $log_entry);
}


if($mybb->usergroup['emailfloodtime'] > 0 || (isset($sent_count) && $sent_count + 1 >= $mybb->usergroup['maxemails']))






		
$mybb->input['from'] = $mybb->get_input('from');
if(!empty($mybb->input['from']))
{
redirect($mybb->input['from'], $lang->contact_success_message, '', true);
}
else

		{
redirect('index.php', $lang->contact_success_message, '', true);

		{
redirect('index.php', $lang->contact_success_message, '', true);

		}
else
{
redirect('contact.php', $lang->contact_success_message, '', true);

 
		}
}
else
{
$errors = inline_error($errors);

		}
}
else
{
$errors = inline_error($errors);

	}
}

	}
}


if(empty($errors))


if(empty($errors))

{

{

	$errors = '';
}

// Generate CAPTCHA?

	$errors = '';
}

// Generate CAPTCHA?

if($mybb->settings['captchaimage'])



$captcha = '';

if($mybb->settings['captchaimage'] && !$mybb->user['uid'])

{
$post_captcha = new captcha(true, "post_captcha");


{
$post_captcha = new captcha(true, "post_captcha");


Zeile 269Zeile 277
	{
$captcha = $post_captcha->html;
}

	{
$captcha = $post_captcha->html;
}

 
}

$contact_subject = htmlspecialchars_uni($mybb->input['subject']);
$contact_message = htmlspecialchars_uni($mybb->input['message']);

if($mybb->user['uid'] && !$mybb->get_input('email'))
{
$user_email = htmlspecialchars_uni($mybb->user['email']);

}
else
{

}
else
{

	$captcha = '';






	$user_email = htmlspecialchars_uni($mybb->get_input('email'));
}

if(isset($mybb->input['from']))
{
$redirect_url = htmlspecialchars_uni($mybb->get_input('from'));

}

}


$mybb->input['subject'] = htmlspecialchars_uni($mybb->input['subject']);
$mybb->input['message'] = htmlspecialchars_uni($mybb->input['message']);

if($mybb->user['uid'] && !$mybb->get_input('email'))

else if(isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $mybb->settings['bburl']) !== false  && strpos($_SERVER['HTTP_REFERER'], "contact.php") === false)





{

{

	$mybb->input['email'] = htmlspecialchars_uni($mybb->user['email']);

	$redirect_url = htmlentities($_SERVER['HTTP_REFERER']);

}
else
{

}
else
{

	$mybb->input['email'] = htmlspecialchars_uni($mybb->get_input('email'));

	$redirect_url = '';

}

$plugins->run_hooks('contact_end');

}

$plugins->run_hooks('contact_end');