diff --git a/install/install.sh b/install/install.sh
new file mode 100644
index 0000000000..12fff5a449
--- /dev/null
+++ b/install/install.sh
@@ -0,0 +1,176 @@
+#!/usr/bin/env sh
+
+# Error on unset variable or parameter and exit
+set -u
+
+DATABASE_NAME="$1"
+DATABASE_USERNAME="$2"
+DATABASE_PASSWORD="$3"
+
+# Determine if the script is run as root
+if [ "$(id -u)" -eq 0 ]; then
+ SUDO=""
+else
+ SUDO="sudo"
+fi
+
+# Function to check if the OS is Ubuntu
+check_os() {
+ # Check if /etc/os-release exists
+ if [ -f /etc/os-release ]; then
+ # Extract the ID value from /etc/os-release
+ os_id=$(grep '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"')
+
+ # Print a warning to stderr if the OS is not Ubuntu
+ if [ "$os_id" != "ubuntu" ]; then
+ echo "Warning: This script isn't regularly tested on non-Ubuntu installations." >&2
+ fi
+ else
+ echo "Error: /etc/os-release file not found. Cannot determine the OS." >&2
+ fi
+}
+
+check_os
+
+# Function to run a command and exit if it fails
+run_or_exit() {
+ "$@"
+ status=$?
+ if [ $status -ne 0 ]; then
+ echo "Command failed: $*" >&2
+ exit 1
+ fi
+}
+
+# Function to download files using curl or wget
+download_file() {
+ URL="$1"
+ OUTPUT="$2"
+
+ if command -v curl >/dev/null 2>&1; then
+ run_or_exit curl -L -o "$OUTPUT" "$URL"
+ elif command -v wget >/dev/null 2>&1; then
+ run_or_exit wget -O "$OUTPUT" "$URL"
+ else
+ echo "Error: Neither curl nor wget is available." >&2
+ exit 1
+ fi
+}
+
+# Package installation function based on available package managers
+if command -v apt-get >/dev/null 2>&1; then
+ install_packages() {
+ run_or_exit $SUDO apt-get update
+ run_or_exit $SUDO apt-get install -y "$@"
+ }
+elif command -v dnf >/dev/null 2>&1; then
+ install_packages() {
+ run_or_exit $SUDO dnf install -y "$@"
+ }
+elif command -v yum >/dev/null 2>&1; then
+ install_packages() {
+ run_or_exit $SUDO yum install -y "$@"
+ }
+else
+ echo "Error: No supported package manager found." >&2
+ exit 1
+fi
+
+# Service management function based on available service managers
+if command -v systemctl >/dev/null 2>&1; then
+ enable_and_start_service() {
+ run_or_exit $SUDO systemctl enable "$1"
+ run_or_exit $SUDO systemctl start "$1"
+ }
+
+ restart_service() {
+ run_or_exit $SUDO systemctl restart "$1"
+ }
+else
+ echo "Error: No supported service manager found." >&2
+ exit 1
+fi
+
+# Install required packages
+install_packages apache2 curl gawk libapache2-mod-php mariadb-client mariadb-server \
+ php php-bcmath php-cli php-curl php-dev php-gd php-intl php-mbstring php-mysql \
+ php-soap php-xml php-zip unzip
+
+# Common logic for all distributions
+cd /tmp
+
+# Get the latest version of ChurchCRM
+if command -v curl >/dev/null 2>&1; then
+ VERSION_CMD="curl -Is https://github.com/ChurchCRM/CRM/releases/latest | awk -F\/ '/^location:/ {sub(/\r$/, \"\", \$NF); print \$NF}'"
+elif command -v wget >/dev/null 2>&1; then
+ VERSION_CMD="wget --spider --server-response https://github.com/ChurchCRM/CRM/releases/latest 2>&1 | awk -F\/ '/^ Location:/ {sub(/\r$/, \"\", \$NF); print \$NF}'"
+else
+ echo "Error: Neither curl nor wget is available." >&2
+ exit 1
+fi
+
+VERSION=$(eval "$VERSION_CMD")
+DOWNLOAD_URL="https://github.com/ChurchCRM/CRM/releases/download/$VERSION/ChurchCRM-$VERSION.zip"
+download_file "$DOWNLOAD_URL" "ChurchCRM-$VERSION.zip"
+run_or_exit unzip "ChurchCRM-$VERSION.zip" && rm "ChurchCRM-$VERSION.zip"
+run_or_exit $SUDO chown -R www-data:www-data churchcrm
+run_or_exit $SUDO mv churchcrm /var/www/html/
+
+enable_and_start_service apache2
+enable_and_start_service mariadb
+
+## Creating the database
+run_or_exit $SUDO mariadb -uroot -p -e "CREATE DATABASE ${DATABASE_NAME} /*\!40100 DEFAULT CHARACTER SET utf8 */;
+CREATE USER ${DATABASE_USERNAME}@'localhost' IDENTIFIED BY '${DATABASE_PASSWORD}';
+GRANT ALL ON ${DATABASE_NAME}.* TO '${DATABASE_USERNAME}'@'localhost' WITH GRANT OPTION;
+FLUSH PRIVILEGES;"
+
+echo "Please make sure to secure your database server:"
+echo " $SUDO mysql_secure_installation"
+
+PHP_CONF_D_PATH="/etc/php/conf.d/churchcrm.ini"
+PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '.' -f 1,2)
+
+if [ "$PHP_VERSION" = "8.3" ]; then
+ PHP_CONF_D_PATH="/etc/php/8.3/apache2/conf.d/99-churchcrm.ini"
+fi
+
+# Set-up the required PHP configuration
+run_or_exit $SUDO tee "$PHP_CONF_D_PATH" << 'TXT'
+file_uploads = On
+allow_url_fopen = On
+short_open_tag = On
+memory_limit = 256M
+upload_max_filesize = 100M
+max_execution_time = 360
+TXT
+
+# Set-up the required Apache configuration
+run_or_exit $SUDO tee /etc/apache2/sites-available/churchcrm.conf << 'TXT'
+
+
+ServerAdmin webmaster@localhost
+DocumentRoot /var/www/html/churchcrm/
+ServerName ChurchCRM
+
+
+ Options -Indexes +FollowSymLinks
+ AllowOverride All
+ Require all granted
+
+
+ErrorLog ${APACHE_LOG_DIR}/error.log
+CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+
+TXT
+
+# Enable apache rewrite module
+run_or_exit $SUDO a2enmod rewrite
+
+# Disable the default apache site and enable ChurchCRM
+run_or_exit $SUDO a2dissite 000-default.conf
+run_or_exit $SUDO a2ensite churchcrm.conf
+
+# Restart apache to load new configuration
+restart_service apache2.service
diff --git a/install/ubuntu.sh b/install/ubuntu.sh
deleted file mode 100644
index 25fbd5c967..0000000000
--- a/install/ubuntu.sh
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/env sh
-
-# Error on unset variable or parameter and exit
-set -u
-
-DATABASE_NAME="$1"
-DATABASE_USERNAME="$2"
-DATABASE_PASSWORD="$3"
-
-sudo apt-get update
-sudo apt-get upgrade -y
-sudo apt-get install -y \
- apache2 \
- curl \
- gawk \
- libapache2-mod-php \
- mariadb-client \
- mariadb-server \
- php \
- php-bcmath \
- php-cli \
- php-curl \
- php-dev \
- php-gd \
- php-intl \
- php-mbstring \
- php-mysql \
- php-soap \
- php-xml \
- php-zip \
- unzip \
- wget
-
-cd /tmp
-VERSION=$(curl -Is https://github.com/ChurchCRM/CRM/releases/latest | awk -F\/ '/^location:/ {sub(/\r$/, "", $NF); print $NF}')
-wget "https://github.com/ChurchCRM/CRM/releases/download/$VERSION/ChurchCRM-$VERSION.zip" || exit
-unzip "ChurchCRM-$VERSION.zip" && rm "ChurchCRM-$VERSION.zip"
-sudo chown -R www-data:www-data churchcrm
-sudo mv churchcrm /var/www/html/
-
-sudo systemctl enable apache2.service mariadb.service
-
-## Creating the database
-sudo mariadb -uroot -p -e "CREATE DATABASE ${DATABASE_NAME} /*\!40100 DEFAULT CHARACTER SET utf8 */;
-CREATE USER ${DATABASE_USERNAME}@'localhost' IDENTIFIED BY '${DATABASE_PASSWORD}';
-GRANT ALL ON ${DATABASE_NAME}.* TO '${DATABASE_USERNAME}'@'localhost' WITH GRANT OPTION;
-FLUSH PRIVILEGES;"
-
-echo "Please make sure to secure your database server:"
-echo " sudo mysql_secure_installation"
-
-PHP_CONF_D_PATH="/etc/php/conf.d/churchcrm.ini"
-PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '.' -f 1,2)
-
-if [ "$PHP_VERSION" = "8.3" ]
-then
- PHP_CONF_D_PATH="/etc/php/8.3/apache2/conf.d/99-churchcrm.ini"
-fi
-
-# Set-up the required PHP configuration
-sudo tee "$PHP_CONF_D_PATH" << 'TXT'
-file_uploads = On
-allow_url_fopen = On
-short_open_tag = On
-memory_limit = 256M
-upload_max_filesize = 100M
-max_execution_time = 360
-TXT
-
-# Set-up the required Apache configuration
-sudo tee /etc/apache2/sites-available/churchcrm.conf << 'TXT'
-
-
-ServerAdmin webmaster@localhost
-DocumentRoot /var/www/html/churchcrm/
-ServerName ChurchCRM
-
-
- Options -Indexes +FollowSymLinks
- AllowOverride All
- Require all granted
-
-
-ErrorLog ${APACHE_LOG_DIR}/error.log
-CustomLog ${APACHE_LOG_DIR}/access.log combined
-
-
-TXT
-
-# Enable apache rewrite module
-sudo a2enmod rewrite
-
-# Disable the default apache site and enable ChurchCRM
-sudo a2dissite 000-default.conf
-sudo a2ensite churchcrm.conf
-
-# Restart apache to load new configuration
-sudo systemctl restart apache2.service
diff --git a/src/ChurchCRM/Reports/ChurchInfoReport.php b/src/ChurchCRM/Reports/ChurchInfoReport.php
index a991eeb8d9..c2f2c97c7f 100644
--- a/src/ChurchCRM/Reports/ChurchInfoReport.php
+++ b/src/ChurchCRM/Reports/ChurchInfoReport.php
@@ -31,7 +31,7 @@ public function stripPhone($phone)
if (mb_substr($phone, 0, 1) == '-') {
$phone = mb_substr($phone, 1, strlen($phone) - 1);
}
- if (strlen($phone) == 7) {
+ if (strlen($phone) === 7) {
// Fix the missing -
$phone = mb_substr($phone, 0, 3) . '-' . mb_substr($phone, 3, 4);
}
diff --git a/src/ChurchCRM/Reports/PDF_Directory.php b/src/ChurchCRM/Reports/PDF_Directory.php
index bb40404360..0bea112d93 100644
--- a/src/ChurchCRM/Reports/PDF_Directory.php
+++ b/src/ChurchCRM/Reports/PDF_Directory.php
@@ -359,7 +359,7 @@ public function sGetHeadString($rsCustomFields, $aHead): string
$sHeadStr = '';
- if (strlen($per_LastName) && (strtolower($per_LastName) != strtolower($this->sLastName))) {
+ if (!empty($per_LastName) && (strtolower($per_LastName) != strtolower($this->sLastName))) {
$bDifferentLastName = true;
} else {
$bDifferentLastName = false;
@@ -421,7 +421,7 @@ public function sGetHeadString($rsCustomFields, $aHead): string
// If there is no additional information for either head or spouse, there is no
// need to print the name in the sublist, they are already are in the heading.
- if (strlen($sHeadStr) == $iTempLen) {
+ if (strlen($sHeadStr) === $iTempLen) {
return '';
} else {
return $sHeadStr;
diff --git a/src/ChurchCRM/Service/GroupService.php b/src/ChurchCRM/Service/GroupService.php
index 5129103655..9347373762 100644
--- a/src/ChurchCRM/Service/GroupService.php
+++ b/src/ChurchCRM/Service/GroupService.php
@@ -227,7 +227,7 @@ public function deleteGroupRole(string $groupID, string $groupRoleID): array
public function addGroupRole(string $groupID, string $groupRoleName): string
{
requireUserGroupMembership('bManageGroups');
- if (strlen($groupRoleName) == 0) {
+ if (strlen($groupRoleName) === 0) {
throw new \Exception('New field name cannot be blank');
} else {
// Check for a duplicate option name
diff --git a/src/ChurchCRM/dto/Cart.php b/src/ChurchCRM/dto/Cart.php
index e11b7ce113..8313d1efff 100644
--- a/src/ChurchCRM/dto/Cart.php
+++ b/src/ChurchCRM/dto/Cart.php
@@ -104,7 +104,7 @@ public static function removeGroup($GroupID): void
public static function hasPeople(): bool
{
- return array_key_exists('aPeopleCart', $_SESSION) && count($_SESSION['aPeopleCart']) != 0;
+ return array_key_exists('aPeopleCart', $_SESSION) && count($_SESSION['aPeopleCart']) !== 0;
}
public static function countPeople(): int
diff --git a/src/DonatedItemReplicate.php b/src/DonatedItemReplicate.php
index 586e991039..74bedab346 100644
--- a/src/DonatedItemReplicate.php
+++ b/src/DonatedItemReplicate.php
@@ -18,7 +18,7 @@
$row = mysqli_fetch_array($rsItem);
$startItem = $row[0];
-if (strlen($startItem) == 2) { // replicated items will sort better if they have a two-digit number
+if (strlen($startItem) === 2) { // replicated items will sort better if they have a two-digit number
$letter = mb_substr($startItem, 0, 1);
$number = mb_substr($startItem, 1, 1);
$startItem = $letter . '0' . $number;
diff --git a/src/DonationFundEditor.php b/src/DonationFundEditor.php
index a26cf0baa2..80918a5c79 100644
--- a/src/DonationFundEditor.php
+++ b/src/DonationFundEditor.php
@@ -56,7 +56,7 @@
$donation->setName(InputUtils::filterString($_POST[$iFieldID . 'name']));
$donation->setDescription(InputUtils::legacyFilterInput($_POST[$iFieldID . 'desc']));
$donation->setActive($_POST[$iFieldID . 'active'] == 1);
- if (strlen($donation->getName()) == 0) {
+ if (strlen($donation->getName()) === 0) {
$aNameErrors[$iFieldID] = true;
$bErrorFlag &= $aNameErrors[$iFieldID];
}
diff --git a/src/FamilyCustomFieldsEditor.php b/src/FamilyCustomFieldsEditor.php
index 5fd7dace44..ef98195fa5 100644
--- a/src/FamilyCustomFieldsEditor.php
+++ b/src/FamilyCustomFieldsEditor.php
@@ -48,7 +48,7 @@
for ($iFieldID = 1; $iFieldID <= $numRows; $iFieldID++) {
$aNameFields[$iFieldID] = InputUtils::legacyFilterInput($_POST[$iFieldID . 'name']);
- if (strlen($aNameFields[$iFieldID]) == 0) {
+ if (strlen($aNameFields[$iFieldID]) === 0) {
$aNameErrors[$iFieldID] = true;
$bErrorFlag = true;
} else {
diff --git a/src/FamilyEditor.php b/src/FamilyEditor.php
index 45a64c01bb..41e69e57a4 100644
--- a/src/FamilyEditor.php
+++ b/src/FamilyEditor.php
@@ -157,7 +157,7 @@
// Make sure first names were entered if editing existing family
if ($iFamilyID > 0) {
- if (strlen($aFirstNames[$iCount]) == 0) {
+ if (strlen($aFirstNames[$iCount]) === 0) {
$aFirstNameError[$iCount] = gettext('First name must be entered');
$bErrorFlag = true;
}
diff --git a/src/GroupPropsFormEditor.php b/src/GroupPropsFormEditor.php
index 31767730ba..ac0bbc0f44 100644
--- a/src/GroupPropsFormEditor.php
+++ b/src/GroupPropsFormEditor.php
@@ -61,7 +61,7 @@
for ($iPropID = 1; $iPropID <= $numRows; $iPropID++) {
$aNameFields[$iPropID] = InputUtils::legacyFilterInput($_POST[$iPropID . 'name']);
- if (strlen($aNameFields[$iPropID]) == 0) {
+ if (strlen($aNameFields[$iPropID]) === 0) {
$aNameErrors[$iPropID] = true;
$bErrorFlag = true;
} else {
@@ -114,7 +114,7 @@
$newFieldName = InputUtils::legacyFilterInput($_POST['newFieldName']);
$newFieldDesc = InputUtils::legacyFilterInput($_POST['newFieldDesc']);
- if (strlen($newFieldName) == 0) {
+ if (strlen($newFieldName) === 0) {
$bNewNameError = true;
} else {
$sSQL = 'SELECT prop_Name FROM groupprop_master WHERE grp_ID = ' . $iGroupID;
diff --git a/src/GroupView.php b/src/GroupView.php
index b87a5fca58..20971511e4 100644
--- a/src/GroupView.php
+++ b/src/GroupView.php
@@ -351,7 +351,7 @@
extract($aRow);
//If the property doesn't already exist for this Person, write the ';
}
}
diff --git a/src/Include/Functions.php b/src/Include/Functions.php
index 9bbb61b890..4c3682af7d 100644
--- a/src/Include/Functions.php
+++ b/src/Include/Functions.php
@@ -350,12 +350,12 @@ function FormatDate($dDate, bool $bWithTime = false): string
return '';
}
- if (strlen($dDate) == 10) { // If only a date was passed append time
+ if (strlen($dDate) === 10) { // If only a date was passed append time
$dDate = $dDate . ' 12:00:00';
} // Use noon to avoid a shift in daylight time causing
// a date change.
- if (strlen($dDate) != 19) {
+ if (strlen($dDate) !== 19) {
return '';
}
@@ -714,7 +714,7 @@ function formCustomField($type, string $fieldname, $data, ?string $special, bool
echo '
';
break;
// Handler for date fields
@@ -884,7 +884,7 @@ function assembleYearMonthDay($sYear, $sMonth, $sDay, $pasfut = 'future')
// Parse the year
// Take a 2 or 4 digit year and return a 4 digit year. Use $pasfut to determine if
// two digit year maps to past or future 4 digit year.
- if (strlen($sYear) == 2) {
+ if (strlen($sYear) === 2) {
$thisYear = date('Y');
$twoDigit = mb_substr($thisYear, 2, 2);
if ($sYear == $twoDigit) {
@@ -1029,7 +1029,7 @@ function parseAndValidateDate($data, $locale = 'US', $pasfut = 'future')
// Now use the date() function to convert timestamp into YYYY-MM-DD
$dateString = date('Y-m-d', $timeStamp);
- if (strlen($dateString) != 10) {
+ if (strlen($dateString) !== 10) {
// Common sense says we have a 10 character string. If not, something is wrong
// and it's time to bail.
return false;
@@ -1074,8 +1074,8 @@ function validateCustomField($type, &$data, $col_Name, ?array &$aErrors): bool
// Handler for 4-digit year
case 6:
- if (strlen($data) != 0) {
- if (!is_numeric($data) || strlen($data) != 4 || $data < 0) {
+ if (strlen($data) !== 0) {
+ if (!is_numeric($data) || strlen($data) !== 4 || $data < 0) {
$aErrors[$col_Name] = gettext('Invalid Year');
$bErrorFlag = true;
}
@@ -1084,7 +1084,7 @@ function validateCustomField($type, &$data, $col_Name, ?array &$aErrors): bool
// Handler for integer numbers
case 8:
- if (strlen($data) != 0) {
+ if (strlen($data) !== 0) {
if ($aLocaleInfo['thousands_sep']) {
$data = preg_replace('/' . $aLocaleInfo['thousands_sep'] . '/i', '', $data); // remove any thousands separators
}
@@ -1100,7 +1100,7 @@ function validateCustomField($type, &$data, $col_Name, ?array &$aErrors): bool
// Handler for money amounts
case 10:
- if (strlen($data) != 0) {
+ if (strlen($data) !== 0) {
if ($aLocaleInfo['mon_thousands_sep']) {
$data = preg_replace('/' . $aLocaleInfo['mon_thousands_sep'] . '/i', '', $data);
}
@@ -1237,10 +1237,10 @@ function FilenameToFontname(string $filename, string $family): string
if ($filename == $family) {
return ucfirst($family);
} else {
- if (strlen($filename) - strlen($family) == 2) {
+ if (strlen($filename) - strlen($family) === 2) {
return ucfirst($family) . gettext(' Bold Italic');
} else {
- if (mb_substr($filename, strlen($filename) - 1) == 'i') {
+ if (mb_substr($filename, strlen($filename) - 1) === 'i') {
return ucfirst($family) . gettext(' Italic');
} else {
return ucfirst($family) . gettext(' Bold');
diff --git a/src/OptionManager.php b/src/OptionManager.php
index 2cb37222c6..18e1749dc4 100644
--- a/src/OptionManager.php
+++ b/src/OptionManager.php
@@ -158,7 +158,7 @@
if (isset($_POST['AddField'])) {
$newFieldName = InputUtils::legacyFilterInput($_POST['newFieldName']);
- if (strlen($newFieldName) == 0) {
+ if (strlen($newFieldName) === 0) {
$iNewNameError = 1;
} else {
// Check for a duplicate option name
@@ -220,7 +220,7 @@
}
for ($row = 1; $row <= $numRows; $row++) {
- if (strlen($aNameFields[$row]) == 0) {
+ if (strlen($aNameFields[$row]) === 0) {
$aNameErrors[$row] = 1;
$bErrorFlag = true;
} elseif ($row < $numRows) {
diff --git a/src/PersonCustomFieldsEditor.php b/src/PersonCustomFieldsEditor.php
index 2f7bb208c1..4e7a2c45fb 100644
--- a/src/PersonCustomFieldsEditor.php
+++ b/src/PersonCustomFieldsEditor.php
@@ -47,7 +47,7 @@
for ($iFieldID = 1; $iFieldID <= $numRows; $iFieldID++) {
$aNameFields[$iFieldID] = InputUtils::legacyFilterInput($_POST[$iFieldID . 'name']);
- if (strlen($aNameFields[$iFieldID]) == 0) {
+ if (strlen($aNameFields[$iFieldID]) === 0) {
$aNameErrors[$iFieldID] = true;
$bErrorFlag = true;
} else {
@@ -86,7 +86,7 @@
$newFieldName = InputUtils::legacyFilterInput($_POST['newFieldName']);
$newFieldSec = $_POST['newFieldSec'];
- if (strlen($newFieldName) == 0) {
+ if (strlen($newFieldName) === 0) {
$bNewNameError = true;
} elseif (strlen($newFieldType) === 0 || $newFieldType < 1) {
// This should never happen, but check anyhow.
diff --git a/src/PersonView.php b/src/PersonView.php
index a68698641c..ebab43a747 100644
--- a/src/PersonView.php
+++ b/src/PersonView.php
@@ -707,7 +707,7 @@
-
+
= gettext('Assign a New Property') ?>:
@@ -825,7 +825,7 @@
while ($aRow = mysqli_fetch_array($rsVolunteerOpps)) {
extract($aRow);
//If the property doesn't already exist for this Person, write the ';
}
} ?>
diff --git a/src/PropertyAssign.php b/src/PropertyAssign.php
index 66fa8beeec..ad82db7896 100644
--- a/src/PropertyAssign.php
+++ b/src/PropertyAssign.php
@@ -118,7 +118,7 @@ function UpdateProperty($iRecordID, $sValue, $iPropertyID, $sAction)
$sPrompt = $aRow['pro_Prompt'];
// If there's no prompt, then just do the insert
-if (strlen($sPrompt) == 0) {
+if (strlen($sPrompt) === 0) {
UpdateProperty($iRecordID, '', $iPropertyID, $sAction);
// Set the Global Message
diff --git a/src/Reports/FamilyPledgeSummary.php b/src/Reports/FamilyPledgeSummary.php
index f6c06f15f3..00758dfa41 100644
--- a/src/Reports/FamilyPledgeSummary.php
+++ b/src/Reports/FamilyPledgeSummary.php
@@ -269,7 +269,7 @@ public function __construct()
$totalAmountPledges = 0;
- if (mysqli_num_rows($rsPledges) != 0) {
+ if (mysqli_num_rows($rsPledges) !== 0) {
$totalAmount = 0;
$cnt = 0;
while ($aRow = mysqli_fetch_array($rsPledges)) {
@@ -295,7 +295,7 @@ public function __construct()
$rsPledges = RunQuery($sSQL);
$totalAmountPayments = 0;
- if (mysqli_num_rows($rsPledges) != 0) {
+ if (mysqli_num_rows($rsPledges) !== 0) {
$totalAmount = 0;
$cnt = 0;
while ($aRow = mysqli_fetch_array($rsPledges)) {
diff --git a/src/bin/google-map/GoogleMap.php b/src/bin/google-map/GoogleMap.php
index 694c2e87e4..47186a2b94 100644
--- a/src/bin/google-map/GoogleMap.php
+++ b/src/bin/google-map/GoogleMap.php
@@ -1564,7 +1564,7 @@ public function addKMLOverlay($file)
*/
public function adjustCenterCoords($lon, $lat)
{
- if (strlen((string) $lon) == 0 || strlen((string) $lat) == 0) {
+ if (strlen((string) $lon) === 0 || strlen((string) $lat) === 0) {
return false;
}
$this->_max_lon = (float) max($lon, $this->_max_lon);
@@ -2702,7 +2702,7 @@ public function getCache($address)
*/
public function putCache($address, $lon, $lat)
{
- if (!isset($this->dsn) || (strlen($address) == 0 || strlen($lon) == 0 || strlen($lat) == 0)) {
+ if (!isset($this->dsn) || (strlen($address) === 0 || strlen($lon) === 0 || strlen($lat) === 0)) {
return false;
}
// PEAR DB
diff --git a/src/eGive.php b/src/eGive.php
index 1567a5b591..5b2afc1915 100644
--- a/src/eGive.php
+++ b/src/eGive.php
@@ -384,7 +384,7 @@ function get_api_data($json)
function yearFirstDate($date)
{
$dateArray = explode('/', $date); // This date is in mm/dd/yy format. churchCRM needs it in yyyy-mm-dd format
- if (strlen($dateArray[2]) == 2) {
+ if (strlen($dateArray[2]) === 2) {
$dateArray[2] += 2000;
}
$dateArray[0] = sprintf('%02d', $dateArray[0]);