Helppage for plugin: NP_SiteList

Plugin overview

This plugin is used to manage a list of links, such as that showing Nucleus sites on nucleuscms.org. Users can add new sites themselves for approval by the site administrator, who can be notified through e-mail. When logged in as administrator, the list of sites can be managed through the admin area or, when enabled, from the list of sites where displayed in your skins. If the sites in the list should meet certain conditions, the administrator can automate verification by setting up to two preg expressions (or strings) to check against. For example, sites listed on the NucleusCMS site might be required to either contain a link to nucleuscms.org or have some form of the <meta name="generator" content="Nucleus CMS v3.22" />.

Requirements

The PHP Pear extension framework is required for the verification features. The file ‘PEAR.php’ should be in the php include path. Supplied with NP_SiteList are the HTTP_Request, Net_URL, and Net_Socket Pear packages, which rely on PEAR.php. Contact your system administrator if you are not sure whether PEAR is available at your site. You can see if the pear framework is in your php path by copying the pearcheck.php file (distributed with NP_SiteList) to an accessible place in your web space. Then point your browser to it and look for the term 'pear' in the listed paths. If it is not there, you probably do not have the files you need. Alternatively, if you have access to a command on your web server, type php -r "echo get_include_path();" and look for 'pear' in the output.

Nucleus CMS v 3.23 or greater is recommended for security reasons.

PHP 4.0.6 or greater is recommended.

Upgrade

Versions 1.0, 1.2, and 1.4 all add a database table field and/or a few plugin options, so users of previous versions must uninstall the previous version and then install the new plugin version when upgrading to one or these or later versions. Please follow this procedure if you wish to keep the data in your tables.

  1. Backup your database.
  2. If starting from a pre-1.0 version or if going from 1.0 to 1.2 or greater, you need to perform this step. Go to the plugins directory of your nucleus installation and edit the following line in NP_SiteList.php:
  3. 
    	function unInstall() {
    		sql_query('DROP TABLE nucleus_plug_sitelist');
    	}
    
    to read :
    
    	function unInstall() {
    		//sql_query('DROP TABLE nucleus_plug_sitelist');
    	}
    
  4. Uninstall the NP_SiteList plugin using the Nucleus Admin GUI.
  5. Install the new NP_SiteList version as described below.

Installation

The NP_SiteList plugin can be downloaded from here.

Download and extract the zip file. Copy the NP_SiteList.php file and the sitelist directory to the nucleus/plugins directory.

Use the Nucleus Admin GUI to register the NP_SiteList plugin into Nucleus. Be sure to click the ‘Update subscription list’ button.

You will need to edit and save the plugin options before using the plugin. The options are described below.

Plugin Options

There are a number of options that control the operation of the SiteList plugin. Most of these options are set from the ‘edit options’ link in the Plugin Admin area, but some advanced options are only available by editing variables in the plugin files. Both types of options are described below.

Plugin Options

Advanced Options

These options are set by editing variables in the NP_SiteList.php and should only be done by those comfortable doing so. The default values for these options should suffice for most cases. All variables are found near the top of the file.

SkinVars

There are four skinvars for this plugin:

where:

SiteList Management

All SiteList management should be done by a user with Administrator privileges for the site. Each site can be in one of four states—unchecked, checked, exempt, or suspended. Only sites in the checked (approved) and exempt states are displayed to non-admin site visitors by the <%SiteList(item)%> skinvar. Checked and Exempt sites are sites that the admin deems approved to display on the site. Exempt sites are not verified with the Checked sites when running batch verification actions. Exempting sites is useful if a site does not pass the verification conditions, but is desired anyway, or if it loads slowly and often fails verifications because of timeouts. Unchecked sites are sites that have been submitted by a non-admin user that are awaiting review and approval. Suspended sites are those that have been reviewed, but do not meet the requirements of the site administrator. Suspended sites stay in the database until they are deleted manually by the admin, or until they are suspended five times. Sites can be manually placed in any of these states (by clicking links), or a site admin can setup verification conditions which can be applied to sites to automate the review process.

The list of sites can be managed from any of three places depending on your settings, as follows:

  1. Your Skins : A limited number of actions are available to a site admin when he views the site links as displayed by <%SiteList(item)%>. A site can be deleted, verified, suspended, or approved by clicking the appropriate links next to the desired site. By default this is disabled. It can be enabled by setting a Plugin Option, or by using the appropriate skinvar parameter.
  2. Your Plugins Page : Full management is available by going to the Plugins page in your Nucleus Admin GUI. Click on the ‘admin’ link in the right column of the row for the Site List plugin. The full management functions will be described below. This management method is always available.
  3. Your QuickMenu : If enabled, by a Plugin Option, a ‘SiteList’ link will appear at the bottom of the left column of your Nucleus Admin GUI, under the Plugins heading. This is a link to the same admin page as available from the Plugins Page.

On the SiteList Admin page, the following functions can be performed:

The following actions are available to the right of each site listed by [Show Unchecked], [Show Approved], and [Show Suspended], and apply only to that one site.

SiteList Test Application

Before you start using the verification functions on your real data, you will want to test the conditions against a set of known, and maybe unknown sites, to confirm that the verification process will pass the sites you want and fail the others. Provided in the sitelist directory is a php application to allow testing your conditions against any site. It can be called by the [manual verify] action for sites in your database, or by typing a URL in your browser, as described below. Only logged in (to Nucleus) site administrators can use this test applicaiton.

For a single url (adjust the url to fit your site).

http://yoursite.domain/nucleus/plugins/sitelist/sltest.php?testurl=http://url-of-site-to-test.domain

For multiple sites at once, create a text file with one url per line and write it to your nucleus/plugins/sitelist directory, or make it available by url as shown below.

File on your webserver. Set the path from the sitelist directory. This example assumes the file is in the sitelist directory. If your file is in the same directory as your config.php file, you can specify testfile=../../../testlist.txt. Or you can use an absolute path, like testfile=/home/user1/testlist.txt

http://yoursite.domain/nucleus/plugins/sitelist/sltest.php?testfile=testlist.txt

Remote File. This is a text file being served on a different web server.

http://yoursite.domain/nucleus/plugins/sitelist/sltest.php?testfile=http://site-of-test-file.domain/path-to-file/testlist.txt

File on your local system. This works for Firefox, but not for IE browsers. I have not tested on other browsers.

http://yoursite.domain/nucleus/plugins/sitelist/sltest.php?testfile=file:///c:/path-to-file/testlist.txt

SiteList Browser Application

This is a semi-supported feature that allows you to show the sites within a frame-based browser page patterned after the one used to display skins at the Nucleus Skins Site. This feature is available as of version 1.1. To use this feature, install version 1.1 or later and copy the contents of the sitelist/browser directory into the directory containing your config.php file. The sitelist/browser directory should contain three files ("sbmain.html", "sbintro.html", and "sbtop2.php") and a directory ("img") of image files. You will need to edit the sbintro.html file to customize the text shown to your needs. By default, 25 random sites are shown in each set, but this can be changed by editing the variable $setlimit at the top of the sbtop2.php file.

Once the files are customized to your needs and moved to the same directory as your config.php file, you can link to the sbmain.html file anywhere in your skins, templates or items where you can use a <a> tag.

If you perform the verify action on the sites, any sites using a frame buster script in the header will be flagged in the database and not shown in the sitelist browser results.

Future Plans

Some added features under consideration, if there is interest, are the following:

Support and Bug reports

For additional support and/or bug reports please use this forum thread: http://forum.nucleuscms.org/viewtopic.php?t=11914

Version History