Page 1 of 1

[SOLVED] page_protect not working in CMSMS2

Posted: Wed Jan 27, 2016 3:25 pm
by gordonallan
Hi Guys

has anyone found that the page_protect plugin doesn't work correctly in CMSMS2?

I now get this error:
Syntax error in template "tpl_body:10" on line 33 "{protect}{content}{/protect}" unknown tag "protect"

Looking at the code for the page_protect plugin it does a smarty.registerPlugin call. Is there some change in the smarty scoping in v2 that means that this behaviour is no longer allowed?

I am calling the initialisation and process_pagedata before the <__html> tags in the template but the {protect} tag in the body tag doesn't work any more.

Any thoughts welcomed, if the process_pagedata plugin needs to be updated I am happy to make the code changes

Re: page_protect not working in CMSMS2

Posted: Wed Jan 27, 2016 4:13 pm
by Dr.CSS
Sounds like an old plugin that no longer works in CMSMS, so you may have to correct the code in it to use it...

Re: page_protect not working in CMSMS2

Posted: Wed Jan 27, 2016 4:20 pm
by Rolf
{page_protect}?

Re: page_protect not working in CMSMS2

Posted: Wed Jan 27, 2016 4:52 pm
by Jo Morg
gordonallan wrote:has anyone found that the page_protect plugin doesn't work correctly in CMSMS2?
I didn't have yet time to test it on CMSMS 2, so it's probable that the changes in Smarty in CMSMS 2.x (and other changes too) may have affected the way the plugin works.
Also, at the moment the recommended way to be sure that the plugin is completely secure is to use the implementation explained on the "The Quick Way" tab (version 1.2 of the plugin), which is using it inside the content blocks instead of in the main template(s). All other ways may have security issues depending on some factors, similar to what happened with CustomContent which is also deprecated in favor of most recent implementations of FEU.
Having said that, the plugin is going to be deprecated in favor of a module that will do the same thing as the plugin (to keep it's simplicity and ease of use) but in a safe way and with a few more options.
The module is in the works but I don't have yet a time frame for it's release.

Re: page_protect not working in CMSMS2

Posted: Wed Jan 27, 2016 5:33 pm
by gordonallan
Thanks, I had tried the quick way (with the modifications required for scope in CMSMS2):

{$content="{content}" scope=global}
{page_protect action='form' passwords='pass1'}
{if $pp_logged_in}
{$content}
{else}
Not Logged in!
{/if}

However I only ever see "Not Logged In", I suspect there is a scoping issue with the pp_logged_in variable?

Cheers

Gordon

Re: page_protect not working in CMSMS2

Posted: Thu Jan 28, 2016 3:10 pm
by Jo Morg
Ok there is a new release on the forge.

However:

a) the only recommended use is to put the following code on any content block:

Code: Select all

{page_protect action='form' passwords='pass1'}
{if $pp_logged_in}
  The allowed content....
{else}
  Not Logged in!
{/if}
b) You can still use it on any template except like this:

Code: Select all

{if $pp_logged_in}
  {content} {* or even {$content} *}
{else}
  Not Logged in!
{/if}
which is NOT SAFE!

c) the {protect}{/protect} block plugin won't work in CMSMS 2.x. I could possibly fix this but I don't think it's worthwhile given that:
d) this plugin is officially deprecated in favor of a new module that will be released soon with the same features and a safer protection (as I said above), and it won't have any further development;
Thank you.

Re: page_protect not working in CMSMS2

Posted: Fri Jan 29, 2016 8:27 am
by gordonallan
Thanks, the change you made has worked. Many thanks for making the change in the short term until the new module comes out.

Cheers

Gordon