[TMF] How to use ManiaLib?

Open source, lightweight PHP framework for Manialink and Web development.

Moderator: NADEO

User avatar
gouxim
Nadeo
Nadeo
Posts: 1186
Joined: 14 Jun 2010, 17:20

Re: How to use ManiaLib?

Post 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.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
Slaat3
Posts: 66
Joined: 19 Jun 2011, 08:36
Location: Romania
Contact:

Re: How to use ManiaLib?

Post 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.
User avatar
gouxim
Nadeo
Nadeo
Posts: 1186
Joined: 14 Jun 2010, 17:20

Re: How to use ManiaLib?

Post 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
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
Slaat3
Posts: 66
Joined: 19 Jun 2011, 08:36
Location: Romania
Contact:

Re: How to use ManiaLib?

Post 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.
User avatar
gouxim
Nadeo
Nadeo
Posts: 1186
Joined: 14 Jun 2010, 17:20

Re: How to use ManiaLib?

Post by gouxim »

What's the URL of your Manialink ?
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
Slaat3
Posts: 66
Joined: 19 Jun 2011, 08:36
Location: Romania
Contact:

Re: How to use ManiaLib?

Post 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.
The_Big_Boo
Posts: 1026
Joined: 15 Jun 2010, 15:46

Re: How to use ManiaLib?

Post by The_Big_Boo »

Are you sure of the URL ? It redirects to http://error404.000webhost.com/? :?
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
User avatar
Slaat3
Posts: 66
Joined: 19 Jun 2011, 08:36
Location: Romania
Contact:

Re: How to use ManiaLib?

Post by Slaat3 »

Yes, it is. Try without WWW:
http://tm-energy.comlu.com/
User avatar
gouxim
Nadeo
Nadeo
Posts: 1186
Joined: 14 Jun 2010, 17:20

Re: How to use ManiaLib?

Post by gouxim »

What's the value of APP_URL in your config file?
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
fastforza
Posts: 850
Joined: 15 Jun 2010, 11:19
Contact:

Re: How to use ManiaLib?

Post by fastforza »

Remove the www part from the redirect URL. ;)
Mania Exchange - Share your maps!

ASUS Maximus IV GENE Z / i7 2600K 3.40Ghz QC / 16GB G.Skill Ripjaws DDR3 / GTX 560 Ti

Need technical help for ManiaPlanet? Click here. :)
Post Reply

Return to “ManiaLib”

Who is online

Users browsing this forum: No registered users and 2 guests