Changeset 1752
- Timestamp:
- 08/23/06 09:08:02 (3 years ago)
- Files:
-
- trunk/data/config/settings.yml (modified) (1 diff)
- trunk/data/skeleton/app/app/config/view.yml (modified) (1 diff)
- trunk/lib/config/sfViewConfigHandler.class.php (modified) (1 diff)
- trunk/lib/debug/sfWebDebug.class.php (modified) (2 diffs)
- trunk/lib/filter/sfFillInFormFilter.class.php (modified) (4 diffs)
- trunk/lib/helper/EscapingHelper.php (modified) (1 diff)
- trunk/lib/response/sfWebResponse.class.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/data/config/settings.yml
r1641 r1752 71 71 72 72 autoloading_functions: ~ 73 74 charset: utf-8 trunk/data/skeleton/app/app/config/view.yml
r1631 r1752 1 1 default: 2 2 http_metas: 3 content-type: text/html ; charset=utf-83 content-type: text/html 4 4 5 5 metas: trunk/lib/config/sfViewConfigHandler.class.php
r1644 r1752 176 176 foreach ($this->mergeConfigValue('metas', $viewName) as $name => $content) 177 177 { 178 $data[] = sprintf(" \$response->addMeta('%s', '%s', false, true);", $name, str_replace('\'', '\\\'', preg_replace('/&(?=\w+;)/', '&', htmlentities($content, ENT_QUOTES, 'UTF-8'))));178 $data[] = sprintf(" \$response->addMeta('%s', '%s', false, true);", $name, str_replace('\'', '\\\'', preg_replace('/&(?=\w+;)/', '&', htmlentities($content, ENT_QUOTES, sfConfig::get('sf_charset'))))); 179 179 } 180 180 trunk/lib/debug/sfWebDebug.class.php
r1641 r1752 131 131 132 132 // escape HTML 133 $log_line = htmlentities($log_line, ENT_QUOTES, 'UTF-8');133 $log_line = htmlentities($log_line, ENT_QUOTES, sfConfig::get('sf_charset')); 134 134 135 135 // replace constants value with constant name … … 373 373 $content = ' 374 374 <h2>'.$id.' <a href="#" onclick="sfWebDebugToggle(\'sfWebDebug'.$id.'\'); return false;"><img src="'.$this->base_image_path.'/toggle.gif" alt="" /></a></h2> 375 <div id="sfWebDebug'.$id.'" style="display: none"><pre>'.htmlentities(@sfYaml::Dump($values), ENT_QUOTES, 'UTF-8').'</pre></div>375 <div id="sfWebDebug'.$id.'" style="display: none"><pre>'.htmlentities(@sfYaml::Dump($values), ENT_QUOTES, sfConfig::get('sf_charset')).'</pre></div> 376 376 '; 377 377 trunk/lib/filter/sfFillInFormFilter.class.php
r1415 r1752 26 26 $request = $context->getRequest(); 27 27 28 $doc = new DomDocument('1.0', 'UTF-8');28 $doc = new DomDocument('1.0', sfConfig::get('sf_charset')); 29 29 @$doc->loadHTML($response->getContent()); 30 30 $xpath = new DomXPath($doc); … … 86 86 if ($request->hasParameter($element->getAttribute('name'))) 87 87 { 88 $element->setAttribute('value', $this->es paceRequestParameter($request, $element->getAttribute('name')));88 $element->setAttribute('value', $this->escapeRequestParameter($request, $element->getAttribute('name'))); 89 89 } 90 90 } … … 96 96 $element->removeChild($child_node); 97 97 } 98 $element->appendChild($doc->createTextNode($this->es paceRequestParameter($request, $element->getAttribute('name'))));98 $element->appendChild($doc->createTextNode($this->escapeRequestParameter($request, $element->getAttribute('name')))); 99 99 } 100 100 else if ($element->nodeName == 'select') … … 131 131 } 132 132 133 private function es paceRequestParameter($request, $name)133 private function escapeRequestParameter($request, $name) 134 134 { 135 135 $value = $request->getParameter($name); 136 137 if (extension_loaded('iconv') && strtolower(sfConfig::get('sf_charset')) != 'utf-8') 138 { 139 $new_value = iconv(sfConfig::get('sf_charset'), 'UTF-8', $value); 140 if (false !== $new_value) 141 { 142 $value = $new_value; 143 } 144 } 145 136 146 if (isset($this->escapers[$name])) 137 147 { trunk/lib/helper/EscapingHelper.php
r1429 r1752 42 42 // Numbers and boolean values get turned into strings which can cause problems 43 43 // with type comparisons (e.g. === or is_int() etc). 44 return is_string($value) ? htmlentities($value, ENT_QUOTES, 'UTF-8') : $value;44 return is_string($value) ? htmlentities($value, ENT_QUOTES, sfConfig::get('sf_charset')) : $value; 45 45 } 46 46 trunk/lib/response/sfWebResponse.class.php
r1734 r1752 244 244 } 245 245 246 $this->fixHeaders(); 247 246 248 // headers 247 249 foreach ($this->headers as $name => $values) … … 277 279 } 278 280 281 private function fixHeaders() 282 { 283 // add charset to the content-type header if needed 284 if (false === stripos($this->getContentType(), 'charset')) 285 { 286 $this->setContentType($this->getContentType().'; charset='.sfConfig::get('sf_charset')); 287 } 288 } 289 279 290 private function normalizeHeaderName($name) 280 291 { … … 377 388 if (!$doNotEscape) 378 389 { 379 $value = htmlentities($value, ENT_QUOTES, 'UTF-8');390 $value = htmlentities($value, ENT_QUOTES, sfConfig::get('sf_charset')); 380 391 } 381 392 … … 400 411 } 401 412 402 $title = htmlentities($title, ENT_QUOTES, 'UTF-8');413 $title = htmlentities($title, ENT_QUOTES, sfConfig::get('sf_charset')); 403 414 } 404 415

