[pmwiki-users] help modifying php code

Chris Carter ccarter at lbcc.edu
Wed Sep 26 12:39:01 CDT 2007


Hi everyone,
 
I'm trying to modify the code from http://www.pmichaud.com/wiki/PmWiki/Security#wikivandalism, which is as follows: 

## Require admin password to edit RecentChanges (etc.) pages.
if ($action=='edit'
&& preg_match('/\\.(Search|Group(Header|Footer)|(All)?RecentChanges)$/', $pagename))
{ $DefaultPasswords['edit'] = crypt('secret phrase'); }

I want to modify this so that some pages in various groups DO NOT require a password to edit-- such as Bolivia.Housing, Bolivia.MustSee, Chile.Housing, Chile.MustSee, etc.

I don't know php, but have tried to modify as follows: 

## Require no password to edit Group.Housing (etc.) pages.
if ($action=='edit'   &&preg_match('/\\ $Group.(Housing|HealthSafety|DailyLife|Food|Interpersonal|Language|MustSee|OfficialDocs|WeekendFun|WhereStay $/'))
{ $DefaultPasswords['edit'] = ''; }

As you can see, I have removed $pagename at the end and added $Group at the beginning.  I have also set $DefaultPasswords to '' for no password.  

Can anyone proofread this code?  Not being a programmer I'm sure it is not perfect. 

Thanks. 
 
Chris Carter

________________________________




More information about the pmwiki-users mailing list