-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.0] Another idea how to fix routing in joomla #22229
Conversation
This comment was marked as abuse.
This comment was marked as abuse.
I love how this PR adds the option/view to the URL and moves the task to the post. It will surely fix multiple issues and has improved security. There is one more change I would make, though: adding ItemId (route) to the links would allow the non-used extensions to be blocked in the future. Both Kunena/Gantry 5 prevent all access the component if you're not using menu item. |
Do we have such situation in core? |
Yes. When SEF mode is ON. Take a look at line from J3/J4 code: where A workaround done in J3/J4 is to force the active |
The second method used by J3/J4 is to insert return URL (the current page - mod_login) directly in the form action link Then SEF link is parsed and plugin languagefilter uses active menu item to find the correct association. |
You can try to build routing based on com_content from J3. The old implementation of routing (com_tags) requires the manual addition of Itemid to If you do not want extension to be used then disable it. |
This is working against the concepts of the routing. No, adding the current menu item to the URL is NOT the solution to people giving a fuck and not setting up their website correctly. |
Yes. This is one of the reasons why I created this PR to eliminate adding an active menu item id in many places:
|
@Hackwar Haha, I get your point. It has always caused a lot of questions in Kunena support because of people have no idea how Joomla menu system works. In Gantry it doesn't really matter as the purpose of the menu item is to only to show blank content (there are no tasks that are independent to the menu item). Though that said, most people do get it, but only after multiple messages in support. Also, this doesn't seem to be an issue in Grav, where pages are always defined by the hierarchy. I was just asking this because of to me having less known URLs to attack would make it less likely that something you installed but later forgot does not create security issues in your site. Though it is not such a large issue as it used to be before you could automatically update extensions. |
@csthomas Now don't work |
@vagabondo I answered at #22036 (comment) You have to apply one more patch from #20979 |
@csthomas |
The structure of routing need it but only if joomla can not find a correct menu item. The path You can leave it as it is and it will work correctly OR if you care about SEO, create a menu item for at least "All Categories". |
@csthomas If set Unpablished for "All categories" - part /component/content/article - exist. If set Published and access Super User - error. The user should not think about how to overcome the error that is present. |
@csthomas |
If you want to compare to J3.8.12 then be sure that you use modern routing in com_content.
If you set access only to "Super User" for "All categories" then everything inside this menu requires access of "Super User". |
@csthomas Then in the release also write that for the correct display (with an additional element in the path) - necessary to include the menu item "All categories"? Sorry, but I think that this will not lead to good results |
That is what I do, and also in 3.x with modern routing on (List all categories menu item set to hidden, for each Content Language when the site is multilingual), and similar for Contacts and Newsfeeds. |
Next error. |
@infograf768 |
Evidently the all categories menu item has to be published, even if hidden, and access set to public... |
@infograf768 |
If you have hundred categories on your site, this will treat them the same. |
@infograf768 |
@vagabondo If you want to remove One parent category "Home Category" (and all your categories will be inside) and set menu item for it as home. I mean, replace featured view by category view in your home menu item. The other way is to set "All Categories" as a home menu item. IMO the featured view (com_content) should be removed and functionality should be moved to category/categories view. |
Next error. I rename menu item all-categories at all. In path have all-categories. Router correctly is not working |
@csthomas |
This PR may solve only part of many problems. I understand that you want to get rid of If this PR helps then please mark the test as a success at https://issues.joomla.org/tracker/joomla-cms/22229 Otherwise, we will wait for a better PR or we will remain with current J4 behavior. |
Not successful |
Next errors. With patch, menu item "All_categories" - Unpublished. With patch, menu item "All_categories" - Published and Hidden. In all cases, the last page is in the category "experiment" and not Featured. And on it there is a link from the previous page. The address of the site will be changed to the form . And in this addition there is no need.Once again I repeat that solution - for each category its menu item - is not correct. Summary: Not successful. |
The problem exists in your menu configuration. What do you want?
How can you get it:
Result:
This should work even without this PR. |
8c9b277
to
ba3655f
Compare
I reverted changes with the access level settings to the menu items. These were the same changes that I tried to do in #22445 |
Dron's fail tests are not related. |
…enu item * Add changes for multilanguage version * uri->setQuery(->getRouter()->getVars()) * Add no menu item * Redirect to the correct language user profile * Force Non SEF URL in the return field
9dda1a2
to
fe6b983
Compare
This can be closed and picked up in another PR if someone is interested. |
Fix issues:
/component/users/login
),index.php?view=article&id=1-article&catid=2
and replace them by/component/content/article/2-category/1-article
&Itemid=xxx
from all/component/content/...
links/component/users/login
Summary of Changes
This PR is an improved redo of #19099 and #19295.
There is a few difference to previous PRs.
Basic assumptions
These links will inherit
Itemid
from the current pageRoute::_('index.php')
- missingoption
andview
Route::_('index.php?id=....')
- missingoption
andview
Route::_('index.php&option=com_content')
- missingview
Route::_('index.php&option=com_users&task=user.login')
- missingview
Route::_('index.php&view=categories')
- missingoption
This not
Route::_('index.php&option=com_content&view=categories')
- if menu item won't exists then/component/content/categories
will be generatedRoute::_('index.php&option=com_users&view=login&task=edit....')
- if menu item won't exists then/component/users/login?task=user.login
will be generatedThe redirect URL in
&return=
parameter should be stored in Non SEF mode, ex:/login-form?return=urlencode(base64_encode('index.php?Itemid=111'))
./login-form?return=urlencode(base64_encode('/news'))
) then association in multilingual website won't work correctly, becauselanguagefilter
plugin is looking for raw URL parameterItemid
.This patch may break B/C.
Regards of changes in this PR, some pages like '/component/content/categories' won't have any active menu item,
Itemid
. This way we won't have headline "Home" in pages that does not have its own menu item.A suffix
&Itemid=xxx
should disappear from SEF link.After applying this patch, joomla will stop adding the default
Itemid
to links without their own menu item.Previously it looked like
/component/content/article/1-article&catid=2&Itemid=102
now it will be/component/content/article/2-uncategorised/1-article
(without suffix&Itemid=102
, which is/was redundant).Without this patch, for pages without their own menu item, joomla generates a lot of duplicated links.
See #22450 (comment)
Testing Instructions
Look at the test instructions for issues:
#15730
#22036
#19295
If you get a 404 error on pages like
/component/content/...
then also apply #20979.Documentation Changes Required
??