e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
321 stars 213 forks source link

Links with e_BASE in path doesn't work with SEF URL #1309

Closed Jimmi08 closed 7 years ago

Jimmi08 commented 8 years ago

I noticed weird thing with my plugins (Just only with mine, so I do something wrong). The same with new plugin or with rewriting old one.

e_BASE is empty. With other plugin (gallery, download) there si value ../..

I found the reason here (code is from e107_class.php). image

~~With other plugins currect directory is correct C:\xampp\htdocs\e107V2\e10720150123\e107_plugins\gallery with my plugins C:\xampp\htdocs\e107V2\e10720150123 but url is f.e http://localhost/e107V2/e10720150123/links_page/links~~

Otherwise everything works. I noticed it just because using lastnews_menu first time and there is path done old way with e_BASE and with empty e_BASE is incorrect.

Without e_url.php path is correct, but e_url.php code seems to be allright, works very well.

I don't know where or what to look. Any idea? Thanks

Jimmi08 commented 8 years ago

After more testing. Gallery plugin with enabled SEF URL has the same problem: without SEF URL: image

with SEF URL: image

CaMer0n commented 8 years ago

e_BASE is for files (includes etc.), not for URLs. The same for e_PLUGIN (file-system) vs e_PLUGIN_ABS (links). If you find them, please replace.

Jimmi08 commented 8 years ago

This code is in 12 files: <a href='".e_BASE."user.php I would replace it if I know how.

Jimmi08 commented 8 years ago

@CaMer0n waw, with this I think I am able to replace others. Just quick question, why did you use e107::getUrl()->create() and not e107::url()?

CaMer0n commented 8 years ago

@Jimmi08 Some of the core is still using the older more complex/advanced method of creating SEF Urls. (news, page, search, system and user still use this). e107::url() is a newer, simpler developer-friendly method for doing the same thing.

Jimmi08 commented 8 years ago

@CaMer0n I am replacing e_BASE now (with user.php), is it possible (when I comment line with e_BASE code) to replace it f.e to ex_BASE, just not have already done code in searching result? I use Total Commander,it is going throught commented code too.

LaocheXe commented 8 years ago

I don't know if this is the same issue as I am having, But here we go.

On a website, I use the donation plugin AnteUp - when I go to the forums or downloads everything is okay, but going into a download catagory or forum catagory the menu donate image and link are broken, at first I thought it was the theme and went looking and found nothing, then started looking at what pages affected the image and url.

So in downloads the url is: www.myurl.com/download/category/5/patches

PHP Firebug shows the HTML for the menu plugin like this: (removed the <'s and >'s to show the code)

a href="e107_plugins/anteup/donate.php"
img style="border:none" title="donate.gif" src="e107_plugins/anteup/images/icons/donate.gif"
/a

But mouse over the broken image displays the url as this: www.myurl.com/download/category/5/e107_plugins/anteup/donate.ph

CaMer0n commented 8 years ago

Sounds like AnteUp is not using e_PLUGIN_ABS, but e_PLUGIN for its links?

Moc commented 8 years ago

Sounds like AnteUp is not using e_PLUGIN_ABS, but e_PLUGIN for it's links?

Correct. Fixed now (@LaocheXe you can redownload the latest files from the AnteUp repository and it should be fixed)

Jimmi08 commented 8 years ago

Closing this, I will create new issue if I notice next one. Thanks to all.

rica-carv commented 7 years ago

Sorry for bringing this up again, but it seems this bug is still around.... I got this strange behaviour in a SEF url forum page (ie: _websiteroot/forum/track): Url HTML: <a href="top.php?0.top.forum.10">Top Posters</a> Link shown by Firefox: _websiteroot/forum/top.php?0.top.forum.10 Which after click gives a error and i'm redirected to forum main page...

With a normal url page (ie: _websiteroot/e107_plugins/forum/forum.php?f=track): Url HTML: <a href="../../top.php?0.top.forum.10">Top Posters</a> Link shown by Firefox: _websiteroot/top.php?0.top.forum.10 Which after click is shown the correct top.php page...

Further more, the e_BASE constant is defined with regular url page, but with SEF one's it simply is not defined...

CaMer0n commented 7 years ago

When you use SEF URLS you are basically in the root directory the entire time, and include files from elsewhere. Using e_BASE for a URL is bad practice. e_BASE is a FILE path, not a URL path.
What needs to be corrected is the URL in the forum shortcode sc_userinfo() e_HTTP usually works as a replacement or SITEBASEURL (if I remember well )

rica-carv commented 7 years ago

@CaMer0n Well, SITEBASEURL doesn't work, it returns itself ("SITEBASEURL"). Ended up working with e_HTTP....

Jimmi08 commented 7 years ago

@rica-carv I am closing this. If there is still problem with SITEBASEURL, it's something different, please, create new issue. Thanks