<?php

/**
 * View your current character's profile.
 */
function profile_controller_get()
{
	auth_only_and_must_have_character();

	$GLOBALS['active_nav_tab'] = "profile";
	echo page('profile/main');
}

/**
 * View another character's profile.
 */
function profile_controller_show_get($id)
{
	auth_only_and_must_have_character();

	if (($char = Character::find($id)) == false) error_response(999);
	if (user()->char_id == $id) redirect('/profile');
	echo page('profile/show', ['c' => $char]);
}
