version=pmwiki-2.2.0-beta57 ordered=1 urlencoded=1 agent=Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.2) Gecko/20061023 SUSE/2.0.0.2-1.1 Firefox/2.0.0.2 author=Pm charset=ISO-8859-1 csum=Site --> SiteAdmin host=76.183.97.54 name=PmWiki.UrlApprovals rev=59 targets=SiteAdmin.ApprovedUrls,Site.AllRecentChanges,Profiles.XES,PmWiki.PerGroupCustomizations,PmWiki.Blocklist,PmWiki.Security,PmWiki.DocumentationIndex 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('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 sites)%25%25-].%0aA click on the link will approve all unapproved `URLs on the page, but only if you are authorized to edit the ''SiteAdmin.ApprovedUrls'' page. You may also pre-approve sites by by adding them 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%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. %0aTo find out which pages are affected one can use an RSS feed on [[Site/AllRecentChanges]]. %0aAll pages with unapproved links will show up there. Please can someone explain this in more detail?%0a%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 sites)]%3c/a>";%0a@]%0a%0a->Note that Safari insists on showing only the link on hover, not the "Title" -- I hacked this idea so that people on Safari (me!) can also see the link to be approved by creating a faked variable with my initials and adding it to the variables in the link. Now when I want to approve sites, it shows me the site I'm about to approve in the link text. You can make up your own variable, but make sure it's something PmWiki is unlikely to use. --[[~XES]]%0a%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----%0aQ: Is it possible to, using [[PmWiki/Per Group Customizations]], use $UnapprovedLinkCountMax to apply only to a specific group or page, given the comment about it having to be set prior to including the script and the script being included in the maim ''config.php' which is processed first?%0aA:%0a%0a!! See Also%0a%0a* [[PmWiki/Blocklist]] - Blocking postings based on content or IP address%0a* [[PmWiki/Security]] - Securing your PmWIki%0a----%0a%25trail%25%3c%3c|[[Documentation Index]]|>> time=1182105959