We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

EE.cp.cleanUrl breaking CP links

Developer Preview

Greg Ferrell's avatar
Greg Ferrell
102 posts
12 years ago
Greg Ferrell's avatar Greg Ferrell

I have CP links like:

http://localhost:8888/ee2.8.0/system/index.php?D=cp&S=0&C=addons_modules&M=show_module_cp&module=freeform&method=edit_form&form_id=6

Which works when pasted directly in EE 2.8 and normally in EE 2.7.x and below.

The automatic running of EE.cp.cleanUrl on all links via:

EE.cp.cleanUrls = function() {
 $('a').attr('href', EE.cp.cleanUrl);
 $('form').attr('action', EE.cp.cleanUrl);
};

Turns my links into these, which throw “Disallowed Key Characters.” errors.

http://localhost:8888/ee2.8.0/system/index.php?/cp?S=0&C=addons_modules&M=show_module_cp&module=freeform&method=entries&form_id=6

Is there some way to opt out of having urls auto-reformatted until we are ready to make our addons segment compatible in the CP?

       
Wes Baker's avatar
Wes Baker
343 posts
12 years ago
Wes Baker's avatar Wes Baker

Greg, that’s weird. It should be turning your URLs into something like:

http://expressionengine/system/index.php?/cp/addons_modules/show_module_cp?module=forum&method=list_boards

How are you building your URLs?

       
Wes Baker's avatar
Wes Baker
343 posts
12 years ago
Wes Baker's avatar Wes Baker

I think we have a fix for your URLs, but are you using the BASE constant to make your urls or are you building them from scratch?

       
David Dexter's avatar
David Dexter
88 posts
12 years ago
David Dexter's avatar David Dexter

I’m seeing this issue as well.

Here is how I was building my urls

$this->base_url = str_replace('&','&',BASE).'&C=addons_modules&M=show_module_cp&module;='.$this->module;

Breaks when I pass that to a view as the action in form_open.

Thanks, David

       
David Dexter's avatar
David Dexter
88 posts
12 years ago
David Dexter's avatar David Dexter

Sorry - My issue was unrelated and had to do with my redirect after posting.

       
Greg Ferrell's avatar
Greg Ferrell
102 posts
12 years ago
Greg Ferrell's avatar Greg Ferrell
I think we have a fix for your URLs, but are you using the BASE constant to make your urls or are you building them from scratch?

Yeah, we use that the majority of the time in the CP.

       
Derek Jones's avatar
Derek Jones
7,561 posts
12 years ago
Derek Jones's avatar Derek Jones

Wes’s change in the release should address the URL example you had, but do you have any ideas how the session ID was being placed after D=cp?

       
Pascal Kriete's avatar
Pascal Kriete
2,589 posts
12 years ago
Pascal Kriete's avatar Pascal Kriete

Hi Greg,

I would also be curious as to what was happening here, why the manual link construction?

       
Derek Jones's avatar
Derek Jones
7,561 posts
about 12 years ago
Derek Jones's avatar Derek Jones

Greg, anything? We really want to help you guys finish knocking out your list.

       
Greg Ferrell's avatar
Greg Ferrell
102 posts
11 years ago
Greg Ferrell's avatar Greg Ferrell

Hey sorry, I wasn’t getting email updates for this topic for some reason and just saw it towards the top while digging through the 2.8.2 stuff.

There was some reason we had to do a lot of these manually. Lemme check into it to make sure what it was and i’ll get back to you.

       
Wes Baker's avatar
Wes Baker
343 posts
11 years ago
Wes Baker's avatar Wes Baker

Greg, just nudging you to see if you have anything we need to look into here.

       
Greg Ferrell's avatar
Greg Ferrell
102 posts
11 years ago
Greg Ferrell's avatar Greg Ferrell

Hey Wes,

Thinking on this I am remembering loosely that the error building the CP links like:

ee()->config->item('cp_url').'?S='.$s

is that our end users weren’t consistent on using the CP url and some were using site.com/admin.php while others were using /system/index.php. Meaning same set of end users, same website, even with user education, some would still go to one link and some the other.

Thus when building ajax links, it was at times failing for some of our customers because they too would set the CP url to one thing then use the other option and cause JS errors because the JS domain wasn’t set.

In the end it was easier to build our own urls manually using the file they were currently visiting (admin.php vs /system/index.php) and route all links and ajax urls in kind.

There is a sidelong issue with trying to send form variables VIA $_GET to a url that already has $_GET variables on it. It doesn’t work properly unless all of the variables are in the form, hence all of the CP $_GET vars have to be written in as hidden inputs. (This situation usually occurs with filtering and pagination on MCP pages for addons.)

       
Greg Ferrell's avatar
Greg Ferrell
102 posts
11 years ago
Greg Ferrell's avatar Greg Ferrell

I should add this was also an issue because many people still don’t understand the difference between www.website.com and website.com.

       
Wes Baker's avatar
Wes Baker
343 posts
11 years ago
Wes Baker's avatar Wes Baker
Thus when building ajax links, it was at times failing for some of our customers because they too would set the CP url to one thing then use the other option and cause JS errors because the JS domain wasn’t set. In the end it was easier to build our own urls manually using the file they were currently visiting (admin.php vs /system/index.php) and route all links and ajax urls in kind.

Maybe I’m misunderstanding here, but that’s exactly what BASE does:

define('BASE', SELF.'?S='.ee()->session->session_id().'&D=cp');

SELF is defined in the index.php or admin.php being used:

define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
       
Greg Ferrell's avatar
Greg Ferrell
102 posts
11 years ago
Greg Ferrell's avatar Greg Ferrell

We were using that too, yes, but BASE is not always set. But, loose memory of the issue. Since it’s been so long since I’ve dealt with it and its kept working, I can’t remember the full extent or what version we started doing the manual link building on.

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.