浏览代码

php 8 fix add staticFetch

Sebijk 3 年之前
父节点
当前提交
698b979173
共有 5 个文件被更改,包括 27 次插入6 次删除
  1. 1 1
      src/index.php
  2. 2 2
      src/serverlib/calendar.class.php
  3. 1 1
      src/serverlib/mailbox.class.php
  4. 22 1
      src/serverlib/user.class.php
  5. 1 1
      src/serverlib/webdisk.class.php

+ 1 - 1
src/index.php

@@ -1009,7 +1009,7 @@ else if($_REQUEST['action'] == 'completeAddressBookEntry'
 			$book->InvalidateSelfCompleteInvitation($contactID, $key);
 
 			// send mail
-			$userData = BMUser::Fetch($contactData['user']);
+			$userData = BMUser::staticFetch($contactData['user']);
 			$vars = array(
 				'vorname'	=> $contactData['vorname'],
 				'nachname'	=> $contactData['nachname']

+ 2 - 2
src/serverlib/calendar.class.php

@@ -817,7 +817,7 @@ class BMCalendar
 		if($userID == -1)
 		{
 			if($this->_userID != $userRow['id'])
-				$userRow	= BMUser::Fetch($this->_userID);
+				$userRow	= BMUser::staticFetch($this->_userID);
 			$firstDay		= $userRow['c_firstday'];
 			$datesStart 	= mktime(0, 0, 0, $month, 1, $year);
 			$datesEnd 		= mktime(23, 59, 59, $month, $daysInMonth, $year);
@@ -828,7 +828,7 @@ class BMCalendar
 		else
 		{
 			if($userID != $userRow['id'])
-				$userRow	= BMUser::Fetch($userID);
+				$userRow	= BMUser::staticFetch($userID);
 			$firstDay		= $userRow['c_firstday'];
 			$userCalendar 	= _new('BMCalendar', array($userID));
 			$datesStart 	= mktime(0, 0, 0, $month, 1, $year);

+ 1 - 1
src/serverlib/mailbox.class.php

@@ -1886,7 +1886,7 @@ class BMMailbox
 
 		// TODO: shared folders
 
-		$userInfo = BMUser::Fetch($this->_userID);
+		$userInfo = BMUser::staticFetch($this->_userID);
 
 		// select new mails
 		$res = $db->Query('SELECT COUNT(*) FROM {pre}mails WHERE '

+ 22 - 1
src/serverlib/user.class.php

@@ -1170,7 +1170,7 @@ class BMUser
 				if(isset($pluginAuth['profile'])
 					&& $row['gesperrt'] == 'no')
 				{
-					$theOldUserRow = $theUserRow = BMUser::Fetch($row['id']);
+					$theOldUserRow = $theUserRow = BMUser::staticFetch($row['id']);
 
 					$theUserRow['passwort'] = md5($password.$row['passwort_salt']);
 					foreach($pluginAuth['profile'] as $key=>$val)
@@ -1432,6 +1432,27 @@ class BMUser
 		return($row);
 	}
 
+	/**
+	 * fetch a user row (static function)
+	 *
+	 * @param int $id
+	 * @return array
+	 */
+	public static function staticFetch($id)
+	{
+		global $db;
+		if(!isset($id)) 
+			return false;
+		$res = $db->Query('SELECT * FROM {pre}users WHERE id=?',
+			$id);
+		if($res->RowCount() == 0)
+			return(false);
+		$row = $res->FetchArray(MYSQLI_ASSOC);
+		$res->Free();
+
+		return($row);
+	}
+
 	/**
 	 * refresh user row
 	 *

+ 1 - 1
src/serverlib/webdisk.class.php

@@ -445,7 +445,7 @@ class BMWebdisk
 		}
 		else
 		{
-			$userRow = BMUser::Fetch($this->_userID);
+			$userRow = BMUser::staticFetch($this->_userID);
 			$info = array(
 					'id'		=> 0,
 					'type'		=> WEBDISK_ITEM_FOLDER,