PmWiki.UrlApprovals 4.8 KB

12345678910
  1. version=pmwiki-2.1.11 ordered=1 urlencoded=1
  2. agent=Opera/9.00 (X11; Linux x86_64; U; en)
  3. author=Martin Krischik
  4. csum=Hint to initial setup
  5. host=84.74.130.70
  6. name=PmWiki.UrlApprovals
  7. rev=43
  8. targets=Site.AllRecentChanges,PmWiki.DocumentationIndex
  9. text=This page explains how to discourage "link spamming" on your wiki site using PmWiki's ''urlapprove.php'' script.%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 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('scripts/urlapprove.php');@]%0a%0aBy default, unapproved links display a [-%25blue%25(approve sites)%25%25-] link instead of the unapproved link.%0aA click on the link will approve all unapproved `URLs on the page, but only if you are authorized to edit the [@Site.ApprovedUrls@] page.%0aYou may also pre-approve sites by by adding them to the [@Site.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%0aIf you wish to totally forbid unapproved links you can use%0a%0a->[@$UnapprovedLinkFmt = "%3cb>external link not allowed%3c/b>";@]%0a%0a!!! `SideBar caveat%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!!! Initial setup%0a%0aAfter initial setup all existing links become un-approved. To find out which pages are affected one can use an RSS feed on [[Site/AllRecentChanges]]. All pages with unappreved links will show up there.%0a%0a!! Technical tips%0aUrls are approved by adding them to a "white list", defined in the variable @@$WhiteUrlPatterns@@, which 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%0aIf you want to change the default name of this [@Site.ApprovedUrls@] write in @@local/config.php@@ (after the script inclusion line):%0a%0a->[@$ApprovedUrlPagesFmt = array('OtherGroup.OtherName');@]%0a%0aGenerally, it might be%0a%0a->[@array('$DefaultGroup.ApprovedUrls');@]%0a%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 sites)]%3c/a>";%0a@]%0a%0a%0a!! About rel='nofollow' [[#nofollow]]%0aBy default, PmWiki creates external links that are not followed by search engines. Here 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* [[Cookbook:Blocklist2]] - A recipe for blocking postings based on content or IP address%0a* [[Cookbook:MTBlackList]] - A recipe for using the Movable Type Spam Black List%0a%0a%25trail%25%3c%3c|[[Documentation Index]]|>>
  10. time=1153548898