PDA

View Full Version : Import buddy/ignorelist fails for IPB 1.2


Marco van Herwaarden
Wed 18th Apr '07, 7:19am
ImpEx: 1.80
source: IPB 1.2 (will probably fail on others also)

Module: 010 - Import banlist

If the banlist/ignorelist for the target user is empty (ie. IS NULL) then the import will fail as the MySQL CONCAT will always return NULL if any of the parameters is NULL

In ImpExDatabase_360.php, line ~789:

// add to buddy list
if ($user['buddylist'] != '')
{
$sql[] = "buddylist = CONCAT(buddylist, ' $user[buddylist]')";
}
// add to ignore list
if ($user['ignorelist'] != '')
{
$sql[] = "ignorelist = CONCAT(ignorelist,' $user[ignorelist]')";
}

Replace by:

// add to buddy list
if ($user['buddylist'] != '')
{
$sql[] = "buddylist = IF(buddylist IS NULL, LTRIM('$user[buddylist]'),CONCAT(buddylist, ' $user[buddylist]'))";
}
// add to ignore list
if ($user['ignorelist'] != '')
{
$sql[] = "ignorelist = IF(ignorelist IS NULL, LTRIM('$user[ignorelist]'), CONCAT(ignorelist, ' $user[ignorelist]'))";
}

Jerry
Tue 24th Apr '07, 3:12pm
In 1.81