[TYPO3-core] FYI: Committed fix in t3lib_beFunc::getRecordWSOL

Robert Lemke robert at typo3.org
Fri Dec 16 21:51:57 CET 2005


Hi folks,

I just committed a little bug fix for t3lib_beFunc::getRecordWSOL which I 
discussed with Kasper. I tested and unit tested it but it shouldn't hurt if 
you have a quick look at it anyway ...

It makes sure that the fields uid, pid and in case of table "pages" 
t3ver_swapmode are selected internally because workspaceOL requires them.

Cheers,
robert

-- 
Robert Lemke
TYPO3 Association - Research & Development
Member of the board
http://association.typo3.org
-------------- next part --------------
Index: class.t3lib_befunc.php
===================================================================
RCS file: /cvsroot/typo3/TYPO3core/t3lib/class.t3lib_befunc.php,v
retrieving revision 1.53
diff -u -r1.53 class.t3lib_befunc.php
--- class.t3lib_befunc.php	7 Nov 2005 17:16:45 -0000	1.53
+++ class.t3lib_befunc.php	16 Dec 2005 20:44:23 -0000
@@ -31,7 +31,7 @@
  * Call ALL methods without making an object!
  * Eg. to get a page-record 51 do this: 't3lib_BEfunc::getRecord('pages',51)'
  *
- * $Id: class.t3lib_befunc.php,v 1.53 2005/11/07 17:16:45 typo3 Exp $
+ * $Id: class.t3lib_befunc.php,v 1.55 2005/12/15 17:34:11 mundaun Exp $
  * Usage counts are based on search 22/2 2003 through whole backend source of typo3/
  * Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj
  * XHTML compliant
@@ -239,9 +239,23 @@
 	 * @param	string		Additional WHERE clause, eg. " AND blablabla=0"
 	 * @return	array		Returns the row if found, otherwise nothing
 	 */
-	function getRecordWSOL($table,$uid,$fields='*',$where='')	{
-		$row = t3lib_BEfunc::getRecord($table,$uid,$fields,$where);
-		t3lib_BEfunc::workspaceOL($table,$row);
+	function getRecordWSOL($table,$uid,$fields='*',$where='') {
+		if ($fields !== '*') {
+			$internalFields = t3lib_div::uniqueList($fields.',uid,pid'.($table == 'pages' ? ',t3ver_swapmode' : ''));
+			$row = t3lib_BEfunc::getRecord($table,$uid,$internalFields,$where);
+			t3lib_BEfunc::workspaceOL($table,$row);
+	
+			if (is_array ($row)) {
+				foreach (array_keys($row) as $key) {
+					if (!t3lib_div::inList($fields, $key) && $key{0} !== '_') {
+						unset ($row[$key]);
+					}
+				}	
+			}
+		} else {
+			$row = t3lib_BEfunc::getRecord($table,$uid,$fields,$where);
+			t3lib_BEfunc::workspaceOL($table,$row);
+		}		
 		return $row;
 	}
 
@@ -2232,7 +2246,7 @@
 			}
 		}
 
-		return "previewWin=window.open('".$url."','newTypo3FrontendWindow','status=1,menubar=1,resizable=1,location=1,scrollbars=1,toolbar=1');".
+		return "previewWin=window.open('".$url."','newTYPO3frontendWindow');".
 				($switchFocus ? 'previewWin.focus();' : '');
 	}
 
@@ -2441,8 +2455,7 @@
 				$settings=array();
 			}
 			if (is_array($MOD_MENU))	{
-				reset($MOD_MENU);
-				while(list($key,$var)=each($MOD_MENU))	{
+				foreach ($MOD_MENU as $key=>$var)	{
 						// If a global var is set before entering here. eg if submitted, then it's substituting the current value the array.
 					if (is_array($CHANGED_SETTINGS) && isset($CHANGED_SETTINGS[$key]) && strcmp($settings[$key],$CHANGED_SETTINGS[$key]))	{
 						$settings[$key] = (string)$CHANGED_SETTINGS[$key];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20051216/32d56fed/attachment.pgp 


More information about the TYPO3-team-core mailing list