referer2

This plugin is listed here for archival purposes. This plugin has been replaced by version 1.0 of the NP_Referrer plugin.

Referer2 plugin for Nucleus

This is another referer plugin for Nucleus. It is heavily based on the referer plugin by -=Xiffy=-, but was extended to offer some additional functionality and to scratch some itches I had with the original.

Upgrading from original [[Referrer]] plugin

This plugin uses the same database structure as the original referrer plugin, so you can save your old table and restore it under the name “nucleus_plug_referer2”. To do this first save the table, then remove the old plugin, install the new plugin and restore the table under its new name.

Differences from the original [[Referrer]] plugin

  • requires Nucleus 2.5beta (I think 2.2 should be OK, but I didn’t test that)
  • uses textarea for list options, because this is a lot more readable and has no length restrictions. List are not comma separated any more, but newline separated (i.e. one entry per line)
  • Clarified how the options have to be entered.
  • uses sql_table() instead of hardcoded table name (makes it PrefixProof ™).
  • IP banning supports CIDR notation (e.g. 192.168.1.0/24 to block all IPs in 192.168.1.0-255)
  • different defaults for <br /> insertion and display of referer time (exactly the other way around).
  • added on option to automagically clean the referer DB table. This means, after you save the options the domain bans will be applied to the database. This comes in handy, if a new vandal came along sprinkling p0rn links on your site: just add the domain to the ban list, and if the option is checked the entries will be removed from the DB, so they don’t show up any more. WARNING: it is rather easy to shoot yourself in the foot, if you enter a too wide ban (e.g. entering “x” as a ban will remove all referers with “x” in their domain name... NO FURTHER QUESTIONS ASKED!)
  • changed the “lastall” target to look like all the others. If you want the old behaviour use “lastalltable” instead, which will use the old style (i.e. uses a table and display where the referral went to).

How to use

  1. Download the code from here
  2. Uplaod to nucleus/plugins
  3. Install from Admin menu
  4. add <%Referer%> somewhere in the skin (see below for usage)

Skinvars

To display the referers there are many options:

  • <%Referer2(last, x)%> Displays the last x referers to this page
  • <%Referer2(top, x)%> Displays the top x referers to this page
  • <%Referer2(lastall, x)%> Displays the last x referers to all pages
  • <%Referer2(lastalltable, x)%> Displays the last x referers to all pages using the old style (HTML table and displays what page of your site the referral went to)
  • <%Referer2(topall, x)%> Displays the top x referers to all pages

Options

  • Add linebreaks <br /> to the links: Pretty self explanatory. If enabled every link gets <br /> appended to it.
  • Show when the referring occured: Display the time, when the refering occurred. Only apllies to the “last” and “lastall” skinvars. The links are then prefixed with the time.
  • Automatically reset “Clean referer table” option to “no”: Also self-explanatory. See description of the “Clean the referer table after saving options” options.
  • How many character to show at most: Control how long the referer URL to show
  • List of domains to ignore: Ignore referrals from domains containing the one of the strings given here. One string per line. Note: Entering e.g. x on a line by itself will block referrals from all domains containing the letter x, so don’t make this too broad.
  • List of IP addresses to ignore: Ignore referrals from the IPs in the list. Like the domains setting from above enter on IP per line. You may also enter complete netblocks in CIDR notation, so e.g. 192.168.1.0/24 will block all referrals from any IP address between 192.168.1.0 and 192.168.1.255. For more information on CIDR see http://compnetworking.about.com/library/weekly/aa021003a.htm or ask your local Google dealer ;)
  • List of search engine names: Domains matching on of these strings are subjected to some special handling in the plugin. The special handling itself has to be http://com-forum.info coded directly into the plugin. Some “standard” search engine URLs may be handled correlty, but YMMV. If you need some other search engines mail me some complete referrer strings from the engine in question, I may be able to cook something up.
  • Clean the referer table after saving options?: This option is the original reason I started hacking this plugin. If you set this to ‘yes’ the referrer table in the database is cleaned from all entries matching the domains block list when you press the “Save Options” button. The idea behind this is that if some d*ckhead comes along and gets around your current blocks and sprinkles his (or maybe even her) darn p0rn links on your precious site, you usually had to clean the database manually using e.g. phpMyAdmin or some other means. Using this option, you can simply add his domain to the block list, and it is removed from the database retroactively. *WARNING*: it is rather easy to shoot yourself in the foot, if you enter a too wide ban (e.g. entering “x” as a ban) this will remove all referers with the letter “x” in their domain name... NO FURTHER QUESTIONS ASKED! For this reason the option is automatically reset to “no” everytime you use this option. You can disable this behaviour using the ‘Automatically reset “Clean referer table” option to “no”’ option.

A small note on spelling...

Yes, I know that “referrer” is correctly spelled with two “r” (well... actually it’s four, but let’s not split hairs... :)). The spelling “referer” has somehow made it into the original HTTP standard and has stuck. Since that time HTTP referrers are called “referers”. I just liked this little quirk, so I used the “wrong” spelling. If it really bothers you: complain, if enough people complain I’ll change it ;)

Note: I have changed my blog software, so I have no more incentive to continue developing this plugin. The plugin will continue to be downloadable from the updated link below.

original version [[Download here]]

Patrick (mod bu admun)

History

  • previous history skipped
  • 0.94 use sql_table, add supportFeature
  • 0.95 add rel=”nofollow”
  • 0.96 trim the line to other display mode
  • 0.97 add NP_BlackList support aka fight the referer spam!, add code for plugin uninstall table remove (comment out by default)
  • 0.98 update to NP_BlackList 0.97+ support
 
referer2.txt · Last modified: 2006/07/05 13:03