registerFunction( 'onInitEditor', 'botmostlyceEditorInit' ); $_MAMBOTS->registerFunction( 'onGetEditorContents', 'botmostlyceEditorGetContents' ); $_MAMBOTS->registerFunction( 'onEditorArea', 'botmostlyceEditorEditorArea' ); Global $mosConfig_live_site, $jspath, $mosConfig_absolute_path; include ($mosConfig_absolute_path."/mambots/editors/mostlyce/jscripts/tiny_mce/mostlyce_config.php"); // --- 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'])) { if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") { $jspath = "https:" . stristr ( $mosConfig_live_site, "//" ); } else { $jspath = "http:" . stristr ( $mosConfig_live_site, "//" ); } // With search and replace we 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 initialisation */ function botmostlyceEditorInit() { global $mosConfig_live_site, $my, $database, $mosConfig_absolute_path, $jspath; include ( $mosConfig_absolute_path."/mambots/editors/mostlyce/jscripts/tiny_mce/mostlyce_config.php" ); require_once ( $mosConfig_absolute_path."/mambots/editors/mostlyce/jscripts/tiny_mce/auth_mostlyce.php" ); //Check for User rights $isSuperAdmin = checkplugin( 'superadmin' ); $imgmanagerAuth = checkplugin( 'imgmanager' ); $filemanagerAuth = checkplugin( 'filemanager' ); $flashAuth = checkplugin( 'flash' ); $fontAuth = checkplugin( 'font' ); $emotionsAuth = checkplugin( 'emotions' ); $advlinkAuth = checkplugin( 'advlink' ); $scriptAuth = checkplugin( 'script' ); $iframeAuth = checkplugin( 'iframe' ); $tableAuth = checkplugin( 'table' ); // 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 Authorisation $invalid_elements[] = 'object,applet'; //Image Manager if( $imgmanagerAuth || $isSuperAdmin ) $plugins[] = 'imgmanager'; //File Manager if( $filemanagerAuth || $isSuperAdmin ) $plugins[] = 'filemanager'; //Flash Manager if( $flashAuth || $isSuperAdmin ) $plugins[] = 'flash'; //Font Options if ( $fontAuth || $isSuperAdmin ){ $elements[] = "font[face|size|color|style]"; $remove_font = false; }else{ $remove_font = true; } //Emotions if( $emotionsAuth || $isSuperAdmin ) $plugins[] = 'emotions'; //Advanced Link if( $advlinkAuth || $isSuperAdmin ) $plugins[] = 'advlink'; //Tables if( $tableAuth || $isSuperAdmin ) $plugins[] = 'table'; //Paragraphs or breaks if ( $editor_newlines == 'p' ){ $p_newlines = "true"; $br_newlines = "false"; } if ( $editor_newlines == 'br' ){ $p_newlines = "false"; $br_newlines = "true"; } if ( $scriptAuth || $isSuperAdmin ){ $elements[] = "script[$editor_script_elms]"; } else { $invalid_elements[] = "script"; } if ( $iframeAuth || $isSuperAdmin ){ $elements[] = "iframe[$editor_iframe_elms]"; } else { $invalid_elements[] = "iframe"; } $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"; $editor_layout_row1 = renderButton( str_replace( "\r\n", "", $editor_layout_row1 ), $remove_font ); $editor_layout_row2 = renderButton( str_replace( "\r\n", "", $editor_layout_row2 ), $remove_font ); $editor_layout_row3 = renderButton( str_replace( "\r\n", "", $editor_layout_row3 ), $remove_font ); $editor_layout_row4 = renderButton( str_replace( "\r\n", "", $editor_layout_row4 ), $remove_font ); //Plugins List $plugins[] = $editor_extra_plugins; $plugins = implode( ',', $plugins ); $elements[] = $editor_xtd_elms; $elements = implode( ',', $elements ); $invalid_elements = implode( ',', $invalid_elements ); //Check TinyMCE compression setting and set correct file path if ($editor_compression=='1') { $compress_file = "mambots/editors/mostlyce/jscripts/tiny_mce/tiny_mce_gzip.php"; } else { $compress_file = "mambots/editors/mostlyce/jscripts/tiny_mce/tiny_mce.js"; } return << 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[] = ''; } $buttons = implode( "", $buttons ); return <<$content
$buttons EOD; } ?>