== Requirements ==

  Crypt_RSA http://pear.php.net/package/Crypt_RSA
  Pear-Base http://pear.php.net/package/PEAR

== Installation ==

Copy all files to extensions/PageProtection and add the following to
LocalSettings.php:

################################################################
# PageProtection extension

$wgCachePages	= false;
$wgCacheEpoch	= 'date +%Y%m%d%H%M%S';
$wgPEMfile	= 'private.pem';

# activate PageProtection extension
require_once('extensions/PageProtection/PageProtection.php');

#
################################################################

When started for the first time, the extension will create a new PEM-file in
the file private.pem. You should set the correct path to it in LocalSettings.php
and make sure, that the webserver has the writeaccess to the directory where
the file will reside. Alternatively, you could create your own PEM-file
and save it there.

 One approach is to let the web server write the default installation directory,
 and leave $wgPEMfile to be set to 'private.pem'.

 Second approach is to create a directory somewhere else then the default directory,
 for example: /var/run/pageprotection and let the web server write there.

For paranoids:
 After the PEM file is successfuly created you can take away the
 write-access to this file and its directory.

== Directory Structure ==
/mw
  |- index.php
  |- PEAR.php
  |- PEAR/
  |    | ...
  |- Crypt
  |- extensions
  |    |-  PageProtection
  |    |     |- PageProtection.php
  |   ...
 ...

== Post-installation (optional) ==

It is very ok to review the README file before further reading.

* Using wiki templates for warninig messages.

 If you want to make your warning messages (that the some 'area cannot be
 displayed/edited due to protection') more fancy, you can use templates
 instead of static messages. Go to the file PageProtection.i18n.php
 in the PageProtection installation directory and find the section, which
 corresponds to the language you would like to create fancy messages for.
 You can back up the modified file before editing.

 For example you can set up 'ProtectedSite' and 'ProtectedSiteEditing'
 to be templates like that:

$wgPageProtectionMessages['en'] = array(
	'ProtectedTitle'	=> 'Page is protected',
	'ProtectedSite'		=> '{{ProtectedSite_en}}',
	'ProtectedSiteEditing'	=> '{{ProtectedSiteEditing_en}}',
);

 Then, using web browser you can edit the wiki page called
 Template:ProtectedSite_en and put there the content:

---------------------

<div style="background-color: #ffefcf; padding: 1em; margin: 10px; border: 1px silver dashed; font-size: 92%; text-align: center;">

'''Unfortunately, this section is [[{{SITENAME}}:Page Protection|protected]] and you cannot read nor edit it!'''<br/>

<div style="font-size:x-small; text-align: left;">
* allowed users: {{{USERS}}}
* allowed groups: {{{GROUPS}}}
</div>
</div>

---------------------

 Then, using web browser you can edit the wiki page called
 Template:ProtectedSiteEditing_en and put there the content:

---------------------

<div style="background-color: #ffefcf; padding: 1em; margin: 10px; border: 1px silver dashed; font-size: 92%; text-align: center;">

'''Unfortunately, this section is [[{{SITENAME}}:Page Protection|protected]] and you cannot edit it!'''<br/>

<div style="font-size:x-small; text-align: left;">
* allowed users: {{{USERS}}}
* allowed groups: {{{GROUPS}}}
</div>
</div>

---------------------

 Voila! Note three special variables are used in the templates:
 {{SITENAME}}, {{USERS}} and {{GROUPS}}

 When the template is activated you'll see a wiki link to the 'Page Protection' page.
 Feel free to create it, and put there all the information your users may need.
 Also you should concider to disable editing by unprivileged users for this template
 pages using built-in, standard way.
 
 See also: TEMPLATES-MSGS
