mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
trying to fix two conversion issues
- anonymous user not entered correctly or entered with user id 0 (need to be tested) - ips not converted git-svn-id: file:///svn/phpbb/trunk@7034 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
87c3b60b17
commit
97a8eb4013
4 changed files with 59 additions and 13 deletions
|
@ -309,10 +309,10 @@ function decode_ip($int_ip)
|
||||||
|
|
||||||
$hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
|
$hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
|
||||||
|
|
||||||
// Any mod changing the way ips are stored? Then we are not able to convert.
|
// Any mod changing the way ips are stored? Then we are not able to convert...
|
||||||
if (sizeof($hexipbang) != 4)
|
if (sizeof($hexipbang) < 4)
|
||||||
{
|
{
|
||||||
return '';
|
return '127.0.0.1';
|
||||||
}
|
}
|
||||||
|
|
||||||
return hexdec($hexipbang[0]) . '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
|
return hexdec($hexipbang[0]) . '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
|
||||||
|
|
|
@ -1023,6 +1023,41 @@ class session
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if URI is blacklisted
|
||||||
|
* This should be called only where absolutly necessary, for example on the submitted website field
|
||||||
|
* This function is not in use at the moment and is only included for testing purposes, it may not work at all!
|
||||||
|
* This means it is untested at the moment and therefore commented out
|
||||||
|
*
|
||||||
|
* @param string $uri URI to check
|
||||||
|
* @return true if uri is on blacklist, else false. Only blacklist is checked (~zero FP), no grey lists
|
||||||
|
function check_uribl($uri)
|
||||||
|
{
|
||||||
|
// Normally parse_url() is not intended to parse uris
|
||||||
|
// We need to get the top-level domain name anyway... change.
|
||||||
|
$uri = parse_url($uri);
|
||||||
|
|
||||||
|
if ($uri === false || empty($uri['host']))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$uri = trim($uri['host']);
|
||||||
|
|
||||||
|
if ($uri)
|
||||||
|
{
|
||||||
|
// One problem here... the return parameter for the "windows" method is different from what
|
||||||
|
// we expect... this may render this check useless...
|
||||||
|
if (phpbb_checkdnsrr($uri . '.multi.uribl.com.', 'A') === true)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Update a persistent login key
|
* Set/Update a persistent login key
|
||||||
*
|
*
|
||||||
|
|
|
@ -436,16 +436,6 @@ function phpbb_get_birthday($birthday = '')
|
||||||
*/
|
*/
|
||||||
function phpbb_user_id($user_id)
|
function phpbb_user_id($user_id)
|
||||||
{
|
{
|
||||||
if (!$user_id)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user_id == -1)
|
|
||||||
{
|
|
||||||
return ANONYMOUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// Increment user id if the old forum is having a user with the id 1
|
// Increment user id if the old forum is having a user with the id 1
|
||||||
|
@ -484,6 +474,19 @@ function phpbb_user_id($user_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the old user id is -1 in 2.0.x it is the anonymous user...
|
||||||
|
if ($user_id == -1)
|
||||||
|
{
|
||||||
|
return ANONYMOUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This should never ever happen - 2.0.x is not allowing a user id of 0
|
||||||
|
// But we return the anonymous user to be consistent and not breaking functionality
|
||||||
|
if (!$user_id)
|
||||||
|
{
|
||||||
|
return ANONYMOUS;
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($config['increment_user_id']))
|
if (!empty($config['increment_user_id']))
|
||||||
{
|
{
|
||||||
$user_id++;
|
$user_id++;
|
||||||
|
@ -1125,6 +1128,7 @@ function phpbb_prepare_message($message)
|
||||||
$message = preg_replace('/\[quote="(.*?)"\]/s', '[quote="\1"]', $message);
|
$message = preg_replace('/\[quote="(.*?)"\]/s', '[quote="\1"]', $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Already the new user id ;)
|
||||||
$user_id = $convert->row['poster_id'];
|
$user_id = $convert->row['poster_id'];
|
||||||
|
|
||||||
$message = str_replace('<', '<', $message);
|
$message = str_replace('<', '<', $message);
|
||||||
|
|
|
@ -1215,6 +1215,13 @@ $template->assign_vars(array(
|
||||||
$first_unread = $post_unread = false;
|
$first_unread = $post_unread = false;
|
||||||
for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
||||||
{
|
{
|
||||||
|
// A non-existing rowset only happens if there was no user present for the entered poster_id
|
||||||
|
// This could be a broken posts table.
|
||||||
|
if (!isset($rowset[$post_list[$i]]))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$row =& $rowset[$post_list[$i]];
|
$row =& $rowset[$post_list[$i]];
|
||||||
$poster_id = $row['user_id'];
|
$poster_id = $row['user_id'];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue