From 7f5c45cc359a189acdb87e19900d64bcead4a951 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 13 Mar 2018 19:48:49 +0900 Subject: [PATCH] Exclude editor components that are not actually directories xpressengine/xe-core#2241 --- modules/editor/editor.controller.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/editor/editor.controller.php b/modules/editor/editor.controller.php index 19cc9f3f9..0e9925548 100644 --- a/modules/editor/editor.controller.php +++ b/modules/editor/editor.controller.php @@ -428,8 +428,11 @@ class editorController extends editor else $output = executeQuery('editor.getComponentList', $args); $db_list = $output->data; - // Get a list of files - $downloaded_list = FileHandler::readDir(_XE_PATH_.'modules/editor/components'); + // Get a list of editor component folders + $downloaded_list = FileHandler::readDir(RX_BASEDIR . 'modules/editor/components'); + $downloaded_list = array_filter($downloaded_list, function($component_name) { + return is_dir(RX_BASEDIR . 'modules/editor/components/' . $component_name); + }); // Get information about log-in status and its group $is_logged = Context::get('is_logged'); @@ -505,8 +508,8 @@ class editorController extends editor $component_list->{$component_name} = $xml_info; // Get buttons, icons, images - $icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif'; - $component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif'; + $icon_file = RX_BASEDIR . 'modules/editor/components/'.$component_name.'/icon.gif'; + $component_icon_file = RX_BASEDIR . 'modules/editor/components/'.$component_name.'/component_icon.gif'; if(file_exists($icon_file)) $component_list->{$component_name}->icon = true; if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true; }