Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [Andy] "report a bad link" plugin...

Quote Reply
Re: [Andy] "report a bad link" plugin... In reply to
Gives me an error, so I commented it out.
Did I placed it well?

Thanks Andy,

ron...

****************************************



#!/usr/bin/perl
# ==============================================================
#
# Report a bad link version '2.1.1a'
# Links SQL code copyright Gossamer Threads
# http://www.gossamer-threads.com
# Modifications and code segments copyright PUGDOG Enterprises, Inc.
# http://www.pugdog.com
# Updates for Links SQL 2.1.1 Compatiblity by Andy
# http://www.ace-installer.com
#
# ==============================================================

# Load required modules.
# ---------------------------------------------------
use strict;
use Links::SiteHTML;
use Links::Authenticate;
use Links::Plugins;
use vars qw/$BAD_LINK_CFG/;

# use GT::Plugins qw/STOP CONTINUE/;
# use GT::Mail;
# $|++;
# Links::reset_env( { load_user => 1 } ) if ($Links::PERSIST);

local $SIG{__DIE__} = \&Links::fatal;

Links::init('/var/www/html/cgi-bin/lsql2/admin');
Links::init_user();



&main();

sub main {

# Define the variables
# ---------------------------------------------------
my ($id, $db_links, $rec, $confirm);

# Get the Links ID number from the input.
$id = $IN->param('ID');
$confirm = $IN->param('confirm');
print Links::SiteHTML::display('error', {error => "Invalid id: $id"});
return;
}
## Check to see if the ID/Link record exists

$db_links = $DB->table('Links'); ## first grab a new db handle

$rec = $db_links->get ($id); ## see if the ID record exists
print $IN->header();
return;
}

print "The ID was found, the rec is ", %$rec, "<br><BR>";

##############check user############
#if (!$USER) { print Links::SiteHTML::display ('error', { error => "LOG IN" }); exit; }
##################################
## Only waste the CPU after we've got a good link in the Links database.
##
## Need to put the configuration variables into the $CFG hash, or similar, and then
## they are globally available, and can be assigned/passed in a hash between routines.
## Works with persistence -- mod_perl speedyCGI, etc

$BAD_LINK_CFG = Links::Plugins::get_plugin_user_cfg ('Bad_Link');
my $bad_links_table = $BAD_LINK_CFG->{'table_name'};

# now, see if the record exists in the Bad_Links database

my $db_bad_links = $DB->table($bad_links_table);
my $rec2 = $db_bad_links->get ($id);
my $dynamic;

if ($db_bad_links->hits) {
$rec->{'Status'} = qq|
Thank you for taking the time to report the link <B>$rec->{'
Title'}</B> <P>\n
It's already been recorded, and and it's status is: &nbsp;<B
>$rec2->{'Status'}</B>
|;

print $IN->header();
print Links::SiteHTML::display ('bad_link', $rec );
return;

} else {
$rec->{'Status'} = qq|
Thank you for taking the time to report the link <B>
$rec->{'Title'}</B> <P>\n
It's been recorded, and will be checked ASAP
|;

$rec->{'Title'} =~ s/'/\\'/g;
$rec->{'Title'} =~ s/"/\\"/g;

$db_bad_links->add ( { LinkID => $id,
URL => $rec->{'UR
L'},
Title => $rec->{'Ti
tle'},
IP => $ENV{'REMO
TE_ADDR'}
} );

print $IN->header();
print Links::SiteHTML::display ('bad_link', $rec );
return;
}

} ## end of main
Subject Author Views Date
Thread "report a bad link" plugin... rsahertian 3735 Sep 10, 2003, 1:46 PM
Thread Re: [rsahertian] "report a bad link" plugin...
Andy 3662 Sep 10, 2003, 1:49 PM
Thread Re: [Andy] "report a bad link" plugin...
rsahertian 3652 Sep 11, 2003, 2:18 AM
Thread Re: [rsahertian] "report a bad link" plugin...
Andy 3643 Sep 11, 2003, 2:31 AM
Thread Re: [Andy] "report a bad link" plugin...
rsahertian 3648 Sep 11, 2003, 3:02 AM
Thread Re: [rsahertian] "report a bad link" plugin...
Andy 3641 Sep 11, 2003, 3:05 AM
Thread Re: [Andy] "report a bad link" plugin...
rsahertian 3639 Sep 11, 2003, 3:40 AM
Post Re: [rsahertian] "report a bad link" plugin...
rsahertian 3616 Sep 11, 2003, 4:49 AM
Thread Re: [Andy] "report a bad link" plugin...
pugdog 3655 Sep 11, 2003, 4:55 AM
Post Re: [pugdog] "report a bad link" plugin...
Andy 3616 Sep 11, 2003, 4:57 AM
Post Re: [pugdog] "report a bad link" plugin...
dwh 3463 Jul 21, 2004, 11:41 AM