diff options
author | Bot <bot@myigel.name> | 2017-01-03 14:12:17 +0100 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2017-01-03 15:32:59 +0100 |
commit | 55141154c083acc2d0397f4c62b4e0be1c7a19fa (patch) | |
tree | 7e5e54a19f7df976fa68c42f21f1484112a7c257 /includes/model | |
parent | 356b2582f3e6a43ecf2607acad4a7fe0b37f659a (diff) |
Replaced " with '
Diffstat (limited to 'includes/model')
-rw-r--r-- | includes/model/AngelType_model.php | 33 | ||||
-rw-r--r-- | includes/model/EventConfig_model.php | 4 | ||||
-rw-r--r-- | includes/model/LogEntries_model.php | 22 | ||||
-rw-r--r-- | includes/model/Message_model.php | 6 | ||||
-rw-r--r-- | includes/model/NeededAngelTypes_model.php | 4 | ||||
-rw-r--r-- | includes/model/Room_model.php | 2 | ||||
-rw-r--r-- | includes/model/ShiftEntry_model.php | 4 | ||||
-rw-r--r-- | includes/model/ShiftTypes_model.php | 2 | ||||
-rw-r--r-- | includes/model/Shifts_model.php | 24 | ||||
-rw-r--r-- | includes/model/UserAngelTypes_model.php | 18 | ||||
-rw-r--r-- | includes/model/UserDriverLicenses_model.php | 4 | ||||
-rw-r--r-- | includes/model/UserGroups_model.php | 6 | ||||
-rw-r--r-- | includes/model/User_model.php | 37 |
13 files changed, 95 insertions, 71 deletions
diff --git a/includes/model/AngelType_model.php b/includes/model/AngelType_model.php index eedcdfbc..c3270863 100644 --- a/includes/model/AngelType_model.php +++ b/includes/model/AngelType_model.php @@ -9,7 +9,7 @@ function AngelType_new() { return [ 'id' => null, - 'name' => "", + 'name' => '', 'restricted' => false, 'no_self_signup' => false, 'description' => '', @@ -82,11 +82,12 @@ function AngelType_delete($angeltype) $result = sql_query(" DELETE FROM `AngelTypes` WHERE `id`='" . sql_escape($angeltype['id']) . "' - LIMIT 1"); + LIMIT 1 + "); if ($result === false) { - engelsystem_error("Unable to delete angeltype."); + engelsystem_error('Unable to delete angeltype.'); } - engelsystem_log("Deleted angeltype: " . AngelType_name_render($angeltype)); + engelsystem_log('Deleted angeltype: ' . AngelType_name_render($angeltype)); return $result; } @@ -111,9 +112,13 @@ function AngelType_update($angeltype) `contact_email`=" . sql_null($angeltype['contact_email']) . " WHERE `id`='" . sql_escape($angeltype['id']) . "'"); if ($result === false) { - engelsystem_error("Unable to update angeltype."); + engelsystem_error('Unable to update angeltype.'); } - engelsystem_log("Updated angeltype: " . $angeltype['name'] . ($angeltype['restricted'] ? ", restricted" : "") . ($angeltype['no_self_signup'] ? ", no_self_signup" : "") . ($angeltype['requires_driver_license'] ? ", requires driver license" : "")); + engelsystem_log( + 'Updated angeltype: ' . $angeltype['name'] . ($angeltype['restricted'] ? ', restricted' : '') + . ($angeltype['no_self_signup'] ? ', no_self_signup' : '') + . ($angeltype['requires_driver_license'] ? ', requires driver license' : '') + ); return $result; } @@ -140,7 +145,9 @@ function AngelType_create($angeltype) engelsystem_error("Unable to create angeltype."); } $angeltype['id'] = sql_id(); - engelsystem_log("Created angeltype: " . $angeltype['name'] . ($angeltype['restricted'] ? ", restricted" : "") . ($angeltype['requires_driver_license'] ? ", requires driver license" : "")); + engelsystem_log( + 'Created angeltype: ' . $angeltype['name'] . ($angeltype['restricted'] ? ', restricted' : '') + . ($angeltype['requires_driver_license'] ? ', requires driver license' : '')); return $angeltype; } @@ -156,8 +163,8 @@ function AngelType_create($angeltype) function AngelType_validate_name($name, $angeltype) { $name = strip_item($name); - if ($name == "") { - return new ValidationResult(false, ""); + if ($name == '') { + return new ValidationResult(false, ''); } if ($angeltype != null && isset($angeltype['id'])) { $valid = sql_num_query(" @@ -194,7 +201,7 @@ function AngelTypes_with_user($user) AND `UserAngelTypes`.`user_id`=" . $user['UID'] . " ORDER BY `name`"); if ($result === false) { - engelsystem_error("Unable to load angeltypes."); + engelsystem_error('Unable to load angeltypes.'); } return $result; } @@ -211,7 +218,7 @@ function AngelTypes() FROM `AngelTypes` ORDER BY `name`"); if ($result === false) { - engelsystem_error("Unable to load angeltypes."); + engelsystem_error('Unable to load angeltypes.'); } return $result; } @@ -225,7 +232,7 @@ function AngelType_ids() { $result = sql_select("SELECT `id` FROM `AngelTypes`"); if ($result === false) { - engelsystem_error("Unable to load angeltypes."); + engelsystem_error('Unable to load angeltypes.'); } return select_array($result, 'id', 'id'); } @@ -240,7 +247,7 @@ function AngelType($angeltype_id) { $angelType_source = sql_select("SELECT * FROM `AngelTypes` WHERE `id`='" . sql_escape($angeltype_id) . "'"); if ($angelType_source === false) { - engelsystem_error("Unable to load angeltype."); + engelsystem_error('Unable to load angeltype.'); } if (count($angelType_source) > 0) { return $angelType_source[0]; diff --git a/includes/model/EventConfig_model.php b/includes/model/EventConfig_model.php index 93ba1e72..330863a9 100644 --- a/includes/model/EventConfig_model.php +++ b/includes/model/EventConfig_model.php @@ -7,9 +7,9 @@ */ function EventConfig() { - $event_config = sql_select("SELECT * FROM `EventConfig` LIMIT 1"); + $event_config = sql_select('SELECT * FROM `EventConfig` LIMIT 1'); if ($event_config === false) { - engelsystem_error("Unable to load event config."); + engelsystem_error('Unable to load event config.'); return false; } if (count($event_config) > 0) { diff --git a/includes/model/LogEntries_model.php b/includes/model/LogEntries_model.php index 7bcb868e..920b1945 100644 --- a/includes/model/LogEntries_model.php +++ b/includes/model/LogEntries_model.php @@ -9,7 +9,13 @@ */ function LogEntry_create($nick, $message) { - return sql_query("INSERT INTO `LogEntries` SET `timestamp`='" . sql_escape(time()) . "', `nick`='" . sql_escape($nick) . "', `message`='" . sql_escape($message) . "'"); + return sql_query(" + INSERT INTO `LogEntries` + SET + `timestamp`='" . sql_escape(time()) . "', + `nick`='" . sql_escape($nick) . "', + `message`='" . sql_escape($message) . "' + "); } /** @@ -19,7 +25,7 @@ function LogEntry_create($nick, $message) */ function LogEntries() { - return sql_select("SELECT * FROM `LogEntries` ORDER BY `timestamp` DESC LIMIT 10000"); + return sql_select('SELECT * FROM `LogEntries` ORDER BY `timestamp` DESC LIMIT 10000'); } /** @@ -30,10 +36,16 @@ function LogEntries() */ function LogEntries_filter($keyword) { - if ($keyword == "") { + if ($keyword == '') { return LogEntries(); } - return sql_select("SELECT * FROM `LogEntries` WHERE `nick` LIKE '%" . sql_escape($keyword) . "%' OR `message` LIKE '%" . sql_escape($keyword) . "%' ORDER BY `timestamp` DESC"); + return sql_select(" + SELECT * + FROM `LogEntries` + WHERE `nick` LIKE '%" . sql_escape($keyword) . "%' + OR `message` LIKE '%" . sql_escape($keyword) . "%' + ORDER BY `timestamp` DESC + "); } /** @@ -43,5 +55,5 @@ function LogEntries_filter($keyword) */ function LogEntries_clear_all() { - return sql_query("TRUNCATE `LogEntries`"); + return sql_query('TRUNCATE `LogEntries`'); } diff --git a/includes/model/Message_model.php b/includes/model/Message_model.php index 57277fbe..e998ba04 100644 --- a/includes/model/Message_model.php +++ b/includes/model/Message_model.php @@ -7,7 +7,7 @@ */ function Message_ids() { - return sql_select("SELECT `id` FROM `Messages`"); + return sql_select('SELECT `id` FROM `Messages`'); } /** @@ -42,10 +42,10 @@ function Message_send($receiver_user_id, $text) global $user; $text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($text)); - $receiver_user_id = preg_replace("/([^0-9]{1,})/ui", '', strip_tags($receiver_user_id)); + $receiver_user_id = preg_replace('/([^0-9]{1,})/ui', '', strip_tags($receiver_user_id)); if ( - ($text != "" && is_numeric($receiver_user_id)) + ($text != '' && is_numeric($receiver_user_id)) && (sql_num_query(" SELECT * FROM `User` diff --git a/includes/model/NeededAngelTypes_model.php b/includes/model/NeededAngelTypes_model.php index ef4698de..f65efc41 100644 --- a/includes/model/NeededAngelTypes_model.php +++ b/includes/model/NeededAngelTypes_model.php @@ -70,7 +70,7 @@ function NeededAngelTypes_by_shift($shiftId) ORDER BY `room_id` DESC "); if ($needed_angeltypes_source === false) { - engelsystem_error("Unable to load needed angeltypes."); + engelsystem_error('Unable to load needed angeltypes.'); } // Use settings from room @@ -85,7 +85,7 @@ function NeededAngelTypes_by_shift($shiftId) ORDER BY `room_id` DESC "); if ($needed_angeltypes_source === false) { - engelsystem_error("Unable to load needed angeltypes."); + engelsystem_error('Unable to load needed angeltypes.'); } } diff --git a/includes/model/Room_model.php b/includes/model/Room_model.php index 9c202c1e..a96ca715 100644 --- a/includes/model/Room_model.php +++ b/includes/model/Room_model.php @@ -19,7 +19,7 @@ function Rooms($show_all = false) */ function Room_delete($room_id) { - return sql_query("DELETE FROM `Room` WHERE `RID`=" . sql_escape($room_id)); + return sql_query('DELETE FROM `Room` WHERE `RID`=' . sql_escape($room_id)); } /** diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php index 84cdb6d8..acdb4160 100644 --- a/includes/model/ShiftEntry_model.php +++ b/includes/model/ShiftEntry_model.php @@ -26,7 +26,7 @@ function ShiftEntry_new() */ function ShiftEntries_freeleaded_count() { - return (int)sql_select_single_cell("SELECT COUNT(*) FROM `ShiftEntry` WHERE `freeloaded` = 1"); + return (int)sql_select_single_cell('SELECT COUNT(*) FROM `ShiftEntry` WHERE `freeloaded` = 1'); } /** @@ -175,7 +175,7 @@ function ShiftEntries_by_shift_and_angeltype($shift_id, $angeltype_id) AND `TID`=" . sql_escape($angeltype_id) . " "); if ($result === false) { - engelsystem_error("Unable to load shift entries."); + engelsystem_error('Unable to load shift entries.'); } return $result; } diff --git a/includes/model/ShiftTypes_model.php b/includes/model/ShiftTypes_model.php index ba8fa2c1..03a98bd8 100644 --- a/includes/model/ShiftTypes_model.php +++ b/includes/model/ShiftTypes_model.php @@ -78,5 +78,5 @@ function ShiftType($shifttype_id) */ function ShiftTypes() { - return sql_select("SELECT * FROM `ShiftTypes` ORDER BY `name`"); + return sql_select('SELECT * FROM `ShiftTypes` ORDER BY `name`'); } diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 7c52d305..e182d905 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -8,9 +8,9 @@ use Engelsystem\ShiftSignupState; */ function Shifts_by_room($room) { - $result = sql_select("SELECT * FROM `Shifts` WHERE `RID`=" . sql_escape($room['RID']) . " ORDER BY `start`"); + $result = sql_select('SELECT * FROM `Shifts` WHERE `RID`=' . sql_escape($room['RID']) . ' ORDER BY `start`'); if ($result === false) { - engelsystem_error("Unable to load shifts."); + engelsystem_error('Unable to load shifts.'); } return $result; } @@ -49,7 +49,7 @@ function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter) ORDER BY `start`"; $result = sql_select($SQL); if ($result === false) { - engelsystem_error("Unable to load shifts by filter."); + engelsystem_error('Unable to load shifts by filter.'); } return $result; } @@ -92,7 +92,7 @@ function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter) AND NOT `Shifts`.`PSID` IS NULL"; $result = sql_select($SQL); if ($result === false) { - engelsystem_error("Unable to load needed angeltypes by filter."); + engelsystem_error('Unable to load needed angeltypes by filter.'); } return $result; } @@ -135,7 +135,7 @@ function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype) AND `AngelTypes`.`id`=" . sql_escape($angeltype['id']) . " AND NOT `Shifts`.`PSID` IS NULL"); if ($result === false) { - engelsystem_error("Unable to load needed angeltypes by filter."); + engelsystem_error('Unable to load needed angeltypes by filter.'); } if (count($result) == 0) { return null; @@ -169,7 +169,7 @@ function ShiftEntries_by_ShiftsFilter(ShiftsFilter $shiftsFilter) ORDER BY `Shifts`.`start`"; $result = sql_select($SQL); if ($result === false) { - engelsystem_error("Unable to load shift entries by filter."); + engelsystem_error('Unable to load shift entries by filter.'); } return $result; } @@ -486,18 +486,18 @@ function Shift_create($shift) */ function Shifts_by_user($user, $include_freeload_comments = false) { - $result = sql_select(" + $result = sql_select(' SELECT `ShiftTypes`.`id` AS `shifttype_id`, `ShiftTypes`.`name`, `ShiftEntry`.`id`, `ShiftEntry`.`SID`, `ShiftEntry`.`TID`, `ShiftEntry`.`UID`, `ShiftEntry`.`freeloaded`, `ShiftEntry`.`Comment`, - " . ($include_freeload_comments ? "`ShiftEntry`.`freeload_comment`, " : "") . " + ' . ($include_freeload_comments ? '`ShiftEntry`.`freeload_comment`, ' : '') . ' `Shifts`.*, `Room`.* FROM `ShiftEntry` JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`) JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`) JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`) - WHERE `UID`='" . sql_escape($user['UID']) . "' + WHERE `UID`=\'' . sql_escape($user['UID']) . '\' ORDER BY `start` - "); + '); if ($result === false) { engelsystem_error('Unable to load users shifts.'); } @@ -552,12 +552,12 @@ function Shift($shift_id) */ function Shifts() { - $shifts_source = sql_select(" + $shifts_source = sql_select(' SELECT `ShiftTypes`.`name`, `Shifts`.*, `Room`.`RID`, `Room`.`Name` AS `room_name` FROM `Shifts` JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`) JOIN `Room` ON `Room`.`RID` = `Shifts`.`RID` - "); + '); if ($shifts_source === false) { return false; } diff --git a/includes/model/UserAngelTypes_model.php b/includes/model/UserAngelTypes_model.php index 4b071847..9ae21772 100644 --- a/includes/model/UserAngelTypes_model.php +++ b/includes/model/UserAngelTypes_model.php @@ -36,7 +36,7 @@ function User_angeltypes($user) WHERE `UserAngelTypes`.`user_id`='" . sql_escape($user['UID']) . "' "); if ($result === false) { - engelsystem_error("Unable to load user angeltypes."); + engelsystem_error('Unable to load user angeltypes.'); return false; } return $result; @@ -66,7 +66,7 @@ function User_unconfirmed_AngelTypes($user) ORDER BY `AngelTypes`.`name` "); if ($result === false) { - engelsystem_error("Unable to load user angeltypes."); + engelsystem_error('Unable to load user angeltypes.'); } return $result; } @@ -109,7 +109,7 @@ function UserAngelType_update($user_angeltype_id, $supporter) LIMIT 1 "); if ($result === false) { - engelsystem_error("Unable to update supporter rights."); + engelsystem_error('Unable to update supporter rights.'); } return $result; } @@ -128,7 +128,7 @@ function UserAngelTypes_delete_all($angeltype_id) AND `confirm_user_id` IS NULL "); if ($result === false) { - engelsystem_error("Unable to delete all unconfirmed users."); + engelsystem_error('Unable to delete all unconfirmed users.'); } return $result; } @@ -149,7 +149,7 @@ function UserAngelTypes_confirm_all($angeltype_id, $confirm_user) AND `confirm_user_id` IS NULL "); if ($result === false) { - engelsystem_error("Unable to confirm all users."); + engelsystem_error('Unable to confirm all users.'); } return $result; } @@ -169,7 +169,7 @@ function UserAngelType_confirm($user_angeltype_id, $confirm_user) WHERE `id`='" . sql_escape($user_angeltype_id) . "' LIMIT 1"); if ($result === false) { - engelsystem_error("Unable to confirm user angeltype."); + engelsystem_error('Unable to confirm user angeltype.'); } return $result; } @@ -202,7 +202,7 @@ function UserAngelType_create($user, $angeltype) `user_id`='" . sql_escape($user['UID']) . "', `angeltype_id`='" . sql_escape($angeltype['id']) . "'"); if ($result === false) { - engelsystem_error("Unable to create user angeltype."); + engelsystem_error('Unable to create user angeltype.'); } return sql_id(); } @@ -221,7 +221,7 @@ function UserAngelType($user_angeltype_id) WHERE `id`='" . sql_escape($user_angeltype_id) . "' LIMIT 1"); if ($angeltype === false) { - engelsystem_error("Unable to load user angeltype."); + engelsystem_error('Unable to load user angeltype.'); } if (count($angeltype) == 0) { return null; @@ -245,7 +245,7 @@ function UserAngelType_by_User_and_AngelType($user, $angeltype) AND `angeltype_id`='" . sql_escape($angeltype['id']) . "' LIMIT 1"); if ($angeltype === false) { - engelsystem_error("Unable to load user angeltype."); + engelsystem_error('Unable to load user angeltype.'); } if (count($angeltype) == 0) { return null; diff --git a/includes/model/UserDriverLicenses_model.php b/includes/model/UserDriverLicenses_model.php index c1cd081b..8091736c 100644 --- a/includes/model/UserDriverLicenses_model.php +++ b/includes/model/UserDriverLicenses_model.php @@ -98,7 +98,7 @@ function UserDriverLicenses_update($user_driver_license) `has_license_forklift`=" . sql_bool($user_driver_license['has_license_forklift']) . " WHERE `user_id`='" . sql_escape($user_driver_license['user_id']) . "'"); if ($result === false) { - engelsystem_error("Unable to update user driver license information"); + engelsystem_error('Unable to update user driver license information'); } return $result; } @@ -113,7 +113,7 @@ function UserDriverLicenses_delete($user_id) { $result = sql_query("DELETE FROM `UserDriverLicenses` WHERE `user_id`=" . sql_escape($user_id)); if ($result === false) { - engelsystem_error("Unable to remove user driver license information"); + engelsystem_error('Unable to remove user driver license information'); } return $result; } diff --git a/includes/model/UserGroups_model.php b/includes/model/UserGroups_model.php index 8716114d..c390cd20 100644 --- a/includes/model/UserGroups_model.php +++ b/includes/model/UserGroups_model.php @@ -8,11 +8,11 @@ */ function User_groups($user) { - return sql_select(" + return sql_select(' SELECT `Groups`.* FROM `UserGroups` JOIN `Groups` ON `Groups`.`UID`=`UserGroups`.`group_id` - WHERE `UserGroups`.`uid`='" . sql_escape($user['UID']) . "' + WHERE `UserGroups`.`uid`=\'' . sql_escape($user['UID']) . '\' ORDER BY `UserGroups`.`group_id` - "); + '); } diff --git a/includes/model/User_model.php b/includes/model/User_model.php index c9987d4e..22299664 100644 --- a/includes/model/User_model.php +++ b/includes/model/User_model.php @@ -60,7 +60,7 @@ function User_update($user) */ function User_force_active_count() { - return sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `force_active` = 1"); + return sql_select_single_cell('SELECT COUNT(*) FROM `User` WHERE `force_active` = 1'); } /** @@ -68,7 +68,7 @@ function User_force_active_count() */ function User_active_count() { - return sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Aktiv` = 1"); + return sql_select_single_cell('SELECT COUNT(*) FROM `User` WHERE `Aktiv` = 1'); } /** @@ -76,7 +76,7 @@ function User_active_count() */ function User_got_voucher_count() { - return sql_select_single_cell("SELECT SUM(`got_voucher`) FROM `User`"); + return sql_select_single_cell('SELECT SUM(`got_voucher`) FROM `User`'); } /** @@ -84,7 +84,7 @@ function User_got_voucher_count() */ function User_arrived_count() { - return sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Gekommen` = 1"); + return sql_select_single_cell('SELECT COUNT(*) FROM `User` WHERE `Gekommen` = 1'); } /** @@ -92,7 +92,7 @@ function User_arrived_count() */ function User_tshirts_count() { - return sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Tshirt` = 1"); + return sql_select_single_cell('SELECT COUNT(*) FROM `User` WHERE `Tshirt` = 1'); } /** @@ -184,7 +184,7 @@ function Users_by_angeltype($angeltype) WHERE `UserAngelTypes`.`angeltype_id`='" . sql_escape($angeltype['id']) . "' ORDER BY `Nick`"); if ($result === false) { - engelsystem_error("Unable to load members."); + engelsystem_error('Unable to load members.'); } return $result; } @@ -196,7 +196,7 @@ function Users_by_angeltype($angeltype) */ function User_ids() { - return sql_select("SELECT `UID` FROM `User`"); + return sql_select('SELECT `UID` FROM `User`'); } /** @@ -207,7 +207,7 @@ function User_ids() */ function User_validate_Nick($nick) { - return preg_replace("/([^a-z0-9üöäß. _+*-]{1,})/ui", '', $nick); + return preg_replace('/([^a-z0-9üöäß. _+*-]{1,})/ui', '', $nick); } /** @@ -313,7 +313,7 @@ function User($user_id) { $user_source = sql_select("SELECT * FROM `User` WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1"); if ($user_source === false) { - engelsystem_error("Unable to load user."); + engelsystem_error('Unable to load user.'); } if (count($user_source) > 0) { return $user_source[0]; @@ -332,7 +332,7 @@ function User_by_api_key($api_key) { $user = sql_select("SELECT * FROM `User` WHERE `api_key`='" . sql_escape($api_key) . "' LIMIT 1"); if ($user === false) { - engelsystem_error("Unable to find user by api key."); + engelsystem_error('Unable to find user by api key.'); } if (count($user) == 0) { return null; @@ -350,7 +350,7 @@ function User_by_email($email) { $user = sql_select("SELECT * FROM `User` WHERE `email`='" . sql_escape($email) . "' LIMIT 1"); if ($user === false) { - engelsystem_error("Unable to load user."); + engelsystem_error('Unable to load user.'); } if (count($user) == 0) { return null; @@ -368,7 +368,7 @@ function User_by_password_recovery_token($token) { $user = sql_select("SELECT * FROM `User` WHERE `password_recovery_token`='" . sql_escape($token) . "' LIMIT 1"); if ($user === false) { - engelsystem_error("Unable to load user."); + engelsystem_error('Unable to load user.'); } if (count($user) == 0) { return null; @@ -392,7 +392,7 @@ function User_reset_api_key(&$user, $log = true) } if ($log) { - engelsystem_log(sprintf("API key resetted (%s).", User_Nick_render($user))); + engelsystem_log(sprintf('API key resetted (%s).', User_Nick_render($user))); } return true; @@ -407,11 +407,16 @@ function User_reset_api_key(&$user, $log = true) function User_generate_password_recovery_token(&$user) { $user['password_recovery_token'] = md5($user['Nick'] . time() . rand()); - $result = sql_query("UPDATE `User` SET `password_recovery_token`='" . sql_escape($user['password_recovery_token']) . "' WHERE `UID`='" . sql_escape($user['UID']) . "' LIMIT 1"); + $result = sql_query(" + UPDATE `User` + SET `password_recovery_token`='" . sql_escape($user['password_recovery_token']) . "' + WHERE `UID`='" . sql_escape($user['UID']) . "' + LIMIT 1 + "); if ($result === false) { - engelsystem_error("Unable to generate password recovery token."); + engelsystem_error('Unable to generate password recovery token.'); } - engelsystem_log("Password recovery for " . User_Nick_render($user) . " started."); + engelsystem_log('Password recovery for ' . User_Nick_render($user) . ' started.'); return $user['password_recovery_token']; } |