+ $dblink = $LINKSDB->getLinkFromUrl($link['url']); // See if the link is already in database.
+ if ($dblink==false)
+ { // Link not in database, let's import it...
+ if (empty($raw_add_date)) $raw_add_date=time(); // In case of shitty bookmark file with no ADD_DATE
+
+ // Make sure date/time is not already used by another link.
+ // (Some bookmark files have several different links with the same ADD_DATE)
+ // We increment date by 1 second until we find a date which is not used in db.
+ // (so that links that have the same date/time are more or less kept grouped by date, but do not conflict.)
+ while (!empty($LINKSDB[date('Ymd_His',$raw_add_date)])) { $raw_add_date++; }// Yes, I know it's ugly.
+ $link['linkdate']=date('Ymd_His',$raw_add_date);
+ $LINKSDB[$link['linkdate']] = $link;
+ $import_count++;
+ }
+ else // link already present in database.
+ {
+ if ($overwrite)
+ { // If overwrite is required, we import link data, except date/time.
+ $link['linkdate']=$dblink['linkdate'];
+ $LINKSDB[$link['linkdate']] = $link;
+ $import_count++;
+ }
+ }
+