Code Duplication    Length = 99-99 lines in 2 locations

Themes/default/Profile.template.php 2 locations

@@ 2557-2655 (lines=99) @@
2554
/**
2555
 * Template to show for deleting a user's account - now with added delete post capability!
2556
 */
2557
function template_deleteAccount()
2558
{
2559
	global $context, $scripturl, $txt;
2560
2561
	// The main containing header.
2562
	echo '
2563
		<form action="', $scripturl, '?action=profile;area=deleteaccount;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
2564
			<div class="cat_bar">
2565
				<h3 class="catbg profile_hd">
2566
					', $txt['deleteAccount'], '
2567
				</h3>
2568
			</div>';
2569
2570
	// If deleting another account give them a lovely info box.
2571
	if (!$context['user']['is_owner'])
2572
		echo '
2573
			<p class="information">', $txt['deleteAccount_desc'], '</p>';
2574
2575
	echo '
2576
			<div class="windowbg">';
2577
2578
	// If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
2579
	if ($context['needs_approval'])
2580
		echo '
2581
				<div class="errorbox">', $txt['deleteAccount_approval'], '</div>';
2582
2583
	// If the user is deleting their own account warn them first - and require a password!
2584
	if ($context['user']['is_owner'])
2585
	{
2586
		echo '
2587
				<div class="alert">', $txt['own_profile_confirm'], '</div>
2588
				<div>
2589
					<strong', (isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : ''), '>', $txt['current_password'], ': </strong>
2590
					<input type="password" name="oldpasswrd" size="20">
2591
					<input type="submit" value="', $txt['yes'], '" class="button">';
2592
2593
		if (!empty($context['token_check']))
2594
			echo '
2595
					<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2596
2597
		echo '
2598
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
2599
					<input type="hidden" name="u" value="', $context['id_member'], '">
2600
					<input type="hidden" name="sa" value="', $context['menu_item_selected'], '">
2601
				</div>';
2602
	}
2603
	// Otherwise an admin doesn't need to enter a password - but they still get a warning - plus the option to delete lovely posts!
2604
	else
2605
	{
2606
		echo '
2607
				<div class="alert">', $txt['deleteAccount_warning'], '</div>';
2608
2609
		// Only actually give these options if they are kind of important.
2610
		if ($context['can_delete_posts'])
2611
		{
2612
			echo '
2613
				<div>
2614
					<label for="deleteVotes">
2615
						<input type="checkbox" name="deleteVotes" id="deleteVotes" value="1"> ', $txt['deleteAccount_votes'], ':
2616
					</label><br>
2617
					<label for="deletePosts">
2618
						<input type="checkbox" name="deletePosts" id="deletePosts" value="1"> ', $txt['deleteAccount_posts'], ':
2619
					</label>
2620
					<select name="remove_type">
2621
						<option value="posts">', $txt['deleteAccount_all_posts'], '</option>
2622
						<option value="topics">', $txt['deleteAccount_topics'], '</option>
2623
					</select>';
2624
2625
			if ($context['show_perma_delete'])
2626
				echo '
2627
					<br>
2628
					<label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>';
2629
2630
			echo '
2631
				</div>';
2632
		}
2633
2634
		echo '
2635
				<div>
2636
					<label for="deleteAccount"><input type="checkbox" name="deleteAccount" id="deleteAccount" value="1" onclick="if (this.checked) return confirm(\'', $txt['deleteAccount_confirm'], '\');"> ', $txt['deleteAccount_member'], '.</label>
2637
				</div>
2638
				<div>
2639
					<input type="submit" value="', $txt['delete'], '" class="button">';
2640
2641
		if (!empty($context['token_check']))
2642
			echo '
2643
				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2644
2645
		echo '
2646
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
2647
					<input type="hidden" name="u" value="', $context['id_member'], '">
2648
					<input type="hidden" name="sa" value="', $context['menu_item_selected'], '">
2649
				</div>';
2650
	}
2651
	echo '
2652
			</div><!-- .windowbg -->
2653
			<br>
2654
		</form>';
2655
}
2656
2657
/**
2658
 * Template for the password box/save button stuck at the bottom of every profile page.
@@ 3264-3362 (lines=99) @@
3261
/**
3262
 * Template to show for deleting a user's account - now with added delete post capability!
3263
 */
3264
function template_getProfileData()
3265
{
3266
	global $context, $scripturl, $txt;
3267
3268
	// The main containing header.
3269
	echo '
3270
		<form action="', $scripturl, '?action=profile;area=getprofiledata;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
3271
			<div class="cat_bar">
3272
				<h3 class="catbg profile_hd">
3273
					', $txt['deleteAccount'], '
3274
				</h3>
3275
			</div>';
3276
3277
	// If deleting another account give them a lovely info box.
3278
	if (!$context['user']['is_owner'])
3279
		echo '
3280
			<p class="information">', $txt['deleteAccount_desc'], '</p>';
3281
3282
	echo '
3283
			<div class="windowbg">';
3284
3285
	// If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
3286
	if ($context['needs_approval'])
3287
		echo '
3288
				<div class="errorbox">', $txt['deleteAccount_approval'], '</div>';
3289
3290
	// If the user is deleting their own account warn them first - and require a password!
3291
	if ($context['user']['is_owner'])
3292
	{
3293
		echo '
3294
				<div class="alert">', $txt['own_profile_confirm'], '</div>
3295
				<div>
3296
					<strong', (isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : ''), '>', $txt['current_password'], ': </strong>
3297
					<input type="password" name="oldpasswrd" size="20">
3298
					<input type="submit" value="', $txt['yes'], '" class="button">';
3299
3300
		if (!empty($context['token_check']))
3301
			echo '
3302
					<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
3303
3304
		echo '
3305
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
3306
					<input type="hidden" name="u" value="', $context['id_member'], '">
3307
					<input type="hidden" name="sa" value="', $context['menu_item_selected'], '">
3308
				</div>';
3309
	}
3310
	// Otherwise an admin doesn't need to enter a password - but they still get a warning - plus the option to delete lovely posts!
3311
	else
3312
	{
3313
		echo '
3314
				<div class="alert">', $txt['deleteAccount_warning'], '</div>';
3315
3316
		// Only actually give these options if they are kind of important.
3317
		if ($context['can_delete_posts'])
3318
		{
3319
			echo '
3320
				<div>
3321
					<label for="deleteVotes">
3322
						<input type="checkbox" name="deleteVotes" id="deleteVotes" value="1"> ', $txt['deleteAccount_votes'], ':
3323
					</label><br>
3324
					<label for="deletePosts">
3325
						<input type="checkbox" name="deletePosts" id="deletePosts" value="1"> ', $txt['deleteAccount_posts'], ':
3326
					</label>
3327
					<select name="remove_type">
3328
						<option value="posts">', $txt['deleteAccount_all_posts'], '</option>
3329
						<option value="topics">', $txt['deleteAccount_topics'], '</option>
3330
					</select>';
3331
3332
			if ($context['show_perma_delete'])
3333
				echo '
3334
					<br>
3335
					<label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>';
3336
3337
			echo '
3338
				</div>';
3339
		}
3340
3341
		echo '
3342
				<div>
3343
					<label for="deleteAccount"><input type="checkbox" name="deleteAccount" id="deleteAccount" value="1" onclick="if (this.checked) return confirm(\'', $txt['deleteAccount_confirm'], '\');"> ', $txt['deleteAccount_member'], '.</label>
3344
				</div>
3345
				<div>
3346
					<input type="submit" value="', $txt['delete'], '" class="button">';
3347
3348
		if (!empty($context['token_check']))
3349
			echo '
3350
				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
3351
3352
		echo '
3353
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
3354
					<input type="hidden" name="u" value="', $context['id_member'], '">
3355
					<input type="hidden" name="sa" value="', $context['menu_item_selected'], '">
3356
				</div>';
3357
	}
3358
	echo '
3359
			</div><!-- .windowbg -->
3360
			<br>
3361
		</form>';
3362
}
3363
3364
?>