1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

Fixes #2376 - users with a dot in username are now properly recognized

during the forum update (v1 to v2)
This commit is contained in:
Tijn Kuyper
2017-02-04 17:02:17 +01:00
parent 8dadf11e7a
commit 030911c1a8

View File

@@ -1523,46 +1523,33 @@ class forumUpgrade
} }
function getUserInfo(&$info) function getUserInfo($info)
{ {
$e107 = e107::getInstance(); $tmp = explode('.', $info);
$id = (int)$tmp[0];
$tmp = explode('.', $info); // Set default values
$ret = array( $ret = array(
'user_id' => 0, 'user_id' => 0,
'user_ip' => '_NULL_', 'user_ip' => '_NULL_',
'anon_name' => '_NULL_' 'anon_name' => '_NULL_'
); );
if (count($tmp) == 2) // Check if post is done anonymously (ID = 0, and there should be a chr(1) value between the username and IP address)
{ if(strpos($info, chr(1)) !== false && $id == 0)
$id = (int)$tmp[0]; {
if ($id == 0)//Anonymous post $anon = explode(chr(1), $info);
{ $anon_name = explode('.', $anon[0]);
$_tmp = explode(chr(0), $tmp[1]);
if (count($_tmp) == 2)//Ip address exists $ret['anon_name'] = $anon_name[1];
{ $ret['user_ip'] = e107::getIPHandler()->ipEncode($anon[1]);
$ret['user_ip'] = $e107 -> ipEncode($_tmp[1]); }
$ret['anon_name'] = $_tmp[0]; // User id is known - NOT anonymous
} {
} $ret['user_id'] = $id;
else }
{
$ret['user_id'] = $id; return $ret;
}
}
else
{
if (is_numeric($info) && $info > 0)
{
$ret['user_id'] = $info;
}
else
{
$ret['anon_name'] = 'Unknown';
}
}
return $ret;
} }
function moveAttachment($attachment, $post, &$error) function moveAttachment($attachment, $post, &$error)