Commit 408a29ac authored by Henri MEDOT's avatar Henri MEDOT
Browse files

Fixed: make sure we do not return as suggestions menu item paths that will be...

Fixed: make sure we do not return as suggestions menu item paths that will be denied by the client-side plugin.
parent fb34bb8a
......@@ -322,3 +322,7 @@ function ckeditor_link_url($path = NULL, $langcode) {
return url($path, $options);
}
function _ckeditor_link_check_path($path) {
return preg_match('`^[a-z][\w\/\.-]*$`i', $path);
}
......@@ -35,10 +35,12 @@ function ckeditor_link_ckeditor_link_i18n_menu_autocomplete($string) {
}
$result = $query->execute();
foreach ($result as $item) {
$router_item = menu_get_item($item->link_path);
if ($router_item && $router_item['access']) {
$path = ckeditor_link_path_prefix_language($item->link_path, $item->language);
$matches[$path] = $item->link_title;
if (_ckeditor_link_check_path($item->link_path)) {
$router_item = menu_get_item($item->link_path);
if ($router_item && $router_item['access']) {
$path = ckeditor_link_path_prefix_language($item->link_path, $item->language);
$matches[$path] = $item->link_title;
}
}
}
}
......
......@@ -28,11 +28,13 @@ function ckeditor_link_ckeditor_link_menu_autocomplete($string) {
}
$result = $query->execute();
foreach ($result as $item) {
$router_item = menu_get_item($item->link_path);
if ($router_item && $router_item['access']) {
$langcode = (isset($item->language)) ? $item->language : LANGUAGE_NONE;
$path = ckeditor_link_path_prefix_language($item->link_path, $langcode);
$matches[$path] = $item->link_title;
if (_ckeditor_link_check_path($item->link_path)) {
$router_item = menu_get_item($item->link_path);
if ($router_item && $router_item['access']) {
$langcode = (isset($item->language)) ? $item->language : LANGUAGE_NONE;
$path = ckeditor_link_path_prefix_language($item->link_path, $langcode);
$matches[$path] = $item->link_title;
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment