Browse Source

Strict if condition

Tobias Reich 8 years ago
parent
commit
36f43c3e27
4 changed files with 9 additions and 9 deletions
  1. 2 2
      php/Access/Guest.php
  2. 1 1
      php/Modules/Config.php
  3. 4 4
      php/Modules/Database.php
  4. 2 2
      php/Modules/Settings.php

+ 2 - 2
php/Access/Guest.php

@@ -55,7 +55,7 @@ final class Guest extends Access {
 
 		$album = new Album($_POST['albumID']);
 
-		if ($album->getPublic()) {
+		if ($album->getPublic()===true) {
 
 			// Album public
 			if ($album->checkPassword($_POST['password'])) Response::json($album->get());
@@ -76,7 +76,7 @@ final class Guest extends Access {
 
 		$album = new Album($_POST['albumID']);
 
-		if ($album->getPublic()) {
+		if ($album->getPublic()===true) {
 
 			// Album public
 			if ($album->checkPassword($_POST['password'])) echo true;

+ 1 - 1
php/Modules/Config.php

@@ -13,7 +13,7 @@ final class Config {
 		if ($connection===false) return 'Warning: Connection failed!';
 
 		// Check if user can create the database before saving the configuration
-		if (!Database::createDatabase($connection, $name)) return 'Warning: Creation failed!';
+		if (Database::createDatabase($connection, $name)===false) return 'Warning: Creation failed!';
 
 		// Escape data
 		$host     = mysqli_real_escape_string($connection, $host);

+ 4 - 4
php/Modules/Database.php

@@ -50,16 +50,16 @@ final class Database {
 		// Check if the connection was successful
 		if ($connection===false) Response::error('' . $connection->connect_error);
 
-		if (!self::setCharset($connection)) Response::error('Could not set database charset!');
+		if (self::setCharset($connection)===false) Response::error('Could not set database charset!');
 
 		// Create database
-		if (!self::createDatabase($connection, $name)) Response::error('Could not create database!');
+		if (self::createDatabase($connection, $name)===false) Response::error('Could not create database!');
 
 		// Create tables
-		if (!self::createTables($connection)) Response::error('Could not create tables!');
+		if (self::createTables($connection)===false) Response::error('Could not create tables!');
 
 		// Update database
-		if (!self::update($connection, $name)) Response::error('Could not update database and tables!');
+		if (self::update($connection, $name)===false) Response::error('Could not update database and tables!');
 
 		$this->connection = $connection;
 

+ 2 - 2
php/Modules/Settings.php

@@ -66,10 +66,10 @@ final class Settings {
 		if ($oldPassword===self::get()['password']||self::get()['password']===crypt($oldPassword, self::get()['password'])) {
 
 			// Save username
-			if (self::setUsername($username)!==true) Response::error('Updating username failed!');
+			if (self::setUsername($username)===false) Response::error('Updating username failed!');
 
 			// Save password
-			if (self::setPassword($password)!==true) Response::error('Updating password failed!');
+			if (self::setPassword($password)===false) Response::error('Updating password failed!');
 
 			return true;