I don't have the perfect fix, but I have greatly improved the way it works on my site. The problem is, I'm still running on Pligg 7.2 so the code is going to be a bit different. In libs\link.php there's a function called duplicates($url) that looks up a story in the database to find out if it's already been submitted.
What happens is user 1 comes along, clicks the
EVB but doesn't want to go through all the submit steps so they drop out half way through, now the story is partially submitted and in the database. Now user 2 comes along, clicks the
EVB and the duplicates function returns true because it finds it already in the database. So now that story is in a limbo state where it can't be voted for or submitted properly.
I changed the duplicates function. Now if it finds a duplicate, it checks to see if the duplicates link category is zero and if the link status is 'discard'. If so, we know it's a partially submitted story, so the duplicates function deletes the partially submitted story from the database, and then returns false meaning there's no duplicate. Now user 2 is able to resubmit the story properly.
The problem here is the door is still open to flood the database with partially submitted stories, but at least this solves the issue of being able to properly resubmit a story after the first user only partially submits it.
Here's what the code looks like in my version (Pligg 7.2) - libs\link.php:
Code:
function duplicates($url) {
global $db;
$link_url=$db->escape($url);
$n = $db->get_var("SELECT count(*) FROM links WHERE link_url = '$link_url'");
if($n > 0) {
if($duplink = $db->get_row("SELECT link_id, link_status, link_category, link_title_url FROM links WHERE link_url = '$link_url'")) {
// Found the link but the status id discard and the category is zero which means someone partially submitted the story so allow for a resubmit
if($duplink->link_status == 'discard' && $duplink->link_category == 0) {
// Delete the partially submitted link from the database to prevent duplicate URL entries
$sql = "DELETE FROM links WHERE link_id=" . $duplink->link_id . ";";
$db->query($sql);
$n = 0;
}
else {
$this->title_url = $duplink->link_title_url;
}
}
}
return $n;
}