<?php

/**
 *
 * @copyright  2013-2016 izend.org
 * @version    3
 * @link       http://www.izend.org
 */
?>
<?php extract($errors); ?>
<form action="" method="post">
<input type="hidden" name="unsubscribe_token" value="<?php echo $token; ?>" />
<p class="inlabel<?php if ($missing_mail or $bad_mail): ?> inerror<?php endif; ?>">What is your email address?</p>
<p><input type="text" name="unsubscribe_mail" id="unsubscribe_mail" size="40" maxlength="100" title="name@domain.net" onkeypress="return focusonenter(event, 'unsubscribe_code')" value="<?php echo htmlspecialchars($user_mail, ENT_COMPAT, 'UTF-8'); ?>" /></p>
<p class="info">Your email address is strictly confidential.</p>
<p class="inlabel<?php if ($missing_confirmation): ?> inerror<?php endif; ?>">Please confirm your unregistration:</p>
<p><input name="unsubscribe_confirmed" id="unsubscribe_confirmed" type="checkbox" title="Confirmation" <?php if ($confirmed) echo 'checked="checked"'; ?> />&nbsp;I don't want to receive the newsletter by email anymore</p>
<?php if ($with_captcha): ?>
<p>
<img src="<?php echo $base_path; ?>/captcha/unsubscribe" alt="" height="40" title="Verification code" />
:
<input type="text" name="unsubscribe_code" id="unsubscribe_code" size="4" maxlength="4" title="4 letters" autocomplete="off" onkeypress="return submitonenter(event, 'unsubscribe_send')" value="" />
</p>
<?php endif; ?>
<p><input type="submit" class="submit submit_send" name="unsubscribe_send" id="unsubscribe_send" value="Send" /></p>
</form>
<div class="errors">
<?php if ($missing_code): ?>
<p>Enter the verification code displayed in the image.</p>
<?php elseif ($bad_code): ?>
<p>The verification code is incorrect.</p>
<?php endif; ?>
<?php if ($missing_mail): ?>
<p>Enter a valid email address.</p>
<?php elseif ($bad_mail): ?>
<p>The email address is invalid.</p>
<?php elseif ($unknown_mail): ?>
<p>This email address is not registered.</p>
<?php endif; ?>
<?php if ($missing_confirmation): ?>
<p>Check the confirmation box.</p>
<?php endif; ?>
</div>
<?php extract($infos); ?>
<div class="infos">
<?php if ($internal_error): ?>
<p>An internal error has occurred.
<?php if ($contact_page): ?>If you can describe the problem, please <a href="<?php echo $contact_page; ?>" rel="nofollow">contact us</a>.<?php endif; ?></p>
<?php endif; ?>
<?php if ($mail_unsubscribed): ?>
<p>A validation email has been sent to your address.</p>
<?php endif; ?>
<?php if ($subscribe_page): ?>
<p>To receive the newsletter, <a href="<?php echo $subscribe_page; ?>">click here</a>.</p>
<?php endif; ?>
</div>
<?php
$focus=false;
if ($missing_code or $bad_code) {
	$focus='#unsubscribe_code';
}
else if ($missing_mail or $bad_mail) {
	$focus='#unsubscribe_mail';
}
?>
<?php if ($focus): ?>
<script type="text/javascript">
$(function() {$('<?php echo $focus; ?>').focus();});
</script>
<?php endif; ?>
