From 36f43c3e2722e93d1c10dcbe062b463ca267306a Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 13 Feb 2016 23:33:39 +0100 Subject: [PATCH] Strict if condition --- php/Access/Guest.php | 4 ++-- php/Modules/Config.php | 2 +- php/Modules/Database.php | 8 ++++---- php/Modules/Settings.php | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/php/Access/Guest.php b/php/Access/Guest.php index 88abf02..a4a0d48 100644 --- a/php/Access/Guest.php +++ b/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; diff --git a/php/Modules/Config.php b/php/Modules/Config.php index 4a00ce6..d68a257 100644 --- a/php/Modules/Config.php +++ b/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); diff --git a/php/Modules/Database.php b/php/Modules/Database.php index 9c4e711..1a2a3c8 100755 --- a/php/Modules/Database.php +++ b/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; diff --git a/php/Modules/Settings.php b/php/Modules/Settings.php index 3f07e12..018dc7c 100755 --- a/php/Modules/Settings.php +++ b/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;