Fixed bug #15516: htmlArea RTE: Safari does not support WISIWYG editing on iPad
[Packages/TYPO3.CMS.git] / typo3 / wizard_table.php
index 6d2b89d..5407073 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2010 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -209,9 +209,9 @@ class SC_wizard_table {
                        $buttons['csh_buttons'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'wizard_table_wiz_buttons', $GLOBALS['BACK_PATH'], '');
 
                        // Close
-                       $buttons['close'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(unescape(\'' . rawurlencode($this->P['returnUrl']) . '\')); return false;') . '">' .
-                               '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/closedok.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', 1) . '" alt="" />' .
-                               '</a>';
+                       $buttons['close'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(unescape(\'' . rawurlencode(t3lib_div::sanitizeLocalUrl($this->P['returnUrl'])) . '\')); return false;') . '">' .
+                               t3lib_iconWorks::getSpriteIcon('actions-document-close', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', TRUE))) .
+                 '</a>';
 
                        // Save
                        $buttons['save'] = '<input type="image" class="c-inputButton" name="savedok"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/savedok.gif') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" />';
@@ -318,9 +318,8 @@ class SC_wizard_table {
                                $tce->process_datamap();
 
                                        // If the save/close button was pressed, then redirect the screen:
-                               if ($_POST['saveandclosedok_x'])        {
-                                       header('Location: '.t3lib_div::locationHeaderUrl($this->P['returnUrl']));
-                                       exit;
+                               if ($_POST['saveandclosedok_x']) {
+                                       t3lib_utility_Http::redirect(t3lib_div::sanitizeLocalUrl($this->P['returnUrl']));
                                }
                        }
                } else {        // If nothing has been submitted, load the $bodyText variable from the selected database row:
@@ -360,7 +359,7 @@ class SC_wizard_table {
                                        if ($this->inputStyle)  {
                                                $cells[]='<input type="text"'.$this->doc->formWidth(20).' name="TABLE[c]['.(($k+1)*2).']['.(($a+1)*2).']" value="'.htmlspecialchars($cellContent).'" />';
                                        } else {
-                                               $cellContent=eregi_replace('<br[ ]?[\/]?>',chr(10),$cellContent);
+                                               $cellContent=preg_replace('/<br[ ]?[\/]?>/i',LF,$cellContent);
                                                $cells[]='<textarea '.$this->doc->formWidth(20).' rows="5" name="TABLE[c]['.(($k+1)*2).']['.(($a+1)*2).']">'.t3lib_div::formatForTextarea($cellContent).'</textarea>';
                                        }
 
@@ -553,8 +552,7 @@ class SC_wizard_table {
                                ksort($this->TABLECFG['c']);
                        }
                        if (substr($cmd,0,4)=='col_')   {
-                               reset($this->TABLECFG['c']);
-                               while(list($cAK)=each($this->TABLECFG['c']))    {
+                               foreach ($this->TABLECFG['c'] as $cAK => $value) {
                                        switch($cmd)    {
                                                case 'col_remove':
                                                        unset($this->TABLECFG['c'][$cAK][$kk]);
@@ -585,11 +583,9 @@ class SC_wizard_table {
                }
 
                // Convert line breaks to <br /> tags:
-               reset($this->TABLECFG['c']);
-               while(list($a)=each($this->TABLECFG['c']))      {
-                       reset($this->TABLECFG['c'][$a]);
-                       while(list($b)=each($this->TABLECFG['c'][$a]))  {
-                               $this->TABLECFG['c'][$a][$b] = str_replace(chr(10),'<br />',str_replace(chr(13),'',$this->TABLECFG['c'][$a][$b]));
+               foreach ($this->TABLECFG['c'] as $a => $value) {
+                       foreach ($this->TABLECFG['c'][$a] as $b => $value2) {
+                               $this->TABLECFG['c'][$a][$b] = str_replace(LF,'<br />',str_replace(CR,'',$this->TABLECFG['c'][$a][$b]));
                        }
                }
        }
@@ -607,18 +603,16 @@ class SC_wizard_table {
                $inLines=array();
 
                        // Traverse the elements of the table wizard and transform the settings into configuration code.
-               reset($this->TABLECFG['c']);
-               while(list($a)=each($this->TABLECFG['c']))      {
+               foreach ($this->TABLECFG['c'] as $a => $value) {
                        $thisLine=array();
-                       reset($this->TABLECFG['c'][$a]);
-                       while(list($b)=each($this->TABLECFG['c'][$a]))  {
+                       foreach ($this->TABLECFG['c'][$a] as $b => $value) {
                                $thisLine[]=$this->tableParsing_quote.str_replace($this->tableParsing_delimiter,'',$this->TABLECFG['c'][$a][$b]).$this->tableParsing_quote;
                        }
                        $inLines[]=implode($this->tableParsing_delimiter,$thisLine);
                }
 
                        // Finally, implode the lines into a string:
-               $bodyText = implode(chr(10),$inLines);
+               $bodyText = implode(LF,$inLines);
 
                        // Return the configuration code:
                return $bodyText;
@@ -635,7 +629,7 @@ class SC_wizard_table {
        function cfgString2CfgArray($cfgStr,$cols)      {
 
                        // Explode lines in the configuration code - each line is a table row.
-               $tLines=explode(chr(10),$cfgStr);
+               $tLines=explode(LF,$cfgStr);
 
                        // Setting number of columns
                if (!$cols && trim($tLines[0])) {       // auto...