Home : Products : Gossamer Links : Discussions :

Products: Gossamer Links: Discussions: Review.pm suggestion: Edit Log

Here is the list of edits for this post
Review.pm suggestion
Hi,

just wanted to add this for the remaining visitors and at least to say hello to Andy.
I started to work a little with reviews and have a suggestion addon for the code.
In "sub _add_this_review" I added:

Code:
if (not $CFG->{user_review_required} and not $USER) {
$input->{Review_GuestName} or return { error => Links::language('REVIEW_GUEST_NAME_REQUIRED') };
$input->{Review_GuestEmail} or return { error => Links::language('REVIEW_GUEST_EMAIL_REQUIRED') };
#start ++
unless ($input->{Review_GuestEmail} =~ /.\@.+\../) {
return {error => Links::language('USER_INVALIDEMAIL', $input->{Review_GuestEmail})};
}
my $rc = $reviews->count({ Review_LinkID => $id, Review_GuestEmail => $input->{Review_GuestEmail} });
if ($CFG->{review_max_reviews} and $rc + 1 > $CFG->{review_max_reviews}) {
my $mtl = Links::Build::build('title', Links::language('LINKS_REVIEW_ADD'), "$CFG->{db_cgi_url}/review.cgi");
print Links::SiteHTML::display('error', { error => Links::language('REVIEW_MAX_REVIEWS', $CFG->{review_max_reviews}), main_title_loop => $mtl });
return;
}
#end ++
}

I thought it makes sense to validate the E-Mail as much as for user registration and restrict the nubers of reviews for the same E-Mail as well.
Still a lot to improve but I like the basic work.

Regards

niko

Last edited by:

el noe: Dec 9, 2016, 5:58 AM

Edit Log: