Changeset 5495 in subversion


Ignore:
Timestamp:
Nov 27, 2011 5:10:40 AM (18 months ago)
Author:
alec
Message:
  • Fix handling of invalid characters in request (#1488124)
Location:
trunk/roundcubemail
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r5494 r5495  
    22=========================== 
    33 
     4- Fix handling of invalid characters in request (#1488124) 
    45- Fix merging some configuration options in update.sh script (#1485864) 
    56- Fix so TEXT key will remove all HEADER keys in IMAP SEARCH (#1488208) 
  • trunk/roundcubemail/program/include/main.inc

    r5490 r5495  
    641641{ 
    642642  $value = NULL; 
    643    
    644   if ($source==RCUBE_INPUT_GET && isset($_GET[$fname])) 
    645     $value = $_GET[$fname]; 
    646   else if ($source==RCUBE_INPUT_POST && isset($_POST[$fname])) 
    647     $value = $_POST[$fname]; 
    648   else if ($source==RCUBE_INPUT_GPC) 
    649     { 
     643 
     644  if ($source == RCUBE_INPUT_GET) { 
     645    if (isset($_GET[$fname])) 
     646      $value = $_GET[$fname]; 
     647  } 
     648  else if ($source == RCUBE_INPUT_POST) { 
     649    if (isset($_POST[$fname])) 
     650      $value = $_POST[$fname]; 
     651  } 
     652  else if ($source == RCUBE_INPUT_GPC) { 
    650653    if (isset($_POST[$fname])) 
    651654      $value = $_POST[$fname]; 
     
    654657    else if (isset($_COOKIE[$fname])) 
    655658      $value = $_COOKIE[$fname]; 
    656     } 
     659  } 
    657660 
    658661  return parse_input_value($value, $allow_html, $charset); 
     
    662665 * Parse/validate input value. See get_input_value() 
    663666 * Performs stripslashes() and charset conversion if necessary 
    664  *  
     667 * 
    665668 * @param  string   Input value 
    666669 * @param  boolean  Allow HTML tags in field value 
     
    688691    $value = stripslashes($value); 
    689692 
    690   // remove HTML tags if not allowed     
     693  // remove HTML tags if not allowed 
    691694  if (!$allow_html) 
    692695    $value = strip_tags($value); 
    693    
     696 
     697  $output_charset = is_object($OUTPUT) ? $OUTPUT->get_charset() : null; 
     698 
     699  // remove invalid characters (#1488124) 
     700  if ($output_charset == 'UTF-8') 
     701    $value = rc_utf8_clean($value); 
     702 
    694703  // convert to internal charset 
    695   if (is_object($OUTPUT) && $charset) 
    696     return rcube_charset_convert($value, $OUTPUT->get_charset(), $charset); 
    697   else 
    698     return $value; 
     704  if ($charset && $output_charset) 
     705    $value = rcube_charset_convert($value, $output_charset, $charset); 
     706 
     707  return $value; 
    699708} 
    700709 
     
    712721  foreach ($src as $key => $value) { 
    713722    $fname = $key[0] == '_' ? substr($key, 1) : $key; 
    714     if ($ignore && !preg_match("/($ignore)/", $fname)) 
     723    if ($ignore && !preg_match('/^(' . $ignore . ')$/', $fname)) 
    715724      $out[$fname] = get_input_value($key, $mode); 
    716725  } 
    717    
     726 
    718727  return $out; 
    719728} 
Note: See TracChangeset for help on using the changeset viewer.