<?php if (!isset($_POST['delete_confirm'])) : ?>
<form data-upload-check="1" class="page" action="<?php echo $tpl['current_url']; ?>" method="post" enctype="multipart/form-data">
	<fieldset>
		<legend><?php echo __('Avatar actuel'); ?></legend>
		<p id="avatar_current" class="field">
			<img src="<?php echo $tpl['user']['avatar_src']; ?>" alt="<?php echo sprintf(__('Avatar de %s'), $tpl['user']['nickname']); ?>">
		</p>
	</fieldset>
	<fieldset<?php if ($_GET['user_id'] == 1 && $tpl['auth']['id'] != 1) : ?> disabled<?php endif; ?>>
		<legend><?php echo __('Nouvel avatar'); ?></legend>
		<p class="field">
			<input required data-maxsize="<?php echo $tpl['upload']['maxfilesize']; ?>" class="file_hide" id="file" name="file" size="35" maxlength="2048" type="file"
				accept="<?php echo implode(',', $tpl['upload']['filetypes']); ?>">
			<label for="file" class="button_file"><?php echo __('Sélectionner un fichier'); ?></label>
		</p>
		<p class="field">
			<span class="text"><?php echo nl2br($tpl['upload']['text_limits']); ?></span>
		</p>
<?php if (!($_GET['user_id'] == 1 && $tpl['auth']['id'] != 1)) : ?>
		<input name="MAX_FILE_SIZE" value="<?php echo $tpl['upload']['maxfilesize']; ?>" type="hidden">
		<input name="anticsrf" type="hidden" value="<?php echo $tpl['anticsrf'](); ?>">
		<input name="change" type="submit" value="<?php echo __('Envoyer'); ?>">
		<script nonce="<?php echo CSP_NONCE; ?>" type="text/javascript">
		var maxsize_text = "<?php echo $tpl['php2js'](__('Poids du fichier trop grand.')); ?>";
		</script>
<?php endif; ?>
	</fieldset>
</form>
<?php endif; ?>

<?php if ($_GET['user_id'] == 1 && $tpl['auth']['id'] != 1) : ?>
<div class="report_classic">
	<div class="report_msg report_info">
		<p><?php echo __('Vous n\'avez pas la permission de modifier ce profil.'); ?></p>
	</div>
</div>
<?php else : ?>
<?php if ($tpl['user']['avatar']) : ?>
<?php $confirm_delete = __('Supprimer l\'avatar ?'); ?>
<form class="page" action="<?php echo $tpl['current_url']; ?>" method="post">
	<fieldset>
		<legend><?php echo __('Suppression'); ?></legend>
<?php if (isset($_POST['delete_confirm'])) : ?>
		<p class="field"><?php echo $confirm_delete; ?></p>
		<p class="field">
			<input name="anticsrf" type="hidden" value="<?php echo $tpl['anticsrf'](); ?>">
			<input name="delete" type="submit" value="<?php echo __('Supprimer'); ?>">
			<input name="cancel" type="submit" value="<?php echo __('Annuler'); ?>">
		</p>
<?php else : ?>
		<p class="field">
			<input name="anticsrf" type="hidden" value="<?php echo $tpl['anticsrf'](); ?>">
			<input name="delete_confirm" type="submit" value="<?php echo __('Supprimer l\'avatar'); ?>">
		</p>
		<script nonce="<?php echo CSP_NONCE; ?>" type="text/javascript">
		var confirm_delete = "<?php echo $tpl['php2js']($confirm_delete); ?>";
		</script>
<?php endif; ?>
	</fieldset>
</form>
<?php endif; ?>
<?php endif; ?>