$_SESSION['login_' . $cookiename] = $data;
// Make sure the user logs in with a new session ID.
if (!isset($_SESSION['login_' . $cookiename]) || $_SESSION['login_' . $cookiename] !== $data)
{
// Backup and remove the old session.
$oldSessionData = $_SESSION;
$_SESSION = array();
session_destroy();
// Recreate and restore the new session.
loadSession();
session_regenerate_id();
$_SESSION = $oldSessionData;
// Version 4.3.2 didn't store the cookie of the new session.
if (version_compare(PHP_VERSION, '4.3.2') === 0)
setcookie(session_name(), session_id(), time() + $cookie_length, $cookie_url[1], '', 0);
$_SESSION['login_' . $cookiename] = $data;
}
}
// PHP < 4.3.2 doesn't have this function
if (!function_exists('session_regenerate_id'))
{
function session_regenerate_id()
{
// Too late to change the session now.
if (headers_sent())
return false;
session_id(strtolower(md5(uniqid(rand(), true))));
return true;
}
// Globalize cookies across domains (filter out IP-addresses)?
if (!empty($modSettings['globalCookies']) && !preg_match('~^\d{1,3}(\.\d{1,3}){3}$~', $parsed_url['host']))
{
// If we can't figure it out, just skip it.
if (preg_match('~(?:[^\.]+\.)?([^\.]{2,}\..+)\z~i', $parsed_url['host'], $parts) == 1)
$parsed_url['host'] = '.' . $parts[1];
}
// We shouldn't use a host at all if both options are off.
elseif (empty($modSettings['localCookies']))
$parsed_url['host'] = '';
// Globalize cookies across domains (filter out IP-addresses)?
if (!empty($modSettings['globalCookies']) && preg_match('~^\d{1,3}(\.\d{1,3}){3}$~', $parsed_url['host']) == 0 && preg_match('~(?:[^\.]+\.)?([^\.]{2,}\..+)\z~i', $parsed_url['host'], $parts) == 1)
$parsed_url['host'] = '.' . $parts[1];
// We shouldn't use a host at all if both options are off.
elseif (empty($modSettings['localCookies']) && empty($modSettings['globalCookies']))
$parsed_url['host'] = '';
// The host also shouldn't be set if there aren't any dots in it.
elseif (!isset($parsed_url['host']) || strpos($parsed_url['host'], '.') === false)
$parsed_url['host'] = '';
if (!mktree(dirname($strPath), $mode))
// Is this an invalid path and/or we can't make the directory?
if ($strPath == dirname($strPath) || !mktree(dirname($strPath), $mode))
// Set the debug level.
// If we're using this try to get some more memory.
@ini_set('memory_limit', '32M');
// Set the debug level.
$tag = preg_quote($match[1], '/');
$reg = '/\A(.*?(<' . $tag . ' .*?>.*?<\/' . $tag . '>.*?)*?)<\/' . $tag . '>/s';
// Remove the element and fetch the inner data.
preg_match($reg, $data, $inner_match);
$data = preg_replace($reg, '', $data, 1);
if (!isset($inner_match[1]))
continue;
// Parse the inner data.
if (strpos($inner_match[1], '<') !== false)
$el += $this->_parse($inner_match[1]);
elseif (trim($inner_match[1]) != '')
{
$text_value = $this->_from_cdata($inner_match[1]);
if ($text_value != '')
$el[] = array(
'name' => '!',
'value' => $text_value
);
// Because PHP 5.2.0+ seems to croak using regex, we'll have to do this the less fun way.
$last_tag_end = strpos($data, '</' . $match[1]. '>');
if ($last_tag_end === false)
continue;
$offset = 0;
while (1 == 1)
{
// Where is the next start tag?
$next_tag_start = strpos($data, '<' . $match[1], $offset);
// If the next start tag is after the last end tag then we've found the right close.
if ($next_tag_start === false || $next_tag_start > $last_tag_end)
break;
// If not then find the next ending tag.
$next_tag_end = strpos($data, '</' . $match[1]. '>', $offset);
// Didn't find one? Then just use the last and sod it.
if ($next_tag_end === false)
break;
else
{
$last_tag_end = $next_tag_end;
$offset = $next_tag_start + 1;
}
}
// Parse the insides.
$inner_match = substr($data, 0, $last_tag_end);
// Data now starts from where this section ends.
$data = substr($data, $last_tag_end + strlen('</' . $match[1]. '>'));
if (!empty($inner_match))
{
// Parse the inner data.
if (strpos($inner_match, '<') !== false)
$el += $this->_parse($inner_match);
elseif (trim($inner_match) != '')
{
$text_value = $this->_from_cdata($inner_match);
if ($text_value != '')
$el[] = array(
'name' => '!',
'value' => $text_value
);
}
function addslashes__recursive($var)
function addslashes__recursive($var, $level = 0)
$new_var[addslashes($k)] = addslashes__recursive($v);
$new_var[addslashes($k)] = $level > 25 ? null : addslashes__recursive($v, $level + 1);
function htmlspecialchars__recursive($var)
function htmlspecialchars__recursive($var, $level = 0)
foreach ($var as $k => $v)
$var[$k] = htmlspecialchars__recursive($v);
foreach ($var as $k => $v)
$var[$k] = $level > 25 ? null : htmlspecialchars__recursive($v, $level + 1);
function urldecode__recursive($var)
function urldecode__recursive($var, $level = 0)
$new_var[urldecode($k)] = urldecode__recursive($v);
$new_var[urldecode($k)] = $level > 25 ? null : urldecode__recursive($v, $level + 1);
function stripslashes__recursive($var)
function stripslashes__recursive($var, $level = 0)
$new_var[stripslashes($k)] = stripslashes__recursive($v);
$new_var[stripslashes($k)] = $level > 25 ? null : stripslashes__recursive($v, $level + 1);