#!/usr/bin/perl
#
# DCLinks 2000 Version 1.000
# dclinks.cgi
# Released Date: Jan 20 2000
#
# Revision History
# DCLinks 1998 Release on 16 November 1997
#
########## YOU MUST KEEP THIS COPYRIGHTS NOTICE INTACT ###############
# Copyright ©1997-2000 DCScripts All Rights Reserved
# As part of the installation process, you will be asked
# to accept the terms of this Agreement. This Agreement is
# a legal contract, which specifies the terms of the license
# and warranty limitation between you and DCScripts and DCLinks.
# You should carefully read the following terms and conditions before
# installing or using this software. Unless you have a different license
# agreement obtained from DCScripts, installation or use of this software
# indicates your acceptance of the license and warranty limitation terms
# contained in this Agreement. If you do not agree to the terms of this
# Agreement, promptly delete and destroy all copies of the Software.
#
# Versions of the Software
# --------------------------------------------------------------------------
# You may install as many copies of DCLinks Script for free
# on personal and non-profit sites. Otherwise, a single license
# of DCLinks is $35 (USD).
#
# License to Redistribute
# --------------------------------------------------------------------------
# Distributing the software and/or documentation with other products
# (commercial or otherwise) or by other than electronic means without
# DCScripts's prior written permission is forbidden.
#
# All rights to the DCLinks software and documentation not expressly
# granted under this Agreement are reserved to DCScripts.
#
# Disclaimer of Warranty
# THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION ARE PROVIDED "AS IS" AND
# WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER
# WARRANTIES WHETHER EXPRESSED OR IMPLIED. BECAUSE OF THE VARIOUS HARDWARE
# AND SOFTWARE ENVIRONMENTS INTO WHICH HKDBOARD MAY BE USED, NO WARRANTY OF
# FITNESS FOR A PARTICULAR PURPOSE IS OFFERED. THE USER MUST ASSUME THE
# ENTIRE RISK OF USING THIS PROGRAM. ANY LIABILITY OF DCSCRIPTS WILL BE
# LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE.
# IN NO CASE SHALL DCSCRIPTS BE LIABLE FOR ANY INCIDENTAL, SPECIAL OR
# CONSEQUENTIAL DAMAGES OR LOSS, INCLUDING, WITHOUT LIMITATION, LOST PROFITS
# OR THE INABILITY TO USE EQUIPMENT OR ACCESS DATA, WHETHER SUCH DAMAGES ARE
# BASED UPON A BREACH OF EXPRESS OR IMPLIED WARRANTIES, BREACH OF CONTRACT,
# NEGLIGENCE, STRICT TORT, OR ANY OTHER LEGAL THEORY. THIS IS TRUE EVEN IF
# DCSCRIPTS IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO CASE WILL
# DCSCRIPT'S LIABILITY EXCEED THE AMOUNT OF THE LICENSE FEE ACTUALLY PAID
# BY LICENSEE TO DCSCRIPTS.
#
###########################################################################
# Define directory path to this script
# If relative path will work leave it as is
$cgidir = ".";
# ----------------- Shouldn't have to change anything below here --------------#
require "$cgidir/dclinks.setup";
require "$cgidir/cgi-lib.pl";
require "$cgidir/dclinkslib.pl";
# OK Let's read in formdata
ReadParse();
$r_in = \%in;
# Cookie name
$in{'cookie_name'} = "DCProtectSessionID";
# OK, before we do anything, let's check the user's session ID
# If it exists then read in user data
$r_in->{'userdata'} = get_session();
$j = -1;
foreach (@link_fields) {
$j++;
$field_id{$_} = $j;
}
# Create files if not found
check_datafile($datafile,[]);
check_datafile($counter,[]);
if ($in{'action'} eq 'set_sort_index') {
set_sort_index($in{'field'});
exit;
}
elsif ($in{'action'} eq 'redirect') {
update_view( $in{"id"} );
print "Location: $in{'URL'}\n\n";
exit;
}
# Send HTTP header to the server
print_header();
# Format Comment input so that it will fit nicely in the database
$in{'Description'} = form_to_text($in{'Description'});
# Depending on Form input:
# 1) Display add to links form
# 2) Add Link information to the database
# 3) Display Links
$header = $title;
$cat1 = $in{'category'};
$cat1 =~ s/\s/+/g;
$menu = qq~
Retour vers Americas |
Annuaire Principal |
Ajouter un site
~;
if ($r_in->{'userdata'}->{'Group'} eq 'admin') {
$menu .= qq~
| DCLinks Admin
| Logout
~;
}
$r_data = readdata($datafile);
if ($in{'action'} eq "add_form") {
print_header_end();
$sub_header = "Compléter le formulaire ci-dessous pour inscrire le site.";
add_form();
}
elsif ($in{'action'} eq "add_links") {
if (incomplete_form()) {
print_header_end();
$sub_header = "ERROR! Incomplete form.";
add_form();
}
elsif (duplicate_url()) {
print_header_end();
$sub_header = "ERROR! Duplicate URL.";
add_form();
}
else {
print_header_end();
add_links();
$sub_header = "Votre lien a été enregistré.";
$html_output = qq~
Merci pour cette inscription. Le site a été ajoué à la base de données.
Aller à la page principale~;
}
}
elsif ($in{'action'} eq "view_category") {
$sub_header = "Listes dans $in{'category'}";
print_header_end();
view_category();
}
elsif ($in{'action'} eq 'update_rating') {
update_rating($in{"id"},$in{'score'});
}
elsif ($in{'action'} eq 'rate') {
rating_form($in{"id"});
}
else {
print_header_end();
display_main();
}
display_output();
exit;
#======================================================================#
# function display_main
# displays the main categories
#======================================================================#
sub display_main {
# Sort data according to category
foreach (@{$r_data}) {
my @data = split /\|/;
$category_num{$data[$cat_id]}++;
}
$html_output = qq~
Catégorie et description | ||
$cat1
($category_num{"$cat1"})
$Category_desc{$cat1} |
~;
$cat = $Category_list[2*$j+1];
$cat1 = $cat;
$cat =~ tr/ /+/;
if ($category_num{"$cat1"} eq "" ) {
$category_num{"$cat1"} = "0";
}
if ($Category_desc{$cat1}) {
$html_output .= qq~
$cat1
($category_num{"$cat1"})
$Category_desc{$cat1} |
~;
}
else {
$html_output .= qq~
~; } $html_output .= " |
Page $pages |
Liste rangée par $sorted_by{$sort_by_field} Classement par : Nom | Date d'entrée | Nouveaux Sites | Visites | Votes | Note |
$link[$field_id{"ID"}]~;
if ($r_in->{'userdata'}->{'Group'} eq 'admin') {
$html_output .= qq~
D E ~; } $html_output .= qq~ |
$link[$field_id{"Name"}] http://$link[$field_id{"Homepage"}] |
||||
$link[$field_id{"Description"}]
|
|||||
$ldate $ltime | $link[$field_id{"Views"}] Visites | $votes Votes | Note : $score | Noter ce site | |
Page $pages |