diff -bbwrN --unified ./imce/imce.module ./10/imce.module --- ./imce/imce.module 2008-03-09 09:45:32.000000000 +0100 +++ ./10/imce.module 2008-03-09 10:49:31.000000000 +0100 @@ -178,3 +178,20 @@ } return !preg_match('/(^\/)|(\.\.)|(\/\/)|(\\\\)|(^\.\/)|(\/\.\/)|(\/\.$)|(^ )|( $)|(\/$)/', $dirname); } \ No newline at end of file + +/* hardcoded crap to get IMCE working with FCLEditor on Drupal 6 */ + +variable_set('imce_settings_fck', 1); + +function imce_integrate($e) { + static $state = array(); + if ($check) { + return $state[$e]; + } + if (!$state[$e]) { + drupal_add_js(drupal_get_path('module', 'imce').'/imce_set_'.$e.'.js'); + drupal_add_js('var imceBrowserURL = "'.url('imce/browse').'";', 'inline'); + drupal_add_js('if (Drupal.jsEnabled) { imce2fck_init() } ', 'inline', 'footer'); + $state[$e] = TRUE; + } +} diff -bbwrN --unified ./imce/imce_set_fck.js ./10/imce_set_fck.js --- ./imce/imce_set_fck.js 1970-01-01 01:00:00.000000000 +0100 +++ ./10/imce_set_fck.js 2008-03-09 09:44:48.000000000 +0100 @@ -0,0 +1,17 @@ +// $Id: imce_set_fck.js,v 1.1.2.4 2006/11/23 01:03:47 ufku Exp $ + +function imce2fck_init() { + if ("undefined" != typeof(window.FCKeditor)) { + for(i=1; document.getElementById("oFCK_" + i); i++) imceSetFCK("oFCK_" + i) ; + } +} + +function imceSetFCK(fck) { + var width = 640; + var height = 480; + var types = ['Image']; + for (var t in types) { + var s = fck+'.Config.'+types[t]+'Browser = true; '+fck+'.Config.'+types[t]+'BrowserURL = imceBrowserURL'; + eval(s); + } +} diff -bbwrN --unified ./imce/inc/page.inc ./10/inc/page.inc --- ./imce/inc/page.inc 2008-03-09 09:46:27.000000000 +0100 +++ ./10/inc/page.inc 2008-03-09 09:44:43.000000000 +0100 @@ -50,6 +50,7 @@ $imce['dir'] = str_replace('%2F', '/', rawurlencode($imce['dir'])); unset($imce['files'], $imce['name'], $imce['directories'], $imce['subdirectories']); drupal_add_js('imce.conf = '. drupal_to_js($imce), 'inline'); + drupal_add_js('imce.setSendTo(\'Insert\', function(file, win) { imceFinitor(file.url, file.width, file.height, file.size) } )', 'inline'); return $content; } diff -bbwrN --unified ./imce/js/imce.js ./10/js/imce.js --- ./imce/js/imce.js 2008-03-09 09:46:43.000000000 +0100 +++ ./10/js/imce.js 2008-03-09 09:44:38.000000000 +0100 @@ -1,4 +1,35 @@ // $Id: imce.js,v 1.3 2008/03/04 13:45:26 ufku Exp $ +var imceOpener = window.opener&&window.opener!=window.self ? window.opener : null; + +function imceFinitor(path, w, h, s) { + fieldId = 'txtUrl'; + imceVar = new Array(); + imceVar['targetWin'] = imceOpener; + imceVar['targetField'] = imceOpener.document.getElementById(fieldId); + imceVar['targetUrl'] = imceVar['targetField'].value; + imceVar['targetType'] = fieldId=='txtLnkUrl' ? 'link' : imceOpener.location.pathname.split('.')[0].split('_')[1]; + if (imceVar['targetType'] == 'image') { + imceVar['targetWidth'] = imceOpener.document.getElementById('txtWidth')||null; + imceVar['targetHeight'] = imceOpener.document.getElementById('txtHeight')||null; + } + + path = imceVar['absURL'] ? ('http://'+ location.host + path) : path; + if (imceVar['customCall']) {// if there is a custom function, call it + eval("imceVar['targetWin']."+imceVar['customCall']+"(path, w, h, s, window.self)"); + return; + } + imceVar['targetField'].value = path; + if (imceVar['targetWidth']) { + imceVar['targetWidth'].value = w; + } + if (imceVar['targetHeight']) { + imceVar['targetHeight'].value = h; + } + imceVar['targetWin'].focus(); + imceVar['targetField'].focus(); + imceVar['targetField'].blur(); + window.close(); +} //Global container. var imce = {'jsTree': {}, 'fileIndex': [], 'fileId': {}, 'selected': {}, 'conf': {}, 'ops': {}, 'vars': {'selcount': 0}};