diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2007-10-04 12:03:05 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2007-10-04 12:03:05 +0000 |
commit | 07f6a6b5f3092f53304be24e43ad2b92912ae5c3 (patch) | |
tree | 77a4f718df92085dd6a0579266c9bc82016c8e58 | |
parent | 92f554e38aaf3c4d280c201d3a6521e519acfb47 (diff) | |
download | forums-07f6a6b5f3092f53304be24e43ad2b92912ae5c3.tar forums-07f6a6b5f3092f53304be24e43ad2b92912ae5c3.tar.gz forums-07f6a6b5f3092f53304be24e43ad2b92912ae5c3.tar.bz2 forums-07f6a6b5f3092f53304be24e43ad2b92912ae5c3.tar.xz forums-07f6a6b5f3092f53304be24e43ad2b92912ae5c3.zip |
- 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
-rw-r--r-- | phpBB/includes/acp/acp_update.php | 8 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 4 | ||||
-rw-r--r-- | phpBB/includes/hooks/index.php | 8 | ||||
-rw-r--r-- | phpBB/includes/session.php | 14 | ||||
-rw-r--r-- | phpBB/includes/template.php | 11 | ||||
-rw-r--r-- | phpBB/install/database_update.php | 18 |
6 files changed, 48 insertions, 15 deletions
diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index 03f2db7d15..1ab4726e8b 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -9,6 +9,14 @@ */ /** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** * @package acp */ class acp_update diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 29512e0e51..4a3659c758 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -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__)) { diff --git a/phpBB/includes/hooks/index.php b/phpBB/includes/hooks/index.php index a8ad64478a..aa85e63f32 100644 --- a/phpBB/includes/hooks/index.php +++ b/phpBB/includes/hooks/index.php @@ -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; diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index b2399c74c5..0d59bf8faf 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -9,6 +9,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); diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index 4c126b8a91..2e60beb658 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -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) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index e4402f30d9..66a22213f9 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -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', ''), ), ), |