Browse Source

That will probably break something: removed all the php functions related to the old editors (html_to_bbc, bbc_to_html, etc.)
Added support for bbcodes buttons introduced by mods (pretty simple implementation but shold work in most cases

Signed-off-by: emanuele <[email protected]>

emanuele 12 years ago
parent
commit
a550b65700

+ 0 - 13
Sources/PersonalMessage.php

@@ -2031,19 +2031,6 @@ function MessagePost2()
 		}
 	}
 
-	// If we came from WYSIWYG then turn it back into BBC regardless.
-	if (!empty($_POST['message_mode']) && isset($_POST['message']))
-	{
-		require_once($sourcedir . '/Subs-Editor.php');
-		$_POST['message'] = html_to_bbc($_POST['message']);
-
-		// We need to unhtml it now as it gets done shortly.
-		$_POST['message'] = un_htmlspecialchars($_POST['message']);
-
-		// We need this in case of errors etc.
-		$_REQUEST['message'] = $_POST['message'];
-	}
-
 	// If your session timed out, show an error, but do allow to re-submit.
 	if (!isset($_REQUEST['xml']) && checkSession('post', '', false) != '')
 		$post_errors[] = 'session_timeout';

+ 4 - 23
Sources/Post.php

@@ -1180,19 +1180,9 @@ function Post2()
 		}
 	}
 
-	// If we came from WYSIWYG then turn it back into BBC regardless.
-	if (!empty($_REQUEST['message_mode']) && isset($_REQUEST['message']))
-	{
-		require_once($sourcedir . '/Subs-Editor.php');
-
-		$_REQUEST['message'] = html_to_bbc($_REQUEST['message']);
-
-		// We need to unhtml it now as it gets done shortly.
-		$_REQUEST['message'] = un_htmlspecialchars($_REQUEST['message']);
-
-		// We need this for everything else.
-		$_POST['message'] = $_REQUEST['message'];
-	}
+	// Previewing? Go back to start.
+	if (isset($_REQUEST['preview']))
+		return Post();
 
 	// Prevent double submission of this form.
 	checkSubmitOnce('check');
@@ -2744,16 +2734,7 @@ function QuoteFast()
 		if (!empty($modSettings['removeNestedQuotes']))
 			$row['body'] = preg_replace(array('~\n?\[quote.*?\].+?\[/quote\]\n?~is', '~^\n~', '~\[/quote\]~'), '', $row['body']);
 
-		// Make the body HTML if need be.
-		if (!empty($_REQUEST['mode']))
-		{
-			require_once($sourcedir . '/Subs-Editor.php');
-			$row['body'] = strtr($row['body'], array('&lt;' => '#smlt#', '&gt;' => '#smgt#', '&amp;' => '#smamp#'));
-			$row['body'] = bbc_to_html($row['body']);
-			$lb = '<br />';
-		}
-		else
-			$lb = "\n";
+		$lb = "\n";
 
 		// Add a quote string on the front and end.
 		$context['quote']['xml'] = '[quote author=' . $row['poster_name'] . ' link=topic=' . $row['id_topic'] . '.msg' . (int) $_REQUEST['quote'] . '#msg' . (int) $_REQUEST['quote'] . ' date=' . $row['poster_time'] . ']' . $lb . $row['body'] . $lb . '[/quote]';

File diff suppressed because it is too large
+ 0 - 1304
Sources/Subs-Editor.php


+ 8 - 7
Themes/default/GenericControls.template.php

@@ -107,7 +107,7 @@ function template_control_richedit($editor_id, $smileyContainer = null, $bbcCont
 							if (popup_exists)
 							{
 								this.options.emoticons.more = this.options.emoticons.popup;
-								moreButton = $(\'<div />\').attr({class: "sceditor-more"}).text(', JavaScriptEscape('[' . $txt['more'] . ']'), ').click(function () {
+								moreButton = $(\'<div />\').attr({class: "sceditor-more"}).text(\'[\' + this._(\'More\') + \']\').click(function () {
 									if ($(".sceditor-smileyPopup").length > 0)
 									{
 										$(".sceditor-smileyPopup").fadeIn(\'fast\');
@@ -119,7 +119,7 @@ function template_control_richedit($editor_id, $smileyContainer = null, $bbcCont
 											allowHide = true;
 											popupContent = $(\'<div />\');
 											line = $(\'<div />\');
-											closeButton = $(\'<span />\').text(', JavaScriptEscape('[' . $txt['find_close'] . ']'), ').click(function () {
+											closeButton = $(\'<span />\').text(\'[\' + base._(\'Close\') + \']\').click(function () {
 												$(".sceditor-smileyPopup").fadeOut(\'fast\');
 											});
 
@@ -204,34 +204,36 @@ function template_control_richedit($editor_id, $smileyContainer = null, $bbcCont
 
 						editor.createDropDown(caller, "insertlink", content);
 					},
-					', javaScriptEscape($txt['ftp']), '
+					\'Insert FTP Link\'
 				);
 				$.sceditor.setCommand(
 					\'glow\',
 					function () {
 						this.wysiwygEditorInsertHtml(\'[glow=red,2,300]\', \'[/glow]\');
 					},
-					', javaScriptEscape($txt['glow']), '
+					\'Glow\'
 				);
 				$.sceditor.setCommand(
 					\'shadow\',
 					function () {
 						this.wysiwygEditorInsertHtml(\'[shadow=red,left]\', \'[/shadow]\');
 					},
-					', javaScriptEscape($txt['shadow']), '
+					\'Shadow\'
 				);
 				$.sceditor.setCommand(
 					\'tt\',
 					function () {
 						this.wysiwygEditorInsertHtml(\'<tt>\', \'</tt>\');
 					},
-					', javaScriptEscape($txt['teletype']), '
+					\'Teletype\'
 				);
+				', !empty($context['bbcodes_hanlders']) ? $context['bbcodes_hanlders'] : '', '
 
 				$("#', $editor_id, '").sceditorBBCodePlugin({
 					style: "', $settings['default_theme_url'], '/css/jquery.sceditor.default.css",
 					emoticonsCompat: true,
 					supportedWysiwyg: (((is_ie5up && !is_ie50) || is_ff || is_opera95up || is_safari || is_chrome) && !(is_iphone || is_android)),
+					locale: en,
 					colors: "black,red,yellow,pink,green,orange,purple,blue,beige,brown,teal,navy,maroon,limegreen,white"';
 
 		// Show the smileys.
@@ -313,7 +315,6 @@ function template_control_richedit($editor_id, $smileyContainer = null, $bbcCont
 					sUniqueId: ', JavaScriptEscape($editor_id), ',
 					bRTL: ', $txt['lang_rtl'] ? 'true' : 'false', ',
 					bWysiwyg: ', $editor_context['rich_active'] ? 'true' : 'false', ',
-					sText: ', JavaScriptEscape($editor_context['rich_active'] ? $editor_context['rich_value'] : ''), ',
 					sEditWidth: ', JavaScriptEscape($editor_context['width']), ',
 					sEditHeight: ', JavaScriptEscape($editor_context['height']), ',
 					bRichEditOff: ', empty($modSettings['disable_wysiwyg']) ? 'false' : 'true', ',

+ 78 - 78
Themes/default/css/jquery.sceditor.css

@@ -229,81 +229,81 @@ div.sceditor-dropdown, div.sceditor-dropdown div {
 			.sceditor-button-source div { background: url('../images/bbc/icons/page_white_text.png'); }
 
 /* SMF buttons styles */
-			.sceditor-button-bold div {
-				background: url('../images/bbc/bold.png');
-			}
-			.sceditor-button-italic div {
-				background: url('../images/bbc/italicize.png');
-			}
-			.sceditor-button-underline div {
-				background: url('../images/bbc/underline.png');
-			}
-			.sceditor-button-strike div {
-				background: url('../images/bbc/strike.png');
-			}
-			.sceditor-button-pre div {
-				background: url('../images/bbc/pre.png');
-			}
-			.sceditor-button-left div {
-				background: url('../images/bbc/left.png');
-			}
-			.sceditor-button-center div {
-				background: url('../images/bbc/center.png');
-			}
-			.sceditor-button-right div {
-				background: url('../images/bbc/right.png');
-			}
-			.sceditor-button-image div {
-				background: url('../images/bbc/img.png');
-			}
-			.sceditor-button-link div {
-				background: url('../images/bbc/url.png');
-			}
-			.sceditor-button-email div {
-				background: url('../images/bbc/email.png');
-			}
-			.sceditor-button-ftp div {
-				background: url('../images/bbc/ftp.png');
-			}
-			.sceditor-button-glow div {
-				background: url('../images/bbc/glow.png');
-			}
-			.sceditor-button-shadow div {
-				background: url('../images/bbc/shadow.png');
-			}
-			.sceditor-button-move div {
-				background: url('../images/bbc/move.png');
-			}
-			.sceditor-button-superscript div {
-				background: url('../images/bbc/sup.png');
-			}
-			.sceditor-button-subscript div {
-				background: url('../images/bbc/sub.png');
-			}
-			.sceditor-button-tt div {
-				background: url('../images/bbc/tele.png');
-			}
-			.sceditor-button-table div {
-				background: url('../images/bbc/table.png');
-			}
-			.sceditor-button-code div {
-				background: url('../images/bbc/code.png');
-			}
-			.sceditor-button-quote div {
-				background: url('../images/bbc/quote.png');
-			}
-			.sceditor-button-bulletlist div {
-				background: url('../images/bbc/list.png');
-			}
-			.sceditor-button-orderedlist div {
-				background: url('../images/bbc/orderlist.png');
-			}
-			.sceditor-button-horizontalrule div {
-				background: url('../images/bbc/hr.png');
-			}
-			.sceditor-button-unformat div {
-				background: url('../images/bbc/unformat.png');
-			}
-			.sceditor-button-toggle div {
-				background: url('../images/bbc/toggle.png');
-			}
+.sceditor-button-bold div {
+	background: url('../images/bbc/bold.png');
+}
+.sceditor-button-italic div {
+	background: url('../images/bbc/italicize.png');
+}
+.sceditor-button-underline div {
+	background: url('../images/bbc/underline.png');
+}
+.sceditor-button-strike div {
+	background: url('../images/bbc/strike.png');
+}
+.sceditor-button-pre div {
+	background: url('../images/bbc/pre.png');
+}
+.sceditor-button-left div {
+	background: url('../images/bbc/left.png');
+}
+.sceditor-button-center div {
+	background: url('../images/bbc/center.png');
+}
+.sceditor-button-right div {
+	background: url('../images/bbc/right.png');
+}
+.sceditor-button-image div {
+	background: url('../images/bbc/img.png');
+}
+.sceditor-button-link div {
+	background: url('../images/bbc/url.png');
+}
+.sceditor-button-email div {
+	background: url('../images/bbc/email.png');
+}
+.sceditor-button-ftp div {
+	background: url('../images/bbc/ftp.png');
+}
+.sceditor-button-glow div {
+	background: url('../images/bbc/glow.png');
+}
+.sceditor-button-shadow div {
+	background: url('../images/bbc/shadow.png');
+}
+.sceditor-button-move div {
+	background: url('../images/bbc/move.png');
+}
+.sceditor-button-superscript div {
+	background: url('../images/bbc/sup.png');
+}
+.sceditor-button-subscript div {
+	background: url('../images/bbc/sub.png');
+}
+.sceditor-button-tt div {
+	background: url('../images/bbc/tele.png');
+}
+.sceditor-button-table div {
+	background: url('../images/bbc/table.png');
+}
+.sceditor-button-code div {
+	background: url('../images/bbc/code.png');
+}
+.sceditor-button-quote div {
+	background: url('../images/bbc/quote.png');
+}
+.sceditor-button-bulletlist div {
+	background: url('../images/bbc/list.png');
+}
+.sceditor-button-orderedlist div {
+	background: url('../images/bbc/orderlist.png');
+}
+.sceditor-button-horizontalrule div {
+	background: url('../images/bbc/hr.png');
+}
+.sceditor-button-unformat div {
+	background: url('../images/bbc/unformat.png');
+}
+.sceditor-button-toggle div {
+	background: url('../images/bbc/toggle.png');
+}

+ 1 - 2
index.php

@@ -193,7 +193,7 @@ function smf_main()
 	if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest']))
 		fatal_lang_error('not_a_topic', false);
 
-	$no_stat_actions = array('dlattach', 'findmember', 'jseditor', 'jsoption', 'requestmembers', 'smstats', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile');
+	$no_stat_actions = array('dlattach', 'findmember', 'jsoption', 'requestmembers', 'smstats', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile');
 	call_integration_hook('integrate_pre_log_stats', $no_stat_actions);
 	// Do some logging, unless this is an attachment, avatar, toggle of editor buttons, theme option, XML feed etc.
 	if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], $no_stat_actions))
@@ -281,7 +281,6 @@ function smf_main()
 		'help' => array('Help.php', 'ShowHelp'),
 		'helpadmin' => array('Help.php', 'ShowAdminHelp'),
 		'im' => array('PersonalMessage.php', 'MessageMain'),
-		'jseditor' => array('Subs-Editor.php', 'EditorMain'),
 		'jsmodify' => array('Post.php', 'JavaScriptModify'),
 		'jsoption' => array('Themes.php', 'SetJavaScript'),
 		'lock' => array('Topic.php', 'LockTopic'),

Some files were not shown because too many files changed in this diff