summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2012-12-27 21:24:44 +0100
committerPhilip Häusler <msquare@notrademark.de>2012-12-27 23:05:09 +0100
commit76efad3c5b3ce63b5fe5ca39245741c7b46e1535 (patch)
tree0351f3d0afda7b55df1493990bbb79462e7554a5
parent622b85629869cce0b051d3cbc107d9b4bdc6aa89 (diff)
fix duplicating user angel types
-rw-r--r--includes/pages/user_shifts.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index fadcc905..7eaf8140 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -235,7 +235,7 @@ function user_shifts() {
$comment = strip_request_item_nl('comment');
sql_query("INSERT INTO `ShiftEntry` SET `Comment`='" . sql_escape($comment) . "', `UID`=" . sql_escape($user_id) . ", `TID`=" . sql_escape($selected_type_id) . ", `SID`=" . sql_escape($shift_id));
- if (sql_num_query("SELECT * FROM `UserAngelTypes` INNER JOIN `AngelTypes` ON `AngelTypes`.`id` = `UserAngelTypes`.`angeltype_id` WHERE `AngelTypes`.`restricted` = 0 AND `user_id` = '" . sql_escape($user_id) . "' AND `angeltype_id` = '" . sql_escape($selected_type_id) . "'") == 0)
+ if ($type['restricted'] == 0 && sql_num_query("SELECT * FROM `UserAngelTypes` INNER JOIN `AngelTypes` ON `AngelTypes`.`id` = `UserAngelTypes`.`angeltype_id` WHERE `angeltype_id` = '" . sql_escape($selected_type_id) . "' AND `user_id` = '" . sql_escape($user_id) . "' ") == 0)
sql_query("INSERT INTO `UserAngelTypes` (`user_id`, `angeltype_id`) VALUES ('" . sql_escape($user_id) . "', '" . sql_escape($selected_type_id) . "')");
$user_source = User($user_id);
@@ -458,7 +458,7 @@ function view_user_shifts() {
$user_may_join_shift &= isset($angeltype['confirm_user_id']);
// you can only join if the shift is in future or running
- $user_may_join_shift &= time() < $shift['end'];
+ $user_may_join_shift &= time() < $shift['start'];
// User shift admins may join anybody in every shift
$user_may_join_shift |= in_array('user_shifts_admin', $privileges);
@@ -574,7 +574,7 @@ function view_user_shifts() {
$user_may_join_shift &= isset($angeltype['confirm_user_id']);
// you can only join if the shift is in future or running
- $user_may_join_shift &= time() < $shift['end'];
+ $user_may_join_shift &= time() < $shift['start'];
// User shift admins may join anybody in every shift
$user_may_join_shift |= in_array('user_shifts_admin', $privileges);