- fixed database updater

- fixed hook function call in database updater
- fixed bot agent detection (we used a wildcard within the w3c-agent, therefore we should really support this. ;))


git-svn-id: file:///svn/phpbb/trunk@8131 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2007-10-04 12:03:05 +00:00
parent 92f554e38a
commit 07f6a6b5f3
6 changed files with 48 additions and 15 deletions

View file

@ -8,6 +8,14 @@
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* @package acp
*/

View file

@ -1577,7 +1577,7 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
// Developers using the hook function need to globalise the $_SID and $_EXTRA_URL on their own and also handle it appropiatly.
// They could mimick most of what is within this function
if ($phpbb_hook->call_hook(__FUNCTION__, $url, $params, $is_amp, $session_id))
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__, $url, $params, $is_amp, $session_id))
{
if ($phpbb_hook->hook_return(__FUNCTION__))
{
@ -4463,7 +4463,7 @@ function phpbb_user_session_handler()
{
global $phpbb_hook;
if ($phpbb_hook->call_hook(__FUNCTION__))
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__))
{
if ($phpbb_hook->hook_return(__FUNCTION__))
{

View file

@ -8,6 +8,14 @@
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Session class
* @package phpBB3
@ -367,7 +375,7 @@ class session
foreach ($active_bots as $row)
{
if ($row['bot_agent'] && strpos(strtolower($this->browser), strtolower($row['bot_agent'])) !== false)
if ($row['bot_agent'] && preg_match('#' . str_replace('\*', '.*?', preg_quote($row['bot_agent'], '#')) . '#i', $this->browser))
{
$bot = $row['user_id'];
}

View file

@ -9,6 +9,7 @@
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
@ -149,7 +150,7 @@ class template
{
global $user, $phpbb_hook;
if ($phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once))
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once))
{
if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
{

View file

@ -79,6 +79,22 @@ $user = new user();
$cache = new cache();
$db = new $sql_db();
// Add own hook handler, if present. :o
if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))
{
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
foreach ($cache->obtain_hooks() as $hook)
{
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
}
}
else
{
$phpbb_hook = false;
}
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false);
@ -428,7 +444,7 @@ $database_update_info = array(
'3.0.RC5' => array(
// Add the following columns
'add_columns' => array(
USER_TABLE => array(
USERS_TABLE => array(
'user_form_salt' => array('VCHAR_UNI:32', ''),
),
),