Page 2 of 3

Re: How to use ManiaLib?

Posted: 21 Jun 2011, 16:58
by gouxim
First, a note about XML

When you see in Chrome "his page contains the following errors: error on line 3 at column 6: XML declaration allowed only at the start of the document" or stuff like that, it is because Chrome tries to interpret the XML code but can't. You can either show the exact code by displaying the page's source (CTRL+U), or you can use an extension for displaying the XML as a tree. I personnaly use https://chrome.google.com/webstore/deta ... bfgdfkpadb

The redirection

It is because of a filter used in the controllers in the example. See http://code.google.com/p/manialib/sourc ... .class.php
At line 19:

Code: Select all

$this->addFilter(new ForceSplashScreenFilter());
It checks if the login is in the session, and if it is not it redirects the user to the splashscreen, which by default the SplashController.

In Manialinks you can use the <redirect></redirect> tag to make a Manialink page redirection.

So this why the first thing you see is

Code: Select all

<redirect>http://www.tm-energy.comlu.com/?/splash/</redirect>
And then if you try to access http://www.tm-energy.comlu.com/?/splash/ with your browser it gives a 404 error.

Re: How to use ManiaLib?

Posted: 22 Jun 2011, 10:14
by Slaat3
gouxim wrote: It checks if the login is in the session, and if it is not it redirects the user to the splashscreen, which by default the SplashController.
Sorry for being a so annoying developer, but what do you mean by login and session? What login and which session?
It's connection's fault or the manialink?

P.S.: I have searched in the documentation but I couldn't find any information about ForceSplashScreenFilter.

Re: How to use ManiaLib?

Posted: 22 Jun 2011, 12:55
by gouxim
No need to apologize, this forum is here to help the community. The more people use ManiaLib, the more support, bug reports etc. there will be, and the better the Manialinks will become :)

There is indeed not much documentation. As always with Nadeo we provide tools with minimum documentation :lol:

So let me explain how it all works.

Login in the session

Some definitions:
  • Login refers to a TrackMania Forever login
  • Session refers to a PHP session
As you can see here on line 17
http://code.google.com/p/manialib/sourc ... ass.php#17

Code: Select all

$this->addFilter(new RegisterRequestParametersFilter());
This filter automatically puts in the session some parameters if they are put in the URL.
For example if you access the page with "?login=blabla" (or "playerlogin=blabla"), you will have that login in the session under $_SESSION['login']. The controllers have a instance of SessionEngine so anywhere in a controller you can do:

Code: Select all

$this->session->get('login');
This feature work for
  • login (note that both "login" and "playerlogin" GET parameters works)
  • nickname
  • path
  • land
  • token
  • sess
  • game
The ForceSplashScreenFilter

If the login is not in the session, it redirects the visitor to the SplashController, where the view should have a button with "addplayerid=1". This way the user clicks on the button, the "playerlogin" parameter is put in the URL, and the login is then stored in the session.

NOTE THAT IT IS NOT SECURED. THIS IS ONLY IDENTIFICATION, NOT AUTHENTICATION !
ie. if login = "gou1" for example, you cannot for sure that it is gou1 because anyone can access the page with "login=gou1" in the URL !
So don't use that for admin access and other such sensitive things.

Final word

If you don't really care about having the login in the session, just remove the line

Code: Select all

$this->addFilter(new ForceSplashScreenFilter());
in you're controllers and you'll be good to go

Re: How to use ManiaLib?

Posted: 24 Jun 2011, 15:29
by Slaat3
After I reinstalled the ManiaLink I'm still getting this problem. If I understood correctly, if the login is not attached to the adress you should be redirected to the splash screen which is the connect page, right? After I click the connect button my login should be attached to the adress, but it isn't. In fact I am not redirected to the splash screen and even when I try to manually insert my login I get the same problem. I also tried to remove the SplashFilter from my controllers but I can't view all my pages because of the same problem. I'm very confused.

Re: How to use ManiaLib?

Posted: 24 Jun 2011, 15:48
by gouxim
What's the URL of your Manialink ?

Re: How to use ManiaLib?

Posted: 24 Jun 2011, 16:03
by Slaat3
http://www.tm-energy.comlu.com
I didn't got yet a real manialink URL because I want to finish the work first.

Re: How to use ManiaLib?

Posted: 24 Jun 2011, 16:17
by The_Big_Boo
Are you sure of the URL ? It redirects to http://error404.000webhost.com/? :?

Re: How to use ManiaLib?

Posted: 24 Jun 2011, 16:49
by Slaat3
Yes, it is. Try without WWW:
http://tm-energy.comlu.com/

Re: How to use ManiaLib?

Posted: 24 Jun 2011, 20:09
by gouxim
What's the value of APP_URL in your config file?

Re: How to use ManiaLib?

Posted: 25 Jun 2011, 04:01
by fastforza
Remove the www part from the redirect URL. ;)