- Timestamp:
- 01/17/12 01:01:29 (4 months ago)
- Location:
- trunk/inc
- Files:
-
- 2 edited
-
classes/BxDolUploader.php (modified) (2 diffs)
-
utils.inc.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/inc/classes/BxDolUploader.php
r15522 r15887 212 212 } 213 213 214 echo '<script>window.parent.' . $this->getNameJsInstanceUploader() . '.onUploadCompleted(\'' . bx_js_string($this->getUploadErrorMessages(), BX_ JS_STR_APOS) . '\');</script>';214 echo '<script>window.parent.' . $this->getNameJsInstanceUploader() . '.onUploadCompleted(\'' . bx_js_string($this->getUploadErrorMessages(), BX_ESCAPE_STR_APOS) . '\');</script>'; 215 215 } 216 216 … … 240 240 $sJsValue = "{\n"; 241 241 foreach ($mixedGhostTemplate as $iFileId => $s) { 242 $sJsValue .= $iFileId . ':' . "'" . bx_js_string($s, BX_ JS_STR_APOS) . "',\n";242 $sJsValue .= $iFileId . ':' . "'" . bx_js_string($s, BX_ESCAPE_STR_APOS) . "',\n"; 243 243 } 244 244 $sJsValue = substr($sJsValue, 0, -2); 245 245 $sJsValue .= "}\n"; 246 246 } else { 247 $sJsValue = "'" . bx_js_string($mixedGhostTemplate, BX_ JS_STR_APOS) . "'";247 $sJsValue = "'" . bx_js_string($mixedGhostTemplate, BX_ESCAPE_STR_APOS) . "'"; 248 248 } 249 249 -
trunk/inc/utils.inc.php
r15790 r15887 25 25 define('BX_DATA_DATETIME_TS', 9); ///< date/time data type stored as unixtimestamp 26 26 27 define('BX_ JS_STR_AUTO', 0); ///< turn apostropes and quote signs into html special chars, for use in @see bx_js_string28 define('BX_ JS_STR_APOS', 1); ///< escape apostrophes only, for js strings enclosed in apostrophes, for use in @see bx_js_string29 define('BX_ JS_STR_QUOTE', 2); ///< escape quotes only, for js strings enclosed in quotes, for use in @see bx_js_string27 define('BX_ESCAPE_STR_AUTO', 0); ///< turn apostropes and quote signs into html special chars, for use in @see bx_js_string and @see bx_html_attribute 28 define('BX_ESCAPE_STR_APOS', 1); ///< escape apostrophes only, for js strings enclosed in apostrophes, for use in @see bx_js_string and @see bx_html_attribute 29 define('BX_ESCAPE_STR_QUOTE', 2); ///< escape quotes only, for js strings enclosed in quotes, for use in @see bx_js_string and @see bx_html_attribute 30 30 31 31 /** … … 1025 1025 * 1026 1026 * @param $mixedInput - string/array which should be filtered 1027 * @param $iQuoteType - string escaping method: BX_ JS_STR_AUTO(default), BX_JS_STR_APOS or BX_JS_STR_QUOTE1027 * @param $iQuoteType - string escaping method: BX_ESCAPE_STR_AUTO(default), BX_ESCAPE_STR_APOS or BX_ESCAPE_STR_QUOTE 1028 1028 * @return converted string / array 1029 1029 */ 1030 function bx_js_string ($mixedInput, $iQuoteType = BX_ JS_STR_AUTO) {1030 function bx_js_string ($mixedInput, $iQuoteType = BX_ESCAPE_STR_AUTO) { 1031 1031 $aUnits = array( 1032 1032 "\n" => "\\n", 1033 1033 "\r" => "", 1034 1034 ); 1035 if (BX_ JS_STR_APOS == $iQuoteType) {1035 if (BX_ESCAPE_STR_APOS == $iQuoteType) { 1036 1036 $aUnits["'"] = "\\'"; 1037 } elseif (BX_ JS_STR_QUOTE == $iQuoteType) {1037 } elseif (BX_ESCAPE_STR_QUOTE == $iQuoteType) { 1038 1038 $aUnits['"'] = '\\"'; 1039 1039 } else { … … 1050 1050 * @return converted string / array 1051 1051 */ 1052 function bx_html_attribute ($mixedInput) { 1053 $aUnits = array( 1054 "\"" => """, 1055 "'" => "'", 1056 ); 1052 function bx_html_attribute ($mixedInput, $iQuoteType = BX_ESCAPE_STR_AUTO) { 1053 1054 $aUnits = array (); 1055 if (BX_ESCAPE_STR_APOS == $iQuoteType) 1056 $aUnits["'"] = "\\'"; 1057 elseif (BX_ESCAPE_STR_QUOTE == $iQuoteType) 1058 $aUnits['"'] = '\\"'; 1059 else 1060 $aUnits = array("\"" => """, "'" => "'"); 1061 1057 1062 return str_replace(array_keys($aUnits), array_values($aUnits), $mixedInput); 1058 1063 } … … 1321 1326 continue; 1322 1327 1323 $sValueC = bx_html_attribute($sValue );1328 $sValueC = bx_html_attribute($sValue, BX_ESCAPE_STR_QUOTE); 1324 1329 1325 1330 $sRet .= " $sKey=\"$sValueC\"";
Note: See TracChangeset
for help on using the changeset viewer.