Fixed bug #13294: IRRE deleted combo records are still validated by TBE_EDITOR (Thank...
[Packages/TYPO3.CMS.git] / typo3 / wizard_forms.php
index f94ecc6..6e35581 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  * Wizard to help make forms (fx. for tt_content elements) of type 'form'.
  *
  * $Id$
- * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
+ * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
  * XHTML compliant
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
@@ -168,7 +168,7 @@ $LANG->includeLLFile('EXT:lang/locallang_wizards.xml');
 /**
  * Script Class for rendering the Form Wizard
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -290,9 +290,9 @@ class SC_wizard_forms {
                        $buttons['csh_buttons'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'wizard_forms_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) . '" />';
@@ -316,9 +316,8 @@ class SC_wizard_forms {
 
                        // First, check the references by selecting the record:
                $row = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
-               if (!is_array($row))    {
-                       t3lib_BEfunc::typo3PrintError ('Wizard Error','No reference to record',0);
-                       exit;
+               if (!is_array($row)) {
+                       throw new RuntimeException('Wizard Error: No reference to record');
                }
 
                        // This will get the content of the form configuration code field to us - possibly cleaned up, saved to database etc. if the form has been submitted in the meantime.
@@ -401,7 +400,7 @@ class SC_wizard_forms {
 
                                        // If the save/close button was pressed, then redirect the screen:
                                if ($_POST['saveandclosedok_x']) {
-                                       t3lib_div::redirect($this->P['returnUrl']);
+                                       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:
@@ -800,7 +799,7 @@ class SC_wizard_forms {
 
                                                // Default:
                                        if ($vv['type']=='select' || $vv['type']=='radio')      {
-                                               $thisLine[2]=str_replace(chr(10),', ',str_replace(',','',$vv['options']));
+                                               $thisLine[2]=str_replace(LF,', ',str_replace(',','',$vv['options']));
                                        } elseif ($vv['type']=='check') {
                                                if ($vv['default'])     $thisLine[2]=1;
                                        } elseif (strcmp(trim($vv['default']),'')) {
@@ -814,7 +813,7 @@ class SC_wizard_forms {
                        }
                }
                        // Finally, implode the lines into a string, and return it:
-               return implode(chr(10),$inLines);
+               return implode(LF,$inLines);
        }
 
        /**
@@ -827,7 +826,7 @@ class SC_wizard_forms {
        function cfgString2CfgArray($cfgStr)    {
 
                        // Traverse the number of form elements:
-               $tLines=explode(chr(10),$cfgStr);
+               $tLines=explode(LF,$cfgStr);
                foreach($tLines as $k => $v)    {
 
                                // Initialize:
@@ -870,7 +869,7 @@ class SC_wizard_forms {
                                        switch((string)$confData['type'])       {
                                                case 'select':
                                                case 'radio':
-                                                       $confData['default'] = implode(chr(10),t3lib_div::trimExplode(',',$parts[2]));
+                                                       $confData['default'] = implode(LF,t3lib_div::trimExplode(',',$parts[2]));
                                                break;
                                                default:
                                                        $confData['default'] = trim($parts[2]);