User Gavatar Support
This commit is contained in:
		@@ -21,6 +21,11 @@ class UserManager
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function getAvatarUrl(){
 | 
			
		||||
		$email = self::getUserData('email');
 | 
			
		||||
		return 'https://secure.gravatar.com/avatar/' . md5( strtolower( trim( $email ) ) );
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function login ($username, $password, $rememberMe) {
 | 
			
		||||
		try {
 | 
			
		||||
			if ($user = Db::loadOne ('SELECT * FROM users WHERE LOWER(username)=LOWER(?)', array ($username))) {
 | 
			
		||||
@@ -104,7 +109,6 @@ class UserManager
 | 
			
		||||
	public static function getUserData ($type, $userId = '') {
 | 
			
		||||
		if ($userId == '') {
 | 
			
		||||
			$userId = $_SESSION['user']['id'];
 | 
			
		||||
			echo 'no user id';
 | 
			
		||||
		}
 | 
			
		||||
		$user = Db::loadOne ('SELECT ' . $type . ' FROM users WHERE user_id=?', array ($userId));
 | 
			
		||||
		return $user[$type];
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,7 @@
 | 
			
		||||
		<div class="col-md-9 main-body">
 | 
			
		||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
				<h4 class="mb-4">
 | 
			
		||||
 | 
			
		||||
					<?php $LANGMNG->echo('t_pageAfterLogIn') ?>
 | 
			
		||||
				</h4>
 | 
			
		||||
				<form method="post" enctype="multipart/form-data">
 | 
			
		||||
@@ -39,6 +40,19 @@
 | 
			
		||||
			</form>
 | 
			
		||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
			
		||||
				<h4 class="mb-4"><?php $LANGMNG->echo('t_profile') ?></h4>
 | 
			
		||||
				<div class="field">
 | 
			
		||||
					<div class="label"><?php $LANGMNG->echo('l_userAvatar') ?>:</div>
 | 
			
		||||
					<img src="<?php echo $USERAVATARURL; ?>" />
 | 
			
		||||
					<div class="label">* providet by Gavatar</div>
 | 
			
		||||
				</div>
 | 
			
		||||
				<div class="field">
 | 
			
		||||
					<div class="label"><?php $LANGMNG->echo('l_userName') ?>:</div>
 | 
			
		||||
					<input class="input" value="<?php echo $USERNAME; ?>" disabled>
 | 
			
		||||
				</div>
 | 
			
		||||
				<div class="field">
 | 
			
		||||
					<div class="label"><?php $LANGMNG->echo('l_userEmail') ?>:</div>
 | 
			
		||||
					<input class="input" value="<?php echo $USEREMAIL; ?>" disabled>
 | 
			
		||||
				</div>
 | 
			
		||||
				<div class="field">
 | 
			
		||||
					<a href="logout" class="button is-primary"><?php $LANGMNG->echo('b_logOut') ?></a>
 | 
			
		||||
				</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ class Setting extends Template
 | 
			
		||||
 | 
			
		||||
		$template = new Template('setting');
 | 
			
		||||
		$template->prepare('baseDir', BASEDIR);
 | 
			
		||||
			$template->prepare('debugMod', DEBUGMOD);
 | 
			
		||||
		$template->prepare('debugMod', DEBUGMOD);
 | 
			
		||||
		$template->prepare('title', 'Automation');
 | 
			
		||||
		$template->prepare('langMng', $langMng);
 | 
			
		||||
		$template->prepare('automations', $automations);
 | 
			
		||||
@@ -32,6 +32,10 @@ class Setting extends Template
 | 
			
		||||
		$users = $userManager->getUsers();
 | 
			
		||||
		$template->prepare('users', $users);
 | 
			
		||||
 | 
			
		||||
		$template->prepare('userName', $userManager->getUserData('username'));
 | 
			
		||||
		$template->prepare('userEmail', $userManager->getUserData('email'));
 | 
			
		||||
		$template->prepare('userAvatarUrl', $userManager->getAvatarUrl());
 | 
			
		||||
 | 
			
		||||
		if ($userManager->getUserData('ota') == ''){
 | 
			
		||||
			$ga = new PHPGangsta_GoogleAuthenticator();
 | 
			
		||||
			$otaSecret = $ga->createSecret();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user