Terms of Service Module 2.2 (5.1 and 5.2 ready)

Adds a Terms of Service (TOS) agreement to the register and posting page and
links to a separate page to display the Terms of Service.

Tested on version 5.1.17 and CVS (till revision 1468)

License:
-------
Free to use, modify, or redistribute this code so long as I am given credit for
the original development somewhere. This code comes with absolutly no warranty.

Installation:
------------
1.  Unpack the archive.

2.  Move the directory "terms_of_service" to the directory "mods" within your
    Phorum installation. Don't change the directory name!

3.  Move terms-of-service.php to your phorum-directory. Rename the file if you
    want to use a localised file name (in this case you have to change the file
    name also in the settings).

4.  Move the terms_of_service.tpl to your template-directory.  You'll find a
    appropriate file for the default template (version 5.1 and 5.2) in
    /mods/terms-of-service/templates/.

5.  You will want to copy or edit lang/english.php in this mod's dir and alter
    the TOS to be legal and appropriate for your site.

6.  To have the TOS show up in the register form, just put {TOS} in
    register.tpl. I recommend just after the closing </table> tag and before
    the submit button.

7.  To have the TOS agreement show up in the posting form, just put {TOS} in
    posting_buttons.tpl. I recommend just at the beginning of this file before
    the first line.

8.  To show a link to the TOS on the index page, edit index_classic.tpl and
    index_new.tpl. Add the following line just behind the
    {INCLUDE "loginout_menu"}:

{IF URL->TOS}&bull;<a class="PhorumNavLink" href="{URL->TOS}">{LANG->TOS->Header}</a>{/IF}

9.  Login as administrator in Phorum's administrative interface and go to the
    "Modules" section.

10. Enable the module "Terms of Service Module".

11. At the first time that this module is run (by visiting the forum), the
    module will automatically create a custom profiles field for storing the
    acceptance date of the TOS. You should be able to see the field in the
    admin interface under "Custom Profiles":

    Field name: mod_tos
    Field length: 8
    Disable HTML: yes

Module settings:
---------------
1. Date of last change to the Terms of Service

Set the date of the last change to the Terms of Service. This date is used to
force users to re-accept the Terms of Services after modifications. It's
recommended to use a date in the future.

The default value is the date of enabling the module.

2. Default value for the accept-checkbox

Define the default value for the accept-checkbox on the posting-form. If you
use "unchecked" the user have to mark the checkbox for each post.

The default value is "unchecked"

3. File name of the Terms of Service page

Change the file name if you want to use a localised name. Don't add the file
extension ".php". Take care that you have to change also the file name in the
file system!

The default value is "terms-of-service".

Language support:
----------------
This module supports multiple languages.

The following languages are included:

- Englisch
- German (Sie)
- German (Du) male
- German (Du) female

If you want to translate the module to a new language, you'll have to do the
following:

Copy lang/english.php to lang/yourlang.php (yourlang.php must have the same
name as Phorum's main language file that you use). After this, translate the
strings in lang/yourlang.php.

If you have created a translation for this module, please post a zip file
containing lang/yourlang.php in the module thread at phorum.org, so the
translation can be added to the module package. See:
http://www.phorum.org/phorum5/read.php?16,52449,112106#msg-112106

Sanity Checks:
-------------
If you have problems with this module login as administrator in Phorum's
administrative interface and go to the "System Sanity Checks" section. Check
for warnings or errors for the Terms of Service Module.

Known issues:
------------
Because of a bug in Phorum database installation (till 5.1.17) you can get an
error messages simular to this:

You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ''20061026')' at line 1:
insert into phorum_user_custom_fields (user_id,type,data) VALUES(2,,'20061026')

In this case:

1. Login as administrator in Phorum's administrative interface and go to the
  "Custom Profiles" section.

2. Delete mod_tos field

3. Add a new profile field:

Field Name: mod_tos
Field Length: 8
Disable HTML: yes

Changelog:
---------
2005/12/15 version 1.0.0 by Brian Moon
- Terms of Service agreement for register page.

2006/04/11 version 1.1.0 by Oliver Riesen (oliver@riesen.org)
- Added TOS agreement for posting page for guests.
- Added display page for the TOS (with language support for file name of the
  page).

2006/04/13 version 2.0.0 by Oliver Riesen (oliver@riesen.org)
- Changed TOS agreement link on posting page.
- Added custom profile field to store the date of acceptance.
- Added date of last change of the TOS in the module settings.
- Added reforcing TOS agreement after modifications of the TOS.

2006/06/25 version 2.0.1 by Oliver Riesen (oliver@riesen.org)
- Changed TOS display on register page; thanks to Patricius
  (http://www.phorum.org/phorum5/profile.php?16,2536).

2006/08/30 version 2.0.2 by Oliver Riesen (oliver@riesen.org)
- Changed how to determine the number of custom user profile fields in use
  (http://www.phorum.org/phorum5/read.php?16,52449,116027#msg-116027);
  thanks to Maurice Makaay (http://www.phorum.org/phorum5/profile.php?16,830).
- Documentation extended.

2006/08/31 version 2.1.0 by Oliver Riesen (oliver@riesen.org)
- Prepare status of TOC so that other modules can use this information
  (http://www.phorum.org/phorum5/read.php?16,52449,116065#msg-116065); thanks
  to freedman (http://www.phorum.org/phorum5/profile.php?16,2878).
- Registered users can renew there agreement also on the terms-of-service page.

2006/08/31 version 2.1.1 by Oliver Riesen (oliver@riesen.org)
- Some small fixes.

2006/09/01 version 2.2.0 by Oliver Riesen (oliver@riesen.org)
- Added sanity checks. See "System Sanity Checks" in Phorum administration.
- Default settings are stored automatically on first usage of the module. So
  the admin don't have to go to the settings page.
- Module language strings now uses own sub-array.
- Correcting error: whenever someone posted a message their TOS accept date
  got updated to the current date
  (http://www.phorum.org/phorum5/read.php?16,52449,116125#msg-116125); thanks
  to freedman (http://www.phorum.org/phorum5/profile.php?16,2878).
- Correcting error: a TOS version date in the future forced a renew for each
  post (http://www.phorum.org/phorum5/read.php?16,52449,116142#msg-116142);
  thanks to freedman (http://www.phorum.org/phorum5/profile.php?16,2878).
- Including template for version 5.1 and future 5.2.

2006/09/26 version 2.2.1 by Oliver Riesen (oliver@riesen.org)
- Optimizing auto-installation of default settings.
- Bug fix: missing profile field when calling settings just after enabling the
  module; thanks to BBSNewbie
  (http://www.phorum.org/phorum5/profile.php?16,3232).

2006/09/29 version 2.2.2 by Oliver Riesen (oliver@riesen.org)
- Small bug fix in sanity checks; thanks to BBSNewbie
  (http://www.phorum.org/phorum5/profile.php?16,3232).

2006/10/02 version 2.2.3 by Oliver Riesen (oliver@riesen.org)
- Show TOS also on read page with posting form; thanks to Avdoshyn Andrej
  (http://www.phorum.org/phorum5/profile.php?16,713).

2006/10/26 version 2.2.4 by Oliver Riesen (oliver@riesen.org)
- Bug fix in storing custom profile field.

2006/10/26 version 2.2.5 by Oliver Riesen (oliver@riesen.org)
- Revert bug fix from 2.2.4. It was a bug in the Phorum core
  (http://www.phorum.org/cgi-bin/trac.cgi/ticket/498), corrected in changeset
  1456 (http://www.phorum.org/cgi-bin/trac.cgi/changeset/1456) and
  1459 (http://www.phorum.org/cgi-bin/trac.cgi/changeset/1459).