No, unfortunately the goto variable is defined within the sub so you can't just define it and feed the new value in. (If anyone form GT is reading this it would be really helpful if the goto variable could be available like this GT::Plugins->dispatch ($CFG->{admin_root_path} . '/Plugins', 'jump_link', \&_plg_jump, {$goto});)
You need to copy the whole sub _plg_jump from Jump.pm into your sub jump_link and modify it. Something like this (I've taken out bits that I thought were unnecessary but you should check you don't need them - like the file bit)
sub jump_link {
# -------------------------------------------------------------------
# This subroutine will get called whenever the hook 'jump_linkafili'
# is run. You should call GT::Plugins->action ( STOP ) if you don't
# want the regular code to run, otherwise the code will continue as
# normal.
#
my $args = shift;
my $url = $IN->param('url');
my $goto;
if ($url) {
my $db = $DB->table('Links');
my $id = $IN->param('ID');
# Otherwise, if we have a link, let's look it up.
if (defined $id) {
if ($id !~ /^\d+$/) {
require Links::SiteHTML;
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language ('JUMP_INVALIDID', $id) });
return;
}
my $rec = $db->get ($id);
if (! $rec or ($rec->{isValidated} eq 'No')) {
require Links::SiteHTML;
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language ('JUMP_INVALIDID', $id) });
return;
}
if ($IN->param('url') == 1){$goto=$rec->{AfilateURL1};}
elsif ($IN->param('url') == 2){$goto=$rec->{AfilateURL2};}
else {$goto=$rec->{URL};}
# Jump to a URL, bump the hit counter.
my $ip = $ENV{REMOTE_HOST} || $ENV{REMOTE_ADDR} || 'None';
my $click_db = $DB->table ('ClickTrack');
my $rows = $click_db->count ( { LinkID => $id, IP => $ip, ClickType => 'Hits' } );
if (! $rows) {
$db->update ( { Hits => \"Hits + 1" }, { ID => $id }, { GT_SQL_SKIP_INDEX => 1 } );
$click_db->insert ( { LinkID => $id, IP => $ip, ClickType => 'Hits', Created => \"NOW()"} );
}
}
# Oops, no link.
else {
require Links::SiteHTML;
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language ('JUMP_INVALIDID', $id) });
return;
}
if (! defined $goto) {
require Links::SiteHTML;
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('JUMP_INVALIDID', $id) });
return;
}
($goto =~ m,^\w+://,) or ($goto = "
http://$goto");
if ($goto) {
print $IN->redirect ($goto);
}
else {
require Links::SiteHTML;
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language ('JUMP_INVALIDID', $id) });
return;
}
GT::Plugins->action ( STOP );
}
return $args;
}
The UK High Street