Also: templates that check that the user is logged in...

This probably isn’t a very common thing for people to be doing, but I’m thinking that a SPIP tag that checks that the client is authenticated might be useful.

This will remove the need to have bits of PHP sprinkled throughout the templates: rather than embedding « if($auteur_session){} » everywhere I need it, I can create a « please login » template (probably 401.html, after the 401Unauthorised HTTP status code), and just put #AUTHENTICATED at the top of the templates to be protected. If a client is not authenticated, then they get the results of the 401.html template instead of the original.

To implement this, the SPIP tag will need to check that they are authenticated (relatively easy with $auteur_session), include another template, and stop the execution of the rest of the page. Can anyone given me any answers on these last two: How can I include a SPIP template from within a SPIP tag? And, is it safe for the PHP generated by a SPIP tag to call exit or return to stop the rest of the template from executing?

Regards,

Thomas Sutton
Web Developer
bouncingorange
graphic + web design

Hello Thomas,

I think you already have all you want in SPIP or around :wink:

the #SESSION tag can be used for that. I think something like:

[(#SESSION{id_auteur}|?{'',' '})
#INCLUDE{....}
]

however, I am not sure if you will be able to change the http header like that. I am not very used to the session plugin (that is now integrated in the SPIP core), there might already be the solution you need.
try to auto translate

or ask on spip-zone :wink:

The dynamic tags (used for FORMULAIRE_XXX etc.) are tags that are computer dynamically 'outside' the cache and can include templates. Check out the content of ecrire/balise for examples.

I am not sure how to break safelly the execution of the code. Maybe you should check how the #HTTP_HEADER tag works and the #LOGIN_XX dynamic form. If you check how it works, it will break the execution and do a header redirect on success/error...

Pierre

Thomas Sutton wrote:

This probably isn't a very common thing for people to be doing, but I'm thinking that a SPIP tag that checks that the client is authenticated might be useful.

This will remove the need to have bits of PHP sprinkled throughout the templates: rather than embedding "if($auteur_session){}" everywhere I need it, I can create a "please login" template (probably 401.html, after the 401Unauthorised HTTP status code), and just put #AUTHENTICATED at the top of the templates to be protected. If a client is not authenticated, then they get the results of the 401.html template instead of the original.

To implement this, the SPIP tag will need to check that they are authenticated (relatively easy with $auteur_session), include another template, and stop the execution of the rest of the page. Can anyone given me any answers on these last two: How can I include a SPIP template from within a SPIP tag? And, is it safe for the PHP generated by a SPIP tag to call exit or return to stop the rest of the template from executing?

Regards,

Thomas Sutton
Web Developer
*bouncing*orange
/graphic/*/ + /*/web/*/ design/*