--- imce/_imce.module.original	2008-09-24 17:04:57.000000000 +0200
+++ imce/imce.module	2008-09-24 18:34:22.000000000 +0200
@@ -189,4 +189,38 @@ function imce_user_page_access($account,
  */
 function imce_reg_dir($dirname) {
   return $dirname == '.' || (is_string($dirname) && $dirname != '' && !preg_match('@(^\s)|(^/)|(^\./)|(\s$)|(/$)|(/\.$)|(\.\.)|(//)|(\\\\)|(/\./)@', $dirname));
-}
\ Kein Zeilenumbruch am Dateiende.
+}
+
+/**
+ * Implementation of hook_wysiwyg_plugin().
+ */
+function imce_wysiwyg_plugin($editor) {
+  static $access, $integrated;
+
+  switch ($editor) {
+    case 'tinymce':
+      if (!isset($access)) {
+        $access = function_exists('imce_access') && imce_access();
+      }
+      if ($access) {
+        $result = array(
+          'imce' => array(
+            'path' => drupal_get_path('module', 'imce') .'/unknown',
+            'extensions' => array('imce' => t('IMCE')),
+            'url' => 'http://drupal.org/project/imce',
+            'options' => array(
+              'file_browser_callback' => 'imceImageBrowser',
+              'inline_styles' => TRUE,
+            ),
+            'internal' => FALSE,
+            'load' => TRUE,
+          ),
+        );
+        if (!isset($integrated)) {
+          $integrated = TRUE;
+          drupal_add_js("function imceImageBrowser(fid, url, type, win) {win.open(Drupal.settings.basePath +'?q=imce&app=TinyMCE|url@'+ fid, '', 'width=760,height=560,resizable=1');}", 'inline');
+        }
+        return $result;
+      }
+  }
+}
