- use proper unicode cleanup for JSON, fixes #1486356
| | |
| | | if (!empty($this->callbacks)) |
| | | $response['callbacks'] = $this->callbacks; |
| | | |
| | | echo json_encode($response); |
| | | echo json_serialize($response); |
| | | } |
| | | |
| | | |
| | |
| | | foreach ($this->commands as $i => $args) { |
| | | $method = array_shift($args); |
| | | foreach ($args as $i => $arg) { |
| | | $args[$i] = json_encode($arg); |
| | | $args[$i] = json_serialize($arg); |
| | | } |
| | | |
| | | $out .= sprintf( |
| | |
| | | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert a variable into a javascript object notation |
| | | * |
| | | * @param mixed Input value |
| | | * @return string Serialized JSON string |
| | | */ |
| | | function json_serialize($input) |
| | | { |
| | | $input = rc_utf8_clean($input); |
| | | |
| | | return json_encode($input); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Explode quoted string |
| | |
| | | { |
| | | $out = ''; |
| | | if (!$this->framed && !empty($this->js_env)) { |
| | | $out .= JS_OBJECT_NAME . '.set_env('.json_encode($this->js_env).");\n"; |
| | | $out .= JS_OBJECT_NAME . '.set_env('.json_serialize($this->js_env).");\n"; |
| | | } |
| | | foreach ($this->js_commands as $i => $args) { |
| | | $method = array_shift($args); |
| | | foreach ($args as $i => $arg) { |
| | | $args[$i] = json_encode($arg); |
| | | $args[$i] = json_serialize($arg); |
| | | } |
| | | $parent = $this->framed || preg_match('/^parent\./', $method); |
| | | $out .= sprintf( |
| | |
| | | JQ(Q(rcube_label('close'))), |
| | | JQ(Q(rcube_label('revertto'))), |
| | | JQ(Q(rcube_label('nospellerrors'))), |
| | | json_encode($spellcheck_langs), |
| | | json_serialize($spellcheck_langs), |
| | | $lang, |
| | | $attrib['id'], |
| | | JS_OBJECT_NAME), 'foot'); |
| | |
| | | if ($header->flagged) |
| | | $a_msg_flags['flagged'] = 1; |
| | | |
| | | if ($browser->ie) |
| | | $a_msg_cols = rc_utf8_clean($a_msg_cols); |
| | | |
| | | $OUTPUT->command('add_message_row', |
| | | $header->uid, |
| | | $a_msg_cols, |
| | |
| | | |
| | | if (is_array($quota)) { |
| | | $OUTPUT->add_script('$(document).ready(function(){ |
| | | rcmail.set_quota('.json_encode($quota).')});', 'foot'); |
| | | rcmail.set_quota('.json_serialize($quota).')});', 'foot'); |
| | | $quota = ''; |
| | | } |
| | | |
| | |
| | | |
| | | if ($source) |
| | | { |
| | | $browser = new rcube_browser; |
| | | |
| | | if ($browser->ie) |
| | | $source = rc_utf8_clean($source); |
| | | |
| | | $source = htmlspecialchars(trim($source)); |
| | | $source = preg_replace('/\t/', ' ', $source); |
| | | $source = preg_replace('/^([a-z0-9_:-]+)/im', '<font class="bold">'.'\1'.'</font>', $source); |