Changeset 2717f9f in github


Ignore:
Timestamp:
Dec 11, 2009 11:53:54 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
7a05909
Parents:
f47e2dc
Message:
  • use proper unicode cleanup for JSON, fixes #1486356
Location:
program
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_json_output.php

    re5d60d6 r2717f9f  
    240240          $response['callbacks'] = $this->callbacks; 
    241241 
    242         echo json_encode($response); 
     242        echo json_serialize($response); 
    243243    } 
    244244     
     
    252252    { 
    253253        $out = ''; 
    254          
     254 
    255255        foreach ($this->commands as $i => $args) { 
    256256            $method = array_shift($args); 
    257257            foreach ($args as $i => $arg) { 
    258                 $args[$i] = json_encode($arg); 
     258                $args[$i] = json_serialize($arg); 
    259259            } 
    260260 
  • program/include/rcube_shared.inc

    re5d60d6 r2717f9f  
    511511  if (!is_string($input) || $input == '') 
    512512    return $input; 
    513    
     513 
    514514  // iconv/mbstring are much faster (especially with long strings) 
    515515  if (function_exists('mb_convert_encoding') && ($res = mb_convert_encoding($input, 'UTF8', 'UTF8'))) 
     
    564564} 
    565565 
     566 
     567/** 
     568 * Convert a variable into a javascript object notation 
     569 * 
     570 * @param mixed Input value 
     571 * @return string Serialized JSON string 
     572 */ 
     573function json_serialize($input) 
     574{ 
     575  $input = rc_utf8_clean($input); 
     576   
     577  return json_encode($input); 
     578} 
     579 
     580 
    566581/** 
    567582 * Explode quoted string 
  • program/include/rcube_template.php

    re5d60d6 r2717f9f  
    415415        $out = ''; 
    416416        if (!$this->framed && !empty($this->js_env)) { 
    417             $out .= JS_OBJECT_NAME . '.set_env('.json_encode($this->js_env).");\n"; 
     417            $out .= JS_OBJECT_NAME . '.set_env('.json_serialize($this->js_env).");\n"; 
    418418        } 
    419419        foreach ($this->js_commands as $i => $args) { 
    420420            $method = array_shift($args); 
    421421            foreach ($args as $i => $arg) { 
    422                 $args[$i] = json_encode($arg); 
     422                $args[$i] = json_serialize($arg); 
    423423            } 
    424424            $parent = $this->framed || preg_match('/^parent\./', $method); 
  • program/steps/mail/compose.inc

    r8abe548 r2717f9f  
    506506      JQ(Q(rcube_label('revertto'))), 
    507507      JQ(Q(rcube_label('nospellerrors'))), 
    508       json_encode($spellcheck_langs), 
     508      json_serialize($spellcheck_langs), 
    509509      $lang, 
    510510      $attrib['id'], 
  • program/steps/mail/func.inc

    rf96ffde r2717f9f  
    459459      $a_msg_flags['flagged'] = 1; 
    460460       
    461     if ($browser->ie) 
    462       $a_msg_cols = rc_utf8_clean($a_msg_cols); 
    463      
    464461    $OUTPUT->command('add_message_row', 
    465462      $header->uid, 
     
    523520  if (is_array($quota)) { 
    524521    $OUTPUT->add_script('$(document).ready(function(){ 
    525         rcmail.set_quota('.json_encode($quota).')});', 'foot'); 
     522        rcmail.set_quota('.json_serialize($quota).')});', 'foot'); 
    526523    $quota = ''; 
    527524    } 
  • program/steps/mail/headers.inc

    r1a00f13 r2717f9f  
    2525  if ($source) 
    2626    { 
    27     $browser = new rcube_browser; 
    28      
    29     if ($browser->ie) 
    30       $source = rc_utf8_clean($source);    
    31  
    3227    $source = htmlspecialchars(trim($source)); 
    3328    $source = preg_replace('/\t/', '&nbsp;&nbsp;&nbsp;&nbsp;', $source); 
Note: See TracChangeset for help on using the changeset viewer.