--- fckeditor,6.x-1.3.module 2009-03-11 10:29:55.000000000 -0400 +++ fckeditor.module 2009-06-23 16:19:12.000000000 -0400 @@ -1372,32 +1372,24 @@ function fckeditor_load_toolbar_options() { $arr = array(); + $config_js = array(); $module_drupal_path = drupal_get_path('module', 'fckeditor'); - $fckconfig_js = $module_drupal_path .'/fckeditor/fckconfig.js'; - $fckeditor_config_js = $module_drupal_path .'/fckeditor.config.js'; - if (file_exists($fckconfig_js) && is_readable($fckconfig_js)) { - $fp = @fopen($fckconfig_js, "r"); - if ($fp) { - while (!feof($fp)) { - $line = fgets($fp, 1024); - if (preg_match("/FCKConfig\.ToolbarSets\[(\"|')(.*?)\\1\]/i", $line, $matches)) { - $arr[$matches[2]] = ucfirst($matches[2]); - } - } - fclose($fp); - } - } - if (file_exists($fckeditor_config_js) && is_readable($fckeditor_config_js)) { - $fp = @fopen($fckeditor_config_js, "r"); - if ($fp) { - while (!feof($fp)) { - $line = fgets($fp, 1024); - if (preg_match("/FCKConfig\.ToolbarSets\[(\"|')(.*?)\\1\]/i", $line, $matches)) { - $arr[$matches[2]] = ucfirst($matches[2]); - } + $config_js[] = $module_drupal_path . '/fckeditor/fckconfig.js'; + $config_js[] = $module_drupal_path . '/fckeditor.config.js'; + foreach (list_themes() as $theme) { + $config_js[] = dirname($theme->filename) . '/fckeditor.config.js'; + } + foreach ($config_js as $file) { + if (!(file_exists($file) && is_readable($file))) continue; + $fp = @fopen($file, "r"); + if (!$fp) continue; + while (!feof($fp)) { + $line = fgets($fp, 1024); + if (preg_match("/FCKConfig\.ToolbarSets\[(\"|')(.*?)\\1\]/i", $line, $matches)) { + $arr[$matches[2]] = ucfirst($matches[2]); } - fclose($fp); } + fclose($fp); } //oops, we have no information about toolbars, let's use hardcoded array