mirror of
				https://github.com/slawkens/myaac.git
				synced 2025-10-25 22:54:18 +02:00 
			
		
		
		
	 56a01e1e64
			
		
	
	56a01e1e64
	
	
	
		
			
			* log some error info when mail cannot be send on account create * fixed some weird include possibilities with forum and account actions (verify action name) * twig getLink function will now return with full url (BASE_URL included) * fixed some changelog PHP Notice warning * (internal) shortened message functions
		
			
				
	
	
		
			144 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			144 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * Account management
 | |
|  *
 | |
|  * @package   MyAAC
 | |
|  * @author    Gesior <jerzyskalski@wp.pl>
 | |
|  * @author    Slawkens <slawkens@gmail.com>
 | |
|  * @copyright 2017 MyAAC
 | |
|  * @link      http://my-aac.org
 | |
|  */
 | |
| defined('MYAAC') or die('Direct access not allowed!');
 | |
| $title = 'Account Management';
 | |
| 
 | |
| if($config['account_country'])
 | |
| 	require(SYSTEM . 'countries.conf.php');
 | |
| 
 | |
| $groups = new OTS_Groups_List();
 | |
| 
 | |
| $show_form = true;
 | |
| $config_salt_enabled = fieldExist('salt', 'accounts');
 | |
| if(!$logged)
 | |
| {
 | |
| 	if($action == "logout") {
 | |
| 		echo $twig->render('account.logout.html.twig');
 | |
| 	}
 | |
| 	else
 | |
| 	{
 | |
| 		if($action == 'confirm_email') {
 | |
| 			require(PAGES . 'account/' . $action . '.php');
 | |
| 			return;
 | |
| 		}
 | |
| 		
 | |
| 		if(!empty($errors))
 | |
| 			echo $twig->render('error_box.html.twig', array('errors' => $errors));
 | |
| 		
 | |
| 		echo $twig->render('account.login.html.twig', array(
 | |
| 			'redirect' => isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : null,
 | |
| 			'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number',
 | |
| 			'error' => isset($errors[0]) ? $errors[0] : null
 | |
| 		));
 | |
| 	}
 | |
| 
 | |
| 	return;
 | |
| }
 | |
| 
 | |
| $errors = array();
 | |
| 
 | |
| 	if(isset($_REQUEST['redirect']))
 | |
| 	{
 | |
| 		$redirect = urldecode($_REQUEST['redirect']);
 | |
| 
 | |
| 		echo $twig->render('account.redirect.html.twig', array(
 | |
| 			'redirect' => $redirect
 | |
| 		));
 | |
| 		return;
 | |
| 	}
 | |
| 
 | |
| 	if($action == '')
 | |
| 	{
 | |
| 		$freePremium = isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium']);
 | |
| 		$recovery_key = $account_logged->getCustomField('key');
 | |
| 		if(!$account_logged->isPremium())
 | |
| 			$account_status = '<b><font color="red">Free Account</font></b>';
 | |
| 		else
 | |
| 			$account_status = '<b><font color="green">Premium Account, ' . ($freePremium ? 'Unlimited' : $account_logged->getPremDays() . ' days left') . '</font></b>';
 | |
| 		
 | |
| 		if(empty($recovery_key))
 | |
| 			$account_registered = '<b><font color="red">No</font></b>';
 | |
| 		else
 | |
| 		{
 | |
| 			if($config['generate_new_reckey'] && $config['mail_enabled'])
 | |
| 				$account_registered = '<b><font color="green">Yes ( <a href="' . getLink('account/register/new') . '"> Buy new Recovery Key </a> )</font></b>';
 | |
| 			else
 | |
| 				$account_registered = '<b><font color="green">Yes</font></b>';
 | |
| 		}
 | |
| 
 | |
| 		$account_created = $account_logged->getCustomField("created");
 | |
| 		$account_email = $account_logged->getEMail();
 | |
| 		$email_new_time = $account_logged->getCustomField("email_new_time");
 | |
| 		if($email_new_time > 1)
 | |
| 			$email_new = $account_logged->getCustomField("email_new");
 | |
| 		$account_rlname = $account_logged->getRLName();
 | |
| 		$account_location = $account_logged->getLocation();
 | |
| 		if($account_logged->isBanned())
 | |
| 			if($account_logged->getBanTime() > 0)
 | |
| 				$welcome_message = '<font color="red">Your account is banished until '.date("j F Y, G:i:s", $account_logged->getBanTime()).'!</font>';
 | |
| 			else
 | |
| 				$welcome_message = '<font color="red">Your account is banished FOREVER!</font>';
 | |
| 		else
 | |
| 			$welcome_message = 'Welcome to your account!';
 | |
| 		
 | |
| 		$email_change = '';
 | |
| 		$email_request = false;
 | |
| 		if($email_new_time > 1)
 | |
| 		{
 | |
| 			if($email_new_time < time())
 | |
| 				$email_change = '<br>(You can accept <b>'.$email_new.'</b> as a new email.)';
 | |
| 			else
 | |
| 			{
 | |
| 				$email_change = ' <br>You can accept <b>new e-mail after '.date("j F Y", $email_new_time).".</b>";
 | |
| 				$email_request = true;
 | |
| 			}
 | |
| 		}
 | |
| 		
 | |
| 		$actions = array();
 | |
| 		foreach($account_logged->getActionsLog(0, 1000) as $action) {
 | |
| 			$actions[] = array('action' => $action['action'], 'date' => $action['date'], 'ip' => $action['ip'] != 0 ? long2ip($action['ip']) : inet_ntop($action['ipv6']));
 | |
| 		}
 | |
| 		
 | |
| 		$players = array();
 | |
| 		$account_players = $account_logged->getPlayersList();
 | |
| 		$account_players->orderBy('id');
 | |
| 		
 | |
| 		echo $twig->render('account.management.html.twig', array(
 | |
| 			'welcome_message' => $welcome_message,
 | |
| 			'recovery_key' => $recovery_key,
 | |
| 			'email_change' => $email_change,
 | |
| 			'email_request' => $email_request,
 | |
| 			'email_new_time' => $email_new_time,
 | |
| 			'email_new' => isset($email_new) ? $email_new : '',
 | |
| 			'account' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId(),
 | |
| 			'account_email' => $account_email,
 | |
| 			'account_created' => $account_created,
 | |
| 			'account_status' => $account_status,
 | |
| 			'account_registered' => $account_registered,
 | |
| 			'account_rlname' => $account_rlname,
 | |
| 			'account_location' => $account_location,
 | |
| 			'actions' => $actions,
 | |
| 			'players' => $account_players
 | |
| 		));
 | |
| 	}
 | |
| 	else {
 | |
| 		if(!ctype_alnum(str_replace(array('-', '_'), '', $action))) {
 | |
| 			error('Error: Action contains illegal characters.');
 | |
| 		}
 | |
| 		else if(file_exists(PAGES . 'account/' . $action . '.php')) {
 | |
| 			require(PAGES . 'account/' . $action . '.php');
 | |
| 		}
 | |
| 		else {
 | |
| 			error('This page does not exists.');
 | |
| 		}
 | |
| 	}
 | |
| ?>
 |