* Fixed bug #0132: % signs in extra parameters of form contentelements where not...
authorRupert Germann <rupi@gmx.li>
Thu, 18 May 2006 21:50:56 +0000 (21:50 +0000)
committerRupert Germann <rupi@gmx.li>
Thu, 18 May 2006 21:50:56 +0000 (21:50 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@1479 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/tslib/class.tslib_content.php

index 77af1b1..26d479c 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-05-18   Rupert Germann  <rupi@gmx.li>
+
+       * Fixed bug #0132: % signs in extra parameters of form contentelements where not handled correctly.
+
 2006-05-18  Ernesto Baschny  <ernst@cron-it.de>
 
        * Fixed bug #3138: Alignment of text in css_styled_content's Text w/ images (nowrap) was wrong (Firefox)
index c389ace..4295ab1 100755 (executable)
@@ -1736,8 +1736,8 @@ class tslib_cObj {
                                                        $wrap = $wrap ? ' wrap="'.$wrap.'"' : ' wrap="virtual"';
                                                }
                                                $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], str_replace('\n',chr(10),trim($parts[2])));
-                                               $fieldCode=sprintf('<textarea name="%s"'.$elementIdAttribute.' cols="%s" rows="%s"%s'.$addParams.'>%s</textarea>',
-                                                       $confData['fieldname'], $cols, $rows, $wrap, t3lib_div::formatForTextarea($default));
+                                               $fieldCode=sprintf('<textarea name="%s"%s cols="%s" rows="%s"%s%s>%s</textarea>',
+                                                       $confData['fieldname'], $elementIdAttribute, $cols, $rows, $wrap, $addParams, t3lib_div::formatForTextarea($default));
                                        break;
                                        case 'input':
                                        case 'password':
@@ -1754,21 +1754,21 @@ class tslib_cObj {
                                                $max=trim($fParts[2]) ? ' maxlength="'.t3lib_div::intInRange($fParts[2],1,1000).'"' : "";
                                                $theType = $confData['type']=='input' ? 'text' : 'password';
 
-                                               $fieldCode=sprintf('<input type="'.$theType.'" name="%s"'.$elementIdAttribute.' size="%s"%s value="%s"'.$addParams.' />',
-                                                       $confData['fieldname'], $size, $max, htmlspecialchars($default));
+                                               $fieldCode=sprintf('<input type="%s" name="%s"%s size="%s"%s value="%s"%s />',
+                                                       $theType, $confData['fieldname'], $elementIdAttribute, $size, $max, htmlspecialchars($default), $addParams);
 
                                        break;
                                        case 'file':
                                                $size=trim($fParts[1]) ? t3lib_div::intInRange($fParts[1],1,60) : 20;
-                                               $fieldCode=sprintf('<input type="file" name="%s"'.$elementIdAttribute.' size="%s"'.$addParams.' />',
-                                                       $confData['fieldname'], $size);
+                                               $fieldCode=sprintf('<input type="file" name="%s"%s size="%s"%s />',
+                                                       $confData['fieldname'], $elementIdAttribute, $size, $addParams);
                                        break;
                                        case 'check':
                                                        // alternative default value:
                                                $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
                                                $checked = $default ? ' checked="checked"' : '';
-                                               $fieldCode=sprintf('<input type="checkbox" value="%s" name="%s"'.$elementIdAttribute.'%s'.$addParams.' />',
-                                                       1, $confData['fieldname'], $checked);
+                                               $fieldCode=sprintf('<input type="checkbox" value="%s" name="%s"%s%s%s />',
+                                                       1, $confData['fieldname'], $elementIdAttribute, $checked, $addParams);
                                        break;
                                        case 'select':
                                                $option='';
@@ -1781,7 +1781,8 @@ class tslib_cObj {
 
                                                $items=array();         // Where the items will be
                                                $defaults=array(); //RTF
-                                               for($a=0;$a<count($valueParts);$a++)    {
+                                               $pCount = count($valueParts);
+                                               for($a=0;$a<$pCount;$a++)       {
                                                        $valueParts[$a]=trim($valueParts[$a]);
                                                        if (substr($valueParts[$a],0,1)=='*')   {       // Finding default value
                                                                $sel='selected';
@@ -1800,13 +1801,14 @@ class tslib_cObj {
                                                        $defaults[] = $default;
                                                } else $defaults=$default;
                                                        // Create the select-box:
-                                               for($a=0;$a<count($items);$a++) {
+                                               $iCount = count($items);
+                                               for($a=0;$a<$iCount;$a++)       {
                                                        $option.='<option value="'.$items[$a][1].'"'.(in_array($items[$a][1],$defaults)?' selected="selected"':'').'>'.trim($items[$a][0]).'</option>'; //RTF
                                                }
 
                                                if ($multiple)  $confData['fieldname'].='[]';   // The fieldname must be prepended '[]' if multiple select. And the reason why it's prepended is, because the required-field list later must also have [] prepended.
-                                               $fieldCode=sprintf('<select name="%s"'.$elementIdAttribute.' size="%s"%s'.$addParams.'>%s</select>',
-                                                       $confData['fieldname'], $size, $multiple, $option); //RTF
+                                               $fieldCode=sprintf('<select name="%s"%s size="%s"%s%s>%s</select>',
+                                                       $confData['fieldname'], $elementIdAttribute, $size, $multiple, $addParams, $option); //RTF
                                        break;
                                        case 'radio':
                                                $option='';
@@ -1816,7 +1818,8 @@ class tslib_cObj {
                                                $valueParts = explode(',',$parts[2]);
                                                $items=array();         // Where the items will be
                                                $default='';
-                                               for($a=0;$a<count($valueParts);$a++)    {
+                                               $pCount = count($valueParts);
+                                               for($a=0;$a<$pCount;$a++)       {
                                                        $valueParts[$a]=trim($valueParts[$a]);
                                                        if (substr($valueParts[$a],0,1)=='*')   {
                                                                $sel='checked';
@@ -1831,14 +1834,15 @@ class tslib_cObj {
                                                        // alternative default value:
                                                $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $default);
                                                        // Create the select-box:
-                                               for($a=0;$a<count($items);$a++) {
+                                               $iCount = count($items);
+                                               for($a=0;$a<$iCount;$a++)       {
                                                        $radioId = $prefix.$fName.$this->cleanFormName($items[$a][0]);
                                                        if ($conf['accessibility'])     {
                                                                $radioLabelIdAttribute = ' id="'.$radioId.'"';
                                                        } else {
                                                                $radioLabelIdAttribute = '';
                                                        }
-                                                       $option .= '<input type="radio" name="'.$confData['fieldname'].'"'.$radioLabelIdAttribute.' value="'.$items[$a][1].'"'.(!strcmp($items[$a][1],$default)?' checked="checked"':'').''.$addParams.' />';
+                                                       $option .= '<input type="radio" name="'.$confData['fieldname'].'"'.$radioLabelIdAttribute.' value="'.$items[$a][1].'"'.(!strcmp($items[$a][1],$default)?' checked="checked"':'').$addParams.' />';
                                                        if ($conf['accessibility'])     {
                                                                $option .= '<label for="'.$radioId.'">' . $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']) . '</label>';
                                                        } else {
@@ -1858,8 +1862,8 @@ class tslib_cObj {
                                                if (strlen($value) && t3lib_div::inList('recipient_copy,recipient',$confData['fieldname']))     {
                                                        $value = $GLOBALS['TSFE']->codeString($value);
                                                }
-                                               $hiddenfields.=sprintf('<input type="hidden" name="%s"'.$elementIdAttribute.' value="%s" />',
-                                                       $confData['fieldname'], htmlspecialchars($value));
+                                               $hiddenfields.=sprintf('<input type="hidden" name="%s"%s value="%s" />',
+                                                       $confData['fieldname'], $elementIdAttribute, htmlspecialchars($value));
                                        break;
                                        case 'property':
                                                if (t3lib_div::inList('type,locationData,goodMess,badMess,emailMess',$confData['fieldname']))   {
@@ -1877,14 +1881,14 @@ class tslib_cObj {
                                                if($image)      {
                                                        $fieldCode = str_replace('<img','<input type="image"'.$addParams.' name="'.$confData['fieldname'].'"' ,$image);
                                                } else  {
-                                                       $fieldCode=sprintf('<input type="submit" name="%s"'.$elementIdAttribute.' value="%s"'.$addParams.' />',
-                                                               $confData['fieldname'], t3lib_div::deHSCentities(htmlspecialchars($value)));
+                                                       $fieldCode=sprintf('<input type="submit" name="%s"%s value="%s"%s />',
+                                                               $confData['fieldname'], $elementIdAttribute, t3lib_div::deHSCentities(htmlspecialchars($value)), $addParams);
                                                }
                                        break;
                                        case 'reset':
                                                $value=trim($parts[2]);
-                                               $fieldCode=sprintf('<input type="reset" name="%s"'.$elementIdAttribute.' value="%s"'.$addParams.' />',
-                                                       $confData['fieldname'], t3lib_div::deHSCentities(htmlspecialchars($value)));
+                                               $fieldCode=sprintf('<input type="reset" name="%s"%s value="%s"%s />',
+                                                       $confData['fieldname'], $elementIdAttribute, t3lib_div::deHSCentities(htmlspecialchars($value)), $addParams);
                                        break;
                                        case 'label':
                                                $fieldCode = nl2br(htmlspecialchars(trim($parts[2])));