| @@ -64,21 +64,21 @@ discard block | ||
| 64 | 64 | case 'accept': | 
| 65 | 65 |      if (canAcceptSwap($swapId) || $verify == verificationCodeForSwap($swapId)) { | 
| 66 | 66 |          switch (acceptSwap($swapId)) { | 
| 67 | - case '1': | |
| 68 | - $message = 'Swap Successful'; | |
| 69 | - break; | |
| 70 | - case '2': | |
| 71 | - $message = 'Swap already accepted.'; | |
| 72 | - break; | |
| 73 | - case '3': | |
| 74 | - $message = 'Swap already declined.'; | |
| 75 | - break; | |
| 76 | - case '4': | |
| 77 | - $message = 'Swap already reverted.'; | |
| 78 | - break; | |
| 79 | - default: | |
| 80 | - $err = 'Technical issue - please inform system administrator'; | |
| 81 | - break; | |
| 67 | + case '1': | |
| 68 | + $message = 'Swap Successful'; | |
| 69 | + break; | |
| 70 | + case '2': | |
| 71 | + $message = 'Swap already accepted.'; | |
| 72 | + break; | |
| 73 | + case '3': | |
| 74 | + $message = 'Swap already declined.'; | |
| 75 | + break; | |
| 76 | + case '4': | |
| 77 | + $message = 'Swap already reverted.'; | |
| 78 | + break; | |
| 79 | + default: | |
| 80 | + $err = 'Technical issue - please inform system administrator'; | |
| 81 | + break; | |
| 82 | 82 | } | 
| 83 | 83 |      } else { | 
| 84 | 84 | $err = 'Swap Already Actioned or Verification Code Invalid'; | 
| @@ -87,15 +87,15 @@ discard block | ||
| 87 | 87 | case 'decline': | 
| 88 | 88 |      if (canDeclineSwap($swapId) || $verify == verificationCodeForSwap($swapId)) { | 
| 89 | 89 |          switch (declineSwap($swapId)) { | 
| 90 | - case '1': | |
| 91 | - $message = 'Swap declined'; | |
| 92 | - break; | |
| 93 | - case '2': | |
| 94 | - $message = 'Swap already declined.'; | |
| 95 | - break; | |
| 96 | - default: | |
| 97 | - $err = 'Technical issue - please inform system administrator'; | |
| 98 | - break; | |
| 90 | + case '1': | |
| 91 | + $message = 'Swap declined'; | |
| 92 | + break; | |
| 93 | + case '2': | |
| 94 | + $message = 'Swap already declined.'; | |
| 95 | + break; | |
| 96 | + default: | |
| 97 | + $err = 'Technical issue - please inform system administrator'; | |
| 98 | + break; | |
| 99 | 99 | } | 
| 100 | 100 |      } else { | 
| 101 | 101 | $err = 'Swap Already Actioned or Verification Code Invalid'; | 
| @@ -28,25 +28,25 @@ | ||
| 28 | 28 | $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT); | 
| 29 | 29 | |
| 30 | 30 |      switch ($_POST['action']) { | 
| 31 | - case 'approve': | |
| 32 | - $userId = approvePendingUser($id); | |
| 33 | - mailNewUser($userId); | |
| 34 | -      header('Location: addUser.php?action=edit&user='.$userId); | |
| 35 | - break; | |
| 36 | - case 'merge': | |
| 37 | - $existingUserId = $_POST['existingUser']; | |
| 38 | - $existingUserId = filter_var($existingUserId, FILTER_SANITIZE_NUMBER_INT); | |
| 39 | - mergePendingUserWithUserId($id, $existingUserId); | |
| 40 | - mailNewUser($existingUserId); | |
| 41 | -      header('Location: addUser.php?action=edit&user='.$existingUserId); | |
| 42 | - break; | |
| 43 | - case 'decline': | |
| 44 | - declinePendingUser($id); | |
| 45 | - break; | |
| 46 | - | |
| 47 | - default: | |
| 48 | - // code... | |
| 49 | - break; | |
| 31 | + case 'approve': | |
| 32 | + $userId = approvePendingUser($id); | |
| 33 | + mailNewUser($userId); | |
| 34 | +          header('Location: addUser.php?action=edit&user='.$userId); | |
| 35 | + break; | |
| 36 | + case 'merge': | |
| 37 | + $existingUserId = $_POST['existingUser']; | |
| 38 | + $existingUserId = filter_var($existingUserId, FILTER_SANITIZE_NUMBER_INT); | |
| 39 | + mergePendingUserWithUserId($id, $existingUserId); | |
| 40 | + mailNewUser($existingUserId); | |
| 41 | +          header('Location: addUser.php?action=edit&user='.$existingUserId); | |
| 42 | + break; | |
| 43 | + case 'decline': | |
| 44 | + declinePendingUser($id); | |
| 45 | + break; | |
| 46 | + | |
| 47 | + default: | |
| 48 | + // code... | |
| 49 | + break; | |
| 50 | 50 | } | 
| 51 | 51 | } | 
| 52 | 52 | |
| @@ -21,36 +21,36 @@ | ||
| 21 | 21 | $method = $_POST['method']; | 
| 22 | 22 | |
| 23 | 23 |      switch ($method) { | 
| 24 | - case 'revoke': | |
| 25 | - $id = $_POST['id']; | |
| 26 | - $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT); | |
| 24 | + case 'revoke': | |
| 25 | + $id = $_POST['id']; | |
| 26 | + $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT); | |
| 27 | 27 | |
| 28 | - revokeCalendarToken($id); | |
| 29 | -      header('Location: calendarTokens.php'); | |
| 30 | - break; | |
| 31 | - | |
| 32 | - default: | |
| 33 | - // generate new URL | |
| 34 | - $format = $_POST['format']; | |
| 35 | - $description = $_POST['description']; | |
| 36 | - | |
| 37 | -      if (empty($format)) { | |
| 38 | - $error = 'Format must be set'; | |
| 39 | - break; | |
| 40 | - } | |
| 41 | -      if (empty($description)) { | |
| 42 | - $error = 'Device or software name cannot be empty'; | |
| 28 | + revokeCalendarToken($id); | |
| 29 | +          header('Location: calendarTokens.php'); | |
| 43 | 30 | break; | 
| 44 | - } | |
| 45 | - $count = CalendarTokenQuery::create()->filterByUserId($sessionUserId)->filterByDescription($description)->filterByRevoked(false)->count(); | |
| 46 | -      if ($count > 0) { | |
| 47 | - $error = 'You already have a calendar for the same device or software name. Please revoke the existing token or use a different name.'; | |
| 48 | - break; | |
| 49 | - } | |
| 50 | 31 | |
| 51 | - $token = createCalendarToken($sessionUserId, $format, $description); | |
| 52 | - $url = siteSettings()->getSiteUrl()."/calendar.php?user=$sessionUserId&format=$format&token=$token"; | |
| 53 | - break; | |
| 32 | + default: | |
| 33 | + // generate new URL | |
| 34 | + $format = $_POST['format']; | |
| 35 | + $description = $_POST['description']; | |
| 36 | + | |
| 37 | +          if (empty($format)) { | |
| 38 | + $error = 'Format must be set'; | |
| 39 | + break; | |
| 40 | + } | |
| 41 | +          if (empty($description)) { | |
| 42 | + $error = 'Device or software name cannot be empty'; | |
| 43 | + break; | |
| 44 | + } | |
| 45 | + $count = CalendarTokenQuery::create()->filterByUserId($sessionUserId)->filterByDescription($description)->filterByRevoked(false)->count(); | |
| 46 | +          if ($count > 0) { | |
| 47 | + $error = 'You already have a calendar for the same device or software name. Please revoke the existing token or use a different name.'; | |
| 48 | + break; | |
| 49 | + } | |
| 50 | + | |
| 51 | + $token = createCalendarToken($sessionUserId, $format, $description); | |
| 52 | + $url = siteSettings()->getSiteUrl()."/calendar.php?user=$sessionUserId&format=$format&token=$token"; | |
| 53 | + break; | |
| 54 | 54 | } | 
| 55 | 55 | } | 
| 56 | 56 | |
| @@ -37,22 +37,22 @@ | ||
| 37 | 37 | $platform = strtolower($_POST['platform']); | 
| 38 | 38 | |
| 39 | 39 |      switch ($_POST['action']) { | 
| 40 | - case 'link': | |
| 41 | -      switch ($platform) { | |
| 40 | + case 'link': | |
| 41 | +          switch ($platform) { | |
| 42 | 42 | case 'facebook': | 
| 43 | 43 | $_SESSION['fb-callback-url'] = 'fb-link.php'; | 
| 44 | 44 |            header('Location: fb-login.php'); | 
| 45 | 45 | exit; | 
| 46 | - } | |
| 47 | - break; | |
| 48 | - case 'unlink': | |
| 49 | - removeSocialAuthFromUserWithId($id, $platform); | |
| 50 | - createNotificationForUser($id, ucfirst($platform).' account unlinked', 'You have successfully unlinked your Facebook account. Login via Facebook is now disabled for your account. Feel free to relink your account at any time.', 'account', 'linkSocialAuth.php'); | |
| 51 | - break; | |
| 52 | - | |
| 53 | - default: | |
| 54 | - // code... | |
| 46 | + } | |
| 55 | 47 | break; | 
| 48 | + case 'unlink': | |
| 49 | + removeSocialAuthFromUserWithId($id, $platform); | |
| 50 | + createNotificationForUser($id, ucfirst($platform).' account unlinked', 'You have successfully unlinked your Facebook account. Login via Facebook is now disabled for your account. Feel free to relink your account at any time.', 'account', 'linkSocialAuth.php'); | |
| 51 | + break; | |
| 52 | + | |
| 53 | + default: | |
| 54 | + // code... | |
| 55 | + break; | |
| 56 | 56 | } | 
| 57 | 57 | } | 
| 58 | 58 | |