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()
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)
function LogEntries_filter($keyword)
{
{
if ($keyword == "") {
if ($keyword == '') {
return LogEntries();
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)
$html .= "Hallo,<br/>" . "hier kannst du den Eintrag ändern. Unter dem Punkt 'Gekommen' " . "wird der Engel als anwesend markiert, ein Ja bei Aktiv bedeutet, " . "dass der Engel aktiv war und damit ein Anspruch auf ein T-Shirt hat. " . "Wenn T-Shirt ein 'Ja' enthält, bedeutet dies, dass der Engel " . "bereits sein T-Shirt erhalten hat.<br/><br/>\n";
$html .= 'Hallo,<br/>'
. 'hier kannst du den Eintrag ändern. Unter dem Punkt \'Gekommen\' '
$html .= form_info('', _('Please visit the angeltypes page or the users profile to manage users angeltypes.'));
$html .= form_info('', _('Please visit the angeltypes page or the users profile to manage users angeltypes.'));
$html .= "Hier kannst Du das Passwort dieses Engels neu setzen:<formaction=\"".page_link_to("admin_user")."&action=change_pw&id=$user_id\"method=\"post\">\n";
$html .= 'Hier kannst Du das Passwort dieses Engels neu setzen:<formaction="'
$my_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($user['UID']) . "' ORDER BY `group_id` LIMIT 1");
$my_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($user['UID']) . "' ORDER BY `group_id` LIMIT 1");
if (count($my_highest_group) > 0) {
if (count($my_highest_group) > 0) {
@ -110,24 +115,36 @@ function admin_user()
}
}
if ($user_id != $user['UID'] && $my_highest_group <= $his_highest_group) {
if ($user_id != $user['UID'] && $my_highest_group <= $his_highest_group) {
$html .= "Hier kannst Du die Benutzergruppen des Engels festlegen:<formaction=\"".page_link_to("admin_user")."&action=save_groups&id=".$user_id."\"method=\"post\">\n";
$html .= 'Hier kannst Du die Benutzergruppen des Engels festlegen:<formaction="'
$groups = sql_select("SELECT * FROM `Groups` LEFT OUTER JOIN `UserGroups` ON (`UserGroups`.`group_id` = `Groups`.`UID` AND `UserGroups`.`uid` = '" . sql_escape($user_id) . "') WHERE `Groups`.`UID` >= '" . sql_escape($my_highest_group) . "' ORDER BY `Groups`.`Name`");
$groups = sql_select("
SELECT *
FROM `Groups`
LEFT OUTER JOIN `UserGroups` ON (
`UserGroups`.`group_id` = `Groups`.`UID`
AND `UserGroups`.`uid` = '" . sql_escape($user_id) . "'
)
WHERE `Groups`.`UID` >= '" . sql_escape($my_highest_group) . "'
$groups_source = sql_select("SELECT * FROM `Groups` LEFT OUTER JOIN `UserGroups` ON (`UserGroups`.`group_id` = `Groups`.`UID` AND `UserGroups`.`uid` = '" . sql_escape($user_id) . "') WHERE `Groups`.`UID` >= '" . sql_escape($my_highest_group[0]['group_id']) . "' ORDER BY `Groups`.`Name`");
$groups_source = sql_select("
SELECT *
FROM `Groups`
LEFT OUTER JOIN `UserGroups` ON (
`UserGroups`.`group_id` = `Groups`.`UID`
AND `UserGroups`.`uid` = '" . sql_escape($user_id) . "'
)
WHERE `Groups`.`UID` >= '" . sql_escape($my_highest_group[0]['group_id']) . "'
ORDER BY `Groups`.`Name`
");
$groups = [];
$groups = [];
$grouplist = [];
$grouplist = [];
foreach ($groups_source as $group) {
foreach ($groups_source as $group) {
@ -160,14 +186,15 @@ function admin_user()
}
}
}
}
$user_source = User($user_id);
$user_source = User($user_id);
engelsystem_log("Set groups of " . User_Nick_render($user_source) . " to: " . join(", ",
engelsystem_log(
$user_groups_info));
'Set groups of ' . User_Nick_render($user_source) . ' to: ' . join(', ', $user_groups_info)
$done_shifts_seconds = sql_select_single_cell("SELECT SUM(`Shifts`.`end` - `Shifts`.`start`) FROM `ShiftEntry` JOIN `Shifts` USING (`SID`) WHERE `Shifts`.`end` <UNIX_TIMESTAMP()");
$users_in_action = sql_select("SELECT `Shifts`.`start`, `Shifts`.`end` FROM `ShiftEntry` JOIN `Shifts` ON `Shifts`.`SID`=`ShiftEntry`.`SID` WHERE UNIX_TIMESTAMP() BETWEEN `Shifts`.`start` AND `Shifts`.`end`");
$users_in_action = sql_select('
SELECT `Shifts`.`start`, `Shifts`.`end`
FROM `ShiftEntry`
JOIN `Shifts` ON `Shifts`.`SID`=`ShiftEntry`.`SID`
WHERE UNIX_TIMESTAMP() BETWEEN `Shifts`.`start` AND `Shifts`.`end`
$messages = sql_select("SELECT * FROM `Messages` WHERE `SUID`='" . sql_escape($user['UID']) . "' OR `RUID`='" . sql_escape($user['UID']) . "' ORDER BY `isRead`,`Datum` DESC");
_("If you reset the key, the url to your iCal- and JSON-export and your atom feed changes! You have to update it in every application using one of these exports."),
_('If you reset the key, the url to your iCal- and JSON-export and your atom feed changes! You have to update it in every application using one of these exports.'),
error(_("Please enter your planned date of departure. It should be after your planned arrival date and after buildup start date and before teardown end date."));
error(_('Please enter your planned date of departure. It should be after your planned arrival date and after buildup start date and before teardown end date.'));
}
}
}
}
@ -81,7 +81,7 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes)
if ($valid) {
if ($valid) {
User_update($user_source);
User_update($user_source);
success(_("Settings saved."));
success(_('Settings saved.'));
redirect(page_link_to('user_settings'));
redirect(page_link_to('user_settings'));
}
}
@ -100,15 +100,15 @@ function user_settings_password($user_source)
_("Export of shown shifts. <ahref=\"%s\">iCal format</a> or <ahref=\"%s\">JSON format</a> available (please keep secret, otherwise <ahref=\"%s\">reset the api key</a>)."),
_('Export of shown shifts. <ahref="%s">iCal format</a> or <ahref="%s">JSON format</a> available (please keep secret, otherwise <ahref="%s">reset the api key</a>).'),