Code:
# work out if they are allowed to access this detailed page...
sub check_restrict_detail_page {
my ($page, $id, $link, $detail_match, $detail_name);
my (@ids,@locked);
$page = $IN->param('g') || $ENV{PATH_INFO} || '';
($id) = $page =~ /(\d+)\Q$CFG->{build_extension}\E$/;
if (!$id) {
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('PAGE_INVALIDDETAIL', $page) });
return;
}
if ($DEBUG) {
print $IN->header();
print $id;
exit;
}
# grab the category in questions details....
($ids[0],$locked[0]) = $DB->table('Links')->select( ['ID','Restricted_Page'], GT::SQL::Condition->new('ID','=',"$id%") )->fetchrow;
# the current detailed page they are on requires them to be logged in.
if ($locked[0] && !$USER->{Username}) {
print $IN->header();
print Links::SiteHTML::display('error', { error => $ErrorMessage } );
exit;
}
}
# Always end with a 1.
1;
Added a new column to the Links table called Restricted_Page. Works for me. Feedback would be great.
Cheers,
Michael Bray