mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
- 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:
parent
92f554e38a
commit
07f6a6b5f3
6 changed files with 48 additions and 15 deletions
|
@ -8,6 +8,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @package acp
|
||||
*/
|
||||
|
|
|
@ -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__))
|
||||
{
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @version $Id$
|
||||
* @copyright (c) 2007 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
* @copyright (c) 2007 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -111,7 +111,7 @@ class phpbb_hook
|
|||
|
||||
if (!empty($this->hooks[$class][$function]))
|
||||
{
|
||||
// Developer tries to call a hooked function within the hooked function...
|
||||
// Developer tries to call a hooked function within the hooked function...
|
||||
if ($this->current_hook !== NULL && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -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'];
|
||||
}
|
||||
|
@ -644,7 +652,7 @@ class session
|
|||
|
||||
$sql = 'SELECT COUNT(session_id) AS sessions
|
||||
FROM ' . SESSIONS_TABLE . '
|
||||
WHERE session_user_id = ' . (int) $this->data['user_id'] . '
|
||||
WHERE session_user_id = ' . (int) $this->data['user_id'] . '
|
||||
AND session_time >= ' . ($this->time_now - $config['form_token_lifetime']);
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
|
@ -837,7 +845,7 @@ class session
|
|||
$sql = 'SELECT DISTINCT c.session_id
|
||||
FROM ' . CONFIRM_TABLE . ' c
|
||||
LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id)
|
||||
WHERE s.session_id IS NULL' .
|
||||
WHERE s.session_id IS NULL' .
|
||||
((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @version $Id$
|
||||
* @copyright (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @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__)))
|
||||
{
|
||||
|
@ -408,10 +409,10 @@ class template
|
|||
*
|
||||
* If key is false the position is set to 0
|
||||
* If key is true the position is set to the last entry
|
||||
*
|
||||
*
|
||||
* @param string $mode Mode to execute (valid modes are 'insert' and 'change')
|
||||
*
|
||||
* If insert, the vararray is inserted at the given position (position counting from zero).
|
||||
* If insert, the vararray is inserted at the given position (position counting from zero).
|
||||
* If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
|
||||
*
|
||||
* Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
|
||||
|
|
|
@ -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', ''),
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Add table
Reference in a new issue