aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-03-22 15:15:20 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-03-22 15:15:20 +0000
commit3ff475bcbba49cf55e7f4e803f7d16f7b0c93759 (patch)
tree493b39b0d9ccc9790bf9fe93ddacd7caf71f6477
parentd8013e9c75eed6f9aed156029685c7bfb0fc9252 (diff)
downloadforums-3ff475bcbba49cf55e7f4e803f7d16f7b0c93759.tar
forums-3ff475bcbba49cf55e7f4e803f7d16f7b0c93759.tar.gz
forums-3ff475bcbba49cf55e7f4e803f7d16f7b0c93759.tar.bz2
forums-3ff475bcbba49cf55e7f4e803f7d16f7b0c93759.tar.xz
forums-3ff475bcbba49cf55e7f4e803f7d16f7b0c93759.zip
some fixes... hopefully not breaking something. :o
git-svn-id: file:///svn/phpbb/trunk@7216 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/adm/style/install_update.html2
-rw-r--r--phpBB/includes/functions.php38
-rw-r--r--phpBB/install/database_update.php199
-rwxr-xr-xphpBB/install/index.php7
-rw-r--r--phpBB/install/install_update.php20
-rwxr-xr-xphpBB/language/en/install.php3
6 files changed, 59 insertions, 210 deletions
diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html
index c393352edf..c8f3811abe 100644
--- a/phpBB/adm/style/install_update.html
+++ b/phpBB/adm/style/install_update.html
@@ -101,7 +101,7 @@
<p>
{L_PERFORM_DATABASE_UPDATE_EXPLAIN}<br />
<br />
- <a href="{U_DB_UPDATE}" target="update"><strong>&raquo; {L_RUN_DATABASE_SCRIPT} &laquo;</strong></a>
+ <a href="{U_DB_UPDATE}"><strong>&raquo; {L_RUN_DATABASE_SCRIPT} &laquo;</strong></a>
</p>
<br /><br />
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 31667358f3..b281ced615 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1693,19 +1693,20 @@ function redirect($url, $return = false)
// Is the uri pointing to the current directory?
if ($pathinfo['dirname'] == '.')
{
+ $url = str_replace('./', '', $url);
+
+ // Strip / from the beginning
+ if ($url && substr($url, 0, 1) == '/')
+ {
+ $url = substr($url, 1);
+ }
+
if ($user->page['page_dir'])
{
- $url = generate_board_url() . '/' . $user->page['page_dir'] . '/' . str_replace('./', '', $url);
+ $url = generate_board_url() . '/' . $user->page['page_dir'] . '/' . $url;
}
else
{
- $url = str_replace('./', '', $url);
-
- if ($url && substr($url, -1, 1) == '/')
- {
- $url = substr($url, 0, -1);
- }
-
$url = generate_board_url() . '/' . $url;
}
}
@@ -1721,12 +1722,27 @@ function redirect($url, $return = false)
$dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs);
+ // Strip / from the end
if ($dir && substr($dir, -1, 1) == '/')
{
$dir = substr($dir, 0, -1);
}
- $url = $dir . '/' . str_replace($pathinfo['dirname'] . '/', '', $url);
+ // Strip / from the beginning
+ if ($dir && substr($dir, 0, 1) == '/')
+ {
+ $dir = substr($dir, 1);
+ }
+
+ $url = str_replace($pathinfo['dirname'] . '/', '', $url);
+
+ // Strip / from the beginning
+ if (substr($url, 0, 1) == '/')
+ {
+ $url = substr($url, 1);
+ }
+
+ $url = $dir . '/' . $url;
$url = generate_board_url() . '/' . $url;
}
}
@@ -3592,6 +3608,10 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
exit;
break;
+
+ case E_RECOVERABLE_ERROR:
+ return false;
+ break;
}
}
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index e037d26f30..5778b501dc 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -77,10 +77,22 @@ $result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
+$language = basename(request_var('language', ''));
+
+if (!$language)
+{
+ $language = $row['config_value'];
+}
+
+if (!file_exists($phpbb_root_path . 'language/' . $language))
+{
+ die('No language found!');
+}
+
// And finally, load the relevant language files
-include($phpbb_root_path . 'language/' . $row['config_value'] . '/common.' . $phpEx);
-include($phpbb_root_path . 'language/' . $row['config_value'] . '/acp/common.' . $phpEx);
-include($phpbb_root_path . 'language/' . $row['config_value'] . '/install.' . $phpEx);
+include($phpbb_root_path . 'language/' . $language . '/common.' . $phpEx);
+include($phpbb_root_path . 'language/' . $language . '/acp/common.' . $phpEx);
+include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx);
// Set PHP error handler to ours
//set_error_handler('msg_handler');
@@ -285,73 +297,6 @@ $unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP');
// Only an example, but also commented out
$database_update_info = array(
- // Changes from 3.0.b3 to the next version
- '3.0.b3' => array(
- // Change the following columns...
- 'change_columns' => array(
- BBCODES_TABLE => array(
- 'bbcode_helpline' => array('VCHAR_UNI', ''),
- ),
- USERS_TABLE => array(
- 'user_occ' => array('TEXT_UNI', ''),
- ),
- CONFIG_TABLE => array(
- 'config_value' => array('VCHAR_UNI', ''),
- ),
- ),
- // Add the following columns
- 'add_columns' => array(
- GROUPS_TABLE => array(
- 'group_founder_manage' => array('BOOL', 0),
- ),
- USERS_TABLE => array(
- 'user_pass_convert' => array('BOOL', 0),
- ),
- ),
- ),
- // Changes from 3.0.b4 to the next version
- '3.0.b4' => array(
- // Add the following columns
- 'add_columns' => array(
- CONFIRM_TABLE => array(
- 'seed' => array('UINT:10', 0),
- ),
- SESSIONS_TABLE => array(
- 'session_forwarded_for' => array('VCHAR:255', ''),
- ),
- ),
- // Change the following columns...
- 'change_columns' => array(
- USERS_TABLE => array(
- 'user_options' => array('UINT:11', 895),
- ),
- FORUMS_TABLE => array(
- 'prune_days' => array('UINT', 0),
- 'prune_viewed' => array('UINT', 0),
- 'prune_freq' => array('UINT', 0),
- ),
- PRIVMSGS_RULES_TABLE => array(
- 'rule_folder_id' => array('INT:11', 0),
- ),
- PRIVMSGS_TO_TABLE => array(
- 'folder_id' => array('INT:11', 0),
- ),
- ),
- // Remove the following keys
- 'drop_keys' => array(
- ZEBRA_TABLE => array(
- 'user_id',
- 'zebra_id',
- ),
- ),
- // Add the following primary keys
- 'add_primary_keys' => array(
- ZEBRA_TABLE => array(
- 'user_id',
- 'zebra_id',
- ),
- ),
- ),
// Changes from 3.0.b5 to the next version
'3.0.b5' => array(
// Add the following columns
@@ -630,115 +575,7 @@ flush();
$no_updates = true;
// some code magic
-if (version_compare($current_version, '3.0.b3', '<='))
-{
- // Set group_founder_manage for administrators group
- $sql = 'SELECT group_id
- FROM ' . GROUPS_TABLE . "
- WHERE group_name = 'ADMINISTRATORS'
- AND group_type = " . GROUP_SPECIAL;
- $result = $db->sql_query($sql);
- $group_id = (int) $db->sql_fetchfield('group_id');
- $db->sql_freeresult($result);
-
- if ($group_id)
- {
- $sql = 'UPDATE ' . GROUPS_TABLE . ' SET group_founder_manage = 1 WHERE group_id = ' . $group_id;
- _sql($sql, $errored, $error_ary);
- }
-
- add_bots();
-
- $no_updates = false;
-}
-
-if (version_compare($current_version, '3.0.b4', '<='))
-{
- // Add config values
- set_config('script_path', '/');
- set_config('forwarded_for_check', '0');
- set_config('ldap_password', '');
- set_config('ldap_user', '');
- set_config('fulltext_native_common_thres', '20');
-
- // Remove config variables
- $sql = 'DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'send_encoding'";
- _sql($sql, $errored, $error_ary);
-
- $sql = 'SELECT user_colour
- FROM ' . USERS_TABLE . '
- WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
- ORDER BY user_id DESC';
- $result = $db->sql_query_limit($sql, 1);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- set_config('newest_user_colour', $row['user_colour'], true);
-
- switch ($config['allow_name_chars'])
- {
- case '[\w]+':
- set_config('allow_name_chars', '[a-z]+');
- break;
-
- case '[\w_\+\. \-\[\]]+':
- set_config('allow_name_chars', '[-\]_+ [a-z]+');
- break;
- }
-
- switch ($config['pass_complex'])
- {
- case '.*':
- set_config('pass_complex', 'PASS_TYPE_ANY');
- break;
-
- case '[a-zA-Z]':
- set_config('pass_complex', 'PASS_TYPE_CASE');
- break;
-
- case '[a-zA-Z0-9]':
- set_config('pass_complex', 'PASS_TYPE_ALPHA');
- break;
-
- case '[a-zA-Z\W]':
- set_config('pass_complex', 'PASS_TYPE_SYMBOL');
- break;
- }
-
- $sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = 895 WHERE user_options = 893';
- _sql($sql, $errored, $error_ary);
-
- $sql = 'UPDATE ' . MODULES_TABLE . " SET module_auth = 'acl_a_board'
- WHERE module_class = 'acp' AND module_mode = 'version_check' AND module_auth = 'acl_a_'";
- _sql($sql, $errored, $error_ary);
-
- // Because the email hash could have been calculated wrongly as well as the clean string function changed,
- // we will update it for every user.
-
- // Since this is not used in a live environment there are not much... not used in a live environment, yes!
- $sql = 'SELECT user_id, user_email, username
- FROM ' . USERS_TABLE;
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $sql = 'UPDATE ' . USERS_TABLE . "
- SET username_clean = '" . $db->sql_escape(utf8_clean_string($row['username'])) . "'";
-
- if ($row['user_email'])
- {
- $sql .= ', user_email_hash = ' . (crc32($row['user_email']) . strlen($row['user_email']));
- }
-
- $sql .= ' WHERE user_id = ' . $row['user_id'];
- _sql($sql, $errored, $error_ary);
- }
- $db->sql_freeresult($result);
-
- $no_updates = false;
-}
-
-if (version_compare($current_version, '3.0.b6', '<='))
+if (version_compare($current_version, '3.0.b5', '<='))
{
// sorting thang
if ($map_dbms === 'mysql_41')
@@ -852,9 +689,9 @@ else
{
?>
- <p><?php echo ((isset($lang['CONTINUE_INLINE_UPDATE'])) ? $lang['CONTINUE_INLINE_UPDATE'] : 'The database update was successful. Now please close this window and continue the update process as explained.'); ?></p>
+ <p><?php echo ((isset($lang['INLINE_UPDATE_SUCCESSFUL'])) ? $lang['INLINE_UPDATE_SUCCESSFUL'] : 'The database update was successful. Now you need to continue the update process.'); ?></p>
- <p><a href="#" onclick="window.close();">&raquo; <?php echo $lang['CLOSE_WINDOW']; ?></a></p>
+ <p><a href="<?php echo append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode=update&amp;sub=file_check&amp;lang=$language"); ?>">&raquo; <?php echo (isset($lang['CONTINUE_UPDATE_NOW'])) ? $lang['CONTINUE_UPDATE_NOW'] : 'Continue the update process now'; ?></a></p>
<?php
}
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index 2baa7c2a2c..e721e90bf6 100755
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -118,7 +118,7 @@ include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
// Try and load an appropriate language if required
-$language = request_var('language', '');
+$language = basename(request_var('language', ''));
if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language)
{
@@ -171,6 +171,11 @@ if (!$language)
closedir($dir);
}
+if (!file_exists($phpbb_root_path . 'language/' . $language))
+{
+ die('No language found!');
+}
+
// And finally, load the relevant language files
include($phpbb_root_path . 'language/' . $language . '/common.' . $phpEx);
include($phpbb_root_path . 'language/' . $language . '/acp/common.' . $phpEx);
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php
index 125c5c3fd5..75f4fc4a56 100644
--- a/phpBB/install/install_update.php
+++ b/phpBB/install/install_update.php
@@ -112,20 +112,6 @@ class install_update extends module
$user->session_begin();
$auth->acl($user->data);
- // Beta4 and below are having a bug displaying an error if the install directory is present.
- // This bug got fixed, but we need to get around it by using a tiny 'hack'.
- if (!defined('DEBUG_EXTRA'))
- {
- if (version_compare(strtolower($config['version']), '3.0.b4', '<='))
- {
- @define('DEBUG_EXTRA', true);
- }
- else if (!empty($config['version_update_from']) && version_compare(strtolower($config['version_update_from']), '3.0.b4', '<='))
- {
- @define('DEBUG_EXTRA', true);
- }
- }
-
$user->setup('install');
// If we are within the intro page we need to make sure we get up-to-date version info
@@ -281,7 +267,7 @@ class install_update extends module
$template->assign_vars(array(
'S_DB_UPDATE' => true,
'S_DB_UPDATE_FINISHED' => ($config['version'] == $this->latest_version) ? true : false,
- 'U_DB_UPDATE' => $phpbb_root_path . 'install/database_update.' . $phpEx . '?type=1',
+ 'U_DB_UPDATE' => append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=1&amp;language=' . $language),
'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&amp;sub=update_db"),
'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&amp;sub=file_check"),
));
@@ -1190,7 +1176,7 @@ class install_update extends module
/* Get custom installed styles...
$sql = 'SELECT template_name, template_path
FROM ' . STYLES_TEMPLATE_TABLE . "
- WHERE template_name NOT IN ('subSilver', 'BLABLA')";
+ WHERE LOWER(template_name) NOT IN ('subsilver', 'prosilver')";
$result = $db->sql_query($sql);
$templates = array();
@@ -1205,7 +1191,7 @@ class install_update extends module
foreach ($info['files'] as $filename)
{
// Template update?
- if (strpos($filename, 'styles/subSilver/template/') === 0)
+ if (strpos(strtolower($filename), 'styles/subsilver/template/') === 0)
{
foreach ($templates as $row)
{
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index cc1e0908bc..8310da0b87 100755
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -340,7 +340,7 @@ $lang = array_merge($lang, array(
'COLLECTED_INFORMATION' => 'Information on collected files',
'COLLECTED_INFORMATION_EXPLAIN' => 'The list below shows information about the files needing an update. Please read the information in front of every status block to see what they mean and what you may need to do to perform a successful update.',
'COMPLETE_LOGIN_TO_BOARD' => 'You should now <a href="../ucp.php?mode=login">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory!',
- 'CONTINUE_INLINE_UPDATE' => 'The database update was successful. Now please close this window and continue the update process as explained.',
+ 'CONTINUE_UPDATE_NOW' => 'Continue the update process now',
'CURRENT_FILE' => 'Current original file',
'CURRENT_VERSION' => 'Current version',
@@ -381,6 +381,7 @@ $lang = array_merge($lang, array(
'INCOMPATIBLE_UPDATE_FILES' => 'The update files found are incompatible with your installed version. Your installed version is %1$s and the update file is for updating phpBB %2$s to %3$s.',
'INCOMPLETE_UPDATE_FILES' => 'The update files are incomplete',
+ 'INLINE_UPDATE_SUCCESSFUL' => 'The database update was successful. Now you need to continue the update process.',
'LATEST_VERSION' => 'Latest version',
'LINE' => 'Line',