From 2b159506cadabe55778c7ac9d855b797cd72b466 Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Tue, 9 Jan 2024 00:42:52 -0500 Subject: [PATCH 1/4] redirect directly to v2/dashboard instead of Menu.php --- src/BackupDatabase.php | 2 +- src/BatchWinnerEntry.php | 2 +- src/CSVImport.php | 2 +- src/CanvassAutomation.php | 2 +- src/CanvassEditor.php | 4 ++-- src/CartToEvent.php | 2 +- src/CartToFamily.php | 2 +- src/CartToGroup.php | 2 +- .../Authentication/AuthenticationManager.php | 2 +- src/ChurchCRM/Config/Menu/Menu.php | 2 +- src/ChurchCRM/utils/RedirectUtils.php | 2 +- src/ConvertIndividualToFamily.php | 2 +- src/DepositSlipEditor.php | 4 ++-- src/DirectoryReports.php | 4 ++-- src/DonatedItemEditor.php | 2 +- src/DonationFundEditor.php | 2 +- src/EditEventTypes.php | 4 +++- src/EventEditor.php | 4 +++- src/EventNames.php | 3 ++- src/FamilyCustomFieldsEditor.php | 2 +- src/FamilyCustomFieldsRowOps.php | 2 +- src/FamilyEditor.php | 6 +++--- src/FinancialReports.php | 4 ++-- src/FundRaiserEditor.php | 2 +- src/GroupEditor.php | 2 +- src/GroupPropsEditor.php | 2 +- src/GroupPropsFormEditor.php | 2 +- src/GroupPropsFormRowOps.php | 2 +- src/GroupReports.php | 2 +- src/Include/Header.php | 2 +- src/LettersAndLabels.php | 2 +- src/ManageEnvelopes.php | 2 +- src/MemberRoleChange.php | 2 +- src/NoteDelete.php | 2 +- src/NoteEditor.php | 2 +- src/OptionManager.php | 20 +++++++++---------- src/OptionManagerRowOps.php | 12 +++++------ src/PaddleNumEditor.php | 2 +- src/PersonCustomFieldsEditor.php | 2 +- src/PersonCustomFieldsRowOps.php | 2 +- src/PersonEditor.php | 6 +++--- src/PledgeDelete.php | 2 +- src/PledgeDetails.php | 2 +- src/PledgeEditor.php | 4 ++-- src/PropertyAssign.php | 4 ++-- src/PropertyDelete.php | 2 +- src/PropertyEditor.php | 4 ++-- src/PropertyList.php | 2 +- src/PropertyTypeDelete.php | 2 +- src/PropertyTypeEditor.php | 2 +- src/PropertyUnassign.php | 4 ++-- src/QuerySQL.php | 2 +- src/QueryView.php | 2 +- src/ReminderReport.php | 4 ++-- src/Reports/AdvancedDeposit.php | 4 ++-- src/Reports/DirectoryReport.php | 2 +- src/Reports/EnvelopeReport.php | 2 +- src/Reports/FamilyPledgeSummary.php | 4 ++-- src/Reports/PledgeSummary.php | 4 ++-- src/Reports/PrintDeposit.php | 4 ++-- src/Reports/ReminderReport.php | 4 ++-- src/Reports/TaxReport.php | 4 ++-- src/Reports/ZeroGivers.php | 4 ++-- src/RestoreDatabase.php | 2 +- src/SelectDelete.php | 2 +- src/SettingsUser.php | 4 ++-- src/SystemDBUpdate.php | 4 ++-- src/SystemSettings.php | 2 +- src/TaxReport.php | 4 ++-- src/UserEditor.php | 2 +- src/VolunteerOpportunityEditor.php | 8 ++++---- src/eGive.php | 2 +- src/index.php | 4 ++-- src/sundayschool/SundaySchoolReports.php | 2 +- 74 files changed, 120 insertions(+), 115 deletions(-) diff --git a/src/BackupDatabase.php b/src/BackupDatabase.php index d2fc95fea3..056a6a928a 100644 --- a/src/BackupDatabase.php +++ b/src/BackupDatabase.php @@ -22,7 +22,7 @@ // Security: User must be an Admin to access this page. // Otherwise, re-direct them to the main menu. if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/BatchWinnerEntry.php b/src/BatchWinnerEntry.php index 6a0fdda247..3c14d34ec0 100644 --- a/src/BatchWinnerEntry.php +++ b/src/BatchWinnerEntry.php @@ -118,7 +118,7 @@ diff --git a/src/CSVImport.php b/src/CSVImport.php index a10dfd1b77..bee31af583 100644 --- a/src/CSVImport.php +++ b/src/CSVImport.php @@ -27,7 +27,7 @@ use ChurchCRM\Utils\RedirectUtils; if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/CanvassAutomation.php b/src/CanvassAutomation.php index f2c291dc5e..14ae1b5d6b 100644 --- a/src/CanvassAutomation.php +++ b/src/CanvassAutomation.php @@ -24,7 +24,7 @@ // Security: User must have canvasser permission to use this form if (!AuthenticationManager::getCurrentUser()->isCanvasserEnabled()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/CanvassEditor.php b/src/CanvassEditor.php index ebf0b3f35b..b0e93602c1 100644 --- a/src/CanvassEditor.php +++ b/src/CanvassEditor.php @@ -20,7 +20,7 @@ // Security: User must have canvasser permission to use this form if (!AuthenticationManager::getCurrentUser()->isCanvasserEnabled()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } @@ -244,7 +244,7 @@ diff --git a/src/CartToEvent.php b/src/CartToEvent.php index 2d0cbeb2db..39b036fcfa 100644 --- a/src/CartToEvent.php +++ b/src/CartToEvent.php @@ -26,7 +26,7 @@ // Security: User must have Manage Groups & Roles permission if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/CartToFamily.php b/src/CartToFamily.php index bb98930a60..f3f9374edd 100644 --- a/src/CartToFamily.php +++ b/src/CartToFamily.php @@ -22,7 +22,7 @@ // Security: User must have add records permission if (!AuthenticationManager::getCurrentUser()->isAddRecordsEnabled()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/CartToGroup.php b/src/CartToGroup.php index 957a7fe39a..cc4134772a 100644 --- a/src/CartToGroup.php +++ b/src/CartToGroup.php @@ -23,7 +23,7 @@ // Security: User must have Manage Groups & Roles permission if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/ChurchCRM/Authentication/AuthenticationManager.php b/src/ChurchCRM/Authentication/AuthenticationManager.php index dca6d86b2c..9ef952575a 100644 --- a/src/ChurchCRM/Authentication/AuthenticationManager.php +++ b/src/ChurchCRM/Authentication/AuthenticationManager.php @@ -127,7 +127,7 @@ public static function authenticate(AuthenticationRequest $AuthenticationRequest } if ($result->isAuthenticated && !$result->preventRedirect) { - $redirectLocation = array_key_exists('location', $_SESSION) ? $_SESSION['location'] : 'Menu.php'; + $redirectLocation = $_SESSION['location'] ?? 'v2/dashboard'; NotificationService::updateNotifications(); $logger->debug( 'Authentication Successful; redirecting to: ' . $redirectLocation diff --git a/src/ChurchCRM/Config/Menu/Menu.php b/src/ChurchCRM/Config/Menu/Menu.php index 99ef4a5200..d08c2d2760 100644 --- a/src/ChurchCRM/Config/Menu/Menu.php +++ b/src/ChurchCRM/Config/Menu/Menu.php @@ -32,7 +32,7 @@ public static function getMenu(): ?array private static function buildMenuItems(): array { return [ - 'Dashboard' => new MenuItem(gettext('Dashboard'), 'Menu.php', true, 'fa-tachometer-alt'), + 'Dashboard' => new MenuItem(gettext('Dashboard'), 'v2/dashboard', true, 'fa-tachometer-alt'), 'Calendar' => self::getCalendarMenu(), 'People' => self::getPeopleMenu(), 'Groups' => self::getGroupMenu(), diff --git a/src/ChurchCRM/utils/RedirectUtils.php b/src/ChurchCRM/utils/RedirectUtils.php index ce1752be17..8172de532e 100644 --- a/src/ChurchCRM/utils/RedirectUtils.php +++ b/src/ChurchCRM/utils/RedirectUtils.php @@ -36,6 +36,6 @@ public static function absoluteRedirect(string $sTargetURL): void public static function securityRedirect(string $missingRole): void { LoggerUtils::getAppLogger()->info('Security Redirect Request due to Role: ' . $missingRole); - self::Redirect('Menu.php'); + self::Redirect('v2/dashboard'); } } diff --git a/src/ConvertIndividualToFamily.php b/src/ConvertIndividualToFamily.php index 93d20ab7ac..071546d715 100644 --- a/src/ConvertIndividualToFamily.php +++ b/src/ConvertIndividualToFamily.php @@ -30,7 +30,7 @@ // Security if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/DepositSlipEditor.php b/src/DepositSlipEditor.php index 668c07c636..124eaf2acd 100644 --- a/src/DepositSlipEditor.php +++ b/src/DepositSlipEditor.php @@ -41,14 +41,14 @@ // Security: User must have finance permission or be the one who created this deposit if (!(AuthenticationManager::getCurrentUser()->isFinanceEnabled() || AuthenticationManager::getCurrentUser()->getId() == $thisDeposit->getEnteredby())) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } } elseif ($iDepositSlipID == 0) { RedirectUtils::redirect('FindDepositSlip.php'); exit; } else { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); } //Set the page title diff --git a/src/DirectoryReports.php b/src/DirectoryReports.php index dc14ab42ac..fa20a8c135 100644 --- a/src/DirectoryReports.php +++ b/src/DirectoryReports.php @@ -22,7 +22,7 @@ // Check for Create Directory user permission. if (!AuthenticationManager::getCurrentUser()->isCreateDirectoryEnabled()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } @@ -285,7 +285,7 @@


- onclick="javascript:document.location='Menu.php';"> + onclick="javascript:document.location='v2/dashboard';">

diff --git a/src/DonatedItemEditor.php b/src/DonatedItemEditor.php index 6635b08d22..da4f6ed5be 100644 --- a/src/DonatedItemEditor.php +++ b/src/DonatedItemEditor.php @@ -312,7 +312,7 @@ + onclick="javascript:document.location = ' 0 ? $linkBack : 'v2/dashboard'; ?>';"> diff --git a/src/DonationFundEditor.php b/src/DonationFundEditor.php index 7cb3100a7f..8e4ff14d69 100644 --- a/src/DonationFundEditor.php +++ b/src/DonationFundEditor.php @@ -23,7 +23,7 @@ // Security: user must be administrator to use this page if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/EditEventTypes.php b/src/EditEventTypes.php index 97116a0d4d..3aea28d4af 100644 --- a/src/EditEventTypes.php +++ b/src/EditEventTypes.php @@ -21,9 +21,11 @@ use ChurchCRM\Authentication\AuthenticationManager; use ChurchCRM\Utils\InputUtils; +use ChurchCRM\Utils\RedirectUtils; if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - header('Location: Menu.php'); + RedirectUtils::redirect('v2/dashboard'); + exit; } $sPageTitle = gettext('Edit Event Types'); require 'Include/Header.php'; diff --git a/src/EventEditor.php b/src/EventEditor.php index d16eddff08..26d5d20caf 100644 --- a/src/EventEditor.php +++ b/src/EventEditor.php @@ -28,11 +28,13 @@ use ChurchCRM\Authentication\AuthenticationManager; use ChurchCRM\dto\SystemURLs; use ChurchCRM\Utils\InputUtils; +use ChurchCRM\Utils\RedirectUtils; $sPageTitle = gettext('Church Event Editor'); if (!AuthenticationManager::getCurrentUser()->isAddEvent()) { - header('Location: Menu.php'); + RedirectUtils::redirect('v2/dashboard'); + exit; } $sAction = 'Create Event'; diff --git a/src/EventNames.php b/src/EventNames.php index 712a46e427..c8603d5440 100644 --- a/src/EventNames.php +++ b/src/EventNames.php @@ -25,7 +25,8 @@ use ChurchCRM\Utils\RedirectUtils; if (!AuthenticationManager::getCurrentUser()->isAddEvent()) { - header('Location: Menu.php'); + RedirectUtils::redirect('v2/dashboard'); + exit; } $sPageTitle = gettext('Edit Event Types'); diff --git a/src/FamilyCustomFieldsEditor.php b/src/FamilyCustomFieldsEditor.php index 205df418c1..b4f1b5d5b1 100644 --- a/src/FamilyCustomFieldsEditor.php +++ b/src/FamilyCustomFieldsEditor.php @@ -26,7 +26,7 @@ // Security: user must be administrator to use this page if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/FamilyCustomFieldsRowOps.php b/src/FamilyCustomFieldsRowOps.php index 90d1a7f878..da856fd8b6 100644 --- a/src/FamilyCustomFieldsRowOps.php +++ b/src/FamilyCustomFieldsRowOps.php @@ -20,7 +20,7 @@ // Security: user must be administrator to use this page. if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/FamilyEditor.php b/src/FamilyEditor.php index ceb2847b79..2b9519328a 100644 --- a/src/FamilyEditor.php +++ b/src/FamilyEditor.php @@ -38,17 +38,17 @@ // Clean error handling: (such as somebody typing an incorrect URL ?PersonID= manually) if ($iFamilyID > 0) { if (!(AuthenticationManager::getCurrentUser()->isEditRecordsEnabled() || (AuthenticationManager::getCurrentUser()->isEditSelfEnabled() && $iFamilyID == AuthenticationManager::getCurrentUser()->getPerson()->getFamId()))) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } $sSQL = 'SELECT fam_ID FROM family_fam WHERE fam_ID = ' . $iFamilyID; if (mysqli_num_rows(RunQuery($sSQL)) == 0) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } } elseif (!AuthenticationManager::getCurrentUser()->isAddRecordsEnabled()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/FinancialReports.php b/src/FinancialReports.php index 42f658d5f3..7c23213a49 100644 --- a/src/FinancialReports.php +++ b/src/FinancialReports.php @@ -19,7 +19,7 @@ // Security if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } @@ -69,7 +69,7 @@ // First Pass Cancel, Next Buttons echo "  + onclick=\"javascript:document.location='v2/dashboard';\"> "; diff --git a/src/FundRaiserEditor.php b/src/FundRaiserEditor.php index c40bbc5016..26df7ef8a0 100644 --- a/src/FundRaiserEditor.php +++ b/src/FundRaiserEditor.php @@ -152,7 +152,7 @@ 0) { diff --git a/src/GroupEditor.php b/src/GroupEditor.php index dadd1017e3..e995c2f0b1 100644 --- a/src/GroupEditor.php +++ b/src/GroupEditor.php @@ -24,7 +24,7 @@ // Security: User must have Manage Groups permission if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/GroupPropsEditor.php b/src/GroupPropsEditor.php index 6131ac6542..dac4677e8b 100644 --- a/src/GroupPropsEditor.php +++ b/src/GroupPropsEditor.php @@ -21,7 +21,7 @@ // Security: user must be allowed to edit records to use this page. if (!AuthenticationManager::getCurrentUser()->isEditRecordsEnabled()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/GroupPropsFormEditor.php b/src/GroupPropsFormEditor.php index 06490fc7d8..63f6070dba 100644 --- a/src/GroupPropsFormEditor.php +++ b/src/GroupPropsFormEditor.php @@ -26,7 +26,7 @@ // Security: user must be allowed to edit records to use this page. if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/GroupPropsFormRowOps.php b/src/GroupPropsFormRowOps.php index 940f61b666..ca4226da72 100644 --- a/src/GroupPropsFormRowOps.php +++ b/src/GroupPropsFormRowOps.php @@ -19,7 +19,7 @@ // Security: user must be allowed to edit records to use this page. if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()) { - RedirectUtils::redirect('Menu.php'); + RedirectUtils::redirect('v2/dashboard'); exit; } diff --git a/src/GroupReports.php b/src/GroupReports.php index fd74e7a22a..7b75f3be49 100644 --- a/src/GroupReports.php +++ b/src/GroupReports.php @@ -148,7 +148,7 @@


- +

diff --git a/src/Include/Header.php b/src/Include/Header.php index 000788645f..b6e408b018 100644 --- a/src/Include/Header.php +++ b/src/Include/Header.php @@ -179,7 +179,7 @@