registerFunction( 'onInitEditor', 'botmostlyceEditorInit' ); $_MAMBOTS->registerFunction( 'onGetEditorContents', 'botmostlyceEditorGetContents' ); $_MAMBOTS->registerFunction( 'onEditorArea', 'botmostlyceEditorEditorArea' ); // --- Start custom code DHS Informatisering - opensource@dhs.nl, www.dhs.nl // This code makes it possible to use mostlyce in a website that combines normal and SSL-connections if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") { $jspath = "https:" . stristr ( $mosConfig_live_site, "//" ); } else { $jspath = "http:" . stristr ( $mosConfig_live_site, "//" ); } // Replaced every occurrence of '$mosConfig_live_site' with '$jspath' in this file // --- End custom code DHS Informatisering --- //Render Row Buttons function renderButton( $row, $remove_font ) { $row = explode( ',', $row ); foreach( $row as $key => $rowitem ) { if( strpos( $rowitem, '-' ) === 0) { unset( $row[$key] ); } if( $remove_font ){ if( $rowitem == 'fontselect' || $rowitem == 'fontsizeselect' || $rowitem == 'forecolor' || $rowitem == 'backcolor' ) { unset( $row[$key] ); } } } return $new_row = implode( ',', array_values( $row ) ); } /** * TinyMCE WYSIWYG Editor - javascript initialization */ function botmostlyceEditorInit() { global $mosConfig_live_site, $my, $database, $mosConfig_absolute_path, $jspath; global $adminside, $mosConfig_secret, $mosConfig_cachetime; include($mosConfig_absolute_path."/mambots/editors/mostlyce/jscripts/tiny_mce/mostlyce_config.php"); //Setup a session variable for Image Manager and external list generator security checks $env = md5($_SERVER['HTTP_USER_AGENT']); $mostlyceRestoreKey=md5($mosConfig_secret.$env.$_SERVER['REMOTE_ADDR']); //Determine cookie expiration time. Should match login timeout (though min of 1min). if (is_numeric($mosConfig_cachetime) && $mosConfig_cachetime>=60) { $cookieTimeout = $mosConfig_cachetime; } else { $cookieTimeout = 60; } setcookie("mostlyce[startup_key]", $mostlyceRestoreKey, time()+$cookieTimeout, '/'); setcookie("mostlyce[usertype]", $my->usertype, time()+$cookieTimeout, '/'); //Allows for dynamic editor sizing by apps like Remository $get_width = mosGetParam($_GET,'width',NULL); $get_height = mosGetParam($_GET,'height',NULL); if ($get_width) { $editor_width = (int) $get_width; } if ($get_height) { $editor_height = (int) $get_height; } // Get the default stylesheet $query = "SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='0'"; $database->setQuery( $query ); $cur_template = $database->loadResult(); // Assigned template if (isset( $Itemid ) && $Itemid != "" && $Itemid != 0) { $query = "SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='$Itemid' LIMIT 1"; $database->setQuery($query); $cur_template = $database->loadResult() ? $database->loadResult() : $cur_template; } //Plugin settings and Authorization $invalid_elements[] = 'object,applet'; //Check access level and MOStlyCE Admin preference. Set editor items accordingly. //Script Elements (Only loads for Admin) if (($adminside>0) && ($editor_script_acl==='true')) { $elements[] = "script[$editor_script_elms]"; } else { $invalid_elements[] = "script"; } //IFrame Elements (Only loads for Admin) if (($adminside>0) && ($editor_iframe_acl=='true')) { $elements[] = "iframe[$editor_iframe_elms]"; } //Media Plugin if ($editor_plugin_media_acl==='true') { $plugins[] = 'media'; } //Font Options if ($editor_font_tools_acl==='true') { $elements[] = "font[face|size|color|style]"; $remove_font = false; } else { $remove_font = true; } //Emotions Plugin if ($editor_plugin_emotions_acl==='true') { $plugins[] = 'emotions'; } //Print Plugin if ($editor_plugin_print==='true') { $plugins[] = 'print'; } //Search & Replace Plugin if ($editor_plugin_searchreplace==='true') { $plugins[] = 'searchreplace'; } //Table Plugin if ($editor_plugin_table_acl==='true') { $plugins[] = 'table'; } //DateTime Plugin if ($editor_plugin_datetime_acl==='true') { $plugins[] = 'insertdatetime'; } //SpellChecker Plugin (needs Curl) if ($editor_plugin_spellchecker==='true' && function_exists("curl_init")) { $plugins[] = 'spellchecker'; $theme_advanced_buttons4_add = 'spellchecker'; } else { $theme_advanced_buttons4_add = ''; } //Layer Plugin if ($editor_plugin_layer==='true') { $plugins[] = 'layer'; } //Image/File Manager Plugin if ($editor_plugin_img_mgr==='true') { $file_browser_callback='fileBrowserCallBack'; } else { //Img/File browser not enabled $file_browser_callback=''; } //Paragraphs or breaks if ($editor_newlines == 'p'){ $p_newlines = "true"; $br_newlines = "false"; } if ($editor_newlines == 'br'){ $p_newlines = "false"; $br_newlines = "true"; } $css_template = $mosConfig_live_site."/templates/".$cur_template."/css/"; $content_css = ($editor_css_override === '1' ) ? $css_template.$editor_custom_css : $css_template."template_css.css"; //Plugins List $plugins[] = $editor_extra_plugins; $plugins[] = 'safari,pagebreak,style,advhr,advimage,advlink,iespell,inlinepopups,preview,contextmenu,paste,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras'; //These ones are always loaded $plugins = implode( ',', $plugins ); $elements[] = $editor_xtd_elms; $elements = implode( ',', $elements ); $invalid_elements = implode( ',', $invalid_elements ); /* Check TinyMCE compression setting and set correct file path Note: The TinyMCE PHP gzip compressor cannot and will not work if zlib compression is already enabled on the server. */ $tinyHeader = ''; if ($editor_compression==='true' && !ini_get('zlib.output_compression')) { $tinyHeader = ""; $tinyHeader .=" "; } else { $tinyHeader = ""; } return << $tinyHeader EOD; } /** * TinyMCE WYSIWYG Editor - copy editor contents to form field * @param string The name of the editor area * @param string The name of the form field */ function botmostlyceEditorGetContents( $editorArea, $hiddenField ) { global $jspath; return <<trigger( 'onCustomEditorButton' ); $buttons = array(); foreach ($results as $result) { $buttons[] = ''; } //Hide old {mosimage} button if requested if ($editor_mosimage_icon == 'false') { unset($buttons[array_search(0,$buttons)]); } $buttons = implode( "", $buttons ); return <<$content
$buttons EOD; } ?>