View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0032557||mantisbt||documentation||public||2023-05-17 21:10||2023-06-06 11:24|
|Summary||0032557: Can not set full URL to $g_manual_url in config_inc.php|
For example, my site URL is "https://www.sample.com/".
|Tags||No tags attached.|
The fix I committed back then worked, until a refactoring of the menu building functions broke it again as it channelled the URL again to helper_mantis_url() function.
Considering there was a pretty strong stance at the time against allowing helper_mantis_url() to handle absolute URLs, I'm not really sure how else this could be handled now.
Well that is the problem exactly ! This cannot currently be done, because the code relies on the standard print_menu() function, which always channels the menu item's URL through helper_mantis_url().
So the simplest and most logical fix, would be to let helper_mantis_url() return absolute URLs as-is.
An alternative could be to introduce a flag in the array of menu items passed on to print_menu(), indicating whether the given URL is absolute, and only pass it on to helper_mantis_url() if not. A bit of a hack I guess, but it would be quite easy to implement.
Why do you need the flag whether the given URL is absolute?
The absolute URL scenario is a corner case, currently used only for the Admin Guide link (and maybe some plugins); using the flag avoids executing a parse_url() call for every single menu item displayed to detect the URL type (absolute or relative), when the caller actually already knows what it is sending to print_menu().
So my idea was to optimize performance. Maybe using preg_match() with an appropriate regex would be slightly faster than parse_url(), and I guess you could even argue that the gain is negligible anyway, so maybe we should favor user convenience over execution speed here.