MantisBT: master-2.0.x bbf4cac7

Author Committer Branch Timestamp Parent
dregad dregad master-2.0.x 2017-01-04 03:43 master-2.0.x da85ef7e
Affected Issues  0022107: EVENT_MENU_MAIN does not support relative paths
Changeset

Allow helper_mantis_url() to be called twice

Starting with Mantis 2.0, the Layout API's layout_sidebar_menu()
function takes care of calling helper_mantis_url() for relative URLs in
menu items.

Since that function blindly prepends $g_short_path to the given URL,
this causes issues for plugins relying on a plugin_page() call with
default parameters, e.g. to display menu items via EVENT_MENU_MAIN
event, because the short path is prefixed twice resulting in generation
of an invalid URL.

As pointed out by user @TiKu in 0022107:0054922 using plugin_page()'s $p_redirect
parameter = true as it was done for the Source Integration plugin [1] is
really a workaround.

This commit fixes the issue by only prepending the short path if it is
not yet part of the given URL string.

Fixes 0022107

[1] https://github.com/mantisbt-plugins/source-integration/commit/1491ba13b288d1b8ac18d3025e3db29e62265cb5

mod - core/helper_api.php Diff File