diff --git a/includes/helper/message_helper.php b/includes/helper/message_helper.php
index a0cc6eb7..37fc84bb 100644
--- a/includes/helper/message_helper.php
+++ b/includes/helper/message_helper.php
@@ -42,12 +42,12 @@ function alert($class, $msg, $immediatly = false) {
return "";
}
return '
' . $msg . '
';
- } else {
- if (! isset($_SESSION['msg'])) {
- $_SESSION['msg'] = "";
- }
- $_SESSION['msg'] .= alert($class, $msg, true);
}
+
+ if (! isset($_SESSION['msg'])) {
+ $_SESSION['msg'] = "";
+ }
+ $_SESSION['msg'] .= alert($class, $msg, true);
}
?>
\ No newline at end of file
diff --git a/includes/model/LogEntries_model.php b/includes/model/LogEntries_model.php
index 8b7f65a0..09bd03dc 100644
--- a/includes/model/LogEntries_model.php
+++ b/includes/model/LogEntries_model.php
@@ -22,6 +22,9 @@ function LogEntries() {
* Returns log entries filtered by a keyword
*/
function LogEntries_filter($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");
}
diff --git a/includes/model/Message_model.php b/includes/model/Message_model.php
index 0195fbea..652b60ea 100644
--- a/includes/model/Message_model.php
+++ b/includes/model/Message_model.php
@@ -43,9 +43,9 @@ function Message_send($receiver_user_id, $text) {
if (($text != "" && is_numeric($receiver_user_id)) && (sql_num_query("SELECT * FROM `User` WHERE `UID`='" . sql_escape($receiver_user_id) . "' AND NOT `UID`='" . sql_escape($user['UID']) . "' LIMIT 1") > 0)) {
sql_query("INSERT INTO `Messages` SET `Datum`='" . sql_escape(time()) . "', `SUID`='" . sql_escape($user['UID']) . "', `RUID`='" . sql_escape($receiver_user_id) . "', `Text`='" . sql_escape($text) . "'");
return true;
- } else {
- return false;
}
+
+ return false;
}
?>
\ No newline at end of file
diff --git a/includes/pages/admin_log.php b/includes/pages/admin_log.php
index 356a6402..d45a232b 100644
--- a/includes/pages/admin_log.php
+++ b/includes/pages/admin_log.php
@@ -5,13 +5,11 @@ function admin_log_title() {
}
function admin_log() {
- if (isset($_POST['keyword'])) {
- $filter = $_POST['keyword'];
- $log_entries_source = LogEntries_filter($_POST['keyword']);
- } else {
- $filter = "";
- $log_entries_source = LogEntries();
+ $filter = "";
+ if (isset($_REQUEST['keyword'])) {
+ $filter = strip_request_item('keyword');
}
+ $log_entries_source = LogEntries_filter($_POST['keyword']);
$log_entries = [];
foreach ($log_entries_source as $log_entry) {
diff --git a/includes/sys_auth.php b/includes/sys_auth.php
index 39f4d4b0..27a74ae8 100644
--- a/includes/sys_auth.php
+++ b/includes/sys_auth.php
@@ -13,12 +13,14 @@ function load_auth() {
// User ist eingeloggt, Datensatz zur Verfügung stellen und Timestamp updaten
list($user) = $user;
sql_query("UPDATE `User` SET " . "`lastLogIn` = '" . time() . "'" . " WHERE `UID` = '" . sql_escape($_SESSION['uid']) . "' LIMIT 1;");
- } else {
- unset($_SESSION['uid']);
+ $privileges = privileges_for_user($user['UID']);
+ return;
}
+ unset($_SESSION['uid']);
}
- $privileges = isset($user) ? privileges_for_user($user['UID']) : privileges_for_group(- 1);
+ // guest privileges
+ $privileges = privileges_for_group(- 1);
}
/**
diff --git a/includes/sys_log.php b/includes/sys_log.php
index b37f0d82..66c323c1 100644
--- a/includes/sys_log.php
+++ b/includes/sys_log.php
@@ -10,10 +10,9 @@
function engelsystem_log($message) {
global $user;
+ $nick = "Guest";
if (isset($user)) {
$nick = User_Nick_render($user);
- } else {
- $nick = "Guest";
}
LogEntry_create($nick, $message);
}
diff --git a/includes/view/ShiftEntry_view.php b/includes/view/ShiftEntry_view.php
index fab5be66..5bf10a91 100644
--- a/includes/view/ShiftEntry_view.php
+++ b/includes/view/ShiftEntry_view.php
@@ -12,13 +12,12 @@
* @return string
*/
function ShiftEntry_edit_view($angel, $date, $location, $title, $type, $comment, $freeloaded, $freeload_comment, $user_admin_shifts = false) {
+ $freeload_form = [];
if ($user_admin_shifts) {
$freeload_form = [
form_checkbox('freeloaded', _("Freeloaded"), $freeloaded),
form_textarea('freeload_comment', _("Freeload comment (Only for shift coordination):"), $freeload_comment)
];
- } else {
- $freeload_form = [];
}
return page_with_title(_("Edit shift entry"), [
msg(),
diff --git a/test/model/Room_model_test.php b/test/model/Room_model_test.php
index d95c5787..a36a9d9f 100644
--- a/test/model/Room_model_test.php
+++ b/test/model/Room_model_test.php
@@ -24,8 +24,9 @@ class Room_model_test extends PHPUnit_Framework_TestCase {
* @after
*/
public function teardown() {
- if ($this->room_id != null)
+ if ($this->room_id != null) {
Room_delete($this->room_id);
+ }
}
}