Documentation ToDo - this page needs to be made more clear. I think that it should start by ignoring $WhiteUrlPatterns and simply focusing on the use of the Site.ApprovedUrls? page and how to set that up. Then after that’s described it can mention how additional URLs can be added using $WhiteUrlPatterns. At any rate, the description is not very clear. A better starting point might be the documentation that’s in the urlapprove.php script itself. —Pm?


A script urlapprove.php for approval of Internet addresses (URL) is supplied with the standard distribution. To activate it, you have to add to the local/config.php file:

 include_once('scripts/urlapprove.php');

You will then approve URLs while adding them to a “white list” defined in the variable $WhiteUrlPatterns which is set in the local/config.php file.
To add multiples URLs, use the separator | . By example:

 $WhiteUrlPatterns =
   "http://example.com/|http://example.net/|http://example.org/";

To add all URLs from, say New Zealand and Australia, use

 $WhiteUrlPatterns[] = 'http://[^/]+\\.nz';
 $WhiteUrlPatterns[] = 'http://[^/]+\\.au';

This white list is also completed by loading the content of the Site.ApprovedUrls page.

Following a non-approved link will be displayed a message “(Approve sites)”. A click on this message will approve all sites of the page, if you have writing rights on the Site.ApprovedUrls page.

If you want to change the name of this page write in local/config.php (after the script inclusion line):

  $ApprovedUrlPagesFmt = array('OtherGroup.OtherName');

Generally, it might be

  array('$DefaultGroup.ApprovedUrls');

You can limit the number of unapproved links per page. If the number is exceeded, the page cannot be posted. This is useful because spammers write long link lists. To activate this limit write in the local/config.php file the next line (value 5 is only for example):

  $UnapprovedLinkCountMax = 5; #by default 100000

You can also make PmWiki display a disapproval message defined in the $UnapprovedLinkFmt variable, by example:

 $UnapprovedLinkFmt = 
  "<b>Address not displayed before approval</b>
   <a class='apprlink' href='\$PageUrl?action=approvesites'>
   $[(approve sites)]</a>";

This is not very useful for the person in charge of links approval, so use it only if really required, or if you wish to totally forbid link addition. In that case, the message can simply be:

  $UnapprovedLinkFmt = “<b>No link allowed</b>”;

Caveat - impossible to improve links in the sidebar directly

Please note that in general you need to go to the sidebar page in order to approve links in the sidebar. The reason for this is that the approve mechanism only approves links on the current page.


« Available actions | DocumentationIndex | Variables »

Last edited by Pm.   Page last modified on July 10, 2005

Legal Information |  Designed and built by Emergency Digital. | Hosted by Steadfast Networks