X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=debian%2Fpatches%2Fchangeset_r3170.patch;h=962a62698eeabaeafd3924b6d4e2f517a97a8dc3;hb=1ed928c3e548903800dcbe2fab131ae265fe6166;hp=f820edcd32ad4695b80e3e77151a95a7316d8c1c;hpb=7793811565a5848faa5b10dc906621aea38d0506;p=roundcube.git diff --git a/debian/patches/changeset_r3170.patch b/debian/patches/changeset_r3170.patch index f820edc..962a626 100644 --- a/debian/patches/changeset_r3170.patch +++ b/debian/patches/changeset_r3170.patch @@ -1,159 +1,171 @@ Use json_encode to ensure compatibility with JQuery 1.4. -Index: roundcubemail/program/include/rcube_template.php -=================================================================== ---- roundcubemail/program/include/rcube_template.php (revision 2980) -+++ roundcubemail/program/include/rcube_template.php (revision 3170) -@@ -415,10 +415,10 @@ - $out = ''; - if (!$this->framed && !empty($this->js_env)) { -- $out .= JS_OBJECT_NAME . '.set_env('.json_serialize($this->js_env).");\n"; -+ $out .= JS_OBJECT_NAME . '.set_env('.json_encode($this->js_env).");\n"; - } - foreach ($this->js_commands as $i => $args) { - $method = array_shift($args); - foreach ($args as $i => $arg) { -- $args[$i] = json_serialize($arg); -+ $args[$i] = json_encode($arg); - } - $parent = $this->framed || preg_match('/^parent\./', $method); -Index: roundcubemail/program/include/rcube_shared.inc -=================================================================== ---- roundcubemail/program/include/rcube_shared.inc (revision 3132) -+++ roundcubemail/program/include/rcube_shared.inc (revision 3170) -@@ -106,95 +106,4 @@ - exit; - } --} -- -- --/** -- * Returns whether an $str is a reserved word for any of the version of Javascript or ECMAScript -- * @param str String to check -- * @return boolean True if $str is a reserver word, False if not -- */ --function is_js_reserved_word($str) --{ -- return in_array($str, array( -- // ECMASript ver 4 reserved words -- 'as','break','case','catch','class','const','continue', -- 'default','delete','do','else','export','extends','false','finally','for','function', -- 'if','import','in','instanceof','is','namespace','new','null','package','private', -- 'public','return','super','switch','this','throw','true','try','typeof','use','var', -- 'void','while','with', -- // ECMAScript ver 4 future reserved words -- 'abstract','debugger','enum','goto','implements','interface','native','protected', -- 'synchronized','throws','transient','volatile', -- // special meaning in some contexts -- 'get','set', -- // were reserved in ECMAScript ver 3 -- 'boolean','byte','char','double','final','float','int','long','short','static' -- )); --} -- -- --/** -- * Convert a variable into a javascript object notation -- * -- * @param mixed Input value -- * @return string Serialized JSON string -- */ --function json_serialize($var) --{ -- if (is_object($var)) -- $var = get_object_vars($var); -- -- if (is_array($var)) -- { -- // empty array -- if (!sizeof($var)) -- return '[]'; -- else -- { -- $keys_arr = array_keys($var); -- $is_assoc = $have_numeric = 0; -- -- for ($i=0; $i $value) -- { -- // enclose key with quotes if it is not variable-name conform -- if (!preg_match('/^[_a-zA-Z]{1}[_a-zA-Z0-9]*$/', $key) || is_js_reserved_word($key)) -- $key = "'$key'"; -- -- $pairs[] = sprintf("%s%s", $is_assoc ? "$key:" : '', json_serialize($value)); -- } -- -- return $brackets{0} . implode(',', $pairs) . $brackets{1}; -- } -- } -- else if (!is_string($var) && strval(intval($var)) === strval($var)) -- return $var; -- else if (is_bool($var)) -- return $var ? '1' : '0'; -- else -- return "'".JQ($var)."'"; --} -- -- --/** -- * Function to convert an array to a javascript array -- * Actually an alias function for json_serialize() -- * @deprecated -- */ --function array2js($arr, $type='') --{ -- return json_serialize($arr); - } - -Index: roundcubemail/program/include/rcube_json_output.php -=================================================================== ---- roundcubemail/program/include/rcube_json_output.php (revision 2905) -+++ roundcubemail/program/include/rcube_json_output.php (revision 3170) -@@ -240,5 +240,5 @@ - $response['callbacks'] = $this->callbacks; - -- echo json_serialize($response); -+ echo json_encode($response); - } - -@@ -256,5 +256,5 @@ - $method = array_shift($args); - foreach ($args as $i => $arg) { -- $args[$i] = json_serialize($arg); -+ $args[$i] = json_encode($arg); - } - -Index: roundcubemail/program/steps/mail/func.inc -=================================================================== ---- roundcubemail/program/steps/mail/func.inc (revision 3099) -+++ roundcubemail/program/steps/mail/func.inc (revision 3170) -@@ -523,5 +523,5 @@ - if (is_array($quota)) { - $OUTPUT->add_script('$(document).ready(function(){ -- rcmail.set_quota('.json_serialize($quota).')});', 'foot'); -+ rcmail.set_quota('.json_encode($quota).')});', 'foot'); - $quota = ''; - } -Index: roundcubemail/program/steps/mail/compose.inc -=================================================================== ---- roundcubemail/program/steps/mail/compose.inc (revision 3166) -+++ roundcubemail/program/steps/mail/compose.inc (revision 3170) -@@ -507,5 +507,5 @@ - JQ(Q(rcube_label('revertto'))), - JQ(Q(rcube_label('nospellerrors'))), -- json_serialize($spellcheck_langs), -+ json_encode($spellcheck_langs), - $lang, - $attrib['id'], +Index: b/program/include/rcube_json_output.php +=================================================================== +--- a/program/include/rcube_json_output.php 2009-09-01 17:13:45.000000000 +0200 ++++ b/program/include/rcube_json_output.php 2010-07-17 17:33:24.000000000 +0200 +@@ -239,7 +239,7 @@ + if (!empty($this->callbacks)) + $response['callbacks'] = $this->callbacks; + +- echo json_serialize($response); ++ echo json_encode($response); + } + + +@@ -255,7 +255,7 @@ + foreach ($this->commands as $i => $args) { + $method = array_shift($args); + foreach ($args as $i => $arg) { +- $args[$i] = json_serialize($arg); ++ $args[$i] = json_encode($arg); + } + + $out .= sprintf( +Index: b/program/include/rcube_shared.inc +=================================================================== +--- a/program/include/rcube_shared.inc 2009-10-27 10:43:39.000000000 +0100 ++++ b/program/include/rcube_shared.inc 2010-07-17 17:33:24.000000000 +0200 +@@ -109,97 +109,6 @@ + + + /** +- * Returns whether an $str is a reserved word for any of the version of Javascript or ECMAScript +- * @param str String to check +- * @return boolean True if $str is a reserver word, False if not +- */ +-function is_js_reserved_word($str) +-{ +- return in_array($str, array( +- // ECMASript ver 4 reserved words +- 'as','break','case','catch','class','const','continue', +- 'default','delete','do','else','export','extends','false','finally','for','function', +- 'if','import','in','instanceof','is','namespace','new','null','package','private', +- 'public','return','super','switch','this','throw','true','try','typeof','use','var', +- 'void','while','with', +- // ECMAScript ver 4 future reserved words +- 'abstract','debugger','enum','goto','implements','interface','native','protected', +- 'synchronized','throws','transient','volatile', +- // special meaning in some contexts +- 'get','set', +- // were reserved in ECMAScript ver 3 +- 'boolean','byte','char','double','final','float','int','long','short','static' +- )); +-} +- +- +-/** +- * Convert a variable into a javascript object notation +- * +- * @param mixed Input value +- * @return string Serialized JSON string +- */ +-function json_serialize($var) +-{ +- if (is_object($var)) +- $var = get_object_vars($var); +- +- if (is_array($var)) +- { +- // empty array +- if (!sizeof($var)) +- return '[]'; +- else +- { +- $keys_arr = array_keys($var); +- $is_assoc = $have_numeric = 0; +- +- for ($i=0; $i $value) +- { +- // enclose key with quotes if it is not variable-name conform +- if (!preg_match('/^[_a-zA-Z]{1}[_a-zA-Z0-9]*$/', $key) || is_js_reserved_word($key)) +- $key = "'$key'"; +- +- $pairs[] = sprintf("%s%s", $is_assoc ? "$key:" : '', json_serialize($value)); +- } +- +- return $brackets{0} . implode(',', $pairs) . $brackets{1}; +- } +- } +- else if (!is_string($var) && strval(intval($var)) === strval($var)) +- return $var; +- else if (is_bool($var)) +- return $var ? '1' : '0'; +- else +- return "'".JQ($var)."'"; +-} +- +- +-/** +- * Function to convert an array to a javascript array +- * Actually an alias function for json_serialize() +- * @deprecated +- */ +-function array2js($arr, $type='') +-{ +- return json_serialize($arr); +-} +- +- +-/** + * Similar function as in_array() but case-insensitive + * + * @param mixed Needle value +Index: b/program/include/rcube_template.php +=================================================================== +--- a/program/include/rcube_template.php 2009-09-22 20:08:45.000000000 +0200 ++++ b/program/include/rcube_template.php 2010-07-17 17:33:24.000000000 +0200 +@@ -414,12 +414,12 @@ + { + $out = ''; + if (!$this->framed && !empty($this->js_env)) { +- $out .= JS_OBJECT_NAME . '.set_env('.json_serialize($this->js_env).");\n"; ++ $out .= JS_OBJECT_NAME . '.set_env('.json_encode($this->js_env).");\n"; + } + foreach ($this->js_commands as $i => $args) { + $method = array_shift($args); + foreach ($args as $i => $arg) { +- $args[$i] = json_serialize($arg); ++ $args[$i] = json_encode($arg); + } + $parent = $this->framed || preg_match('/^parent\./', $method); + $out .= sprintf( +Index: b/program/steps/mail/compose.inc +=================================================================== +--- a/program/steps/mail/compose.inc 2009-10-06 08:55:08.000000000 +0200 ++++ b/program/steps/mail/compose.inc 2010-07-17 17:33:24.000000000 +0200 +@@ -493,7 +493,7 @@ + JQ(Q(rcube_label('close'))), + JQ(Q(rcube_label('revertto'))), + JQ(Q(rcube_label('nospellerrors'))), +- json_serialize($spellcheck_langs), ++ json_encode($spellcheck_langs), + $lang, + $attrib['id'], + JS_OBJECT_NAME), 'foot'); +Index: b/program/steps/mail/func.inc +=================================================================== +--- a/program/steps/mail/func.inc 2009-10-24 21:09:23.000000000 +0200 ++++ b/program/steps/mail/func.inc 2010-07-17 17:33:24.000000000 +0200 +@@ -522,7 +522,7 @@ + + if (is_array($quota)) { + $OUTPUT->add_script('$(document).ready(function(){ +- rcmail.set_quota('.json_serialize($quota).')});', 'foot'); ++ rcmail.set_quota('.json_encode($quota).')});', 'foot'); + $quota = ''; + } +