CNCat 1.4


Installation

The downloaded archive must be unpacked to the directory where you want to run CNCat.

If you have downloaded ZIP archive:

Unzip it with pkunzip supporting long file names (pkzip25 or WinZIP). Additional information about ZIP archivers is available at www.pkware.com.

pkzip25 -extract -dir cncat-1.4.zip

After unpacking and copying files to the server, you'll be able to run installation script "install.php", for example http://www.server.com/cncat/install.php, which will help you to create a database and configuration files.

The installation script will try to create files config.php, _top.php, and _bottom.php, by itself. If it fails, you will be shown sample files and will create these files manually.

When installation is over, you will need to delete the installation script "install.php". Moreover, we strongly recommend to set up the rights disallowing the web-server writing to this file.


Updating to Version 1.4

CNCat 1.4 can be installed only over versions 1.3 and 1.3.1. If you run an older version, please upgrade it to version 1.3. first. (Old versions are available for download at our official web-site - www.cn-software.com.)

Copy all CNCat 1.4 files, with exception of install.php, over old ones.

The archive doesn't contain files config.php, _top.php, and _bottom.php, and the previous configuration will not be lost.


Edit Configuration File

The configuration file consists of three parts

  1. CNCat settings
  2. CNCat design
  3. Services

In the first part, the CNCat settings are stored.

$db["host"] MySql host
$db["user"] MySql connection login
$db["password"] MySql connection password
$db["name"] Database name
$db["alogin"] Administrator's login for access to administrative interface at http://www.server.com/cncat/admin/
$db["apassword"] MD5 of administrator's password
$cat["mailifnewlink"] Yes - send new link notifications via e-mail No - do not send
$cat["mailifnewlinkto"] E-mail address where notifications will be sent
$cat["mailifnewlinksubject"] Message subject.
$cat["duptestcount"] Number of links automatically checked for reduplications in "New" section of the administrative interface. (value 1 is recommended if the server is slow).
$cat["shownew"] 1 - display "New Links" sections on main page
0 - do not display
$cat["shownewcount"] Number of links to be displayed in "New Links" section
$cat["linksatmain"] 1 - display links on main page
0 - do not (only category is displayed)
$cat["defaultorder"] Default sorting
0 - by popularity
1 - by name
2 - by moderator's grade
3 - by date of entry (new at the top)
$cat["resfield1"]
$cat["resfield2"]
$cat["resfield3"]
Optional fields. If standard fields (URL, name, description, E-Mail) are not enough, you may add your own fields.
$cat["rows"] Number of columns to display directory sections
$CATNAME Name of directory
$LANGFILE Language file. Files for Russian and English are shipped with the software. Additional language files may be downloaded from http://www.cn-software.com/download.xhtm

The second part contains CNCat design settings.

Name Template description Replaceble lines
Link list
linkstopPart of the document before the link listNo
linksmiddlePart of the document between the best and regular links
  • %NUM - sequence number of the first link on the main page.
linksbottomPart of the document after link listNo
linksbitOne link
  • %ID - site identifier
  • %TITLE - site name
  • %DESC - link description
  • %URL - site address
  • %ADMINIFACE - administrative section (available for administrator only)
  • %GIN - number of jumps from site to directory
  • %GOUT - number of jumps from directory to site
  • %MODERVOTE - moderator's grade
  • %BROKENTEXT - text "Broken Link"
  • %RESFIELD1 - optional field 1
  • %RESFIELD2 - optional field 2
  • %RESFIELD3 - optional field 3
bestlinksbitOne best link
  • %ID - site identifier
  • %DESC - link description
  • %TITLE - site name
  • %URL - site address
  • %ADMINIFACE - administrative section (available for administrator only)
  • %GIN - number of jumps from site to directory
  • %GOUT - number of jumps from directory to site
  • %MODERVOTE - moderator's grade
  • %BROKENTEXT - text "Broken Link"
  • %RESFIELD1 - optional field 1
  • %RESFIELD2 - optional field 2
  • %RESFIELD3 - optional field 3
Section "New Links"
newlinkstopUpper part of "New Links" section
  • %NEWLINKSTEXT - text "New Links"
newlinkstbottomBottom part of "New Links" sectionNo
newlinkstbitNew link
  • %ID - site identifier
  • %TITLE - site name
  • %URL - site address
  • %DESC - link description
  • %DESC75 - short description
  • %ADMINIFACE - administrative section (available for administrator only)
  • %GIN - number of jumps from site to directory
  • %GOUT - number of jumps from directory to site
  • %MODERVOTE - moderator's grade
  • %RESFIELD1 - optional field 1
  • %RESFIELD2 - optional field 2
  • %RESFIELD3 - optional field 3
List of categories
partstopUpper part of categories sectionNo
partsdelimtopStart of new line of categories sectionNo
partsdelimbottomEnd of new line of categories sectionNo
partsbottomBottom part of categories sectionNo
partsbitName of the category
  • %CID - category identifier
  • %CTITLE - category name
  • %CCOUNT - number of links in the category
Search
searchformSearch form
  • %QUERYTEXT - search request
  • %SEARCHTEXT - text "Perform search"
searchtopPart of document before list of links
  • %STARTNUM - sequence number of the first link on page.
searchbottomPart of the document after link listNo
Miscellaneuos
catnameCategory name section
  • %MAINTEXT - Name of directory
  • %OTHERTEXT - Section name
sortbySorting section
  • %SORTBYTEXT - Text "Sort by"
  • %SORTBYPOP - popularity
  • %SORTBYTITLE - name
  • %SORTBYMODER - moderator's grade
  • %SORTBYIN - by date of entry
brokenscriptBroken links information script
  • %YESTEXT - Text "Yes"
  • %NOTEXT - Text "No"
  • %BROKENSURETEXT - Sending notification confirmation text

You may change $COPY variable or even delete it. But, license agreement requires logo and name of software be displayed on each page of the directory.


How to Create Your Own Plugin.

Plugins are software modules allowing quick and simple extention of program functions. CNCat plugins are found in ./admin/plugins/. directory. Standard distribution includes four plugins:

Below is an example of the simple plugin. The plugin displays links according to moderator's rating.

Let's have a look at the code by lines:

<?
01:
/* PLUGIN: This is title of example plugin; */
02:
03:
chdir("..");
04:
$ADLINK="../";
05:
06:
/* Authorization */
07:
include "auth.php";
08:
09: if (isset(
$HTTP_GET_VARS["max"])) {
10:     
$max=intval($HTTP_GET_VARS["max"]);
11:     
$min=intval($HTTP_GET_VARS["min"]);
12:     
$r=mysql_query("SELECT url FROM ".$db["prefix"]."main WHERE moder_vote<=".$max." AND moder_vote>='".$min."' LIMIT 1000;") or die(mysql_error());
13:     print
"<html><body>";
14:     while (
$a=mysql_fetch_array($r)) {
15:         print
"<a href='".$a["url"]."'>".$a["url"]."</a><br>\n";
16:         }
17:     print
"</body></html>";
18:
19:     
/* Synchronization of number of links in categories */
20:     
sync();
21:     
/* Synchronization of full names in categories */
22:     
sync_names();
23:     exit;
24:     }
25:
26:
/* Administrative interface - upper part of the page */
27:
include "_top.php";
28: include
"menu.php";
29:
30:
/* Main form */
31:
?>
32:
<table align=center cellspacing=1 cellpadding=6 border=0><form action=example.php method=get>
33: <th colspan=2 background=../../cat/tablebg.gif>Plugin example</th></tr>
34: <tr class=t1><td>Minimum moderator vote<td><input type=text name=min value='8'></td></tr>
35: <tr class=t1><td>Maximum moderator vote<td><input type=text name=max value='10'></td></tr>
36: <tr class=t2><td colspan=2 align=right><input type=submit value='Show'></td></tr>
37: </form></table>
39: <?
40:
/* Administrative interface - bottom part of the page */
41:
include "_bottom.php";
42:
?>

Database structure:

Table "cncat_main" - contains information about links

FieldTypeNullKeyDefaultDescription
lid int(11) PRI NULL link ID
title text YES NULL site name
description text YES NULL site description
url text YES NULL site URL
cat1 int(11) YES NULL category ID
gin int(11) YES NULL number of jumps from site
gout int(11) YES NULL number of jumps to site
moder_vote int(11) YES NULL moderator's rating
email text YES NULL E-Mail
type int(11) YES NULL 0 - new link, 1 - working, 2 - deleted
broken int(11) YES 0 votes for broken link
insert_date datetime YES NULL date of submission
resfield1 text YES NULL additional field #1
resfield2 text YES NULL additional field #2
resfield3 text YES NULL additional field #3

Table "cncat_cat" - contains information about categories

FieldTypeNullKeyDefaultDescription
cid int(11) PRI NULL category ID
name text YES NULL name
parent int(11) YES NULL parent category ID
count int(11) YES 0 number of links in category and sub-categories

Table "cncat_cat_linear" - contains full names of categories

FieldTypeNullKeyDefaultDescription
cid int(11) YES NULL category ID
name text YES NULL full name of category

What's New in Version 1.4

1. Plugins support added.

2. Administrative interface access form changed.

3. Sort by submission date error fixed.

4. Simultaneous confirmation of multiple links plugin added.

5. Plugins for XML format import/export added.


What's New in Version 1.3.1

1. Multiple links edition added.

2. Database reset option added.

3. Number of jumps reset added.

4. Images paths fixed.


What's New in Version 1.3

1. News search capabilities. ID search (for example: "id:102") and URL search added (for example: "URL:www.yahoo.com"). Besides, it is now possible to search by exact word-form, just use the search phrase with quatation marks.

2. Links editing form changed. "Garbage" has been removed.

3. Links can be removed from directory pages at once, without entering administration interface.

4. Prefixes for tables have been added. Now it is possible to use CNCat even if you have only one database.

5. Three optional fields have been added, in case, standard fields (URL, name, description, E-Mail) are not enough. Optional fields are set in file config.php, for example:

$cat["resfield1"]="Second Name";
$cat["resfield2"]="First Name";
$cat["resfield3"]="";

6. Sorting by entry date has been added.

7. Setting default sorting method is now possible. It can be done with hel of the directive "defaultorder" in file config.php:

$cat["defaultorder"]=3;

What's New in Version 1.2

1. Added use of $HTTP_POST_VARS when new link had been added.

2. Added option of editing links on results page.

3. Optional display of link list on the main page.

4. Appearance may be set up how you want it. (Do not change this file, if you want to easily upgrate to newer versions of CNCat. To change appearance set up files: _top.php, _bottom.php and config.php)

5. Added installation script, which will help you to install CNCat or upgrade it from any version.


What's New in Version 1.1

1. Directory sections editing and synchronisation option added.

2. Broken links notification added.

3. New link notification added. The notification is e-mailed to site administrator. To enable it, the following changes to the configuration file should be performed:

$cat["mailifnewlink"]="yes";
$cat["mailifnewlinkto"]="support@cn-software.com";

E-Mail, where notification will be sent.

$cat["mailifnewlinksubject"]="New Link";

E-Mail subject.

This option is very useful, if links are not added to your directory very often - there is no need to visit administrator's page and look for new links.

4. More flexible design added. The following style table has been added: (see _top.php)

<STYLE>
<!--
.tbl0 {background-color:#D0D0D0;color:white;}
.tbl1 {background-color:#F0F0F0;}
.tbl2 {background-color:#D0D0D0;}
-->
</STYLE>

5. New links may be displayed on the main page:

$cat["newlinksbordercolor"]="#896819";
$cat["newlinksbgcolor"]="#FFEEB3";

Table and border colors for new links.

$cat["shownew"]=1;
$cat["shownewcount"]=4;

Number of new links to display.

6. Double link automatic checking added. First N links in "New" section will be automatically checked for doubling.

$cat["duptestcount"]=1;

Sets number of links to check (N). Every check calls for a separate SQL query. Set to 10 if you have a powerful server.


License

Installing CNCat you agree to the following terms:

You may use CNCat at your site regardless of its type - commercial or non-commercial. CN-Software copyrights must be present in system code, CN-Software graphical or text link must be present on EVERY page, created by CNCat. The link must be:

You are allowed to modify CNCat code, leaving our copyrights inside the code, as well as on pages created by the script. You are NOT ALLOWED to distribute modified CNCat code.

You are not allowed to:

If you want to remove CNCat logos or links, you must contact CN-Software Support Team for details and terms via e-mail support@cn-software.com

Script CNCat is distributed "AS IS", you are using it at your own risk and the script authors do not bear responsibility for any damage (mental, financial, circumstantial or any other) caused by script performance.