version=pmwiki-2.2.5 ordered=1 urlencoded=1 agent=Midori/0.1.9 (X11; Linux x86_64; U; en-us) WebKit/532+ author=Petko charset=ISO-8859-1 csum=refactor host=81.65.12.233 name=PmWiki.UrlApprovals rev=71 targets=SiteAdmin.ApprovedUrls,Site.AllRecentChanges,PmWiki.Blocklist,PmWiki.Security text=(:Summary:Require approval of Url links:)%0aThis page explains how to discourage "link spamming" on your wiki site using PmWiki's ''urlapprove.php'' script. This script is already included in PmWiki files, but not activated by default.%0a%0a%0a!! Using ''urlapprove.php''%0aOccasionally spammers may try to add large number of (sometimes hidden) `URLs to pages because they think it will improve their search engine rankings -- which it [[#nofollow |probably won't]]. The ''urlapprove.php'' script works against these spammers' purpose by%0a%0a* requiring approval of links to Internet sites before a link to them are created in the wiki, and%0a* allowing you to limit the number of unapproved links that may be added to a page.%0a%0aTo enable ''urlapprove.php'', add the following line to a configuration file:%0a%0a->[@include_once("$FarmD/scripts/urlapprove.php");@]%0a%0aBy default, unapproved links display what ever should be displayed normally (the URL or a text), but not linked and next to it a link [-%25blue%25(approve links)%25%25-].%0aA click on the link will approve all unapproved `URLs on the page, %25green%25but ''only'' if you are authorized to edit the ''SiteAdmin.ApprovedUrls'' page%25%25. You may also pre-approve sites by by adding them directly to the [[SiteAdmin.ApprovedUrls]] page.%0a%0a%0a!!! Limiting unapproved urls per page%0aYou can limit the number of unapproved links per page. If the limit is exceeded, the page cannot be saved. This is useful because spammers like to write long link lists, which is rare for normal authors.%0a%0aExample: To set the limit to 5 unapproved links, add the following line to a configuration file:%0a%0a->[@$UnapprovedLinkCountMax = 5;@]%0a->[@include_once('scripts/urlapprove.php');@]%0a%0aNote that $UnapprovedLinkCountMax must be set ''before'' including the ''urlapprove.php'' script.%0a%0a%0a!!! Handling of Unapproved Links%0aYou can also change the disapproval message defined in the $UnapprovedLinkFmt variable, for example:%0a%0a-> [@%0ainclude_once('scripts/urlapprove.php');%0a$UnapprovedLinkFmt =%0a "[$[Link requires approval]]%3ca class='apprlink'%0a href='\$PageUrl?action=approvesites'>$[(approve)]%3c/a>";%0a@]%0a%0a"Link requires approval" is whatever you want to see in place of the unapproved link and "(approve)" is the blue text. Using this feature may prove usefull if you want to always hide the unapproved link.%0a%0aIf you wish to totally forbid unapproved links you can use%0a%0a->[@$UnapprovedLinkFmt = "%3cb>external link not allowed%3c/b>";@]%0a%0a%0a!!! `SideBar caveat [[#sidebar]]%0aPlease 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.%0a%0a%0a!!! Initial setup%0aAfter initial setup all existing links become unapproved. You need to visit your pages and approve all links, where needed. See [[Site/AllRecentChanges]] for a list of all pages that were created on your wiki.%0a%0a!! Password approval of URLs%0aTo approve external links, an author needs permissions to edit the page [[SiteAdmin.ApprovedUrls]].%0a%0a!! Technical tips%0a[[#whiteurls]]%0a!!! URL Whitelist%0aUrls can also be approved by adding them to a "white list", %0adefined in the variable @@$WhiteUrlPatterns@@, %0awhich is set in the ''local/config.php'' file.\\%0aTo add multiples urls, use the separator @@|@@ (vertical bar). For example:%0a%0a-> [@%0a$WhiteUrlPatterns =%0a "http://example.com/|http://example.net/|http://example.org/";%0a@]%0a%0aTo add all urls from, say New Zealand and Australia, use:%0a%0a-> [@%0a$WhiteUrlPatterns[] = 'http://[^/] \\.nz';%0a$WhiteUrlPatterns[] = 'http://[^/] \\.au';%0a@]%0a%0a%0a!!! Change Approved URLs page name%0aIf you want to change the default name of ''SiteAdmin.ApprovedUrls'', set the following in ''local/config.php'':%0a%0a->[@$ApprovedUrlPagesFmt = array('OtherGroup.OtherName');@]%0a%0a!!! Previewing the unapproved URL%0aTo see what link is to be approved without editing the page a tool tip can be displayed when the cursor hovers over the [-%25blue%25(approve links)%25%25-] link that displays the URL. e.g. [[http://uuu.example.com|Example]].%0a%0aAdd the following setting in your ''local/config.php'':%0a%0a-> [@%0a$UnapprovedLinkFmt =%0a "\$LinkText%3ca class='apprlink' href='\$PageUrl?action=approvesites'%0a title='\$LinkUrl'>$[(approve links)]%3c/a>";%0a@]%0a%0a->Some browsers show only the link and not the tooltip title. In this case, you can use the following code to see the unapproved link at the end of the tooltip :%0a-> [@$UnapprovedLinkFmt =%0a "\$LinkText%3ca class='apprlink' href='\$PageUrl?action=approvesites&XES_url=\$LinkUrl'%0a title='\$LinkUrl'>$[(approve sites)]%3c/a>";%0a@]%0a%0a%0a!! About rel='nofollow' [[#nofollow]]%0aBy default, PmWiki creates external links that are not followed by search engines. %0aHere are release notes from pmwiki-2.0.beta20 (30-Jan-2005):%0a%0a->''First, the $UrlLinkFmt variable has been modified so that links to external urls automatically have a rel='nofollow' attribute added to them, to help combat wiki spam as described in [[http://googleblog.blogspot.com/2005/01/preventing-comment-spam.html]]. Site administrators can customize $UrlLinkFmt and $UnapprovedLinkFmt to supply or omit rel='nofollow' as appropriate.''%0a%0a!! See Also%0a%0a* [[PmWiki/Blocklist]] - Blocking postings based on content or IP address%0a* [[PmWiki/Security]] - Securing your PmWIki%0a time=1254657391