[SOLVED] page_protect not working in CMSMS2

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
gordonallan
New Member
New Member
Posts: 5
Joined: Fri May 15, 2015 6:35 pm

[SOLVED] page_protect not working in CMSMS2

Post 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
Last edited by gordonallan on Fri Jan 29, 2016 8:27 am, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: page_protect not working in CMSMS2

Post 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...
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: page_protect not working in CMSMS2

Post by Rolf »

{page_protect}?
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: page_protect not working in CMSMS2

Post 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.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
gordonallan
New Member
New Member
Posts: 5
Joined: Fri May 15, 2015 6:35 pm

Re: page_protect not working in CMSMS2

Post 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
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: page_protect not working in CMSMS2

Post 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.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
gordonallan
New Member
New Member
Posts: 5
Joined: Fri May 15, 2015 6:35 pm

Re: page_protect not working in CMSMS2

Post 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
Post Reply

Return to “Modules/Add-Ons”