Browse Source

add some placeholders; disable gravatar for default @localhost emails

Andrew Dolgov 6 months ago
parent
commit
0584811fd3
2 changed files with 12 additions and 4 deletions
  1. 10 2
      index.php
  2. 2 2
      prefs.php

+ 10 - 2
index.php

@@ -234,8 +234,16 @@
 		<span id="net-alert" class="glyphicon glyphicon-exclamation-sign text-danger" style="display : none"
 			title="<?php echo __("Communication problem with the server.") ?>"> </span>
 
-		<?php $grav_hash = md5(trim(get_user_email($_SESSION['name']))); ?>
-		<img onclick="show_prefs()" class="avatar" title="<?php echo __('Preferences') ?>" referrerpolicy="no-referrer"  src="https://secure.gravatar.com/avatar/<?php echo $grav_hash ?>?s=96">
+		<?php
+			$email = get_user_email($_SESSION['name']);
+
+			if (strpos($email, "@localhost") === FALSE) {
+				$grav_hash = md5(trim($email));
+			?>
+				<img onclick="show_prefs()" class="avatar" title="<?php echo __('Preferences') ?>" referrerpolicy="no-referrer"  src="https://secure.gravatar.com/avatar/<?php echo $grav_hash ?>?s=96">
+		<?php } else { ?>
+			<a href="#" onclick="show_prefs()" title="<?php echo __("Preferences") ?>"><span class="glyphicon glyphicon-cog"></a>
+		<?php } ?>
 
 		<?php if ($_SESSION["access_level"] >= 10) { ?>
 		<a href="#" onclick="show_users()" title="<?php echo __("Users") ?>"><span class="text-warning glyphicon glyphicon-user"></a>

+ 2 - 2
prefs.php

@@ -340,14 +340,14 @@
 		<div class="form-group">
 			<label class="col-sm-4 control-label"><?php echo __('Nickname:') ?></label>
 			<div class="col-sm-6">
-				<input type="text" class="form-control" name="nick" required="1" size="30" value="<?php echo $nick ?>">
+				<input type="text" class="form-control" name="nick" placeholder="<?php echo $_SESSION['name'] ?>" required="1" size="30" value="<?php echo $nick ?>">
 			</div>
 		</div>
 
 		<div class="form-group">
 			<label class="col-sm-4 control-label"><?php echo __('E-mail:') ?></label>
 			<div class="col-sm-6">
-				<input type="text" class="form-control" name="email" required="1" size="30" value="<?php echo $email ?>">
+				<input type="text" class="form-control" name="email" placeholder="<?php echo $_SESSION['name'] ?>@localhost" required="1" size="30" value="<?php echo $email ?>">
 			</div>
 		</div>