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 = '= strlen($linkBack) > 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 @@
-
+
diff --git a/src/LettersAndLabels.php b/src/LettersAndLabels.php
index a299f1d584..0816168e1b 100644
--- a/src/LettersAndLabels.php
+++ b/src/LettersAndLabels.php
@@ -75,7 +75,7 @@
-
+
diff --git a/src/ManageEnvelopes.php b/src/ManageEnvelopes.php
index 136110220f..100468b791 100644
--- a/src/ManageEnvelopes.php
+++ b/src/ManageEnvelopes.php
@@ -23,10 +23,7 @@
$sPageTitle = gettext('Envelope Manager');
// Security: User must have finance permission to use this form
-if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isFinanceEnabled());
$envelopesToWrite = [];
// get the array of envelopes of interest, indexed by family id
diff --git a/src/MemberRoleChange.php b/src/MemberRoleChange.php
index d9c2d9b47f..90763058ea 100644
--- a/src/MemberRoleChange.php
+++ b/src/MemberRoleChange.php
@@ -18,10 +18,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());
//Set the page title
$sPageTitle = gettext('Member Role Change');
diff --git a/src/Menu.php b/src/Menu.php
deleted file mode 100644
index c59ece7d60..0000000000
--- a/src/Menu.php
+++ /dev/null
@@ -1,8 +0,0 @@
-isNotesEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isNotesEnabled());
//Set the page title
$sPageTitle = gettext('Note Delete Confirmation');
diff --git a/src/NoteEditor.php b/src/NoteEditor.php
index f310c2ccea..cc49fac578 100644
--- a/src/NoteEditor.php
+++ b/src/NoteEditor.php
@@ -22,10 +22,7 @@
// Security: User must have Notes permission
// Otherwise, re-direct them to the main menu.
-if (!AuthenticationManager::getCurrentUser()->isNotesEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isNotesEnabled());
//Set the page title
$sPageTitle = gettext('Note Editor');
diff --git a/src/OptionManager.php b/src/OptionManager.php
index 417d49d57a..c6cc2edec6 100644
--- a/src/OptionManager.php
+++ b/src/OptionManager.php
@@ -27,32 +27,23 @@
switch ($mode) {
case 'famroles':
case 'classes':
- if (!AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
- }
+ AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled());
break;
case 'grptypes':
case 'grproles':
case 'groupcustom':
- if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
- }
+ AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isManageGroupsEnabled());
break;
case 'custom':
case 'famcustom':
case 'securitygrp':
- if (!AuthenticationManager::getCurrentUser()->isAdmin()) {
- RedirectUtils::redirect('Menu.php');
- exit;
- }
+ AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin());
break;
default:
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
break;
}
@@ -105,7 +96,7 @@
// Validate that this list ID is really for a group roles list. (for security)
if (mysqli_num_rows($rsTemp) == 0) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
break;
}
@@ -126,7 +117,7 @@
// Validate that this is a valid person-custom field custom list
if (mysqli_num_rows($rsTemp) == 0) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
break;
}
@@ -144,7 +135,7 @@
// Validate that this is a valid group-specific-property field custom list
if (mysqli_num_rows($rsTemp) == 0) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
break;
}
@@ -162,13 +153,13 @@
// Validate that this is a valid family_custom field custom list
if (mysqli_num_rows($rsTemp) == 0) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
break;
}
break;
default:
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
break;
}
@@ -381,7 +372,7 @@
} elseif ($mode != 'grproles') {
?>
+ echo 'v2/dashboard'; ?>';">
diff --git a/src/OptionManagerRowOps.php b/src/OptionManagerRowOps.php
index 713ff54c7e..1538dc53d0 100644
--- a/src/OptionManagerRowOps.php
+++ b/src/OptionManagerRowOps.php
@@ -29,29 +29,20 @@
switch ($mode) {
case 'famroles':
case 'classes':
- if (!AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
- }
+ AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled());
break;
case 'grptypes':
case 'grproles':
- if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
- }
+ AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isManageGroupsEnabled());
break;
case 'custom':
case 'famcustom':
- if (!AuthenticationManager::getCurrentUser()->isAdmin()) {
- RedirectUtils::redirect('Menu.php');
- exit;
- }
+ AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin());
break;
default:
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
break;
}
@@ -82,7 +73,7 @@
$sSQL = "SELECT '' FROM group_grp WHERE grp_RoleListID = " . $listID;
$rsTemp = RunQuery($sSQL);
if (mysqli_num_rows($rsTemp) == 0) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
break;
}
@@ -160,7 +151,7 @@
// If no valid action was specified, abort
default:
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
break;
}
diff --git a/src/PaddleNumEditor.php b/src/PaddleNumEditor.php
index 429940fe4e..e4b1cf59a7 100644
--- a/src/PaddleNumEditor.php
+++ b/src/PaddleNumEditor.php
@@ -154,7 +154,7 @@
diff --git a/src/PersonCustomFieldsEditor.php b/src/PersonCustomFieldsEditor.php
index d98fd99b38..a062686dba 100644
--- a/src/PersonCustomFieldsEditor.php
+++ b/src/PersonCustomFieldsEditor.php
@@ -20,10 +20,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 Person Fields Editor');
diff --git a/src/PersonCustomFieldsRowOps.php b/src/PersonCustomFieldsRowOps.php
index e4b2eb4a7f..ff8ec5ceae 100644
--- a/src/PersonCustomFieldsRowOps.php
+++ b/src/PersonCustomFieldsRowOps.php
@@ -18,10 +18,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/PersonEditor.php b/src/PersonEditor.php
index 456767e402..8c0a7a016b 100644
--- a/src/PersonEditor.php
+++ b/src/PersonEditor.php
@@ -49,7 +49,7 @@
$per_fam_ID = $aRow['per_fam_ID'];
if (mysqli_num_rows($rsPerson) == 0) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
@@ -60,11 +60,11 @@
(AuthenticationManager::getCurrentUser()->isEditSelfEnabled() && $per_fam_ID > 0 && $per_fam_ID == AuthenticationManager::getCurrentUser()->getPerson()->getFamId())
)
) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
} elseif (!AuthenticationManager::getCurrentUser()->isAddRecordsEnabled()) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
// Get Field Security List Matrix
diff --git a/src/PledgeDelete.php b/src/PledgeDelete.php
index 401e6523f5..3fe2e23850 100644
--- a/src/PledgeDelete.php
+++ b/src/PledgeDelete.php
@@ -25,10 +25,7 @@
// Security: User must have Add or Edit Records permission to use this form in those manners
// Clean error handling: (such as somebody typing an incorrect URL ?PersonID= manually)
-if (!AuthenticationManager::getCurrentUser()->isDeleteRecordsEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isDeleteRecordsEnabled());
//Is this the second pass?
if (isset($_POST['Delete'])) {
diff --git a/src/PledgeDetails.php b/src/PledgeDetails.php
index 201b8176d4..6eb2d0b54f 100644
--- a/src/PledgeDetails.php
+++ b/src/PledgeDetails.php
@@ -24,10 +24,7 @@
// Security: User must have Finance permission to use this form.
// Clean error handling: (such as somebody typing an incorrect URL ?PersonID= manually)
-if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isFinanceEnabled());
//Is this the second pass?
if (isset($_POST['Back'])) {
diff --git a/src/PledgeEditor.php b/src/PledgeEditor.php
index c3312f0440..16dbd136cf 100644
--- a/src/PledgeEditor.php
+++ b/src/PledgeEditor.php
@@ -93,7 +93,7 @@
// Security: User must have Finance permission or be the one who entered this record originally
if (!(AuthenticationManager::getCurrentUser()->isFinanceEnabled() || AuthenticationManager::getCurrentUser()->getId() == $aRow['plg_EditedBy'])) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
}
@@ -670,7 +670,7 @@
} else {
$cancelText = 'Return';
} ?>
-
+
diff --git a/src/PropertyAssign.php b/src/PropertyAssign.php
index 61eec3eb6a..e194df045e 100644
--- a/src/PropertyAssign.php
+++ b/src/PropertyAssign.php
@@ -22,7 +22,7 @@
// Security: User must have Manage Groups or Edit Records permissions
// Otherwise, re-direct them to the main menu.
if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled() && !AuthenticationManager::getCurrentUser()->isEditRecordsEnabled()) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
@@ -78,7 +78,7 @@
$sName = $aRow['fam_Name'];
} else {
// Somebody tried to call the script with no options
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
}
// If no property, return to previous page
diff --git a/src/PropertyDelete.php b/src/PropertyDelete.php
index a3cb453150..ff3b490f07 100644
--- a/src/PropertyDelete.php
+++ b/src/PropertyDelete.php
@@ -17,10 +17,7 @@
use ChurchCRM\Utils\InputUtils;
use ChurchCRM\Utils\RedirectUtils;
-if (!AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled());
//Set the page title
$sPageTitle = gettext('Property Delete Confirmation');
diff --git a/src/PropertyEditor.php b/src/PropertyEditor.php
index eb2abd9970..c09e5811cc 100644
--- a/src/PropertyEditor.php
+++ b/src/PropertyEditor.php
@@ -19,10 +19,7 @@
use ChurchCRM\Utils\RedirectUtils;
// Security: User must have property and classification editing permission
-if (!AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled());
$sClassError = '';
$sNameError = '';
@@ -51,7 +48,7 @@
break;
default:
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
break;
}
diff --git a/src/PropertyList.php b/src/PropertyList.php
index 481f7840ef..41aada1ada 100644
--- a/src/PropertyList.php
+++ b/src/PropertyList.php
@@ -35,7 +35,7 @@
break;
default:
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
break;
}
diff --git a/src/PropertyTypeDelete.php b/src/PropertyTypeDelete.php
index 106333fd29..70e119bc90 100644
--- a/src/PropertyTypeDelete.php
+++ b/src/PropertyTypeDelete.php
@@ -18,10 +18,7 @@
use ChurchCRM\Utils\RedirectUtils;
// Security: User must have property and classification editing permission
-if (!AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled());
//Set the page title
$sPageTitle = gettext('Property Type Delete Confirmation');
diff --git a/src/PropertyTypeEditor.php b/src/PropertyTypeEditor.php
index 29437f53ae..bba5d1522e 100644
--- a/src/PropertyTypeEditor.php
+++ b/src/PropertyTypeEditor.php
@@ -18,10 +18,7 @@
use ChurchCRM\Utils\RedirectUtils;
// Security: User must have property and classification editing permission
-if (!AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled());
//Set the page title
$sPageTitle = gettext('Property Type Editor');
diff --git a/src/PropertyUnassign.php b/src/PropertyUnassign.php
index 239406a7f4..61761fea52 100644
--- a/src/PropertyUnassign.php
+++ b/src/PropertyUnassign.php
@@ -20,7 +20,7 @@
// Security: User must have Manage Groups or Edit Records permissions
// Otherwise, re-direct them to the main menu.
if (!AuthenticationManager::getCurrentUser()->isManageGroupsEnabled() && !AuthenticationManager::getCurrentUser()->isEditRecordsEnabled()) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
@@ -68,7 +68,7 @@
$sName = $aRow['fam_Name'];
} else {
// Somebody tried to call the script with no options
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
diff --git a/src/QuerySQL.php b/src/QuerySQL.php
index 3334f2c72e..c0081b63d4 100644
--- a/src/QuerySQL.php
+++ b/src/QuerySQL.php
@@ -22,10 +22,7 @@
// Security: User must be an Admin to access this page. It allows unrestricted database access!
// Otherwise, re-direct them to the main menu.
-if (!AuthenticationManager::getCurrentUser()->isAdmin()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin());
if (isset($_POST['SQL'])) {
//Assign the value locally
diff --git a/src/QueryView.php b/src/QueryView.php
index c7878fcd1f..eac6f9fa2f 100644
--- a/src/QueryView.php
+++ b/src/QueryView.php
@@ -28,7 +28,7 @@
$aFinanceQueries = explode(',', SystemConfig::getValue('aFinanceQueries'));
if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled() && in_array($iQueryID, $aFinanceQueries)) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
diff --git a/src/ReminderReport.php b/src/ReminderReport.php
index 3afe16674a..775fb0473a 100644
--- a/src/ReminderReport.php
+++ b/src/ReminderReport.php
@@ -19,7 +19,7 @@
// If CSVAdminOnly option is enabled and user is not admin, redirect to the menu.
if (!AuthenticationManager::getCurrentUser()->isAdmin() && SystemConfig::getValue('bCSVAdminOnly')) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
@@ -51,7 +51,7 @@
= gettext('Create Report') ?>
= gettext('Cancel') ?>
+ onclick="javascript:document.location='v2/dashboard';">= gettext('Cancel') ?>
diff --git a/src/Reports/AdvancedDeposit.php b/src/Reports/AdvancedDeposit.php
index 3d694dffa9..e2ba6fbb1e 100644
--- a/src/Reports/AdvancedDeposit.php
+++ b/src/Reports/AdvancedDeposit.php
@@ -19,10 +19,7 @@
use ChurchCRM\Utils\RedirectUtils;
// Security
-if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isFinanceEnabled());
// Filter values
$sort = InputUtils::legacyFilterInput($_POST['sort']);
@@ -80,7 +77,7 @@
// If CSVAdminOnly option is enabled and user is not admin, redirect to the menu.
if (!AuthenticationManager::getCurrentUser()->isAdmin() && SystemConfig::getValue('bCSVAdminOnly') && $output != 'pdf') {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
diff --git a/src/Reports/DirectoryReport.php b/src/Reports/DirectoryReport.php
index 1963adea36..a574b6cdea 100644
--- a/src/Reports/DirectoryReport.php
+++ b/src/Reports/DirectoryReport.php
@@ -22,10 +22,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());
// Get and filter the classifications selected
$aClasses = [];
diff --git a/src/Reports/EnvelopeReport.php b/src/Reports/EnvelopeReport.php
index 090b90b92f..04e218d0da 100644
--- a/src/Reports/EnvelopeReport.php
+++ b/src/Reports/EnvelopeReport.php
@@ -18,7 +18,7 @@
// If CSVAdminOnly option is enabled and user is not admin, redirect to the menu.
if (!AuthenticationManager::getCurrentUser()->isAdmin() && SystemConfig::getValue('bCSVAdminOnly')) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
diff --git a/src/Reports/FamilyPledgeSummary.php b/src/Reports/FamilyPledgeSummary.php
index 51a3f3adf7..b544554269 100644
--- a/src/Reports/FamilyPledgeSummary.php
+++ b/src/Reports/FamilyPledgeSummary.php
@@ -20,10 +20,7 @@
use ChurchCRM\Utils\RedirectUtils;
// Security
-if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isFinanceEnabled());
if (!empty($_POST['classList'])) {
$classList = $_POST['classList'];
@@ -74,7 +71,7 @@
// If CSVAdminOnly option is enabled and user is not admin, redirect to the menu.
if (!AuthenticationManager::getCurrentUser()->isAdmin() && SystemConfig::getValue('bCSVAdminOnly')) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
diff --git a/src/Reports/PledgeSummary.php b/src/Reports/PledgeSummary.php
index b755d0edfb..a276babb9d 100644
--- a/src/Reports/PledgeSummary.php
+++ b/src/Reports/PledgeSummary.php
@@ -19,10 +19,7 @@
use ChurchCRM\Utils\RedirectUtils;
// Security
-if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isFinanceEnabled());
// Filter Values
$output = InputUtils::legacyFilterInput($_POST['output']);
@@ -34,7 +31,7 @@
// If CSVAdminOnly option is enabled and user is not admin, redirect to the menu.
if (!AuthenticationManager::getCurrentUser()->isAdmin() && SystemConfig::getValue('bCSVAdminOnly') && $output != 'pdf') {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
diff --git a/src/Reports/PrintDeposit.php b/src/Reports/PrintDeposit.php
index e4657c4157..c72b41859a 100644
--- a/src/Reports/PrintDeposit.php
+++ b/src/Reports/PrintDeposit.php
@@ -24,10 +24,7 @@
use ChurchCRM\Utils\RedirectUtils;
//Security
-if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isFinanceEnabled());
$iBankSlip = 0;
if (array_key_exists('BankSlip', $_GET)) {
@@ -54,7 +51,7 @@
// If CSVAdminOnly option is enabled and user is not admin, redirect to the menu.
// If no DepositSlipId, redirect to the menu
if ((!AuthenticationManager::getCurrentUser()->isAdmin() && $bCSVAdminOnly && $output != 'pdf') || !$iDepositSlipID) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
diff --git a/src/Reports/ReminderReport.php b/src/Reports/ReminderReport.php
index b0892a5a19..51df843e78 100644
--- a/src/Reports/ReminderReport.php
+++ b/src/Reports/ReminderReport.php
@@ -19,10 +19,7 @@
use ChurchCRM\Utils\RedirectUtils;
// Security
-if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isFinanceEnabled());
//Get the Fiscal Year ID out of the querystring
$iFYID = InputUtils::legacyFilterInput($_POST['FYID'], 'int');
@@ -36,7 +33,7 @@
// If CSVAdminOnly option is enabled and user is not admin, redirect to the menu.
if (!AuthenticationManager::getCurrentUser()->isAdmin() && SystemConfig::getValue('bCSVAdminOnly')) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
diff --git a/src/Reports/TaxReport.php b/src/Reports/TaxReport.php
index 9d8e32a98f..8826a4c58b 100644
--- a/src/Reports/TaxReport.php
+++ b/src/Reports/TaxReport.php
@@ -19,10 +19,7 @@
use ChurchCRM\Utils\RedirectUtils;
// Security
-if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isFinanceEnabled());
// Filter values
$letterhead = InputUtils::legacyFilterInput($_POST['letterhead']);
@@ -36,7 +33,7 @@
// If CSVAdminOnly option is enabled and user is not admin, redirect to the menu.
if (!AuthenticationManager::getCurrentUser()->isAdmin() && SystemConfig::getValue('bCSVAdminOnly') && $output != 'pdf') {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
diff --git a/src/Reports/ZeroGivers.php b/src/Reports/ZeroGivers.php
index 127248b3c7..83642eeac4 100644
--- a/src/Reports/ZeroGivers.php
+++ b/src/Reports/ZeroGivers.php
@@ -20,10 +20,7 @@
use ChurchCRM\Utils\RedirectUtils;
// Security
-if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isFinanceEnabled());
// Filter values
$output = InputUtils::legacyFilterInput($_POST['output']);
@@ -35,7 +32,7 @@
// If CSVAdminOnly option is enabled and user is not admin, redirect to the menu.
if (!AuthenticationManager::getCurrentUser()->isAdmin() && SystemConfig::getValue('bCSVAdminOnly') && $output != 'pdf') {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
diff --git a/src/RestoreDatabase.php b/src/RestoreDatabase.php
index f3ed4e3137..cbe6d5f084 100644
--- a/src/RestoreDatabase.php
+++ b/src/RestoreDatabase.php
@@ -21,10 +21,7 @@
use ChurchCRM\Utils\RedirectUtils;
// Security: User must have Manage Groups permission
-if (!AuthenticationManager::getCurrentUser()->isAdmin()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin());
//Set the page title
$sPageTitle = gettext('Restore Database');
diff --git a/src/SelectDelete.php b/src/SelectDelete.php
index 531dbda3b9..7bb4dafac2 100644
--- a/src/SelectDelete.php
+++ b/src/SelectDelete.php
@@ -29,10 +29,7 @@
// Security: User must have Delete records permission
// Otherwise, re-direct them to the main menu.
-if (!AuthenticationManager::getCurrentUser()->isDeleteRecordsEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isDeleteRecordsEnabled());
// default values to make the newer versions of php happy
$iFamilyID = 0;
diff --git a/src/SettingsUser.php b/src/SettingsUser.php
index b8190dea9d..333d770953 100644
--- a/src/SettingsUser.php
+++ b/src/SettingsUser.php
@@ -22,10 +22,7 @@
use ChurchCRM\Utils\RedirectUtils;
// Security
-if (!AuthenticationManager::getCurrentUser()->isAdmin()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin());
// Save Settings
if (isset($_POST['save'])) {
@@ -158,7 +155,7 @@
-
+
diff --git a/src/SystemDBUpdate.php b/src/SystemDBUpdate.php
index a2d9b1367b..01d8a380a5 100644
--- a/src/SystemDBUpdate.php
+++ b/src/SystemDBUpdate.php
@@ -13,7 +13,7 @@
require 'Include/Functions.php';
if (Bootstrapper::isDBCurrent()) {
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
}
@@ -23,7 +23,7 @@
$logger->info("Beginning database upgrade");
UpgradeService::upgradeDatabaseVersion();
$logger->info("Complete database upgrade; redirecting to Main menu");
- RedirectUtils::redirect('Menu.php');
+ RedirectUtils::redirect('v2/dashboard');
exit;
} catch (\Exception $ex) {
$errorMessage = $ex->getMessage();
diff --git a/src/SystemSettings.php b/src/SystemSettings.php
index b82cc07a9a..5fc9428947 100644
--- a/src/SystemSettings.php
+++ b/src/SystemSettings.php
@@ -23,10 +23,7 @@
use ChurchCRM\Utils\RedirectUtils;
// Security
-if (!AuthenticationManager::getCurrentUser()->isAdmin()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin());
// Set the page title and include HTML header
$sPageTitle = gettext('System Settings');
diff --git a/src/TaxReport.php b/src/TaxReport.php
index a9a9883224..0e6c8e190e 100644
--- a/src/TaxReport.php
+++ b/src/TaxReport.php
@@ -19,10 +19,7 @@
use ChurchCRM\Utils\RedirectUtils;
// If CSVAdminOnly option is enabled and user is not admin, redirect to the menu.
-if (!AuthenticationManager::getCurrentUser()->isAdmin() && SystemConfig::getValue('bCSVAdminOnly')) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin() && SystemConfig::getValue('bCSVAdminOnly'));
// Set the page title and include HTML header
$sPageTitle = gettext('Tax Report');
@@ -51,7 +48,7 @@
= gettext('Create Report') ?>
= gettext('Cancel') ?>
+ onclick="javascript:document.location='v2/dashboard';">= gettext('Cancel') ?>
diff --git a/src/UserEditor.php b/src/UserEditor.php
index 3d85576080..1ea58bfed8 100644
--- a/src/UserEditor.php
+++ b/src/UserEditor.php
@@ -35,10 +35,7 @@
// Security: User must be an Admin to access this page.
// Otherwise re-direct to the main menu.
-if (!AuthenticationManager::getCurrentUser()->isAdmin()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin());
$iPersonID = -1;
$vNewUser = false;
diff --git a/src/VolunteerOpportunityEditor.php b/src/VolunteerOpportunityEditor.php
index 078e49047a..8926c16d8b 100644
--- a/src/VolunteerOpportunityEditor.php
+++ b/src/VolunteerOpportunityEditor.php
@@ -19,11 +19,7 @@
// Security: User must have proper permission
// For now ... require $bAdmin
// Future ... $bManageVol
-
-if (!AuthenticationManager::getCurrentUser()->isAdmin()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isAdmin());
// top down design....
// title line
@@ -59,10 +55,7 @@
// Security: User must have Delete records permission
// Otherwise, redirect to the main menu
- if (!AuthenticationManager::getCurrentUser()->isDeleteRecordsEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
- }
+ AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isDeleteRecordsEnabled());
$sSQL = "SELECT * FROM `volunteeropportunity_vol` WHERE `vol_ID` = '" . $iOpp . "'";
$rsOpps = RunQuery($sSQL);
@@ -120,10 +113,7 @@
if (($sAction == 'ConfDelete') && $iOpp > 0) {
// Security: User must have Delete records permission
// Otherwise, redirect to the main menu
- if (!AuthenticationManager::getCurrentUser()->isDeleteRecordsEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
- }
+ AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isDeleteRecordsEnabled());
// get the order value for the record being deleted
$sSQL = "SELECT vol_Order from volunteeropportunity_vol WHERE vol_ID='$iOpp'";
@@ -408,7 +398,7 @@
-
+
diff --git a/src/composer.lock b/src/composer.lock
index e8a110558c..4af2a924f8 100644
--- a/src/composer.lock
+++ b/src/composer.lock
@@ -5170,16 +5170,16 @@
"packages-dev": [
{
"name": "phpstan/phpstan",
- "version": "1.10.56",
+ "version": "1.10.57",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
- "reference": "27816a01aea996191ee14d010f325434c0ee76fa"
+ "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan/zipball/27816a01aea996191ee14d010f325434c0ee76fa",
- "reference": "27816a01aea996191ee14d010f325434c0ee76fa",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e",
+ "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e",
"shasum": ""
},
"require": {
@@ -5228,25 +5228,25 @@
"type": "tidelift"
}
],
- "time": "2024-01-15T10:43:00+00:00"
+ "time": "2024-01-24T11:51:34+00:00"
},
{
"name": "rector/rector",
- "version": "0.19.1",
+ "version": "0.19.8",
"source": {
"type": "git",
"url": "https://github.com/rectorphp/rector.git",
- "reference": "2bba0dd55ba92c23f1253d9e60d0242a896d1025"
+ "reference": "de3b3bb159abd704b144aa86fb244f7f1f4ac947"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/rectorphp/rector/zipball/2bba0dd55ba92c23f1253d9e60d0242a896d1025",
- "reference": "2bba0dd55ba92c23f1253d9e60d0242a896d1025",
+ "url": "https://api.github.com/repos/rectorphp/rector/zipball/de3b3bb159abd704b144aa86fb244f7f1f4ac947",
+ "reference": "de3b3bb159abd704b144aa86fb244f7f1f4ac947",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0",
- "phpstan/phpstan": "^1.10.52"
+ "phpstan/phpstan": "^1.10.56"
},
"conflict": {
"rector/rector-doctrine": "*",
@@ -5276,7 +5276,7 @@
],
"support": {
"issues": "https://github.com/rectorphp/rector/issues",
- "source": "https://github.com/rectorphp/rector/tree/0.19.1"
+ "source": "https://github.com/rectorphp/rector/tree/0.19.8"
},
"funding": [
{
@@ -5284,7 +5284,7 @@
"type": "github"
}
],
- "time": "2024-01-15T18:02:43+00:00"
+ "time": "2024-02-05T10:59:13+00:00"
},
{
"name": "squizlabs/php_codesniffer",
diff --git a/src/eGive.php b/src/eGive.php
index 0b64b6b214..cfacf5a80c 100644
--- a/src/eGive.php
+++ b/src/eGive.php
@@ -16,10 +16,7 @@
use ChurchCRM\Utils\InputUtils;
use ChurchCRM\Utils\RedirectUtils;
-if (!AuthenticationManager::getCurrentUser()->isFinanceEnabled()) {
- RedirectUtils::redirect('Menu.php');
- exit;
-}
+AuthenticationManager::redirectHomeIfFalse(AuthenticationManager::getCurrentUser()->isFinanceEnabled());
$now = time();
$dDate = date('Y-m-d', $now);
diff --git a/src/index.php b/src/index.php
index 19a0036d29..ca49df3b10 100644
--- a/src/index.php
+++ b/src/index.php
@@ -41,8 +41,8 @@
AuthenticationManager::ensureAuthentication();
if (strtolower($shortName) === 'index.php' || strtolower($fileName) === 'index.php') {
- // Index.php -> Menu.php
- header('Location: ' . SystemURLs::getRootPath() . '/Menu.php');
+ // Index.php -> v2/dashboard
+ header('Location: ' . SystemURLs::getRootPath() . '/v2/dashboard');
exit;
} elseif (file_exists($shortName)) {
// Try actual path
diff --git a/src/sundayschool/SundaySchoolReports.php b/src/sundayschool/SundaySchoolReports.php
index 8a0408e93c..375213a95f 100644
--- a/src/sundayschool/SundaySchoolReports.php
+++ b/src/sundayschool/SundaySchoolReports.php
@@ -286,7 +286,7 @@
-
+