Permalink
Browse files

Initial TinyMCE editor support (still need to work on spellcheck and …

…skins)
  • Loading branch information...
1 parent bb5ddfa commit a0109c4933e0bfb5ed9dbcf94f932991ca689542 @thomascube thomascube committed Sep 14, 2006
Showing with 15,839 additions and 136 deletions.
  1. +6 −0 CHANGELOG
  2. +1 −0 SQL/mysql.initial.sql
  3. +2 −0 SQL/mysql.update.sql
  4. +2 −1 SQL/mysql5.initial.sql
  5. +2 −1 SQL/postgres.initial.sql
  6. +2 −0 SQL/postgres.update.sql
  7. +2 −1 SQL/sqlite.initial.sql
  8. +16 −1 index.php
  9. +14 −0 program/include/bugs.inc
  10. +13 −5 program/include/main.inc
  11. +69 −12 program/include/rcube_shared.inc
  12. +90 −27 program/js/app.js
  13. +148 −0 program/js/editor.js
  14. +9 −0 program/js/tiny_mce/blank.htm
  15. +41 −0 program/js/tiny_mce/langs/en.js
  16. +7 −0 program/js/tiny_mce/langs/readme.txt
  17. +437 −0 program/js/tiny_mce/license.txt
  18. 0 program/js/tiny_mce/plugins/cleanup/editor_plugin.js
  19. +12 −0 program/js/tiny_mce/plugins/cleanup/editor_plugin_src.js
  20. +1 −0 program/js/tiny_mce/plugins/cleanup/readme.txt
  21. +1 −0 program/js/tiny_mce/plugins/emotions/editor_plugin.js
  22. +65 −0 program/js/tiny_mce/plugins/emotions/editor_plugin_src.js
  23. +40 −0 program/js/tiny_mce/plugins/emotions/emotions.htm
  24. BIN program/js/tiny_mce/plugins/emotions/images/emotions.gif
  25. +2 −0 program/js/tiny_mce/plugins/emotions/images/readme.txt
  26. BIN program/js/tiny_mce/plugins/emotions/images/smiley-cool.gif
  27. BIN program/js/tiny_mce/plugins/emotions/images/smiley-cry.gif
  28. BIN program/js/tiny_mce/plugins/emotions/images/smiley-embarassed.gif
  29. BIN program/js/tiny_mce/plugins/emotions/images/smiley-foot-in-mouth.gif
  30. BIN program/js/tiny_mce/plugins/emotions/images/smiley-frown.gif
  31. BIN program/js/tiny_mce/plugins/emotions/images/smiley-innocent.gif
  32. BIN program/js/tiny_mce/plugins/emotions/images/smiley-kiss.gif
  33. BIN program/js/tiny_mce/plugins/emotions/images/smiley-laughing.gif
  34. BIN program/js/tiny_mce/plugins/emotions/images/smiley-money-mouth.gif
  35. BIN program/js/tiny_mce/plugins/emotions/images/smiley-sealed.gif
  36. BIN program/js/tiny_mce/plugins/emotions/images/smiley-smile.gif
  37. BIN program/js/tiny_mce/plugins/emotions/images/smiley-surprised.gif
  38. BIN program/js/tiny_mce/plugins/emotions/images/smiley-tongue-out.gif
  39. BIN program/js/tiny_mce/plugins/emotions/images/smiley-undecided.gif
  40. BIN program/js/tiny_mce/plugins/emotions/images/smiley-wink.gif
  41. BIN program/js/tiny_mce/plugins/emotions/images/smiley-yell.gif
  42. +21 −0 program/js/tiny_mce/plugins/emotions/jscripts/functions.js
  43. +22 −0 program/js/tiny_mce/plugins/emotions/langs/en.js
  44. +1 −0 program/js/tiny_mce/plugins/emotions/readme.txt
  45. +1 −0 program/js/tiny_mce/plugins/readme.txt
  46. +1 −0 program/js/tiny_mce/plugins/searchreplace/editor_plugin.js
  47. +185 −0 program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js
  48. BIN program/js/tiny_mce/plugins/searchreplace/images/replace.gif
  49. BIN program/js/tiny_mce/plugins/searchreplace/images/search.gif
  50. +40 −0 program/js/tiny_mce/plugins/searchreplace/jscripts/replace.js
  51. +36 −0 program/js/tiny_mce/plugins/searchreplace/jscripts/search.js
  52. +21 −0 program/js/tiny_mce/plugins/searchreplace/langs/en.js
  53. +1 −0 program/js/tiny_mce/plugins/searchreplace/readme.txt
  54. +49 −0 program/js/tiny_mce/plugins/searchreplace/replace.htm
  55. +42 −0 program/js/tiny_mce/plugins/searchreplace/search.htm
  56. +182 −0 program/js/tiny_mce/plugins/table/cell.htm
  57. +17 −0 program/js/tiny_mce/plugins/table/css/cell.css
  58. +25 −0 program/js/tiny_mce/plugins/table/css/row.css
  59. +13 −0 program/js/tiny_mce/plugins/table/css/table.css
  60. +1 −0 program/js/tiny_mce/plugins/table/editor_plugin.js
  61. +1,054 −0 program/js/tiny_mce/plugins/table/editor_plugin_src.js
  62. BIN program/js/tiny_mce/plugins/table/images/buttons.gif
  63. BIN program/js/tiny_mce/plugins/table/images/table.gif
  64. BIN program/js/tiny_mce/plugins/table/images/table_cell_props.gif
  65. BIN program/js/tiny_mce/plugins/table/images/table_delete.gif
  66. BIN program/js/tiny_mce/plugins/table/images/table_delete_col.gif
  67. BIN program/js/tiny_mce/plugins/table/images/table_delete_row.gif
  68. BIN program/js/tiny_mce/plugins/table/images/table_insert_col_after.gif
  69. BIN program/js/tiny_mce/plugins/table/images/table_insert_col_before.gif
  70. BIN program/js/tiny_mce/plugins/table/images/table_insert_row_after.gif
  71. BIN program/js/tiny_mce/plugins/table/images/table_insert_row_before.gif
  72. BIN program/js/tiny_mce/plugins/table/images/table_merge_cells.gif
  73. BIN program/js/tiny_mce/plugins/table/images/table_row_props.gif
  74. BIN program/js/tiny_mce/plugins/table/images/table_split_cells.gif
  75. +249 −0 program/js/tiny_mce/plugins/table/jscripts/cell.js
  76. +19 −0 program/js/tiny_mce/plugins/table/jscripts/merge_cells.js
  77. +200 −0 program/js/tiny_mce/plugins/table/jscripts/row.js
  78. +344 −0 program/js/tiny_mce/plugins/table/jscripts/table.js
  79. +78 −0 program/js/tiny_mce/plugins/table/langs/en.js
  80. +37 −0 program/js/tiny_mce/plugins/table/merge_cells.htm
  81. +1 −0 program/js/tiny_mce/plugins/table/readme.txt
  82. +159 −0 program/js/tiny_mce/plugins/table/row.htm
  83. +155 −0 program/js/tiny_mce/plugins/table/table.htm
  84. +52 −0 program/js/tiny_mce/themes/advanced/about.htm
  85. +33 −0 program/js/tiny_mce/themes/advanced/anchor.htm
  86. +53 −0 program/js/tiny_mce/themes/advanced/charmap.htm
  87. +13 −0 program/js/tiny_mce/themes/advanced/color_picker.htm
  88. +31 −0 program/js/tiny_mce/themes/advanced/docs/en/about.htm
  89. +162 −0 program/js/tiny_mce/themes/advanced/docs/en/common_buttons.htm
  90. +45 −0 program/js/tiny_mce/themes/advanced/docs/en/create_accessible_content.htm
  91. BIN program/js/tiny_mce/themes/advanced/docs/en/images/insert_anchor_window.gif
  92. BIN program/js/tiny_mce/themes/advanced/docs/en/images/insert_image_window.gif
  93. BIN program/js/tiny_mce/themes/advanced/docs/en/images/insert_link_window.gif
  94. BIN program/js/tiny_mce/themes/advanced/docs/en/images/insert_table_window.gif
  95. +27 −0 program/js/tiny_mce/themes/advanced/docs/en/index.htm
  96. +32 −0 program/js/tiny_mce/themes/advanced/docs/en/insert_anchor_button.htm
  97. +65 −0 program/js/tiny_mce/themes/advanced/docs/en/insert_image_button.htm
  98. +33 −0 program/js/tiny_mce/themes/advanced/docs/en/insert_link_button.htm
  99. +71 −0 program/js/tiny_mce/themes/advanced/docs/en/insert_table_button.htm
  100. +28 −0 program/js/tiny_mce/themes/advanced/docs/en/style.css
  101. +1 −0 program/js/tiny_mce/themes/advanced/editor_template.js
  102. +1,411 −0 program/js/tiny_mce/themes/advanced/editor_template_src.js
  103. +100 −0 program/js/tiny_mce/themes/advanced/image.htm
  104. BIN program/js/tiny_mce/themes/advanced/images/anchor.gif
  105. BIN program/js/tiny_mce/themes/advanced/images/anchor_symbol.gif
  106. BIN program/js/tiny_mce/themes/advanced/images/backcolor.gif
  107. BIN program/js/tiny_mce/themes/advanced/images/bold.gif
  108. BIN program/js/tiny_mce/themes/advanced/images/bold_de_se.gif
  109. BIN program/js/tiny_mce/themes/advanced/images/bold_es.gif
  110. BIN program/js/tiny_mce/themes/advanced/images/bold_fr.gif
  111. BIN program/js/tiny_mce/themes/advanced/images/bold_ru.gif
  112. BIN program/js/tiny_mce/themes/advanced/images/bold_tw.gif
  113. BIN program/js/tiny_mce/themes/advanced/images/browse.gif
  114. BIN program/js/tiny_mce/themes/advanced/images/bullist.gif
  115. BIN program/js/tiny_mce/themes/advanced/images/button_menu.gif
  116. BIN program/js/tiny_mce/themes/advanced/images/buttons.gif
  117. BIN program/js/tiny_mce/themes/advanced/images/cancel_button_bg.gif
  118. BIN program/js/tiny_mce/themes/advanced/images/charmap.gif
  119. BIN program/js/tiny_mce/themes/advanced/images/cleanup.gif
  120. BIN program/js/tiny_mce/themes/advanced/images/close.gif
  121. BIN program/js/tiny_mce/themes/advanced/images/code.gif
  122. BIN program/js/tiny_mce/themes/advanced/images/color.gif
  123. BIN program/js/tiny_mce/themes/advanced/images/copy.gif
  124. BIN program/js/tiny_mce/themes/advanced/images/custom_1.gif
  125. BIN program/js/tiny_mce/themes/advanced/images/cut.gif
  126. BIN program/js/tiny_mce/themes/advanced/images/forecolor.gif
  127. BIN program/js/tiny_mce/themes/advanced/images/help.gif
  128. BIN program/js/tiny_mce/themes/advanced/images/hr.gif
  129. BIN program/js/tiny_mce/themes/advanced/images/image.gif
  130. BIN program/js/tiny_mce/themes/advanced/images/indent.gif
  131. BIN program/js/tiny_mce/themes/advanced/images/insert_button_bg.gif
  132. BIN program/js/tiny_mce/themes/advanced/images/italic.gif
  133. BIN program/js/tiny_mce/themes/advanced/images/italic_de_se.gif
  134. BIN program/js/tiny_mce/themes/advanced/images/italic_es.gif
  135. BIN program/js/tiny_mce/themes/advanced/images/italic_ru.gif
  136. BIN program/js/tiny_mce/themes/advanced/images/italic_tw.gif
  137. BIN program/js/tiny_mce/themes/advanced/images/justifycenter.gif
  138. BIN program/js/tiny_mce/themes/advanced/images/justifyfull.gif
  139. BIN program/js/tiny_mce/themes/advanced/images/justifyleft.gif
  140. BIN program/js/tiny_mce/themes/advanced/images/justifyright.gif
  141. BIN program/js/tiny_mce/themes/advanced/images/link.gif
  142. BIN program/js/tiny_mce/themes/advanced/images/menu_check.gif
  143. BIN program/js/tiny_mce/themes/advanced/images/newdocument.gif
  144. BIN program/js/tiny_mce/themes/advanced/images/numlist.gif
  145. BIN program/js/tiny_mce/themes/advanced/images/opacity.png
  146. BIN program/js/tiny_mce/themes/advanced/images/outdent.gif
  147. BIN program/js/tiny_mce/themes/advanced/images/paste.gif
  148. BIN program/js/tiny_mce/themes/advanced/images/redo.gif
  149. BIN program/js/tiny_mce/themes/advanced/images/removeformat.gif
  150. BIN program/js/tiny_mce/themes/advanced/images/separator.gif
  151. BIN program/js/tiny_mce/themes/advanced/images/spacer.gif
  152. BIN program/js/tiny_mce/themes/advanced/images/statusbar_resize.gif
  153. BIN program/js/tiny_mce/themes/advanced/images/strikethrough.gif
  154. BIN program/js/tiny_mce/themes/advanced/images/sub.gif
  155. BIN program/js/tiny_mce/themes/advanced/images/sup.gif
  156. BIN program/js/tiny_mce/themes/advanced/images/underline.gif
  157. BIN program/js/tiny_mce/themes/advanced/images/underline_es.gif
  158. BIN program/js/tiny_mce/themes/advanced/images/underline_fr.gif
  159. BIN program/js/tiny_mce/themes/advanced/images/underline_ru.gif
  160. BIN program/js/tiny_mce/themes/advanced/images/underline_tw.gif
  161. BIN program/js/tiny_mce/themes/advanced/images/undo.gif
  162. BIN program/js/tiny_mce/themes/advanced/images/unlink.gif
  163. BIN program/js/tiny_mce/themes/advanced/images/visualaid.gif
  164. BIN program/js/tiny_mce/themes/advanced/images/xp/tab_bg.gif
  165. BIN program/js/tiny_mce/themes/advanced/images/xp/tab_end.gif
  166. BIN program/js/tiny_mce/themes/advanced/images/xp/tab_sel_bg.gif
  167. BIN program/js/tiny_mce/themes/advanced/images/xp/tab_sel_end.gif
  168. BIN program/js/tiny_mce/themes/advanced/images/xp/tabs_bg.gif
  169. +75 −0 program/js/tiny_mce/themes/advanced/jscripts/about.js
  170. +74 −0 program/js/tiny_mce/themes/advanced/jscripts/anchor.js
  171. +326 −0 program/js/tiny_mce/themes/advanced/jscripts/charmap.js
  172. +108 −0 program/js/tiny_mce/themes/advanced/jscripts/color_picker.js
  173. +81 −0 program/js/tiny_mce/themes/advanced/jscripts/image.js
  174. +70 −0 program/js/tiny_mce/themes/advanced/jscripts/link.js
  175. +66 −0 program/js/tiny_mce/themes/advanced/jscripts/source_editor.js
  176. +81 −0 program/js/tiny_mce/themes/advanced/langs/en.js
  177. +100 −0 program/js/tiny_mce/themes/advanced/link.htm
  178. +30 −0 program/js/tiny_mce/themes/advanced/source_editor.htm
  179. +1 −0 program/js/tiny_mce/tiny_mce.js
  180. +272 −0 program/js/tiny_mce/tiny_mce_popup.js
  181. +6,719 −0 program/js/tiny_mce/tiny_mce_src.js
  182. +63 −0 program/js/tiny_mce/utils/editable_selects.js
  183. +210 −0 program/js/tiny_mce/utils/form_utils.js
  184. +212 −0 program/js/tiny_mce/utils/mclayer.js
  185. +76 −0 program/js/tiny_mce/utils/mctabs.js
  186. +50 −0 program/js/tiny_mce/utils/validate.js
  187. +17 −2 program/lib/Mail/mime.php
  188. +9 −6 program/localization/en_US/labels.inc
  189. +1 −0 program/localization/en_US/messages.inc
  190. +180 −65 program/steps/mail/compose.inc
  191. +55 −5 program/steps/mail/func.inc
  192. +73 −2 program/steps/mail/sendmail.inc
  193. +32 −2 program/steps/settings/edit_identity.inc
  194. +8 −1 program/steps/settings/func.inc
  195. +13 −2 program/steps/settings/save_identity.inc
  196. +2 −1 program/steps/settings/save_prefs.inc
  197. +58 −0 skins/default/editor_content.css
  198. +327 −0 skins/default/editor_popup.css
  199. +353 −0 skins/default/editor_ui.css
  200. +3 −1 skins/default/templates/compose.html
  201. +1 −1 skins/default/templates/ldappublicsearch.html
View
@@ -1,6 +1,12 @@
CHANGELOG RoundCube Webmail
---------------------------
+2006/09/13 (estadtherr)
+----------
+- Introduction of TinyMCE HTML editor support for message composition and signatures
+ Note : a new column is added to the "identities" database table
+
+
2006/09/12 (estadtherr)
----------
- Fixed html2text treatment of table headers (Bug #1484020)
@@ -58,6 +58,7 @@ CREATE TABLE `identities` (
`reply-to` varchar(128) NOT NULL default '',
`bcc` varchar(128) NOT NULL default '',
`signature` text NOT NULL,
+ `html_signature` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`identity_id`),
KEY `user_id` (`user_id`)
);
@@ -7,3 +7,5 @@ ALTER TABLE `messages`
ADD `structure` TEXT,
ADD UNIQUE `uniqueness` (`cache_key`, `uid`);
+ALTER TABLE 'identities'
+ ADD 'html_signature' tinyint(1) default 0 NOT NULL;
@@ -114,6 +114,7 @@ CREATE TABLE `identities` (
`reply-to` varchar(128) NOT NULL,
`bcc` varchar(128) NOT NULL,
`signature` text NOT NULL,
+ `html_signature` tinyint(1) NOT NULL DEFAULT '0',
`user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY(`identity_id`),
CONSTRAINT `User_ID_FK_identities` FOREIGN KEY (`user_id`)
@@ -123,4 +124,4 @@ CREATE TABLE `identities` (
) TYPE=MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
-SET FOREIGN_KEY_CHECKS=1;
+SET FOREIGN_KEY_CHECKS=1;
@@ -69,7 +69,8 @@ CREATE TABLE identities (
email character varying(128) NOT NULL,
"reply-to" character varying(128),
bcc character varying(128),
- signature text
+ signature text,
+ html_signature integer DEFAULT 0 NOT NULL
);
@@ -5,3 +5,5 @@ ALTER TABLE "messages" DROP body;
ALTER TABLE "messages" ADD structure TEXT;
ALTER TABLE "messages" ADD UNIQUE (cache_key, uid);
+ALTER TABLE "identities" ADD html_signature integer DEFAULT 0 NOT NULL;
+
@@ -58,7 +58,8 @@ CREATE TABLE identities (
email varchar(128) NOT NULL default '',
"reply-to" varchar(128) NOT NULL default '',
bcc varchar(128) NOT NULL default '',
- signature text NOT NULL default ''
+ signature text NOT NULL default '',
+ html_signature tinyint NOT NULL default '0'
);
CREATE INDEX ix_identities_user_id ON identities(user_id);
View
@@ -81,6 +81,7 @@
require_once('include/bugs.inc');
require_once('include/main.inc');
require_once('include/cache.inc');
+require_once('lib/html2text.inc');
require_once('PEAR.php');
@@ -145,6 +146,21 @@
raise_error(array('code' => hexdec($_GET['_code'])), FALSE, TRUE);
}
+// handle HTML->text conversion
+if ($_action=='html2text')
+ {
+ $htmlText = $HTTP_RAW_POST_DATA;
+ $converter = new html2text($htmlText);
+
+ // TODO possibly replace with rcube_remote_response()
+ send_nocacheing_headers();
+ header('Content-Type: text/plain');
+ $plaintext = $converter->get_text();
+ print $plaintext;
+
+ exit;
+ }
+
// try to log in
if ($_action=='login' && $_task=='mail')
@@ -241,7 +257,6 @@
exit;
}
-
// include task specific files
if ($_task=='mail')
{
@@ -115,5 +115,19 @@ function log_bug($arg_arr)
}
}
+function log_debug($filename, $text)
+{
+ global $CONFIG, $INSTALL_PATH;
+
+ if (empty($CONFIG['log_dir']))
+ $CONFIG['log_dir'] = $INSTALL_PATH.'logs';
+
+ // try to open specific log file for writing
+ if ($fp = @fopen($CONFIG['log_dir'].'/'.$filename, 'a'))
+ {
+ fwrite($fp, date("d-M-Y H:i:s", mktime()) . ' ' . $text . "\n");
+ fclose($fp);
+ }
+}
?>
@@ -375,7 +375,7 @@ function load_gui()
// don't wait for page onload. Call init at the bottom of the page (delayed)
$javascript_foot = "if (window.call_init)\n call_init('$JS_OBJECT_NAME');";
-
+
if (!empty($GLOBALS['_framed']))
$javascript .= "$JS_OBJECT_NAME.set_env('framed', true);\n";
@@ -1197,6 +1197,7 @@ function rcube_xml_command($command, $str_attrib, $add_attrib=array())
'composeattachment' => 'rcmail_compose_attachment_field',
'priorityselector' => 'rcmail_priority_selector',
'charsetselector' => 'rcmail_charset_selector',
+ 'editorselector' => 'rcmail_editor_selector',
'searchform' => 'rcmail_search_form',
'receiptcheckbox' => 'rcmail_receipt_checkbox',
@@ -1279,8 +1280,7 @@ function rcube_button($attrib)
if ($attrib['type'])
$attrib['type'] = strtolower($attrib['type']);
else
- $attrib['type'] = ($attrib['image'] || $attrib['imagepas'] || $arg['imageact']) ? 'image' : 'link';
-
+ $attrib['type'] = ($attrib['image'] || $attrib['imagepas'] || $attrib['imageact']) ? 'image' : 'link';
$command = $attrib['command'];
@@ -1289,7 +1289,7 @@ function rcube_button($attrib)
$attrib = $sa_buttons[$attrib['name']];
// add button to button stack
- else if($attrib['image'] || $arg['imageact'] || $attrib['imagepas'] || $attrib['class'])
+ else if($attrib['image'] || $attrib['imageact'] || $attrib['imagepas'] || $attrib['class'])
{
if(!$attrib['name'])
$attrib['name'] = $command;
@@ -1487,7 +1487,15 @@ function rcube_table_output($attrib, $table_data, $a_show_cols, $id_col)
}
-
+/**
+ * Create an edit field for inclusion on a form
+ *
+ * @param string col field name
+ * @param string value field value
+ * @param array attrib HTML element attributes for field
+ * @param string type HTML element type (default 'text')
+ * @return string HTML field definition
+ */
function rcmail_get_edit_field($col, $value, $attrib, $type='text')
{
$fname = '_'.$col;
@@ -28,13 +28,15 @@ class rcube_html_page
var $scripts_path = '';
var $script_files = array();
+ var $external_scripts = array();
var $scripts = array();
var $charset = 'ISO-8859-1';
var $script_tag_file = "<script type=\"text/javascript\" src=\"%s%s\"></script>\n";
var $script_tag = "<script type=\"text/javascript\">\n<!--\n%s\n\n//-->\n</script>\n";
var $default_template = "<html>\n<head><title></title></head>\n<body></body>\n</html>";
-
+ var $tag_format_external_script = "<script type=\"text/javascript\" src=\"%s\"></script>\n";
+
var $title = '';
var $header = '';
var $footer = '';
@@ -69,13 +71,22 @@ class rcube_html_page
$this->script_files[$position][] = $file;
}
-
+ function include_external_script($script_location, $position='head')
+ {
+ if (!is_array($this->external_scripts[$position]))
+ {
+ $this->external_scripts[$position] = array();
+ }
+
+ $this->external_scripts[$position][] = $script_location;
+ }
+
function add_script($script, $position='head')
{
if (!isset($this->scripts[$position]))
- $this->scripts[$position] = '';
-
- $this->scripts[$position] .= "\n$script";
+ $this->scripts[$position] = "\n$script";
+ else
+ $this->scripts[$position] .= "\n$script";
}
@@ -139,19 +150,27 @@ class rcube_html_page
foreach ($this->script_files['head'] as $file)
$__page_header .= sprintf($this->script_tag_file, $this->scripts_path, $file);
+ if (is_array($this->external_scripts['head']))
+ {
+ foreach ($this->external_scripts['head'] as $xscript)
+ {
+ $__page_header .= sprintf($this->tag_format_external_script, $xscript);
+ }
+ }
+
if (strlen($this->scripts['head']))
$__page_header .= sprintf($this->script_tag, $this->scripts['head']);
if (is_array($this->script_files['foot']))
+ {
foreach ($this->script_files['foot'] as $file)
$__page_footer .= sprintf($this->script_tag_file, $this->scripts_path, $file);
+ }
if (strlen($this->scripts['foot']))
$__page_footer .= sprintf($this->script_tag, $this->scripts['foot']);
-
$__page_header .= $this->css->show();
-
// find page header
if($hpos = strpos(strtolower($output), '</head>'))
@@ -192,8 +211,12 @@ class rcube_html_page
// find and add page footer
- if(($fpos = strpos(strtolower($output), '</body>')) || ($fpos = strpos(strtolower($output), '</html>')))
+ $output_lc = strtolower($output);
+ if(($fpos = strrpos($output_lc, '</body>')) ||
+ ($fpos = strrpos($output_lc, '</html>')))
+ {
$output = substr($output,0,$fpos) . "$__page_footer\n" . substr($output,$fpos,strlen($output));
+ }
else
$output .= "\n$__page_footer";
@@ -202,7 +225,7 @@ class rcube_html_page
$__page_header = $__page_footer = '';
- // correct absolute pathes in images and other tags
+ // correct absolute paths in images and other tags
$output = preg_replace('/(src|href|background)=(["\']?)(\/[a-z0-9_\-]+)/Ui', "\\1=\\2$base_path\\3", $output);
$output = str_replace('$__skin_path', $base_path, $output);
@@ -854,9 +877,9 @@ class textarea extends base_form_element
if (isset($this->attrib['value']))
unset($this->attrib['value']);
- if (strlen($value))
+ if (strlen($value) && !isset($this->attrib['mce_editable']))
$value = rep_specialchars_output($value, 'html', 'replace', FALSE);
-
+
// return final tag
return sprintf('<%s%s>%s</%s>%s',
$this->_conv_case('textarea', 'tag'),
@@ -1233,7 +1256,7 @@ function array2js($arr, $type='')
if (!ereg("^[_a-zA-Z]{1}[_a-zA-Z0-9]*$", $key) /* || is_js_reserved_word($key) */)
$key = "'$key'";
- if (!is_array($value))
+ if (!is_array($value) && is_string($value))
{
$value = str_replace("\r\n", '\n', $value);
$value = str_replace("\n", '\n', $value);
@@ -1244,6 +1267,11 @@ function array2js($arr, $type='')
{
if ($type=='string')
$is_string = true;
+ else if (($type == 'mixed' && is_bool($value)) || $type == 'bool')
+ {
+ $is_string = false;
+ $value = $value ? "true" : "false";
+ }
else if ((($type=='mixed' && is_numeric($value)) || $type=='int') && strlen($value)<16) // js interprets numbers with digits >15 as ...e+...
$is_string = FALSE;
else
@@ -1270,7 +1298,9 @@ function array2js($arr, $type='')
}
}
else
+ {
return $arr;
+ }
}
@@ -1437,4 +1467,31 @@ function get_offset_time($offset_str, $factor=1)
}
+/**
+ * strrstr
+ *
+ * return the last occurence of a string in another string
+ * @param haystack string string in which to search
+ * @param needle string string for which to search
+ * @return index of needle within haystack, or false if not found
+ */
+function strrstr($haystack, $needle)
+ {
+ $pver = phpversion();
+ if ($pver[0] >= 5)
+ {
+ return strrpos($haystack, $needle);
+ }
+ else
+ {
+ $index = strpos(strrev($haystack), strrev($needle));
+ if($index === false) {
+ return false;
+ }
+ $index = strlen($haystack) - strlen($needle) - $index;
+ return $index;
+ }
+ }
+
+
?>
Oops, something went wrong.

0 comments on commit a0109c4

Please sign in to comment.