View Full Version : Duplicate domain checking in admin panel
Bryan Ex
01-15-2007, 03:03 PM
Pro 1.2 had difficulties checking for duplicate domains (exact URL had to be used) but that was later fixed in one of the patch releases. It seems that the duplicate checking in the admin panel was not also updated. With duplicate checking set to DOMAIN I am still able to enter mysite.com and mysite.com/ as two different links from the admin panel. Can the updated code from suggest-link.php be copied over to /admin/suggest-link.php as an easy fix or do they use different queries?
Dave Baker
01-20-2007, 08:56 PM
Hello Bryan,
We apologize for your long waiting.
***Open admin/suggest-link.php and find code***
/** check duplicate link **/
if ($gDirConfig['duplicate_checking'] && !$gDirConfig['duplicate_visitors'])
{
$forcheck = ($gDirConfig['duplicate_domain']) ? $link['domain'] : $_POST['url'];
if ($gAdminDb->checkDuplicateLinks($forcheck, $gDirConfig['duplicate_domain']))
{
$error = true;
$msg = $gDirLang['error_link_present'];
}
}
***Replace with the following code***
/** check duplicate link **/
if ($gDirConfig['duplicate_checking'] && !$gDirConfig['duplicate_visitors'])
{
$forcheck = ($gDirConfig['duplicate_type'] == 'domain') ? $link['domain'] : $link['url'];
if ($gAdminDb->checkDuplicateLinks($forcheck, $gDirConfig['duplicate_type']))
{
$error = true;
$msg = $gDirLang['error_link_present'];
}
}
***Save file***
***Open classes/DirAdmin.php and find this function***
function checkDuplicateLinks($aUrl, $aType = 0)
{
$sql = "SELECT `id` ";
$sql .= "FROM `{$this->mPrefix}links` WHERE ";
$sql .= ($aType) ? "`domain`" : "`url`";
$sql .= " = '{$aUrl}'";
return $this->mDb->getOne($sql);
}
***Replace with the following function***
function checkDuplicateLinks($aUrl, $aType = 'exact')
{
$sql = "SELECT `id` ";
$sql .= "FROM `{$this->mPrefix}links` ";
$cause = ($aType == 'domain') ? "WHERE `domain` = '{$aUrl}'" : "WHERE `url` = '{$aUrl}'";
$sql .= ($aType == 'contain') ? "WHERE `url` = '%{$aUrl}%'" : $cause;
return $this->mDb->getOne($sql);
}
***Save file***
Bryan Ex
02-14-2007, 04:36 PM
Sorry Dave... I completely forgot to say thanks for this fix. I did get it when you first posted and as always it is very much appreciated.
Dave Baker
02-15-2007, 04:52 PM
Bryan please don't worry about thanks. If this modification works normally for me it' enough. :)
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.