Browse Source

Small code cleanup

Tobias Reich 11 years ago
parent
commit
ed79ddce47
2 changed files with 11 additions and 6 deletions
  1. 8 4
      php/modules/Album.php
  2. 3 2
      php/modules/misc.php

+ 8 - 4
php/modules/Album.php

@@ -442,15 +442,19 @@ class Album extends Module {
 		# Call plugins
 		$this->plugins(__METHOD__, 0, func_get_args());
 
-		if (isset($password)&&strlen($password)>0) {
-			# get hashed password
+		if (strlen($password)>0) {
+
+			# Get hashed password
 			$password = get_hashed_password($password);
 
-			# set hashed password
+			# Set hashed password
 			$result = $this->database->query("UPDATE lychee_albums SET password = '$password' WHERE id IN ('$this->albumIDs');");
+
 		} else {
-			# unset password
+
+			# Unset password
 			$result = $this->database->query("UPDATE lychee_albums SET password = NULL WHERE id IN ('$this->albumIDs');");
+
 		}
 
 		# Call plugins

+ 3 - 2
php/modules/misc.php

@@ -82,9 +82,9 @@ function search($database, $settings, $term) {
 
 function get_hashed_password($password) {
 
-	# inspired by -> http://alias.io/2010/01/store-passwords-safely-with-php-and-mysql/
+	# Inspired by http://alias.io/2010/01/store-passwords-safely-with-php-and-mysql/
 
-	# A higher "cost" is more secure but consumes more processing power
+	# A higher $cost is more secure but consumes more processing power
 	$cost = 10;
 
 	# Create a random salt
@@ -96,6 +96,7 @@ function get_hashed_password($password) {
 
 	# Hash the password with the salt
 	return crypt($password, $salt);
+
 }
 
 ?>