diff --git a/docker/cypress.config.ts b/docker/cypress.config.ts index e86ac121b5..1fefa77058 100644 --- a/docker/cypress.config.ts +++ b/docker/cypress.config.ts @@ -14,6 +14,7 @@ export default defineConfig({ 'admin.api.key': 'ajGwpy8Pdai22XDUpqjC5Ob04v0eG7EGgb4vz2bD2juT8YDmfM', 'user.api.key': 'JZJApQ9XOnF7nvupWZlTWBRrqMtHE9eNcWBTUzEWGqL4Sdqp6C', }, + retries: 2, e2e: { // We've imported your old cypress plugins here. // You may want to clean this up later by importing these. diff --git a/src/BackupDatabase.php b/src/BackupDatabase.php index d2fc95fea3..822cb35bb8 100644 --- a/src/BackupDatabase.php +++ b/src/BackupDatabase.php @@ -21,10 +21,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'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin()); // Set the page title and include HTML header 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..f8a42cbe40 100644 --- a/src/CSVImport.php +++ b/src/CSVImport.php @@ -26,10 +26,7 @@ use ChurchCRM\Utils\InputUtils; use ChurchCRM\Utils\RedirectUtils; -if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin()); /** * A monogamous society is assumed, however it can be patriarchal or matriarchal diff --git a/src/CanvassAutomation.php b/src/CanvassAutomation.php index f2c291dc5e..4538c23907 100644 --- a/src/CanvassAutomation.php +++ b/src/CanvassAutomation.php @@ -23,10 +23,7 @@ $sPageTitle = gettext('Canvass Automation'); // Security: User must have canvasser permission to use this form -if (!AuthenticationManager::getCurrentUser()->isCanvasserEnabled()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isCanvasserEnabled()); $iFYID = CurrentFY(); if (array_key_exists('idefaultFY', $_SESSION)) { diff --git a/src/CanvassEditor.php b/src/CanvassEditor.php index ebf0b3f35b..645049974a 100644 --- a/src/CanvassEditor.php +++ b/src/CanvassEditor.php @@ -19,10 +19,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security: User must have canvasser permission to use this form -if (!AuthenticationManager::getCurrentUser()->isCanvasserEnabled()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isCanvasserEnabled()); require 'Include/CanvassUtilities.php'; @@ -244,7 +241,7 @@ diff --git a/src/CartToEvent.php b/src/CartToEvent.php index 2d0cbeb2db..9ad35ab951 100644 --- a/src/CartToEvent.php +++ b/src/CartToEvent.php @@ -25,10 +25,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security: User must have Manage Groups & Roles permission -if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()); // Was the form submitted? if (isset($_POST['Submit']) && count($_SESSION['aPeopleCart']) > 0 && isset($_POST['EventID'])) { diff --git a/src/CartToFamily.php b/src/CartToFamily.php index bb98930a60..b663412bc0 100644 --- a/src/CartToFamily.php +++ b/src/CartToFamily.php @@ -21,10 +21,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security: User must have add records permission -if (!AuthenticationManager::getCurrentUser()->isAddRecordsEnabled()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAddRecordsEnabled()); // Was the form submitted? if (isset($_POST['Submit']) && count($_SESSION['aPeopleCart']) > 0) { diff --git a/src/CartToGroup.php b/src/CartToGroup.php index 957a7fe39a..f685926fd9 100644 --- a/src/CartToGroup.php +++ b/src/CartToGroup.php @@ -22,10 +22,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security: User must have Manage Groups & Roles permission -if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()); // Was the form submitted? if ((isset($_GET['groupeCreationID']) || isset($_POST['Submit'])) && count($_SESSION['aPeopleCart']) > 0) { diff --git a/src/ChurchCRM/Authentication/AuthenticationManager.php b/src/ChurchCRM/Authentication/AuthenticationManager.php index dca6d86b2c..e48e41ef81 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 @@ -209,4 +209,10 @@ public static function getForgotPasswordURL(): string // but rather redirect users to some other password reset mechanism. return SystemURLs::getRootPath() . '/session/forgot-password/reset-request'; } + public static function redirectHomeIfFalse(bool $hasAccess): void + { + if (!$hasAccess) { + RedirectUtils::redirect('v2/dashboard'); + } + } } diff --git a/src/ChurchCRM/Backup/BackupJob.php b/src/ChurchCRM/Backup/BackupJob.php index a61b051727..427c41a46a 100644 --- a/src/ChurchCRM/Backup/BackupJob.php +++ b/src/ChurchCRM/Backup/BackupJob.php @@ -60,7 +60,7 @@ public function __construct(string $BaseName, $BackupType, $IncludeExtraneousFil ); } - public function copyToWebDAV(string $Endpoint, string $Username, string $Password) + public function copyToWebDAV(string $Endpoint, string $Username, string $Password): bool { LoggerUtils::getAppLogger()->info('Beginning to copy backup to: ' . $Endpoint); @@ -78,7 +78,7 @@ public function copyToWebDAV(string $Endpoint, string $Username, string $Passwor curl_setopt($ch, CURLOPT_INFILESIZE, $this->BackupFile->getSize()); LoggerUtils::getAppLogger()->debug('Beginning to send file'); $time = new ExecutionTime(); - $result = curl_exec($ch); + $result = (bool) curl_exec($ch); if (curl_error($ch)) { $error_msg = curl_error($ch); } diff --git a/src/ChurchCRM/Backup/JobBase.php b/src/ChurchCRM/Backup/JobBase.php index 1602cd8478..92da13031b 100644 --- a/src/ChurchCRM/Backup/JobBase.php +++ b/src/ChurchCRM/Backup/JobBase.php @@ -16,7 +16,7 @@ class JobBase */ protected $TempFolder; - protected function createEmptyTempFolder() + protected function createEmptyTempFolder(): string { // both backup and restore operations require a clean temporary working folder. Create it. $TempFolder = SystemURLs::getDocumentRoot() . '/tmp_attach/ChurchCRMBackups'; 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/Emails/users/BaseUserEmail.php b/src/ChurchCRM/Emails/users/BaseUserEmail.php index 1568c40f87..5561e338e0 100644 --- a/src/ChurchCRM/Emails/users/BaseUserEmail.php +++ b/src/ChurchCRM/Emails/users/BaseUserEmail.php @@ -26,7 +26,7 @@ public function __construct($user) abstract protected function getSubSubject(); - public function getTokens() + public function getTokens(): array { $myTokens = ['toName' => $this->user->getPerson()->getFirstName(), 'userName' => $this->user->getUserName(), @@ -37,7 +37,7 @@ public function getTokens() return array_merge($this->getCommonTokens(), $myTokens); } - protected function getFullURL() + protected function getFullURL(): string { return SystemURLs::getURL() . '/session/begin?username=' . $this->user->getUserName(); } diff --git a/src/ChurchCRM/Service/MailChimpService.php b/src/ChurchCRM/Service/MailChimpService.php index 8525858925..146d4319df 100644 --- a/src/ChurchCRM/Service/MailChimpService.php +++ b/src/ChurchCRM/Service/MailChimpService.php @@ -75,14 +75,14 @@ private function getListsFromCache() return $_SESSION['MailChimpLists']; } - public function isEmailInMailChimp(?string $email) + public function isEmailInMailChimp(?string $email): array { if (empty($email)) { - return new Exception(gettext('No email passed in')); + throw new Exception(gettext('No email passed in')); } if (!$this->isActive()) { - return new Exception(gettext('Mailchimp is not active')); + throw new Exception(gettext('Mailchimp is not active')); } $lists = $this->getListsFromCache(); diff --git a/src/ChurchCRM/dto/Cart.php b/src/ChurchCRM/dto/Cart.php index b197dc9518..f1d7f920d7 100644 --- a/src/ChurchCRM/dto/Cart.php +++ b/src/ChurchCRM/dto/Cart.php @@ -112,7 +112,7 @@ public static function countPeople(): int return count($_SESSION['aPeopleCart']); } - public static function convertCartToString($aCartArray) + public static function convertCartToString($aCartArray): string { // Implode the array $sCartString = implode(',', $aCartArray); diff --git a/src/ChurchCRM/dto/Photo.php b/src/ChurchCRM/dto/Photo.php index 7335f96486..eb5a63b068 100644 --- a/src/ChurchCRM/dto/Photo.php +++ b/src/ChurchCRM/dto/Photo.php @@ -143,11 +143,13 @@ private function photoHunt(): void } if (SystemConfig::getBooleanValue('bEnableGravatarPhotos')) { - $photoPath = $this->loadFromGravatar($personEmail, $baseName); - if ($photoPath) { + try { + $photoPath = $this->loadFromGravatar($personEmail, $baseName); $this->setURIs($photoPath); return; + } catch (\Exception $e) { + // do nothing } } } @@ -166,7 +168,7 @@ private function convertToPNG(): void $this->setURIs($targetPath); } - private function getGDImage($sourceImagePath) + private function getGDImage($sourceImagePath): \GdImage { $sourceImageType = exif_imagetype($sourceImagePath); switch ($sourceImageType) { @@ -182,6 +184,7 @@ private function getGDImage($sourceImagePath) default: throw new \Exception('Unsupported image type: ' . $sourceImageType); } + MiscUtils::throwIfFailed($sourceGDImage); return $sourceGDImage; } @@ -193,18 +196,24 @@ private function ensureThumbnailsPath(): void } } - public function getThumbnailBytes() + public function getThumbnailBytes(): string { if (!file_exists($this->photoThumbURI)) { $this->createThumbnail(); } - return file_get_contents($this->photoThumbURI); + $content = file_get_contents($this->photoThumbURI); + MiscUtils::throwIfFailed($content); + + return $content; } - public function getPhotoBytes() + public function getPhotoBytes(): string|false { - return file_get_contents($this->photoURI); + $content = file_get_contents($this->photoURI); + MiscUtils::throwIfFailed($content); + + return $content; } public function getPhotoContentType() @@ -237,7 +246,7 @@ public function getPhotoURI() return $this->photoURI; } - private function loadFromGravatar($email, string $baseName) + private function loadFromGravatar($email, string $baseName): string { $s = 60; $d = '404'; @@ -256,10 +265,10 @@ private function loadFromGravatar($email, string $baseName) return $photoPath; } - return false; + throw new \Exception('Gravatar not found'); } - private function loadFromGoogle($email, string $baseName) + private function loadFromGoogle($email, string $baseName): string|false { $url = 'http://picasaweb.google.com/data/entry/api/user/'; $url .= strtolower(trim($email)); @@ -284,7 +293,7 @@ private function loadFromGoogle($email, string $baseName) return false; } - private function getRandomColor($image) + private function getRandomColor(\GdImage $image): int|false { $red = random_int(0, 150); $green = random_int(0, 150); @@ -318,6 +327,7 @@ private function renderInitials(): void $pointSize = SystemConfig::getValue('iInitialsPointSize'); $font = SystemURLs::getDocumentRoot() . '/fonts/Roboto-Regular.ttf'; $image = imagecreatetruecolor($width, $height); + MiscUtils::throwIfFailed($image); $bgcolor = $this->getRandomColor($image); $white = imagecolorallocate($image, 255, 255, 255); imagefilledrectangle($image, 0, 0, $height, $width, $bgcolor); diff --git a/src/ChurchCRM/utils/InputUtils.php b/src/ChurchCRM/utils/InputUtils.php index ce7e639211..e4bb493f2c 100644 --- a/src/ChurchCRM/utils/InputUtils.php +++ b/src/ChurchCRM/utils/InputUtils.php @@ -17,13 +17,24 @@ public static function legacyFilterInputArr(array $arr, $key, $type = 'string', } } - public static function translateSpecialCharset($string) + public static function translateSpecialCharset($string): string { if (empty($string)) { return ''; } - return (SystemConfig::getValue('sCSVExportCharset') === 'UTF-8') ? gettext($string) : iconv('UTF-8', SystemConfig::getValue('sCSVExportCharset'), gettext($string)); + if (SystemConfig::getValue('sCSVExportCharset') === 'UTF-8') { + return gettext($string); + } + + $resultString = iconv( + 'UTF-8', + SystemConfig::getValue('sCSVExportCharset'), + gettext($string) + ); + MiscUtils::throwIfFailed($resultString); + + return $resultString; } public static function filterString($sInput): string 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..e03e2e6aa9 100644 --- a/src/ConvertIndividualToFamily.php +++ b/src/ConvertIndividualToFamily.php @@ -29,10 +29,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security -if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin()); if ($_GET['all'] == 'true') { $bDoAll = true; 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..56ffb92ea7 100644 --- a/src/DirectoryReports.php +++ b/src/DirectoryReports.php @@ -21,10 +21,7 @@ use ChurchCRM\Utils\RedirectUtils; // Check for Create Directory user permission. -if (!AuthenticationManager::getCurrentUser()->isCreateDirectoryEnabled()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isCreateDirectoryEnabled()); // Set the page title and include HTML header $sPageTitle = gettext('Directory reports'); @@ -285,7 +282,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..855d1f3df7 100644 --- a/src/DonationFundEditor.php +++ b/src/DonationFundEditor.php @@ -22,10 +22,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security: user must be administrator to use this page -if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin()); if (isset($_GET['Action'])) { $sAction = $_GET['Action']; diff --git a/src/EditEventTypes.php b/src/EditEventTypes.php index 97116a0d4d..2474095850 100644 --- a/src/EditEventTypes.php +++ b/src/EditEventTypes.php @@ -21,10 +21,10 @@ use ChurchCRM\Authentication\AuthenticationManager; use ChurchCRM\Utils\InputUtils; +use ChurchCRM\Utils\RedirectUtils; + +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin()); -if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - header('Location: Menu.php'); -} $sPageTitle = gettext('Edit Event Types'); require 'Include/Header.php'; diff --git a/src/EventEditor.php b/src/EventEditor.php index d16eddff08..1fd4305396 100644 --- a/src/EventEditor.php +++ b/src/EventEditor.php @@ -28,12 +28,11 @@ 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'); -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAddEvent()); $sAction = 'Create Event'; require 'Include/Header.php'; diff --git a/src/EventNames.php b/src/EventNames.php index 712a46e427..795aad64b1 100644 --- a/src/EventNames.php +++ b/src/EventNames.php @@ -24,9 +24,7 @@ use ChurchCRM\Utils\InputUtils; use ChurchCRM\Utils\RedirectUtils; -if (!AuthenticationManager::getCurrentUser()->isAddEvent()) { - header('Location: Menu.php'); -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAddEvent()); $sPageTitle = gettext('Edit Event Types'); diff --git a/src/FamilyCustomFieldsEditor.php b/src/FamilyCustomFieldsEditor.php index 205df418c1..26a2466d1c 100644 --- a/src/FamilyCustomFieldsEditor.php +++ b/src/FamilyCustomFieldsEditor.php @@ -25,10 +25,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security: user must be administrator to use this page -if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin()); $sPageTitle = gettext('Custom Family Fields Editor'); diff --git a/src/FamilyCustomFieldsRowOps.php b/src/FamilyCustomFieldsRowOps.php index 90d1a7f878..8377b84929 100644 --- a/src/FamilyCustomFieldsRowOps.php +++ b/src/FamilyCustomFieldsRowOps.php @@ -19,10 +19,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security: user must be administrator to use this page. -if (!AuthenticationManager::getCurrentUser()->isAdmin()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin()); // Get the Group, Property, and Action from the querystring $iOrderID = InputUtils::legacyFilterInput($_GET['OrderID'], 'int'); 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..372e387c15 100644 --- a/src/FinancialReports.php +++ b/src/FinancialReports.php @@ -18,10 +18,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security -if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isFinanceEnabled()); $sReportType = ''; @@ -69,7 +66,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..8303359b60 100644 --- a/src/GroupEditor.php +++ b/src/GroupEditor.php @@ -23,10 +23,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security: User must have Manage Groups permission -if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()); //Set the page title $sPageTitle = gettext('Group Editor'); diff --git a/src/GroupPropsEditor.php b/src/GroupPropsEditor.php index 6131ac6542..9bd2102aca 100644 --- a/src/GroupPropsEditor.php +++ b/src/GroupPropsEditor.php @@ -20,10 +20,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security: user must be allowed to edit records to use this page. -if (!AuthenticationManager::getCurrentUser()->isEditRecordsEnabled()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isEditRecordsEnabled()); $sPageTitle = gettext('Group Member Properties Editor'); diff --git a/src/GroupPropsFormEditor.php b/src/GroupPropsFormEditor.php index 06490fc7d8..3252942b11 100644 --- a/src/GroupPropsFormEditor.php +++ b/src/GroupPropsFormEditor.php @@ -25,10 +25,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security: user must be allowed to edit records to use this page. -if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()); // Get the Group from the querystring $iGroupID = InputUtils::legacyFilterInput($_GET['GroupID'], 'int'); diff --git a/src/GroupPropsFormRowOps.php b/src/GroupPropsFormRowOps.php index 940f61b666..07e7d0ac14 100644 --- a/src/GroupPropsFormRowOps.php +++ b/src/GroupPropsFormRowOps.php @@ -18,10 +18,7 @@ use ChurchCRM\Utils\RedirectUtils; // Security: user must be allowed to edit records to use this page. -if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()) { - RedirectUtils::redirect('Menu.php'); - exit; -} +AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()); // Get the Group, Property, and Action from the querystring $iGroupID = InputUtils::legacyFilterInput($_GET['GroupID'], 'int'); 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 @@