1 Use json_encode to ensure compatibility with JQuery 1.4.
\r
3 Index: roundcubemail/program/include/rcube_template.php
\r
4 ===================================================================
\r
5 --- roundcubemail/program/include/rcube_template.php (revision 2980)
\r
6 +++ roundcubemail/program/include/rcube_template.php (revision 3170)
\r
7 @@ -415,10 +415,10 @@
\r
9 if (!$this->framed && !empty($this->js_env)) {
\r
10 - $out .= JS_OBJECT_NAME . '.set_env('.json_serialize($this->js_env).");\n";
\r
11 + $out .= JS_OBJECT_NAME . '.set_env('.json_encode($this->js_env).");\n";
\r
13 foreach ($this->js_commands as $i => $args) {
\r
14 $method = array_shift($args);
\r
15 foreach ($args as $i => $arg) {
\r
16 - $args[$i] = json_serialize($arg);
\r
17 + $args[$i] = json_encode($arg);
\r
19 $parent = $this->framed || preg_match('/^parent\./', $method);
\r
20 Index: roundcubemail/program/include/rcube_shared.inc
\r
21 ===================================================================
\r
22 --- roundcubemail/program/include/rcube_shared.inc (revision 3132)
\r
23 +++ roundcubemail/program/include/rcube_shared.inc (revision 3170)
\r
24 @@ -106,95 +106,4 @@
\r
31 - * Returns whether an $str is a reserved word for any of the version of Javascript or ECMAScript
\r
32 - * @param str String to check
\r
33 - * @return boolean True if $str is a reserver word, False if not
\r
35 -function is_js_reserved_word($str)
\r
37 - return in_array($str, array(
\r
38 - // ECMASript ver 4 reserved words
\r
39 - 'as','break','case','catch','class','const','continue',
\r
40 - 'default','delete','do','else','export','extends','false','finally','for','function',
\r
41 - 'if','import','in','instanceof','is','namespace','new','null','package','private',
\r
42 - 'public','return','super','switch','this','throw','true','try','typeof','use','var',
\r
43 - 'void','while','with',
\r
44 - // ECMAScript ver 4 future reserved words
\r
45 - 'abstract','debugger','enum','goto','implements','interface','native','protected',
\r
46 - 'synchronized','throws','transient','volatile',
\r
47 - // special meaning in some contexts
\r
49 - // were reserved in ECMAScript ver 3
\r
50 - 'boolean','byte','char','double','final','float','int','long','short','static'
\r
56 - * Convert a variable into a javascript object notation
\r
58 - * @param mixed Input value
\r
59 - * @return string Serialized JSON string
\r
61 -function json_serialize($var)
\r
63 - if (is_object($var))
\r
64 - $var = get_object_vars($var);
\r
66 - if (is_array($var))
\r
69 - if (!sizeof($var))
\r
73 - $keys_arr = array_keys($var);
\r
74 - $is_assoc = $have_numeric = 0;
\r
76 - for ($i=0; $i<sizeof($keys_arr); ++$i)
\r
78 - if (is_numeric($keys_arr[$i]))
\r
79 - $have_numeric = 1;
\r
80 - if (!is_numeric($keys_arr[$i]) || $keys_arr[$i] != $i)
\r
82 - if ($is_assoc && $have_numeric)
\r
86 - $brackets = $is_assoc ? '{}' : '[]';
\r
89 - foreach ($var as $key => $value)
\r
91 - // enclose key with quotes if it is not variable-name conform
\r
92 - if (!preg_match('/^[_a-zA-Z]{1}[_a-zA-Z0-9]*$/', $key) || is_js_reserved_word($key))
\r
95 - $pairs[] = sprintf("%s%s", $is_assoc ? "$key:" : '', json_serialize($value));
\r
98 - return $brackets{0} . implode(',', $pairs) . $brackets{1};
\r
101 - else if (!is_string($var) && strval(intval($var)) === strval($var))
\r
103 - else if (is_bool($var))
\r
104 - return $var ? '1' : '0';
\r
106 - return "'".JQ($var)."'";
\r
111 - * Function to convert an array to a javascript array
\r
112 - * Actually an alias function for json_serialize()
\r
115 -function array2js($arr, $type='')
\r
117 - return json_serialize($arr);
\r
120 Index: roundcubemail/program/include/rcube_json_output.php
\r
121 ===================================================================
\r
122 --- roundcubemail/program/include/rcube_json_output.php (revision 2905)
\r
123 +++ roundcubemail/program/include/rcube_json_output.php (revision 3170)
\r
124 @@ -240,5 +240,5 @@
\r
125 $response['callbacks'] = $this->callbacks;
\r
127 - echo json_serialize($response);
\r
128 + echo json_encode($response);
\r
131 @@ -256,5 +256,5 @@
\r
132 $method = array_shift($args);
\r
133 foreach ($args as $i => $arg) {
\r
134 - $args[$i] = json_serialize($arg);
\r
135 + $args[$i] = json_encode($arg);
\r
138 Index: roundcubemail/program/steps/mail/func.inc
\r
139 ===================================================================
\r
140 --- roundcubemail/program/steps/mail/func.inc (revision 3099)
\r
141 +++ roundcubemail/program/steps/mail/func.inc (revision 3170)
\r
142 @@ -523,5 +523,5 @@
\r
143 if (is_array($quota)) {
\r
144 $OUTPUT->add_script('$(document).ready(function(){
\r
145 - rcmail.set_quota('.json_serialize($quota).')});', 'foot');
\r
146 + rcmail.set_quota('.json_encode($quota).')});', 'foot');
\r
149 Index: roundcubemail/program/steps/mail/compose.inc
\r
150 ===================================================================
\r
151 --- roundcubemail/program/steps/mail/compose.inc (revision 3166)
\r
152 +++ roundcubemail/program/steps/mail/compose.inc (revision 3170)
\r
153 @@ -507,5 +507,5 @@
\r
154 JQ(Q(rcube_label('revertto'))),
\r
155 JQ(Q(rcube_label('nospellerrors'))),
\r
156 - json_serialize($spellcheck_langs),
\r
157 + json_encode($spellcheck_langs),
\r