Kaynağa Gözat

Ticket #5491 - PHP 8.5 compatibility.

AntonLV 5 ay önce
ebeveyn
işleme
fbb2d7e5d4

+ 6 - 6
inc/classes/BxDolDb.php

@@ -464,19 +464,19 @@ class BxDolDb extends BxDolFactory implements iBxDolSingleton
     /**
      * execute sql query and return table of records as result
      */
-    public function getPairs($oStatement, $sFieldKey, $sFieldValue, $aBindings = array(), $iFetchType = PDO::FETCH_ASSOC)
+    public function getPairs($oStatement, $sFieldKey, $sFieldValue, $aBindings = [], $iFetchType = PDO::FETCH_ASSOC)
     {
-    	$aResult = array();
+    	$aResult = [];
         if(!$oStatement)
             return $aResult;
-		else if(!($oStatement instanceof PDOStatement) && is_string($oStatement))
-			$oStatement = $this->prepare($oStatement);
+        else if(!($oStatement instanceof PDOStatement) && is_string($oStatement))
+            $oStatement = $this->prepare($oStatement);
 
         $aRow = $this->getFirstRow($oStatement, $aBindings, $iFetchType);
         while(!empty($aRow)) {
-        	$aResult[$aRow[$sFieldKey]] = $aRow[$sFieldValue];
+            $aResult[$aRow[$sFieldKey] ?? ''] = $aRow[$sFieldValue];
 
-        	$aRow = $this->getNextRow($iFetchType);
+            $aRow = $this->getNextRow($iFetchType);
         }
 
         return $aResult;

+ 2 - 2
modules/base/groups/classes/BxBaseModGroupsTemplate.php

@@ -51,9 +51,9 @@ class BxBaseModGroupsTemplate extends BxBaseModProfileTemplate
         if (!$oProfile) 
             $oProfile = BxDolProfileUndefined::getInstance();
 
-        $aVars['title'] = (boolean)$aVars['public'] ? bx_process_output($aData[$CNF['FIELD_NAME']]) : _t($CNF['T']['txt_private_group']);
+        $aVars['title'] = (bool)$aVars['public'] ? bx_process_output($aData[$CNF['FIELD_NAME']]) : _t($CNF['T']['txt_private_group']);
         $aVars['description'] = '';
-        if(!empty($CNF['FIELD_TEXT']) && !empty($aData[$CNF['FIELD_TEXT']]) && (boolean)$aVars['public'])
+        if(!empty($CNF['FIELD_TEXT']) && !empty($aData[$CNF['FIELD_TEXT']]) && (bool)$aVars['public'])
             $aVars['description'] = strmaxtextlen(strip_tags($aData[$CNF['FIELD_TEXT']]), $this->_iUnitCharsSummary);
 
         $aVars['author'] = $oProfile->getDisplayName();

+ 1 - 1
modules/boonex/files/classes/BxFilesModule.php

@@ -247,7 +247,7 @@ class BxFilesModule extends BxBaseModFilesModule
             }
             
             $sCommand = '"' . constant('BX_SYSTEM_JAVA') . '" -Djava.awt.headless=true -jar "' . $this->_oConfig->getHomePath() . 'data/tika-app.jar" --encoding=UTF-8 --text "' . $sFilePath . '"';
-            $sData = `$sCommand`;
+            $sData = shell_exec($sCommand);
             @unlink($sFilePath);
 
             $this->_oDb->updateFileData ($aContentInfo[$CNF['FIELD_ID']], $sData);

+ 1 - 1
modules/boonex/notifications/classes/BxNtfsGridSettingsAdministration.php

@@ -62,7 +62,7 @@ class BxNtfsGridSettingsAdministration extends BxTemplGrid
 
     public function setGrouped($bGrouped)
     {
-        $bReinit = $this->_bGrouped !== (boolean)$bGrouped;
+        $bReinit = $this->_bGrouped !== (bool)$bGrouped;
 
         $this->_bGrouped = $bGrouped;
 

+ 2 - 2
modules/boonex/wiki/classes/BxWikiStudioPage.php

@@ -111,8 +111,8 @@ class BxWikiStudioPage extends BxTemplStudioModule
                 'repository' => $oForm->getCleanValue('repo'),
                 'base_url' => $oForm->getCleanValue('base_url'),
                 'lang' => $oForm->getCleanValue('lang'),
-                'unsafe' => (boolean)$oForm->getCleanValue('unsafe'),
-                'add_titles' => (boolean)$oForm->getCleanValue('add_titles'),
+                'unsafe' => (bool)$oForm->getCleanValue('unsafe'),
+                'add_titles' => (bool)$oForm->getCleanValue('add_titles'),
                 'ext' => $oForm->getCleanValue('ext'),
                 'skip_files' => json_decode($oForm->getCleanValue('skip_files'), true),
                 'only_files' => json_decode($oForm->getCleanValue('only_files'), true),

+ 9 - 9
studio/classes/BxDolStudioToolsAudit.php

@@ -350,11 +350,11 @@ class BxDolStudioToolsAudit extends BxDol
 
         $s .= $this->getBlock(_t('_sys_audit_permissions'), '', _t('_sys_audit_msg_permissions'));
 
-        $s .= $this->getBlock('ffmpeg', '', _t('_sys_audit_msg_ffmpeg', `{$sFfmpegPath} 2>&1`));
+        $s .= $this->getBlock('ffmpeg', '', _t('_sys_audit_msg_ffmpeg', shell_exec("{$sFfmpegPath} 2>&1")));
 
         $s .= $this->getBlock(_t('_sys_audit_mail_sending'), '', _t('_sys_audit_msg_mail_sending'));
 
-        $s .= $this->getBlock(_t('_sys_audit_cron_jobs'), '', _t('_sys_audit_msg_cron_jobs', `crontab -l 2>&1`));
+        $s .= $this->getBlock(_t('_sys_audit_cron_jobs'), '', _t('_sys_audit_msg_cron_jobs', shell_exec("crontab -l 2>&1")));
 
         $iCronTime = getParam('sys_cron_time');
         $s .= $this->getBlock(_t('_sys_audit_cron_jobs_exec_time'), '', !empty($iCronTime) ? bx_time_js($iCronTime, BX_FORMAT_DATE_TIME, true) : _t('_None'));
@@ -580,19 +580,19 @@ class BxDolStudioToolsAudit extends BxDol
 
         } else {
 
-            $sApachectlPath = trim(`which apachectl`);
+            $sApachectlPath = trim(shell_exec("which apachectl"));
             if (!$sApachectlPath)
-                $sApachectlPath = trim(`which apache2ctl`);
+                $sApachectlPath = trim(shell_exec("which apache2ctl"));
             if (!$sApachectlPath)
-                $sApachectlPath = trim(`which /usr/local/apache/bin/apachectl`);
+                $sApachectlPath = trim(shell_exec("which /usr/local/apache/bin/apachectl"));
             if (!$sApachectlPath)
-                $sApachectlPath = trim(`which /usr/local/apache/bin/apache2ctl`);
+                $sApachectlPath = trim(shell_exec("which /usr/local/apache/bin/apache2ctl"));
             if (!$sApachectlPath) {
                 return array('type' => BX_DOL_AUDIT_UNDEF);
             }
-            $ret = (boolean)`$sApachectlPath -M 2>&1 | grep $sModule`;
+            $ret = (bool)shell_exec("$sApachectlPath -M 2>&1 | grep $sModule");
             if (!$ret)
-                $ret = (boolean)`$sApachectlPath -l 2>&1 | grep $sNameCompiledName`;
+                $ret = (bool)shell_exec("$sApachectlPath -l 2>&1 | grep $sNameCompiledName");
         }
 
         $aMessage = array('type' => BX_DOL_AUDIT_OK);
@@ -650,7 +650,7 @@ class BxDolStudioToolsAudit extends BxDol
     protected function setErrorReporting ()
     {
         if (version_compare(phpversion(), "5.3.0", ">=") == 1)
-            $this->iPhpErrorReporting = error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED & ~E_STRICT);
+            $this->iPhpErrorReporting = error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
         else
             $this->iPhpErrorReporting = error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
     }

+ 4 - 4
studio/template/scripts/BxBaseStudioStoragesImages.php

@@ -68,18 +68,18 @@ class BxBaseStudioStoragesImages extends BxDolStudioStoragesImages
         )));
     }
 
-	protected function _getCellMimeType($mixedValue, $sKey, $aField, $aRow)
+    protected function _getCellMimeType($mixedValue, $sKey, $aField, $aRow)
     {
     	$iWidth = $iHeight = 0;
 
     	$sFileUrl = $this->_oStorage->getFileUrlById($aRow['id']);
-    	if(!empty($sFileUrl))
-    		list($iWidth, $iHeight) = @getimagesize($sFileUrl);
+    	if(!empty($sFileUrl) && ($aSize = @getimagesize($sFileUrl)))
+            list($iWidth, $iHeight) = $aSize;
 
         return parent::_getCellDefault(_t('_adm_strg_txt_size_mime_type', (int)$iWidth, (int)$iHeight, $mixedValue), $sKey, $aField, $aRow);
     }
 
-	protected function _getFormObjectResize($iId)
+    protected function _getFormObjectResize($iId)
     {
     	bx_import('BxTemplStudioFormView');
 

+ 3 - 3
template/scripts/BxBaseServices.php

@@ -536,15 +536,15 @@ class BxBaseServices extends BxDol implements iBxDolProfileService
 
         $iSubtypes = 0;
         switch($sType) {
-            case 'content';
+            case 'content':
                 $iSubtypes = BX_DOL_MODULE_SUBTYPE_TEXT;
                 break;
 
-            case 'context';
+            case 'context':
                 $iSubtypes = BX_DOL_MODULE_SUBTYPE_CONTEXT;
                 break;
 
-            case 'profile';
+            case 'profile':
                 $iSubtypes = BX_DOL_MODULE_SUBTYPE_PROFILE;
                 break;
         }