Fix bug #3779: edit form on page broken
authorMartin Kutschker <martin.t.kutschker@blackbox.net>
Thu, 6 Jul 2006 10:06:57 +0000 (10:06 +0000)
committerMartin Kutschker <martin.t.kutschker@blackbox.net>
Thu, 6 Jul 2006 10:06:57 +0000 (10:06 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@1602 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/beuser/mod/index.php
typo3/sysext/cms/tslib/class.tslib_content.php
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/tslib/class.tslib_pagegen.php

index 756760a..10f2ede 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
 
+2006-07-06  Martin Kutschker  <martin.t.kutschker@blackbox.net>
+
+       * Fix bug #3779: edit form on page broken
+
 2006-07-01  Martin Kutschker  <martin.t.kutschker@blackbox.net>
 
        * Fix bug #3427: config.spamProtectEmailAddresses may garble mail link
 2006-07-01  Karsten Dambekalns <karsten@typo3.org>
 
        * DBAL update (sysext):
-            * this update closes bugs #3638, #2106, #2866, #3754 (for Firefox, broken in MSIE) and maybe a few more
-           * Implemented support for sysLog() on connection failure
-            * DBAL now honours the no_pconnect setting
-           * For handlers in native mode the setDBinit queries are executed upon connection
-            * The initial value for generated sequences can be configured per handler, to avoid duplicate key errors after having imported data
-           * BLOB fields are handled correctly now during INSERT and UPDATE
-            * Setting $store_lastBuiltQuery acts like in t3lib_db now (fill $debug_lastBuiltQuery)
-           * For the native handler quoting methods directly return the input for speedup, as no quoting is needed in that case
-            * Added support for native and userdefined handler to MetaType()
-           * Changed mapping of types to always use the largest possible integer, map tinytext to varchar instead of text
-            * admin_get_tables() skips tables whose names match /BIN\$/ (coming from the recycle bin on Oracle)
-           * Importing dumps using the install tool now works, see manual for tips
-            * Changed the way NOT NULL and DEFAULT are handled when setting up tables, see manual for the rules that now apply
-           * Code cleanup (indentation, documentation)
-            * Updated the manual and added new content
+        - this update closes bugs #3638, #2106, #2866, #3754 (for Firefox, broken in MSIE) and maybe a few more
+        - Implemented support for sysLog() on connection failure
+        - DBAL now honours the no_pconnect setting
+        - For handlers in native mode the setDBinit queries are executed upon connection
+        - The initial value for generated sequences can be configured per handler, to avoid duplicate key errors after having imported data
+        - BLOB fields are handled correctly now during INSERT and UPDATE
+        - Setting $store_lastBuiltQuery acts like in t3lib_db now (fill $debug_lastBuiltQuery)
+        - For the native handler quoting methods directly return the input for speedup, as no quoting is needed in that case
+        - Added support for native and userdefined handler to MetaType()
+        - Changed mapping of types to always use the largest possible integer, map tinytext to varchar instead of text
+        - admin_get_tables() skips tables whose names match /BIN\$/ (coming from the recycle bin on Oracle)
+        - Importing dumps using the install tool now works, see manual for tips
+        - Changed the way NOT NULL and DEFAULT are handled when setting up tables, see manual for the rules that now apply
+        - Code cleanup (indentation, documentation)
+        - Updated the manual and added new content
 
 2006-06-30  Franz Holzinger <kontakt@fholzinger.com>
 
index f723856..031f2bd 100755 (executable)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -315,7 +315,7 @@ class printAllPageTree_perms extends printAllPageTree {
                                <td nowrap="nowrap">'.$be_group_Array[$row['perms_groupid']]['title'].' &nbsp;</td>
                                <td nowrap="nowrap">'.$this->ext_printPerms($row['perms_group']).' &nbsp;</td>
                                <td nowrap="nowrap" align="center" '.$col1.'>'.$this->ext_printPerms($row['perms_everybody']).' &nbsp;</td>
-                               <td nowrap="nowrap" align="center">'.($row['editlock'] ? '<img src="'.$this->backPath.'gfx/recordlock_warning2.gif" width="22" height="16" title="Edit lock prevents all editing" alt="" />' : $this->ext_printPerms($this->BE_USER->calcPerms($row))).' &nbsp;</td>
+                               <td nowrap="nowrap" align="center">'.($row['editlock'] ? '<img '.t3lib_iconWorks::skinImg($this->backPath,'gfx/recordlock_warning2.gif').' title="Edit lock prevents all editing" alt="" />' : $this->ext_printPerms($this->BE_USER->calcPerms($row))).' &nbsp;</td>
                                <td nowrap="nowrap" align="center">'.$this->ext_printPerms($this->ext_groupPerms($row,$be_group_Array[$this->BE_USER->firstMainGroup])).' &nbsp;</td>
                        </tr>';
                }
@@ -775,7 +775,7 @@ class local_beUserAuth extends t3lib_beUserAuth {
                                                        if (isset($nef[$iCfg[1]]))      {
                                                                unset($nef[$iCfg[1]]);
                                                                if (strlen($iCfg[2]))   {
-                                                                       $icon = '<img src="'.$GLOBALS['BACK_PATH'].'gfx/'.$iCfg[2].'" class="absmiddle" style="margin-right: 5px;" alt="" />';
+                                                                       $icon = '<img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/'.$iCfg[2]).' class="absmiddle" style="margin-right: 5px;" alt="" />';
                                                                } else {
                                                                        $icon = '';
                                                                }
@@ -1336,7 +1336,7 @@ class SC_mod_tools_be_user_index {
                        reset($options);
 
                        $link_createNewUser='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[be_users][0]=new',$this->doc->backPath,-1)).'">'.
-                               '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/new_el.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('new',1).'" alt="" />'.
+                               '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/new_el.gif').' title="'.$GLOBALS['LANG']->getLL('new',1).'" alt="" />'.
                                '</a>';
 
                        $allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%"><td><b>Usernames:</b></td><td width="12">'.$link_createNewUser.'</td></tr></table>';
@@ -1356,8 +1356,8 @@ class SC_mod_tools_be_user_index {
                                reset($dat['users']);
                                while(list(,$uDat)=each($dat['users'])) {
                                        $uListArr[] = '<tr><td width="130">'.t3lib_iconWorks::getIconImage('be_users',$uDat,$GLOBALS['BACK_PATH'],'align="top" title="'.$uDat['uid'].'"').$this->linkuser($uDat['username'],$uDat).'&nbsp;&nbsp;</td><td nowrap="nowrap">'.$this->elementLinks('be_users',$uDat).
-                                               '<a href="'.t3lib_div::linkThisScript(array('SwitchUser'=>$uDat['uid'])).'" target="_top"><img src="'.$GLOBALS['BACK_PATH'].'gfx/su.gif" width="18" height="11" border="0" align="top" title="'.htmlspecialchars('Switch User to: '.$uDat['username']).'" alt="" /></a>'.
-                                               '<a href="'.t3lib_div::linkThisScript(array('SwitchUser'=>$uDat['uid'], 'switchBackUser' => 1)).'" target="_top"><img src="'.$GLOBALS['BACK_PATH'].'gfx/su.gif" width="18" height="11" border="0" align="top" title="'.htmlspecialchars('Switch User to: '.$uDat['username']).' [SU-mode]" alt="" style="background-color:red;" /></a>'.
+                                               '<a href="'.t3lib_div::linkThisScript(array('SwitchUser'=>$uDat['uid'])).'" target="_top"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/su.gif').' border="0" align="top" title="'.htmlspecialchars('Switch user to: '.$uDat['username']).' [change-to mode]" alt="" /></a>'.
+                                               '<a href="'.t3lib_div::linkThisScript(array('SwitchUser'=>$uDat['uid'], 'switchBackUser' => 1)).'" target="_top"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/su_back.gif').' border="0" align="top" title="'.htmlspecialchars('Switch user to: '.$uDat['username']).' [switch-back mode]" alt="" /></a>'.
                                                '</td></tr>';
                                }
                                $allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%">'.implode('',$uListArr).'</table>';
@@ -1409,25 +1409,25 @@ class SC_mod_tools_be_user_index {
        function elementLinks($table,$row)      {
                global $TCA;
                        // Info:
-               $cells[]='<a href="#" onclick="top.launchView(\''.$table.'\', \''.$row['uid'].'\',\''.$GLOBALS['BACK_PATH'].'\'); return false;"><img src="'.$GLOBALS['BACK_PATH'].'gfx/zoom2.gif" width="12" height="12" border="0" align="top" title="Show information" alt="" /></a>';
+               $cells[]='<a href="#" onclick="top.launchView(\''.$table.'\', \''.$row['uid'].'\',\''.$GLOBALS['BACK_PATH'].'\'); return false;"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/zoom2.gif').' border="0" align="top" title="Show information" alt="" /></a>';
 
                        // Edit:
                $params='&edit['.$table.']['.$row['uid'].']=edit';
-               $cells[]='<a href="#" onclick="'.t3lib_BEfunc::editOnClick($params,$GLOBALS['BACK_PATH'],'').'"><img src="'.$GLOBALS['BACK_PATH'].'gfx/edit2.gif" width="11" height="12" border="0" align="top" title="Edit" alt="" /></a>';
+               $cells[]='<a href="#" onclick="'.t3lib_BEfunc::editOnClick($params,$GLOBALS['BACK_PATH'],'').'"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/edit2.gif').' border="0" align="top" title="Edit" alt="" /></a>';
 
                        // Hide:
                $hiddenField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
                if ($row[$hiddenField]) {
                        $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=0';
-                       $cells[]='<a href="'.$this->doc->issueCommand($params).'"><img src="'.$GLOBALS['BACK_PATH'].'gfx/button_unhide.gif" width="11" height="10" border="0" title="Disable" align="top" alt="" /></a>';
+                       $cells[]='<a href="'.$this->doc->issueCommand($params).'"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/button_unhide.gif').' border="0" title="Enable" align="top" alt="" /></a>';
                } else {
                        $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=1';
-                       $cells[]='<a href="'.$this->doc->issueCommand($params).'"><img src="'.$GLOBALS['BACK_PATH'].'gfx/button_hide.gif" width="11" height="10" border="0" title="Disable" align="top" alt="" /></a>';
+                       $cells[]='<a href="'.$this->doc->issueCommand($params).'"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/button_hide.gif').' border="0" title="Disable" align="top" alt="" /></a>';
                }
 
                        // Delete
                $params='&cmd['.$table.']['.$row['uid'].'][delete]=1';
-               $cells[]='<a href="'.$this->doc->issueCommand($params).'" onclick="return confirm(unescape(\''.rawurlencode('Are you sure you want to delete this element?').'\'));"><img src="'.$GLOBALS['BACK_PATH'].'gfx/garbage.gif" width="11" height="12" border="0" align="top" title="Delete(!)" alt="" /></a>';
+               $cells[]='<a href="'.$this->doc->issueCommand($params).'" onclick="return confirm(unescape(\''.rawurlencode('Are you sure you want to delete this element?').'\'));"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/garbage.gif').' border="0" align="top" title="Delete(!)" alt="" /></a>';
 
                return implode('',$cells);
        }
index 0d40113..8a37a44 100755 (executable)
@@ -7087,7 +7087,7 @@ class tslib_cObj {
         * @see editPanel(), editIcons(), t3lib_tsfeBeUserAuth::extEditAction()
         */
        function editPanelLinkWrap($string,$formName,$cmd,$currentRecord='',$confirm='',$nPid='')       {
-               $eFONPage = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editFormsOnPage'] &&  $BE_USER->workspace===0;    // Editing forms on page only supported in Live workspace (because of incomplete implementation)
+               $eFONPage = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editFormsOnPage'] && $GLOBALS['BE_USER']->workspace===0;  // Editing forms on page only supported in Live workspace (because of incomplete implementation)
                $nV=t3lib_div::_GP('ADMCMD_view')?1:0;
                $adminURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir;
 
@@ -7526,4 +7526,4 @@ class tslib_controlTable  {
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php'])  {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php']);
 }
-?>
+?>
\ No newline at end of file
index 7418fcc..b47335b 100755 (executable)
@@ -3360,6 +3360,26 @@ if (version == "n3") {
        }
 
        /**
+        * Encryption (or decryption) of a single character.
+        * Within the given range the character is shifted with the supplied offset.
+        *
+        * @param       int             Ordinal of input character
+        * @param       int             Start of range
+        * @param       int             End of range
+        * @param       int             Offset
+        * @return      string          encoded/decoded version of character
+        */
+       function encryptCharcode($n,$start,$end,$offset)        {
+               $n = $n + $offset;
+               if ($offset > 0 && $n > $end)   {
+                       $n = $start + ($n - $end - 1);
+               } else if ($offset < 0 && $n < $start)  {
+                       $n = $end - ($start - $n - 1);
+               }
+               return chr($n);
+       }
+
+       /**
         * Encryption of email addresses for <A>-tags See the spam protection setup in TS 'config.'
         *
         * @param       string          Input string to en/decode: "mailto:blabla@bla.com"
@@ -3374,10 +3394,20 @@ if (version == "n3") {
                                $out .= '&#'.ord(substr($string, $a, 1)).';';
                        }
                } else  {
-                       for ($a=0; $a<strlen($string); $a++)    {
-                               $charValue = ord(substr($string,$a,1));
-                               $charValue+= intval($this->spamProtectEmailAddresses)*($back?-1:1);
-                               $out.= chr($charValue);
+                               // like str_rot13() but with a variable offset and a wider character range
+                       $len = strlen($string);
+                       $offset = intval($this->spamProtectEmailAddresses)*($back?-1:1);
+                       for ($i=0; $i<$len; $i++)       {
+                               $charValue = ord($string{$i});
+                               if ($charValue >= 0x2B && $charValue <= 0x3A)   {       // 0-9 . , - + / :
+                                       $out .= $this->encryptCharcode($charValue,0x2B,0x3A,$offset);
+                               } elseif ($charValue >= 0x40 && $charValue <= 0x5A)     {       // A-Z @
+                                       $out .= $this->encryptCharcode($charValue,0x40,0x5A,$offset);
+                               } else if ($charValue >= 0x61 && $charValue <= 0x7A)    {       // a-z
+                                       $out .= $this->encryptCharcode($charValue,0x61,0x7A,$offset);
+                               } else {
+                                       $out .= $string{$i};
+                               }
                        }
                }
                return $out;
index a300238..7c10580 100755 (executable)
@@ -149,25 +149,42 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'] === 'ascii') {
                        $GLOBALS['TSFE']->spamProtectEmailAddresses = 'ascii';
                } else {
-                       $GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-5,1,0);
+                       $GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-10,10,0);
                        if ($GLOBALS['TSFE']->spamProtectEmailAddresses)        {
                                $GLOBALS['TSFE']->additionalJavaScript['UnCryptMailto()']='
-  // JS function for uncrypting spam-protected emails:
-function UnCryptMailto(s) {    //
-       var n=0;
-       var r="";
-       for(var i=0; i < s.length; i++) {
-               n=s.charCodeAt(i);
-               if (n>=8364) {n = 128;}
-               r += String.fromCharCode(n-('.$GLOBALS['TSFE']->spamProtectEmailAddresses.'));
+  // decrypt helper function 
+function decryptCharcode(n,start,end,offset) {
+       n = n + offset;
+       if (offset > 0 && n > end)      {
+               n = start + (n - end - 1);
+       } else if (offset < 0 && n < start)     {
+               n = end - (start - n - 1);
        }
-       return r;
+       return String.fromCharCode(n);
 }
-  // JS function for uncrypting spam-protected emails:
-function linkTo_UnCryptMailto(s)       {       //
-       location.href=UnCryptMailto(s);
+  // decrypt string
+function decryptString(enc,offset) {
+       var dec = "";
+       var len = enc.length;
+       for(var i=0; i < len; i++)      {
+               var n = enc.charCodeAt(i);
+               if (n >= 0x2B && n <= 0x39)     {
+                       dec += decryptCharcode(n,0x2B,0x3A,offset);     // 0-9 . , - + / :
+               } else if (n >= 0x40 && n <= 0x5A)      {
+                       dec += decryptCharcode(n,0x40,0x5A,offset);     // A-Z @
+               } else if (n >= 0x61 && n <= 0x7A)      {
+                       dec += decryptCharcode(n,0x61,0x7A,offset);     // a-z
+               } else {
+                       dec += enc.charAt(i);
+               }
+       }
+       return dec;
 }
-               ';
+  // decrypt spam-protected emails
+function linkTo_UnCryptMailto(s)       {
+       location.href = decryptString(s,'.($GLOBALS['TSFE']->spamProtectEmailAddresses*-1).');
+}
+'                              ;
                        }
                }