if (document.getElementById("CommentBox")) { document.getElementById("CommentBoxController").style.display = "none"; var oFCKeditor = new FCKeditor("Body") ; oFCKeditor.BasePath = "' . $Context->Configuration['WEB_ROOT'] . 'js/FCKeditor/" ; oFCKeditor.Config["CustomConfigurationsPath"] = "' . $Context->Configuration['WEB_ROOT'] . 'extensions/FCKeditor/config.js" ; oFCKeditor.ToolbarSet = "Vanilla" ; oFCKeditor.Height = 400; oFCKeditor.CheckBrowser = true ; oFCKeditor.ReplaceTextarea() ; } '; } function AddFCKeditortoCommentForm(&$DiscussionForm) { FCKeditorBar_Create($DiscussionForm->Context); } function RemoveToolbarRadioButton($Context) { print ' '; } function browser_detection( $which_test ) { // initialize the variables $browser = ''; $dom_browser = ''; // set to lower case to avoid errors, check to see if http_user_agent is set $navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : ''; // only detect safari if ((stristr($navigator_user_agent, "konqueror")) || (stristr($navigator_user_agent, "safari"))) { $browser = 'safari'; $dom_browser = true; } return $browser; } $user_browser = browser_detection('browser'); //add Kses formater class FCKeditorFormatter extends StringFormatter { var $allowed_tags; var $allowed_protocols; function FCKeditorFormatter($tags, $protocols) { $this->allowed_tags = $tags; $this->allowed_protocols = $protocols; } function Parse($String, $Object, $FormatPurpose) { if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY) { return kses($String, $this->allowed_tags, $this->allowed_protocols); } return $String; } } $FCKeditorFormatter = $Context->ObjectFactory->NewObject($Context, "FCKeditorFormatter", $FCKeditor_allowed_tags, $FCKeditor_allowed_protocols); $Context->StringManipulator->AddManipulator("FCKeditor", $FCKeditorFormatter); if ( $user_browser != 'safari') // Disable FCkeditor for Safari { if ($Context->Session->UserID > 0 && $Context->Session->User->Permission('PERMISSION_HTML_ALLOWED')) { if ($Context->Session->User->Preference('VisualEditing')) { //Make FCKeditor formatter the only formatter available to post a new comment or to edit an old one $Context->Configuration['DEFAULT_FORMAT_TYPE'] = 'FCKeditor'; $Context->Session->User->DefaultFormatType = 'FCKeditor'; $Context->Session->User->Preferences['ShowFormatSelector'] = 0; } else { $Context->Session->User->Preferences['ShowFormatSelector'] = 1; } } if ( in_array($Context->SelfUrl, array("post.php", "comments.php")) && $Context->Session->User->Preference('VisualEditing')) { $Head->AddScript('js/FCKeditor/fckeditor.js'); $Context->AddToDelegate('DiscussionForm', 'DiscussionForm_PreButtonsRender', 'AddFCKeditortoCommentForm'); $Context->AddToDelegate('DiscussionForm', 'CommentForm_PreButtonsRender','AddFCKeditortoCommentForm'); } $Context->AddToDelegate('DiscussionForm', 'DiscussionForm_PostSubmitRender', 'RemoveToolbarRadioButton'); $Context->AddToDelegate('DiscussionForm', 'CommentForm_PostSubmitRender','RemoveToolbarRadioButton'); } if ($Context->SelfUrl == 'account.php') { $Context->Dictionary['VisualEditing'] = 'Visual Editing Preference'; $Context->Dictionary['VisualEditingPreference'] = 'Enable Visual editing toolbar (not compatible with Safari Browser)'; $Context->AddToDelegate('PreferencesForm', 'PreRender', 'FCKeditor_PreferencesForm'); function FCKeditor_PreferencesForm(&$PreferencesForm) { $PreferencesForm->AddPreference($PreferencesForm->Context->GetDefinition('VisualEditing'), $PreferencesForm->Context->GetDefinition('VisualEditingPreference'), 'VisualEditing'); } } ?>