[SOLVED] $this->CreateLink in new version

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

[SOLVED] $this->CreateLink in new version

Post by brownrl »

Umm like yeah...

In so many ways I have loved CMS Made Simple because, well, it helps create websites for clients.

However, EVERY time there is a version change.

JESUS TAP DANCING CHRIST do you have to change the fundamental underlying code?

As I go from 1.4 to 1.5

EVERY WHERE I have some sort $this->CreateLink(

I get screwed!!!


Here is how an old link looks and AMAZINGLY the new module API STILL works!!!!  Fix IT!

moduleinterface.php?mact=modulecreator,m1_,reset,0&_s_=82833b88

here is the code that used work very well:

header( "Location: ".$this->CreateLink( $id , 'defaultadmin' , $returnid , '' , '' , '' , true ) );

or



What is _s_?

Apparently now instead of mact= its module=....

Great, good, you finally named a GET var nicely....  But then update the CreateLink func to handle it. As it stands the users gets booted out to the login screen. NOT GOOD!


I and I am sure many others are royally f'd because none of the websites that we have with 1.4 that use modules are able to be upgraded.


At the very least you could have on your home page a HUGE tag, blinking, saying:

ATTENTION UPGRADING WILL BONE YOU!

I'm sorry to be upset but I really thought that I was going to be able to enjoy my weekend.
Last edited by brownrl on Fri Dec 05, 2008 2:06 pm, edited 1 time in total.
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm
Location: the Netherlands

Re: $this->CreateLink in new version

Post by Dee »

I think _s_ is the new session key which is appended to each and every URL in the admin console.
If you're using the module API's CreateLink method to create your links the URL may change, but things should work without any problems. Normally you don't use the URL itself, but pass parameters which will be available in the called module action.

Regards,
D
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

FOUND: Re: $this->CreateLink in new version

Post by brownrl »

One piece of the puzzel


foreach() in /home/garage/public_html/internal/eurowebsite/lib/classes/module_support/modform.inc.php on line 438


There isn't a check there to make sure that the params maybe empty....

so a warning gets thrown up


changed:


added

if( is_array( $params ) && count( $params ) )


to on 441
modform.inc.php
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

UNSOLVED: $this->CreateLink in new version

Post by brownrl »

Ok,

going further it appears that in the newer version you can't have a redirect in admin modules.

any kind of call to:

header( "Location: ....

-- tried many ways --


Breaks something and it goes to the login screen. So lets say you have a module called "cars".

And you have an action called "create_car".

Lets say after "creating your car" you want to go back to the default admin action...

well.... not possible it appears now...



Look I am all for safe software....

BUT carrying some unique session_id arround on the get url string is a little bit well... amateur hour?
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm
Location: the Netherlands

Re: $this->CreateLink in new version

Post by Dee »

If you pass the "params" parameter to the CreateLink method it should be an (empty) array, not a text string.
The API docs say 'string', but this is incorrect.

Code: Select all

$this->CreateLink( $id , 'defaultadmin' , $returnid , '' , array() , '' , true )
Regards,
D
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm
Location: the Netherlands

Re: UNSOLVED: $this->CreateLink in new version

Post by Dee »

brownrl wrote: any kind of call to:

header( "Location: ....

-- tried many ways --


Breaks something and it goes to the login screen. So lets say you have a module called "cars".

And you have an action called "create_car".

Lets say after "creating your car" you want to go back to the default admin action...

well.... not possible it appears now...
Use either the Redirect or DoAction method.
brownrl wrote: Look I am all for safe software....

BUT carrying some unique session_id arround on the get url string is a little bit well... amateur hour?
The reasons for this ID in the URL are explained here.

Regards,
D
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

Re: $this->CreateLink in new version

Post by brownrl »

ok


redirect seems to be new?

but works for the time being....


thanks a ton I was pooping my pants on this... 1000 apologies!
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm
Location: the Netherlands

Re: $this->CreateLink in new version

Post by Dee »

brownrl wrote: redirect seems to be new?

but works for the time being....
Redirect and RedirectForFrontEnd have been around since at least version 0.13
brownrl wrote: thanks a ton I was pooping my pants on this... 1000 apologies!
Not a problem, you can put on some clean ones now ;)

Regards,
D
Post Reply

Return to “Developers Discussion”