From 4e52b1e54501e0c16d40c3b7e8f7e7fda409d438 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Fri, 30 May 2014 16:55:30 +0200 Subject: [PATCH] Added Log to Settings --- php/modules/Settings.php | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/php/modules/Settings.php b/php/modules/Settings.php index d985ac6..46253cb 100755 --- a/php/modules/Settings.php +++ b/php/modules/Settings.php @@ -70,12 +70,18 @@ class Settings extends Module { # Parse $username = htmlentities($username); - if (strlen($username)>50) return false; + if (strlen($username)>50) { + Log::notice($this->database, __METHOD__, __LINE__, 'Username is longer than 50 chars'); + return false; + } # Execute query $result = $this->database->query("UPDATE lychee_settings SET value = '$username' WHERE `key` = 'username';"); - if (!$result) return false; + if (!$result) { + Log::error($this->database, __METHOD__, __LINE__, $this->database->error); + return false; + } return true; } @@ -90,7 +96,10 @@ class Settings extends Module { # Execute query $result = $this->database->query("UPDATE lychee_settings SET value = '$password' WHERE `key` = 'password';"); - if (!$result) return false; + if (!$result) { + Log::error($this->database, __METHOD__, __LINE__, $this->database->error); + return false; + } return true; } @@ -100,12 +109,18 @@ class Settings extends Module { # Check dependencies $this->dependencies(isset($this->database, $key)); - if (strlen($key)<1||strlen($key)>50) return false; + if (strlen($key)<1||strlen($key)>50) { + Log::notice($this->database, __METHOD__, __LINE__, 'Dropbox key is either too short or too long'); + return false; + } # Execute query $result = $this->database->query("UPDATE lychee_settings SET value = '$key' WHERE `key` = 'dropboxKey';"); - if (!$result) return false; + if (!$result) { + Log::error($this->database, __METHOD__, __LINE__, $this->database->error); + return false; + } return true; } @@ -163,7 +178,10 @@ class Settings extends Module { # Execute query $result = $this->database->query("UPDATE lychee_settings SET value = '$sorting' WHERE `key` = 'sorting';"); - if (!$result) return false; + if (!$result) { + Log::error($this->database, __METHOD__, __LINE__, $this->database->error); + return false; + } return true; }