#56 fixed problem with editing angels rights and angels can not subscribe running oder ended shifs now

main
Philip Häusler 13 years ago
parent 2a944121f8
commit bc03069017

@ -179,8 +179,8 @@ function admin_user() {
switch ($_REQUEST['action']) {
case 'save_groups' :
if ($id != $user['UID']) {
list ($my_highest_group) = sql_select("SELECT * FROM `UserGroups` WHERE `uid`=" . sql_escape($user['UID']) . " ORDER BY `uid`");
list ($his_highest_group) = sql_select("SELECT * FROM `UserGroups` WHERE `uid`=" . sql_escape($id) . " ORDER BY `uid`");
list ($my_highest_group) = sql_select("SELECT * FROM `UserGroups` WHERE `uid`=" . sql_escape($user['UID']) . " ORDER BY `group_id`");
list ($his_highest_group) = sql_select("SELECT * FROM `UserGroups` WHERE `uid`=" . sql_escape($id) . " ORDER BY `group_id`");
if ($my_highest_group <= $his_highest_group) {
$groups = sql_select("SELECT * FROM `Groups` LEFT OUTER JOIN `UserGroups` ON (`UserGroups`.`group_id` = `Groups`.`UID` AND `UserGroups`.`uid` = " . sql_escape($id) . ") WHERE `Groups`.`UID` >= " . sql_escape($my_highest_group['group_id']) . " ORDER BY `Groups`.`Name`");

@ -164,6 +164,12 @@ function user_shifts() {
else
header("Location: " . page_link_to('user_shifts'));
// Schicht läuft schon, Eintragen für Engel nicht mehr möglich
if(!in_array('user_shifts_admin', $privileges) && time() > $shift['start']) {
error("Diese Schicht läuft gerade oder ist bereits vorbei. Bitte kontaktiere den Schichtkoordinator um Dich eintragen zu lassen.");
header("Location: " . page_link_to('user_shifts'));
}
$type = sql_select("SELECT * FROM `AngelTypes` WHERE `id`=" . sql_escape($type_id) . " LIMIT 1");
if (count($type) == 0)
header("Location: " . page_link_to('user_shifts'));
@ -333,7 +339,7 @@ function view_user_shifts() {
$entry_list[] = $entry['Nick'];
}
if ($angeltype['count'] - count($entries) > 0) {
if (!$my_shift || in_array('user_shifts_admin', $privileges)) {
if ((time() < $shift['end'] && !$my_shift) || in_array('user_shifts_admin', $privileges)) {
$entry_list[] = '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'] . '">' . ($angeltype['count'] - count($entries)) . ' Helfer' . ($angeltype['count'] - count($entries) != 1 ? '' : '') . ' gebraucht &raquo;</a>';
} else {
$entry_list[] = ($angeltype['count'] - count($entries)) . ' Helfer gebraucht';

Loading…
Cancel
Save