@ -42,12 +42,12 @@ function alert($class, $msg, $immediatly = false) {
return "";
}
return '<div class="alert alert-' . $class . '">' . $msg . '</div>';
} else {
if (! isset($_SESSION['msg'])) {
$_SESSION['msg'] = "";
$_SESSION['msg'] .= alert($class, $msg, true);
?>
@ -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");
@ -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;
return false;
@ -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']);
$filter = "";
$log_entries_source = LogEntries();
if (isset($_REQUEST['keyword'])) {
$filter = strip_request_item('keyword');
$log_entries = [];
foreach ($log_entries_source as $log_entry) {
@ -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;");
unset($_SESSION['uid']);
$privileges = privileges_for_user($user['UID']);
return;
$privileges = isset($user) ? privileges_for_user($user['UID']) : privileges_for_group(- 1);
// guest privileges
$privileges = privileges_for_group(- 1);
/**
@ -10,10 +10,9 @@
function engelsystem_log($message) {
global $user;
$nick = "Guest";
if (isset($user)) {
$nick = User_Nick_render($user);
LogEntry_create($nick, $message);
@ -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)
];
return page_with_title(_("Edit shift entry"), [
msg(),
@ -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);