diff options
Diffstat (limited to 'phpBB/install')
-rw-r--r-- | phpBB/install/convertors/convert_phpbb20.php | 2 | ||||
-rw-r--r-- | phpBB/install/convertors/functions_phpbb20.php | 12 | ||||
-rw-r--r-- | phpBB/install/database_update.php | 443 | ||||
-rwxr-xr-x | phpBB/install/index.php | 72 | ||||
-rw-r--r-- | phpBB/install/install_convert.php | 90 | ||||
-rwxr-xr-x | phpBB/install/install_install.php | 112 | ||||
-rwxr-xr-x | phpBB/install/install_main.php | 2 | ||||
-rw-r--r-- | phpBB/install/install_update.php | 119 |
8 files changed, 225 insertions, 627 deletions
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 518de114b8..eb71667435 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -22,7 +22,7 @@ if (!defined('IN_PHPBB')) exit; } -include($phpbb_root_path . 'config.' . $phpEx); +include(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); unset($dbpasswd); /** diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index b9d3677e34..05cda4d6b9 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -314,7 +314,7 @@ function phpbb_insert_forums() function phpbb_set_encoding($text, $grab_user_lang = true) { global $lang_enc_array, $convert_row; - global $convert, $phpEx; + global $convert; /*static $lang_enc_array = array( 'korean' => 'euc-kr', @@ -395,7 +395,7 @@ function phpbb_set_encoding($text, $grab_user_lang = true) if (!isset($lang_enc_array[$get_lang])) { - $filename = $convert->options['forum_path'] . '/language/lang_' . $get_lang . '/lang_main.' . $phpEx; + $filename = $convert->options['forum_path'] . '/language/lang_' . $get_lang . '/lang_main.' . PHP_EXT; if (!file_exists($filename)) { @@ -404,7 +404,7 @@ function phpbb_set_encoding($text, $grab_user_lang = true) if (!isset($lang_enc_array[$get_lang])) { - include($convert->options['forum_path'] . '/language/lang_' . $get_lang . '/lang_main.' . $phpEx); + include($convert->options['forum_path'] . '/language/lang_' . $get_lang . '/lang_main.' . PHP_EXT); $lang_enc_array[$get_lang] = $lang['ENCODING']; unset($lang); } @@ -1223,7 +1223,7 @@ function phpbb_replace_size($matches) */ function phpbb_prepare_message($message) { - global $phpbb_root_path, $phpEx, $db, $convert, $user, $config, $cache, $convert_row, $message_parser; + global $db, $convert, $user, $config, $cache, $convert_row, $message_parser; if (!$message) { @@ -1367,7 +1367,7 @@ function phpbb_get_files_dir() */ function phpbb_copy_thumbnails() { - global $db, $convert, $user, $config, $cache, $phpbb_root_path; + global $db, $convert, $user, $config, $cache; $src_path = $convert->options['forum_path'] . '/' . phpbb_get_files_dir() . '/thumbs/'; @@ -1387,7 +1387,7 @@ function phpbb_copy_thumbnails() else { copy_file($src_path . $entry, $config['upload_path'] . '/' . preg_replace('/^t_/', 'thumb_', $entry)); - @unlink($phpbb_root_path . $config['upload_path'] . '/thumbs/' . $entry); + @unlink(PHPBB_ROOT_PATH . $config['upload_path'] . '/thumbs/' . $entry); } } closedir($handle); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 277fc055df..627049f941 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -21,8 +21,8 @@ if (defined('IN_PHPBB') && defined('IN_INSTALL')) define('IN_PHPBB', true); define('IN_INSTALL', true); -$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); +if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './../'); +if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); // Report all errors, except notices //error_reporting(E_ALL ^ E_NOTICE); @@ -31,7 +31,7 @@ error_reporting(E_ALL); @set_time_limit(0); // Include essential scripts -include($phpbb_root_path . 'config.' . $phpEx); +include(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); if (!isset($dbms)) { @@ -50,23 +50,23 @@ if (!empty($load_extensions)) } // Include files -require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx); -require($phpbb_root_path . 'includes/cache.' . $phpEx); -require($phpbb_root_path . 'includes/template.' . $phpEx); -require($phpbb_root_path . 'includes/session.' . $phpEx); -require($phpbb_root_path . 'includes/auth.' . $phpEx); +require(PHPBB_ROOT_PATH . 'includes/acm/acm_' . $acm_type . '.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/cache.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/template.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/session.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/auth.' . PHP_EXT); -require($phpbb_root_path . 'includes/functions.' . $phpEx); +require(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT); -if (file_exists($phpbb_root_path . 'includes/functions_content.' . $phpEx)) +if (file_exists(PHPBB_ROOT_PATH . 'includes/functions_content.' . PHP_EXT)) { - require($phpbb_root_path . 'includes/functions_content.' . $phpEx); + require(PHPBB_ROOT_PATH . 'includes/functions_content.' . PHP_EXT); } -require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); -require($phpbb_root_path . 'includes/constants.' . $phpEx); -require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); -require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); +require(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/utf/utf_tools.' . PHP_EXT); // If we are on PHP >= 6.0.0 we do not need some code if (version_compare(PHP_VERSION, '6.0.0-dev', '>=')) @@ -87,14 +87,14 @@ $cache = new acm(); $db = new $sql_db(); // Add own hook handler, if present. :o -if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx)) +if (file_exists(PHPBB_ROOT_PATH . 'includes/hooks/index.' . PHP_EXT)) { - require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); + require(PHPBB_ROOT_PATH . 'includes/hooks/index.' . PHP_EXT); $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); + @include(PHPBB_ROOT_PATH . 'includes/hooks/' . $hook . '.' . PHP_EXT); } } else @@ -124,15 +124,15 @@ if (!$language) $language = $row['config_value']; } -if (!file_exists($phpbb_root_path . 'language/' . $language)) +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); -include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx); +include(PHPBB_ROOT_PATH . 'language/' . $language . '/common.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'language/' . $language . '/acp/common.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'language/' . $language . '/install.' . PHP_EXT); // Set PHP error handler to ours //set_error_handler('msg_handler'); @@ -589,7 +589,6 @@ flush(); $no_updates = true; $versions = array( - '3.0.RC2', '3.0.RC3', '3.0.RC4', '3.0.RC5', '3.0.0' ); // some code magic @@ -681,7 +680,7 @@ else <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="<?php echo append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode=update&sub=file_check&lang=$language"); ?>" class="button1"><?php echo (isset($lang['CONTINUE_UPDATE_NOW'])) ? $lang['CONTINUE_UPDATE_NOW'] : 'Continue the update process now'; ?></a></p> + <p><a href="<?php echo append_sid('install/index', "mode=update&sub=file_check&lang=$language"); ?>" class="button1"><?php echo (isset($lang['CONTINUE_UPDATE_NOW'])) ? $lang['CONTINUE_UPDATE_NOW'] : 'Continue the update process now'; ?></a></p> <?php } @@ -723,404 +722,12 @@ if (function_exists('exit_handler')) */ function change_database_data($version) { - global $db, $map_dbms, $errored, $error_ary, $config, $phpbb_root_path; + global $db, $map_dbms, $errored, $error_ary, $config; switch ($version) { - case '3.0.RC2': - - $smileys = array(); - - $sql = 'SELECT smiley_id, code - FROM ' . SMILIES_TABLE; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $smileys[$row['smiley_id']] = $row['code']; - } - $db->sql_freeresult($result); - - foreach ($smileys as $id => $code) - { - // 2.0 only entitized lt and gt; We need to do something about double quotes. - if (strchr($code, '"') === false) - { - continue; - } - - $new_code = str_replace('&', '&', $code); - $new_code = str_replace('<', '<', $new_code); - $new_code = str_replace('>', '>', $new_code); - $new_code = utf8_htmlspecialchars($new_code); - - $sql = 'UPDATE ' . SMILIES_TABLE . ' - SET code = \'' . $db->sql_escape($new_code) . '\' - WHERE smiley_id = ' . (int) $id; - $db->sql_query($sql); - } - - $index_list = sql_list_index($map_dbms, ACL_ROLES_DATA_TABLE); - - if (in_array('ath_opt_id', $index_list)) - { - sql_index_drop($map_dbms, 'ath_opt_id', ACL_ROLES_DATA_TABLE); - sql_create_index($map_dbms, 'ath_op_id', ACL_ROLES_DATA_TABLE, array('auth_option_id')); - } - - break; - - case '3.0.RC3': - - if ($map_dbms === 'postgres') - { - $sql = "SELECT SETVAL('" . FORUMS_TABLE . "_seq',(select case when max(forum_id)>0 then max(forum_id)+1 else 1 end from " . FORUMS_TABLE . '));'; - _sql($sql, $errored, $error_ary); - } - - // we check for: - // ath_opt_id - // ath_op_id - // ACL_ROLES_DATA_TABLE_ath_opt_id - // we want ACL_ROLES_DATA_TABLE_ath_op_id - - $table_index_fix = array( - ACL_ROLES_DATA_TABLE => array( - 'ath_opt_id' => 'ath_op_id', - 'ath_op_id' => 'ath_op_id', - ACL_ROLES_DATA_TABLE . '_ath_opt_id' => 'ath_op_id' - ), - STYLES_IMAGESET_DATA_TABLE => array( - 'i_id' => 'i_d', - 'i_d' => 'i_d', - STYLES_IMAGESET_DATA_TABLE . '_i_id' => 'i_d' - ) - ); - - // we need to create some indicies... - $needed_creation = array(); - - foreach ($table_index_fix as $table_name => $index_info) - { - $index_list = sql_list_fake($map_dbms, $table_name); - foreach ($index_info as $bad_index => $good_index) - { - if (in_array($bad_index, $index_list)) - { - // mysql is actually OK, it won't get a hand in this crud - switch ($map_dbms) - { - // last version, mssql had issues with index removal - case 'mssql': - $sql = 'DROP INDEX ' . $table_name . '.' . $bad_index; - _sql($sql, $errored, $error_ary); - break; - - // last version, firebird, oracle, postgresql and sqlite all got bad index names - // we got kinda lucky, tho: they all support the same syntax - case 'firebird': - case 'oracle': - case 'postgres': - case 'sqlite': - $sql = 'DROP INDEX ' . $bad_index; - _sql($sql, $errored, $error_ary); - break; - } - - // If the good index already exist we do not need to create it again... - if (($map_dbms == 'mysql_40' || $map_dbms == 'mysql_41') && $bad_index == $good_index) - { - } - else - { - $needed_creation[$table_name][$good_index] = 1; - } - } - } - } - - $new_index_defs = array('ath_op_id' => array('auth_option_id'), 'i_d' => array('imageset_id')); - - foreach ($needed_creation as $bad_table => $index_repair_list) - { - foreach ($index_repair_list as $new_index => $garbage) - { - sql_create_index($map_dbms, $new_index, $bad_table, $new_index_defs[$new_index]); - } - } - - // Make sure empty smiley codes do not exist - $sql = 'DELETE FROM ' . SMILIES_TABLE . " - WHERE code = ''"; - _sql($sql, $errored, $error_ary); - - set_config('allow_birthdays', '1'); - set_config('cron_lock', '0', true); - - break; - - case '3.0.RC4': - - $update_auto_increment = array( - STYLES_TABLE => 'style_id', - STYLES_TEMPLATE_TABLE => 'template_id', - STYLES_THEME_TABLE => 'theme_id', - STYLES_IMAGESET_TABLE => 'imageset_id' - ); - - $sql = 'SELECT * - FROM ' . STYLES_TABLE . ' - WHERE style_id = 0'; - $result = _sql($sql, $errored, $error_ary); - $bad_style_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($bad_style_row) - { - $sql = 'SELECT MAX(style_id) as max_id - FROM ' . STYLES_TABLE; - $result = _sql($sql, $errored, $error_ary); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $proper_id = $row['max_id'] + 1; - - _sql('UPDATE ' . STYLES_TABLE . " SET style_id = $proper_id WHERE style_id = 0", $errored, $error_ary); - _sql('UPDATE ' . FORUMS_TABLE . " SET forum_style = $proper_id WHERE forum_style = 0", $errored, $error_ary); - _sql('UPDATE ' . USERS_TABLE . " SET user_style = $proper_id WHERE user_style = 0", $errored, $error_ary); - - $sql = 'SELECT config_value - FROM ' . CONFIG_TABLE . " - WHERE config_name = 'default_style'"; - $result = _sql($sql, $errored, $error_ary); - $style_config = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($style_config['config_value'] === '0') - { - set_config('default_style', (string) $proper_id); - } - } - - $sql = 'SELECT * - FROM ' . STYLES_TEMPLATE_TABLE . ' - WHERE template_id = 0'; - $result = _sql($sql, $errored, $error_ary); - $bad_style_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($bad_style_row) - { - $sql = 'SELECT MAX(template_id) as max_id - FROM ' . STYLES_TEMPLATE_TABLE; - $result = _sql($sql, $errored, $error_ary); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $proper_id = $row['max_id'] + 1; - - _sql('UPDATE ' . STYLES_TABLE . " SET template_id = $proper_id WHERE template_id = 0", $errored, $error_ary); - } - - $sql = 'SELECT * - FROM ' . STYLES_THEME_TABLE . ' - WHERE theme_id = 0'; - $result = _sql($sql, $errored, $error_ary); - $bad_style_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($bad_style_row) - { - $sql = 'SELECT MAX(theme_id) as max_id - FROM ' . STYLES_THEME_TABLE; - $result = _sql($sql, $errored, $error_ary); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $proper_id = $row['max_id'] + 1; - - _sql('UPDATE ' . STYLES_TABLE . " SET theme_id = $proper_id WHERE theme_id = 0", $errored, $error_ary); - } - - $sql = 'SELECT * - FROM ' . STYLES_IMAGESET_TABLE . ' - WHERE imageset_id = 0'; - $result = _sql($sql, $errored, $error_ary); - $bad_style_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($bad_style_row) - { - $sql = 'SELECT MAX(imageset_id) as max_id - FROM ' . STYLES_IMAGESET_TABLE; - $result = _sql($sql, $errored, $error_ary); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $proper_id = $row['max_id'] + 1; - - _sql('UPDATE ' . STYLES_TABLE . " SET imageset_id = $proper_id WHERE imageset_id = 0", $errored, $error_ary); - _sql('UPDATE ' . STYLES_IMAGESET_DATA_TABLE . " SET imageset_id = $proper_id WHERE imageset_id = 0", $errored, $error_ary); - } - - if ($map_dbms == 'mysql_40' || $map_dbms == 'mysql_41') - { - foreach ($update_auto_increment as $auto_table_name => $auto_column_name) - { - $sql = "SELECT MAX({$auto_column_name}) as max_id - FROM {$auto_table_name}"; - $result = _sql($sql, $errored, $error_ary); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $max_id = ((int) $row['max_id']) + 1; - _sql("ALTER TABLE {$auto_table_name} AUTO_INCREMENT = {$max_id}", $errored, $error_ary); - } - } - else if ($map_dbms == 'postgres') - { - foreach ($update_auto_increment as $auto_table_name => $auto_column_name) - { - $sql = "SELECT SETVAL('" . $auto_table_name . "_seq',(select case when max({$auto_column_name})>0 then max({$auto_column_name})+1 else 1 end from " . $auto_table_name . '));'; - _sql($sql, $errored, $error_ary); - } - - $sql = 'DROP SEQUENCE ' . STYLES_TEMPLATE_DATA_TABLE . '_seq'; - _sql($sql, $errored, $error_ary); - } - else if ($map_dbms == 'firebird') - { - $sql = 'DROP TRIGGER t_' . STYLES_TEMPLATE_DATA_TABLE; - _sql($sql, $errored, $error_ary); - - $sql = 'DROP GENERATOR ' . STYLES_TEMPLATE_DATA_TABLE . '_gen'; - _sql($sql, $errored, $error_ary); - } - else if ($map_dbms == 'oracle') - { - $sql = 'DROP TRIGGER t_' . STYLES_TEMPLATE_DATA_TABLE; - _sql($sql, $errored, $error_ary); - - $sql = 'DROP SEQUENCE ' . STYLES_TEMPLATE_DATA_TABLE . '_seq'; - _sql($sql, $errored, $error_ary); - } - else if ($map_dbms == 'mssql') - { - // we use transactions because we need to have a working DB at the end of all of this - $db->sql_transaction('begin'); - - $sql = 'SELECT * - FROM ' . STYLES_TEMPLATE_DATA_TABLE; - $result = _sql($sql, $errored, $error_ary); - $old_style_rows = array(); - while ($row = $db->sql_fetchrow($result)) - { - $old_style_rows[] = $row; - } - $db->sql_freeresult($result); - - // death to the table, it is evil! - $sql = 'DROP TABLE ' . STYLES_TEMPLATE_DATA_TABLE; - _sql($sql, $errored, $error_ary); - - // the table of awesomeness, praise be to it (or something) - $sql = 'CREATE TABLE [' . STYLES_TEMPLATE_DATA_TABLE . "] ( - [template_id] [int] DEFAULT (0) NOT NULL , - [template_filename] [varchar] (100) DEFAULT ('') NOT NULL , - [template_included] [varchar] (8000) DEFAULT ('') NOT NULL , - [template_mtime] [int] DEFAULT (0) NOT NULL , - [template_data] [text] DEFAULT ('') NOT NULL - ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]"; - _sql($sql, $errored, $error_ary); - - // index? index - $sql = 'CREATE INDEX [tid] ON [' . STYLES_TEMPLATE_DATA_TABLE . ']([template_id]) ON [PRIMARY]'; - _sql($sql, $errored, $error_ary); - - // yet another index - $sql = 'CREATE INDEX [tfn] ON [' . STYLES_TEMPLATE_DATA_TABLE . ']([template_filename]) ON [PRIMARY]'; - _sql($sql, $errored, $error_ary); - - foreach ($old_style_rows as $return_row) - { - _sql('INSERT INTO ' . STYLES_TEMPLATE_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $return_row), $errored, $error_ary); - } - - $db->sql_transaction('commit'); - } - - // Setting this here again because new installations may not have it... - set_config('cron_lock', '0', true); - set_config('ldap_port', ''); - set_config('ldap_user_filter', ''); - - break; - - case '3.0.RC5': - - // In case the user is having the bot mediapartner google "as is", adjust it. - $sql = 'UPDATE ' . BOTS_TABLE . " - SET bot_agent = '" . $db->sql_escape('Mediapartners-Google') . "' - WHERE bot_agent = '" . $db->sql_escape('Mediapartners-Google/') . "'"; - _sql($sql, $errored, $error_ary); - - set_config('form_token_lifetime', '7200'); - set_config('form_token_mintime', '0'); - set_config('min_time_reg', '5'); - set_config('min_time_terms', '2'); - set_config('form_token_sid_guests', '1'); - - $db->sql_transaction('begin'); - - $sql = 'SELECT forum_id, forum_password - FROM ' . FORUMS_TABLE; - $result = _sql($sql, $errored, $error_ary); - - while ($row = $db->sql_fetchrow($result)) - { - if (!empty($row['forum_password'])) - { - _sql('UPDATE ' . FORUMS_TABLE . " SET forum_password = '" . md5($row['forum_password']) . "' WHERE forum_id = {$row['forum_id']}", $errored, $error_ary); - } - } - $db->sql_freeresult($result); - - $db->sql_transaction('commit'); - - break; - - case '3.0.0': - - $sql = 'UPDATE ' . TOPICS_TABLE . " - SET topic_last_view_time = topic_last_post_time - WHERE topic_last_view_time = 0"; - _sql($sql, $errored, $error_ary); - - // Update smiley sizes - $smileys = array('icon_e_surprised.gif', 'icon_eek.gif', 'icon_cool.gif', 'icon_lol.gif', 'icon_mad.gif', 'icon_razz.gif', 'icon_redface.gif', 'icon_cry.gif', 'icon_evil.gif', 'icon_twisted.gif', 'icon_rolleyes.gif', 'icon_exclaim.gif', 'icon_question.gif', 'icon_idea.gif', 'icon_arrow.gif', 'icon_neutral.gif', 'icon_mrgreen.gif', 'icon_e_ugeek.gif'); - - foreach ($smileys as $smiley) - { - if (file_exists($phpbb_root_path . 'images/smilies/' . $smiley)) - { - list($width, $height) = getimagesize($phpbb_root_path . 'images/smilies/' . $smiley); - - $sql = 'UPDATE ' . SMILIES_TABLE . ' - SET smiley_width = ' . $width . ', smiley_height = ' . $height . " - WHERE smiley_url = '" . $db->sql_escape($smiley) . "'"; - - _sql($sql, $errored, $error_ary); - } - } - + default: break; - - case '3.0.1': - - set_config('referer_validation', '1'); - set_config('check_attachment_content', '1'); - set_config('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title'); - } } diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 02d379a50f..7aceaa0aa0 100755 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -15,8 +15,8 @@ define('IN_PHPBB', true); define('IN_INSTALL', true); /**#@-*/ -$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); +if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './../'); +if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); // Report all errors, except notices error_reporting(E_ALL ^ E_NOTICE); @@ -148,21 +148,21 @@ else @ini_set('memory_limit', $mem_limit); // Include essential scripts -require($phpbb_root_path . 'includes/functions.' . $phpEx); +require(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT); -if (file_exists($phpbb_root_path . 'includes/functions_content.' . $phpEx)) +if (file_exists(PHPBB_ROOT_PATH . 'includes/functions_content.' . PHP_EXT)) { - require($phpbb_root_path . 'includes/functions_content.' . $phpEx); + require(PHPBB_ROOT_PATH . 'includes/functions_content.' . PHP_EXT); } -include($phpbb_root_path . 'includes/auth.' . $phpEx); -include($phpbb_root_path . 'includes/session.' . $phpEx); -include($phpbb_root_path . 'includes/template.' . $phpEx); -include($phpbb_root_path . 'includes/acm/acm_file.' . $phpEx); -include($phpbb_root_path . 'includes/cache.' . $phpEx); -include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); -include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); -require($phpbb_root_path . 'includes/functions_install.' . $phpEx); +include(PHPBB_ROOT_PATH . 'includes/auth.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'includes/session.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'includes/template.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'includes/acm/acm_file.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'includes/cache.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'includes/utf/utf_tools.' . PHP_EXT); +require(PHPBB_ROOT_PATH . 'includes/functions_install.' . PHP_EXT); // Try and load an appropriate language if required $language = basename(request_var('language', '')); @@ -175,7 +175,7 @@ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language) // Set correct format ... guess full xx_yy form $accept_lang = substr($accept_lang, 0, 2) . '_' . substr($accept_lang, 3, 2); - if (file_exists($phpbb_root_path . 'language/' . $accept_lang)) + if (file_exists(PHPBB_ROOT_PATH . 'language/' . $accept_lang)) { $language = $accept_lang; break; @@ -184,7 +184,7 @@ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language) { // No match on xx_yy so try xx $accept_lang = substr($accept_lang, 0, 2); - if (file_exists($phpbb_root_path . 'language/' . $accept_lang)) + if (file_exists(PHPBB_ROOT_PATH . 'language/' . $accept_lang)) { $language = $accept_lang; break; @@ -197,7 +197,7 @@ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language) // dir, this may or may not be English if (!$language) { - $dir = @opendir($phpbb_root_path . 'language'); + $dir = @opendir(PHPBB_ROOT_PATH . 'language'); if (!$dir) { @@ -207,7 +207,7 @@ if (!$language) while (($file = readdir($dir)) !== false) { - $path = $phpbb_root_path . 'language/' . $file; + $path = PHPBB_ROOT_PATH . 'language/' . $file; if (!is_file($path) && !is_link($path) && file_exists($path . '/iso.txt')) { @@ -218,17 +218,17 @@ if (!$language) closedir($dir); } -if (!file_exists($phpbb_root_path . 'language/' . $language)) +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); -include($phpbb_root_path . 'language/' . $language . '/acp/board.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx); -include($phpbb_root_path . 'language/' . $language . '/posting.' . $phpEx); +include(PHPBB_ROOT_PATH . 'language/' . $language . '/common.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'language/' . $language . '/acp/common.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'language/' . $language . '/acp/board.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'language/' . $language . '/install.' . PHP_EXT); +include(PHPBB_ROOT_PATH . 'language/' . $language . '/posting.' . PHP_EXT); $mode = request_var('mode', 'overview'); $sub = request_var('sub', ''); @@ -242,14 +242,14 @@ $cache = new acm(); $template = new template(); // Add own hook handler, if present. :o -if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx)) +if (file_exists(PHPBB_ROOT_PATH . 'includes/hooks/index.' . PHP_EXT)) { - require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); + require(PHPBB_ROOT_PATH . 'includes/hooks/index.' . PHP_EXT); $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); + @include(PHPBB_ROOT_PATH . 'includes/hooks/' . $hook . '.' . PHP_EXT); } } else @@ -270,7 +270,7 @@ $user->theme['template_storedb'] = false; $install = new module(); -$install->create('install', "index.$phpEx", $mode, $sub); +$install->create('install', 'index.' . PHP_EXT, $mode, $sub); $install->load(); // Generate the page @@ -302,7 +302,7 @@ class module */ function create($module_type, $module_url, $selected_mod = false, $selected_submod = false) { - global $db, $config, $phpEx, $phpbb_root_path; + global $db, $config; $module = array(); @@ -317,7 +317,7 @@ class module $setmodules = 1; while (($file = readdir($dir)) !== false) { - if (preg_match('#^install_(.*?)\.' . $phpEx . '$#', $file)) + if (preg_match('#^install_(.*?)\.' . PHP_EXT . '$#', $file)) { include($file); } @@ -381,8 +381,6 @@ class module */ function load($mode = false, $run = true) { - global $phpbb_root_path, $phpEx; - if ($run) { if (!empty($mode)) @@ -415,7 +413,7 @@ class module } define('HEADER_INC', true); - global $template, $lang, $stage, $phpbb_root_path; + global $template, $lang, $stage; $template->assign_vars(array( 'L_CHANGE' => $lang['CHANGE'], @@ -423,7 +421,7 @@ class module 'L_SELECT_LANG' => $lang['SELECT_LANG'], 'L_SKIP' => $lang['SKIP'], 'PAGE_TITLE' => $this->get_page_title(), - 'T_IMAGE_PATH' => $phpbb_root_path . 'adm/images/', + 'T_IMAGE_PATH' => PHPBB_ROOT_PATH . 'adm/images/', 'S_CONTENT_DIRECTION' => $lang['DIRECTION'], 'S_CONTENT_FLOW_BEGIN' => ($lang['DIRECTION'] == 'ltr') ? 'left' : 'right', @@ -529,7 +527,7 @@ class module */ function generate_navigation() { - global $lang, $template, $phpEx, $language; + global $lang, $template, $language; if (is_array($this->module_ary)) { @@ -762,9 +760,7 @@ class module */ function inst_language_select($default = '') { - global $phpbb_root_path, $phpEx; - - $dir = @opendir($phpbb_root_path . 'language'); + $dir = @opendir(PHPBB_ROOT_PATH . 'language'); if (!$dir) { @@ -773,7 +769,7 @@ class module while ($file = readdir($dir)) { - $path = $phpbb_root_path . 'language/' . $file; + $path = PHPBB_ROOT_PATH . 'language/' . $file; if ($file == '.' || $file == '..' || is_link($path) || is_file($path) || $file == 'CVS') { diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 105266f5ed..f222dd7fa6 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -22,7 +22,7 @@ if (!empty($setmodules)) $module[] = array( 'module_type' => 'install', 'module_title' => 'CONVERT', - 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), + 'module_filename' => substr(basename(__FILE__), 0, -strlen(PHP_EXT)-1), 'module_order' => 20, 'module_subs' => '', 'module_stages' => array('INTRO', 'SETTINGS', 'IN_PROGRESS', 'FINAL'), @@ -90,7 +90,7 @@ class install_convert extends module function main($mode, $sub) { - global $lang, $template, $phpbb_root_path, $phpEx, $cache, $config, $language, $table_prefix; + global $lang, $template, $cache, $config, $language, $table_prefix; global $convert; $this->tpl_name = 'install_convert'; @@ -104,9 +104,9 @@ class install_convert extends module // Try opening config file // @todo If phpBB is not installed, we need to do a cut-down installation here // For now, we redirect to the installation script instead - if (@file_exists($phpbb_root_path . 'config.' . $phpEx)) + if (@file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT)) { - include($phpbb_root_path . 'config.' . $phpEx); + include(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); } if (!defined('PHPBB_INSTALLED')) @@ -114,16 +114,16 @@ class install_convert extends module $template->assign_vars(array( 'S_NOT_INSTALLED' => true, 'TITLE' => $lang['BOARD_NOT_INSTALLED'], - 'BODY' => sprintf($lang['BOARD_NOT_INSTALLED_EXPLAIN'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=install&language=' . $language)), + 'BODY' => sprintf($lang['BOARD_NOT_INSTALLED_EXPLAIN'], append_sid('install/index', 'mode=install&language=' . $language)), )); return; } - require($phpbb_root_path . 'config.' . $phpEx); - require($phpbb_root_path . 'includes/constants.' . $phpEx); - require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); - require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); + require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/functions_convert.' . PHP_EXT); $db = new $sql_db(); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); @@ -215,10 +215,10 @@ class install_convert extends module // This is for making sure the session get not screwed due to the 3.0.x users table being completely new. $cache->purge(); - require($phpbb_root_path . 'config.' . $phpEx); - require($phpbb_root_path . 'includes/constants.' . $phpEx); - require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); - require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); + require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/functions_convert.' . PHP_EXT); $db = new $sql_db(); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); @@ -258,7 +258,7 @@ class install_convert extends module */ function list_convertors($sub) { - global $lang, $language, $template, $phpbb_root_path, $phpEx; + global $lang, $language, $template; $this->page_title = $lang['SUB_INTRO']; @@ -289,7 +289,7 @@ class install_convert extends module while ($entry = readdir($handle)) { - if (preg_match('/^convert_([a-z0-9_]+).' . $phpEx . '$/i', $entry, $m)) + if (preg_match('/^convert_([a-z0-9_]+).' . PHP_EXT . '$/i', $entry, $m)) { include('./convertors/' . $entry); if (isset($convertor_data)) @@ -333,12 +333,12 @@ class install_convert extends module */ function get_convert_settings($sub) { - global $lang, $language, $template, $db, $phpbb_root_path, $phpEx, $config, $cache; + global $lang, $language, $template, $db, $config, $cache; - require($phpbb_root_path . 'config.' . $phpEx); - require($phpbb_root_path . 'includes/constants.' . $phpEx); - require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); - require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); + require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/functions_convert.' . PHP_EXT); $db = new $sql_db(); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); @@ -368,12 +368,12 @@ class install_convert extends module // check security implications of direct inclusion $convertor_tag = basename($convertor_tag); - if (!file_exists('./convertors/convert_' . $convertor_tag . '.' . $phpEx)) + if (!file_exists('./convertors/convert_' . $convertor_tag . '.' . PHP_EXT)) { $this->p_master->error($lang['CONVERT_NOT_EXIST'], __LINE__, __FILE__); } - include('./convertors/convert_' . $convertor_tag . '.' . $phpEx); + include('./convertors/convert_' . $convertor_tag . '.' . PHP_EXT); // The test_file is a file that should be present in the location of the old board. if (!isset($test_file)) @@ -581,13 +581,13 @@ class install_convert extends module */ function convert_data($sub) { - global $template, $user, $phpbb_root_path, $phpEx, $db, $lang, $config, $cache; + global $template, $user, $db, $lang, $config, $cache; global $convert, $convert_row, $message_parser, $skip_rows; - require($phpbb_root_path . 'config.' . $phpEx); - require($phpbb_root_path . 'includes/constants.' . $phpEx); - require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); - require($phpbb_root_path . 'includes/functions_convert.' . $phpEx); + require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/functions_convert.' . PHP_EXT); $db = new $sql_db(); $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true); @@ -613,7 +613,7 @@ class install_convert extends module // Set up a user as well. We _should_ have enough of a database here at this point to do this // and it helps for any core code we call $user->session_begin(); - $user->page = $user->extract_current_page($phpbb_root_path); + $user->page = $user->extract_current_page(PHPBB_ROOT_PATH); // This is a little bit of a fudge, but it allows the language entries to be available to the // core code without us loading them again @@ -658,7 +658,7 @@ class install_convert extends module { if ($convert->src_dbms != $dbms) { - require($phpbb_root_path . 'includes/db/' . $convert->src_dbms . '.' . $phpEx); + require(PHPBB_ROOT_PATH . 'includes/db/' . $convert->src_dbms . '.' . PHP_EXT); } $sql_db = 'dbal_' . $convert->src_dbms; $src_db = new $sql_db(); @@ -715,18 +715,18 @@ class install_convert extends module $get_info = false; // check security implications of direct inclusion - if (!file_exists('./convertors/convert_' . $convert->convertor_tag . '.' . $phpEx)) + if (!file_exists('./convertors/convert_' . $convert->convertor_tag . '.' . PHP_EXT)) { $this->p_master->error($user->lang['CONVERT_NOT_EXIST'], __LINE__, __FILE__); } - if (file_exists('./convertors/functions_' . $convert->convertor_tag . '.' . $phpEx)) + if (file_exists('./convertors/functions_' . $convert->convertor_tag . '.' . PHP_EXT)) { - include('./convertors/functions_' . $convert->convertor_tag . '.' . $phpEx); + include('./convertors/functions_' . $convert->convertor_tag . '.' . PHP_EXT); } $get_info = true; - include('./convertors/convert_' . $convert->convertor_tag . '.' . $phpEx); + include('./convertors/convert_' . $convert->convertor_tag . '.' . PHP_EXT); // Map some variables... $convert->convertor_data = $convertor_data; @@ -735,7 +735,7 @@ class install_convert extends module // Now include the real data $get_info = false; - include('./convertors/convert_' . $convert->convertor_tag . '.' . $phpEx); + include('./convertors/convert_' . $convert->convertor_tag . '.' . PHP_EXT); $convert->convertor_data = $convertor_data; $convert->tables = $tables; @@ -751,18 +751,18 @@ class install_convert extends module $search_type = basename(trim($config['search_type'])); // For conversions we are a bit less strict and set to a search backend we know exist... - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (!file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT)) { $search_type = 'fulltext_native'; set_config('search_type', $search_type); } - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (!file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT)) { trigger_error('NO_SUCH_SEARCH_MODULE'); } - require($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx); + require(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT); $error = false; $convert->fulltext_search = new $search_type($error); @@ -772,7 +772,7 @@ class install_convert extends module trigger_error($error); } - include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT); $message_parser = new parse_message(); $jump = request_var('jump', 0); @@ -828,7 +828,7 @@ class install_convert extends module $this->p_master->error($user->lang['DEV_NO_TEST_FILE'], __LINE__, __FILE__); } - if (!$local_path || !@is_writable($phpbb_root_path . $local_path)) + if (!$local_path || !@is_writable(PHPBB_ROOT_PATH . $local_path)) { if (!$local_path) { @@ -1438,7 +1438,7 @@ class install_convert extends module */ function sync_forums($sync_batch) { - global $template, $user, $db, $phpbb_root_path, $phpEx, $config, $cache; + global $template, $user, $db, $config, $cache; global $convert; $template->assign_block_vars('checks', array( @@ -1547,7 +1547,7 @@ class install_convert extends module */ function finish_conversion() { - global $db, $phpbb_root_path, $convert, $config, $language, $user, $template; + global $db, $convert, $config, $language, $user, $template; $db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'convert_progress' @@ -1556,7 +1556,7 @@ class install_convert extends module OR config_name = 'convert_db_user'"); $db->sql_query('DELETE FROM ' . SESSIONS_TABLE); - @unlink($phpbb_root_path . 'cache/data_global.php'); + @unlink(PHPBB_ROOT_PATH . 'cache/data_global.php'); cache_moderators(); // And finally, add a note to the log @@ -1578,7 +1578,7 @@ class install_convert extends module */ function final_jump($final_jump) { - global $template, $user, $src_db, $same_db, $db, $phpbb_root_path, $phpEx, $config, $cache; + global $template, $user, $src_db, $same_db, $db, $config, $cache; global $convert; $template->assign_block_vars('checks', array( @@ -1617,7 +1617,7 @@ class install_convert extends module */ function jump($jump, $last_statement) { - global $template, $user, $src_db, $same_db, $db, $phpbb_root_path, $phpEx, $config, $cache; + global $template, $user, $src_db, $same_db, $db, $config, $cache; global $convert; $template->assign_block_vars('checks', array( @@ -1920,7 +1920,7 @@ class install_convert extends module */ function process_row(&$schema, &$sql_data, &$insert_values) { - global $template, $user, $phpbb_root_path, $phpEx, $db, $lang, $config, $cache; + global $template, $user, $db, $lang, $config, $cache; global $convert, $convert_row; $sql_flag = false; diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 194d5ca705..5f2161a1ce 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -19,9 +19,9 @@ if (!defined('IN_INSTALL')) if (!empty($setmodules)) { // If phpBB is already installed we do not include this module - if (@file_exists($phpbb_root_path . 'config.' . $phpEx) && !file_exists($phpbb_root_path . 'cache/install_lock')) + if (@file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) && !file_exists(PHPBB_ROOT_PATH . 'cache/install_lock')) { - include_once($phpbb_root_path . 'config.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); if (defined('PHPBB_INSTALLED')) { @@ -32,7 +32,7 @@ if (!empty($setmodules)) $module[] = array( 'module_type' => 'install', 'module_title' => 'INSTALL', - 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), + 'module_filename' => substr(basename(__FILE__), 0, -strlen(PHP_EXT)-1), 'module_order' => 10, 'module_subs' => '', 'module_stages' => array('INTRO', 'REQUIREMENTS', 'DATABASE', 'ADMINISTRATOR', 'CONFIG_FILE', 'ADVANCED', 'CREATE_TABLE', 'FINAL'), @@ -53,7 +53,7 @@ class install_install extends module function main($mode, $sub) { - global $lang, $template, $language, $phpbb_root_path; + global $lang, $template, $language; switch ($sub) { @@ -107,7 +107,7 @@ class install_install extends module $this->email_admin($mode, $sub); // Remove the lock file - @unlink($phpbb_root_path . 'cache/install_lock'); + @unlink(PHPBB_ROOT_PATH . 'cache/install_lock'); break; } @@ -120,7 +120,7 @@ class install_install extends module */ function check_server_requirements($mode, $sub) { - global $lang, $template, $phpbb_root_path, $phpEx, $language; + global $lang, $template, $language; $this->page_title = $lang['STAGE_REQUIREMENTS']; @@ -455,31 +455,31 @@ class install_install extends module $exists = $write = false; // Try to create the directory if it does not exist - if (!file_exists($phpbb_root_path . $dir)) + if (!file_exists(PHPBB_ROOT_PATH . $dir)) { - @mkdir($phpbb_root_path . $dir, 0777); - @chmod($phpbb_root_path . $dir, 0777); + @mkdir(PHPBB_ROOT_PATH . $dir, 0777); + @chmod(PHPBB_ROOT_PATH . $dir, 0777); } // Now really check - if (file_exists($phpbb_root_path . $dir) && is_dir($phpbb_root_path . $dir)) + if (file_exists(PHPBB_ROOT_PATH . $dir) && is_dir(PHPBB_ROOT_PATH . $dir)) { - if (!@is_writable($phpbb_root_path . $dir)) + if (!@is_writable(PHPBB_ROOT_PATH . $dir)) { - @chmod($phpbb_root_path . $dir, 0777); + @chmod(PHPBB_ROOT_PATH . $dir, 0777); } $exists = true; } // Now check if it is writable by storing a simple file - $fp = @fopen($phpbb_root_path . $dir . 'test_lock', 'wb'); + $fp = @fopen(PHPBB_ROOT_PATH . $dir . 'test_lock', 'wb'); if ($fp !== false) { $write = true; } @fclose($fp); - @unlink($phpbb_root_path . $dir . 'test_lock'); + @unlink(PHPBB_ROOT_PATH . $dir . 'test_lock'); $passed['files'] = ($exists && $write && $passed['files']) ? true : false; @@ -502,14 +502,14 @@ class install_install extends module 'LEGEND_EXPLAIN' => $lang['FILES_OPTIONAL_EXPLAIN'], )); - $directories = array('config.' . $phpEx, 'images/avatars/upload/'); + $directories = array('config.' . PHP_EXT, 'images/avatars/upload/'); foreach ($directories as $dir) { $write = $exists = true; - if (file_exists($phpbb_root_path . $dir)) + if (file_exists(PHPBB_ROOT_PATH . $dir)) { - if (!@is_writable($phpbb_root_path . $dir)) + if (!@is_writable(PHPBB_ROOT_PATH . $dir)) { $write = false; } @@ -550,7 +550,7 @@ class install_install extends module */ function obtain_database_settings($mode, $sub) { - global $lang, $template, $phpEx; + global $lang, $template; $this->page_title = $lang['STAGE_DATABASE']; @@ -684,7 +684,7 @@ class install_install extends module */ function obtain_admin_settings($mode, $sub) { - global $lang, $template, $phpEx; + global $lang, $template; $this->page_title = $lang['STAGE_ADMINISTRATOR']; @@ -695,7 +695,7 @@ class install_install extends module { // Someone's been silly and tried calling this page direct // So we send them back to the start to do it again properly - $this->p_master->redirect("index.$phpEx?mode=install"); + $this->p_master->redirect('index.' . PHP_EXT . '?mode=install'); } $s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : ''; @@ -852,7 +852,7 @@ class install_install extends module */ function create_config_file($mode, $sub) { - global $lang, $template, $phpbb_root_path, $phpEx; + global $lang, $template; $this->page_title = $lang['STAGE_CONFIG_FILE']; @@ -863,7 +863,7 @@ class install_install extends module { // Someone's been silly and tried calling this page direct // So we send them back to the start to do it again properly - $this->p_master->redirect("index.$phpEx?mode=install"); + $this->p_master->redirect('index.' . PHP_EXT . '?mode=install'); } $s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : ''; @@ -889,7 +889,7 @@ class install_install extends module } // Create a lock file to indicate that there is an install in progress - $fp = @fopen($phpbb_root_path . 'cache/install_lock', 'wb'); + $fp = @fopen(PHPBB_ROOT_PATH . 'cache/install_lock', 'wb'); if ($fp === false) { // We were unable to create the lock file - abort @@ -897,7 +897,7 @@ class install_install extends module } @fclose($fp); - @chmod($phpbb_root_path . 'cache/install_lock', 0666); + @chmod(PHPBB_ROOT_PATH . 'cache/install_lock', 0666); $load_extensions = implode(',', $load_extensions); @@ -929,12 +929,12 @@ class install_install extends module $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused! // Attempt to write out the config file directly. If it works, this is the easiest way to do it ... - if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && is_writable($phpbb_root_path . 'config.' . $phpEx)) || is_writable($phpbb_root_path)) + if ((file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) && is_writable(PHPBB_ROOT_PATH . 'config.' . PHP_EXT)) || is_writable(PHPBB_ROOT_PATH)) { // Assume it will work ... if nothing goes wrong below $written = true; - if (!($fp = @fopen($phpbb_root_path . 'config.' . $phpEx, 'w'))) + if (!($fp = @fopen(PHPBB_ROOT_PATH . 'config.' . PHP_EXT, 'w'))) { // Something went wrong ... so let's try another method $written = false; @@ -950,7 +950,7 @@ class install_install extends module if ($written) { - @chmod($phpbb_root_path . 'config.' . $phpEx, 0644); + @chmod(PHPBB_ROOT_PATH . 'config.' . PHP_EXT, 0644); } } @@ -960,7 +960,7 @@ class install_install extends module // Note that all we check is that the file has _something_ in it // We don't compare the contents exactly - if they can't upload // a single file correctly, it's likely they will have other problems.... - if (filesize($phpbb_root_path . 'config.' . $phpEx) > 10) + if (filesize(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) > 10) { $written = true; } @@ -984,8 +984,8 @@ class install_install extends module if (isset($_POST['dlconfig'])) { // They want a copy of the file to download, so send the relevant headers and dump out the data - header("Content-Type: text/x-delimtext; name=\"config.$phpEx\""); - header("Content-disposition: attachment; filename=config.$phpEx"); + header('Content-Type: text/x-delimtext; name="config.' . PHP_EXT . '"'); + header('Content-disposition: attachment; filename=config.' . PHP_EXT); echo $config_data; exit; } @@ -1021,7 +1021,7 @@ class install_install extends module */ function obtain_advanced_settings($mode, $sub) { - global $lang, $template, $phpEx; + global $lang, $template; $this->page_title = $lang['STAGE_ADVANCED']; @@ -1032,7 +1032,7 @@ class install_install extends module { // Someone's been silly and tried calling this page direct // So we send them back to the start to do it again properly - $this->p_master->redirect("index.$phpEx?mode=install"); + $this->p_master->redirect('index.' . PHP_EXT . '?mode=install'); } $s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : ''; @@ -1117,7 +1117,7 @@ class install_install extends module */ function load_schema($mode, $sub) { - global $db, $lang, $template, $phpbb_root_path, $phpEx; + global $db, $lang, $template; $this->page_title = $lang['STAGE_CREATE_TABLE']; $s_hidden_fields = ''; @@ -1129,7 +1129,7 @@ class install_install extends module { // Someone's been silly and tried calling this page direct // So we send them back to the start to do it again properly - $this->p_master->redirect("index.$phpEx?mode=install"); + $this->p_master->redirect('index.' . PHP_EXT . '?mode=install'); } // HTTP_HOST is having the correct browser url in most cases... @@ -1148,13 +1148,13 @@ class install_install extends module if (!isset($available_dbms[$data['dbms']])) { // Someone's been silly and tried providing a non-existant dbms - $this->p_master->redirect("index.$phpEx?mode=install"); + $this->p_master->redirect('index.' . PHP_EXT . '?mode=install'); } $dbms = $available_dbms[$data['dbms']]['DRIVER']; // Load the appropriate database class if not already loaded - include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT); // Instantiate the database $db = new $sql_db(); @@ -1172,8 +1172,8 @@ class install_install extends module $delimiter = $available_dbms[$data['dbms']]['DELIM']; - include($phpbb_root_path . 'includes/db/db_tools.php'); - include($phpbb_root_path . 'install/schemas/schema_data.php'); + include(PHPBB_ROOT_PATH . 'includes/db/db_tools.php'); + include(PHPBB_ROOT_PATH . 'install/schemas/schema_data.php'); // we must do this so that we can handle the errors phpbb_db_tools::$return_statements = true; @@ -1413,7 +1413,7 @@ class install_install extends module */ function build_search_index($mode, $sub) { - global $db, $lang, $phpbb_root_path, $phpEx, $config; + global $db, $lang, $config; // Obtain any submitted data $data = $this->get_submitted_data(); @@ -1425,13 +1425,13 @@ class install_install extends module if (!isset($available_dbms[$data['dbms']])) { // Someone's been silly and tried providing a non-existant dbms - $this->p_master->redirect("index.$phpEx?mode=install"); + $this->p_master->redirect('index.' . PHP_EXT . '?mode=install'); } $dbms = $available_dbms[$data['dbms']]['DRIVER']; // Load the appropriate database class if not already loaded - include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT); // Instantiate the database $db = new $sql_db(); @@ -1440,8 +1440,8 @@ class install_install extends module // NOTE: trigger_error does not work here. $db->sql_return_on_error(true); - include_once($phpbb_root_path . 'includes/constants.' . $phpEx); - include_once($phpbb_root_path . 'includes/search/fulltext_native.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT); + include_once(PHPBB_ROOT_PATH . 'includes/search/fulltext_native.' . PHP_EXT); // Fill the config array - it is needed by those functions we call $sql = 'SELECT * @@ -1474,9 +1474,9 @@ class install_install extends module */ function add_modules($mode, $sub) { - global $db, $lang, $phpbb_root_path, $phpEx; + global $db, $lang; - include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/acp/acp_modules.' . PHP_EXT); $_module = &new acp_modules(); $module_classes = array('acp', 'mcp', 'ucp'); @@ -1695,9 +1695,9 @@ class install_install extends module */ function add_language($mode, $sub) { - global $db, $lang, $phpbb_root_path, $phpEx; + global $db, $lang; - $dir = @opendir($phpbb_root_path . 'language'); + $dir = @opendir(PHPBB_ROOT_PATH . 'language'); if (!$dir) { @@ -1706,7 +1706,7 @@ class install_install extends module while (($file = readdir($dir)) !== false) { - $path = $phpbb_root_path . 'language/' . $file; + $path = PHPBB_ROOT_PATH . 'language/' . $file; if ($file == '.' || $file == '..' || is_link($path) || is_file($path) || $file == 'CVS') { @@ -1745,9 +1745,9 @@ class install_install extends module while ($imageset_row = $db->sql_fetchrow($result)) { - if (@file_exists("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['lang_iso']}/imageset.cfg")) + if (@file_exists(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['lang_iso']}/imageset.cfg")) { - $cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['lang_iso']}/imageset.cfg"); + $cfg_data_imageset_data = parse_cfg_file(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['lang_iso']}/imageset.cfg"); foreach ($cfg_data_imageset_data as $image_name => $value) { if (strpos($value, '*') !== false) @@ -1808,7 +1808,7 @@ class install_install extends module */ function add_bots($mode, $sub) { - global $db, $lang, $phpbb_root_path, $phpEx, $config; + global $db, $lang, $config; // Obtain any submitted data $data = $this->get_submitted_data(); @@ -1840,7 +1840,7 @@ class install_install extends module if (!function_exists('user_add')) { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); } foreach ($this->bot_list as $bot_name => $bot_ary) @@ -1886,7 +1886,7 @@ class install_install extends module */ function email_admin($mode, $sub) { - global $auth, $config, $db, $lang, $template, $user, $phpbb_root_path, $phpEx; + global $auth, $config, $db, $lang, $template, $user; $this->page_title = $lang['STAGE_FINAL']; @@ -1914,7 +1914,7 @@ class install_install extends module if ($config['email_enable']) { - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); $messenger = new messenger(false); @@ -1940,9 +1940,9 @@ class install_install extends module $template->assign_vars(array( 'TITLE' => $lang['INSTALL_CONGRATS'], - 'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], $config['version'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=convert&language=' . $data['language']), '../docs/README.html'), + 'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], $config['version'], append_sid('install/index', 'mode=convert&language=' . $data['language']), '../docs/README.html'), 'L_SUBMIT' => $lang['INSTALL_LOGIN'], - 'U_ACTION' => append_sid($phpbb_root_path . 'adm/index.' . $phpEx), + 'U_ACTION' => append_sid(CONFIG_ADM_FOLDER . '/index.' . PHP_EXT), )); } diff --git a/phpBB/install/install_main.php b/phpBB/install/install_main.php index e9f35efa1d..565b06b0b3 100755 --- a/phpBB/install/install_main.php +++ b/phpBB/install/install_main.php @@ -22,7 +22,7 @@ if (!empty($setmodules)) $module[] = array( 'module_type' => 'install', 'module_title' => 'OVERVIEW', - 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), + 'module_filename' => substr(basename(__FILE__), 0, -strlen(PHP_EXT)-1), 'module_order' => 0, 'module_subs' => array('INTRO', 'LICENSE', 'SUPPORT'), 'module_stages' => '', diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index d494007f3d..8bad2f7560 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -20,9 +20,9 @@ if (!defined('IN_INSTALL')) if (!empty($setmodules)) { // If phpBB is not installed we do not include this module - if (@file_exists($phpbb_root_path . 'config.' . $phpEx) && !@file_exists($phpbb_root_path . 'cache/install_lock')) + if (@file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) && !@file_exists(PHPBB_ROOT_PATH . 'cache/install_lock')) { - include_once($phpbb_root_path . 'config.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); if (!defined('PHPBB_INSTALLED')) { @@ -37,7 +37,7 @@ if (!empty($setmodules)) $module[] = array( 'module_type' => 'update', 'module_title' => 'UPDATE', - 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), + 'module_filename' => substr(basename(__FILE__), 0, -strlen(PHP_EXT)-1), 'module_order' => 30, 'module_subs' => '', 'module_stages' => array('INTRO', 'VERSION_CHECK', 'UPDATE_DB', 'FILE_CHECK', 'UPDATE_FILES'), @@ -70,19 +70,19 @@ class install_update extends module function main($mode, $sub) { - global $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth; + global $template, $user, $db, $config, $cache, $auth; $this->tpl_name = 'install_update'; $this->page_title = 'UPDATE_INSTALLATION'; $this->unequal_version = false; - $this->old_location = $phpbb_root_path . 'install/update/old/'; - $this->new_location = $phpbb_root_path . 'install/update/new/'; + $this->old_location = PHPBB_ROOT_PATH . 'install/update/old/'; + $this->new_location = PHPBB_ROOT_PATH . 'install/update/new/'; // Init DB - require($phpbb_root_path . 'config.' . $phpEx); - require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); - require($phpbb_root_path . 'includes/constants.' . $phpEx); + require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT); + require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT); // Special options for conflicts/modified files define('MERGE_NO_MERGE_NEW', 1); @@ -148,7 +148,7 @@ class install_update extends module $up_to_date = (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->latest_version)), '<')) ? false : true; // Check for a valid update directory, else point the user to the phpbb.com website - if (!file_exists($phpbb_root_path . 'install/update') || !file_exists($phpbb_root_path . 'install/update/index.' . $phpEx) || !file_exists($this->old_location) || !file_exists($this->new_location)) + if (!file_exists(PHPBB_ROOT_PATH . 'install/update') || !file_exists(PHPBB_ROOT_PATH . 'install/update/index.php') || !file_exists($this->old_location) || !file_exists($this->new_location)) { $template->assign_vars(array( 'S_ERROR' => true, @@ -206,9 +206,9 @@ class install_update extends module } // Include renderer and engine - $this->include_file('includes/diff/diff.' . $phpEx); - $this->include_file('includes/diff/engine.' . $phpEx); - $this->include_file('includes/diff/renderer.' . $phpEx); + $this->include_file('includes/diff/diff.' . PHP_EXT); + $this->include_file('includes/diff/engine.' . PHP_EXT); + $this->include_file('includes/diff/renderer.' . PHP_EXT); // Make sure we stay at the file check if checking the files again if (!empty($_POST['check_again'])) @@ -259,9 +259,9 @@ class install_update extends module $valid = false; $updates_to_version = ''; - if (file_exists($phpbb_root_path . 'install/database_update.' . $phpEx)) + if (file_exists(PHPBB_ROOT_PATH . 'install/database_update.' . PHP_EXT)) { - include_once($phpbb_root_path . 'install/database_update.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'install/database_update.' . PHP_EXT); if ($updates_to_version === $this->update_info['version']['to']) { @@ -282,7 +282,7 @@ class install_update extends module $template->assign_vars(array( 'S_DB_UPDATE' => true, 'S_DB_UPDATE_FINISHED' => ($config['version'] == $this->update_info['version']['to']) ? true : false, - 'U_DB_UPDATE' => append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=1&language=' . $user->data['user_lang']), + 'U_DB_UPDATE' => append_sid('install/database_update', 'type=1&language=' . $user->data['user_lang']), 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_db"), 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=file_check"), )); @@ -301,7 +301,7 @@ class install_update extends module // We are directly within an update. To make sure our update list is correct we check its status. $update_list = (!empty($_POST['check_again'])) ? false : $cache->get('_update_list'); - $modified = ($update_list !== false) ? @filemtime($cache->cache_dir . 'data_update_list.' . $phpEx) : 0; + $modified = ($update_list !== false) ? @filemtime($cache->cache_dir . 'data_update_list.' . PHP_EXT) : 0; // Make sure the list is up-to-date if ($update_list !== false) @@ -309,7 +309,7 @@ class install_update extends module $get_new_list = false; foreach ($this->update_info['files'] as $file) { - if (file_exists($phpbb_root_path . $file) && filemtime($phpbb_root_path . $file) > $modified) + if (file_exists(PHPBB_ROOT_PATH . $file) && filemtime(PHPBB_ROOT_PATH . $file) > $modified) { $get_new_list = true; break; @@ -459,21 +459,21 @@ class install_update extends module $update_time = time(); // We test for stylesheet.css because it is faster and most likely the only file changed on common themes - if (!$recache && $theme['theme_mtime'] < @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css')) + if (!$recache && $theme['theme_mtime'] < @filemtime(PHPBB_ROOT_PATH . 'styles/' . $theme['theme_path'] . '/theme/stylesheet.css')) { $recache = true; - $update_time = @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'); + $update_time = @filemtime(PHPBB_ROOT_PATH . 'styles/' . $theme['theme_path'] . '/theme/stylesheet.css'); } else if (!$recache) { $last_change = $theme['theme_mtime']; - $dir = @opendir("{$phpbb_root_path}styles/{$theme['theme_path']}/theme"); + $dir = @opendir(PHPBB_ROOT_PATH . "styles/{$theme['theme_path']}/theme"); if ($dir) { while (($entry = readdir($dir)) !== false) { - if (substr(strrchr($entry, '.'), 1) == 'css' && $last_change < @filemtime("{$phpbb_root_path}styles/{$theme['theme_path']}/theme/{$entry}")) + if (substr(strrchr($entry, '.'), 1) == 'css' && $last_change < @filemtime(PHPBB_ROOT_PATH . "styles/{$theme['theme_path']}/theme/{$entry}")) { $recache = true; break; @@ -485,7 +485,7 @@ class install_update extends module if ($recache) { - include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx); + include_once(PHPBB_ROOT_PATH . 'includes/acp/acp_styles.' . PHP_EXT); $theme['theme_data'] = acp_styles::db_theme_data($theme); $theme['theme_mtime'] = $update_time; @@ -679,11 +679,11 @@ class install_update extends module break; case MERGE_NO_MERGE_MOD: - $contents = file_get_contents($phpbb_root_path . $file_struct['filename']); + $contents = file_get_contents(PHPBB_ROOT_PATH . $file_struct['filename']); break; default: - $diff = $this->return_diff($this->old_location . $original_filename, $phpbb_root_path . $file_struct['filename'], $this->new_location . $original_filename); + $diff = $this->return_diff($this->old_location . $original_filename, PHPBB_ROOT_PATH . $file_struct['filename'], $this->new_location . $original_filename); $contents = implode("\n", $diff->merged_output()); unset($diff); @@ -710,12 +710,12 @@ class install_update extends module break; case MERGE_NO_MERGE_MOD: - $contents = file_get_contents($phpbb_root_path . $file_struct['filename']); + $contents = file_get_contents(PHPBB_ROOT_PATH . $file_struct['filename']); break; default: - $diff = $this->return_diff($this->old_location . $original_filename, $phpbb_root_path . $file_struct['filename'], $this->new_location . $original_filename); + $diff = $this->return_diff($this->old_location . $original_filename, PHPBB_ROOT_PATH . $file_struct['filename'], $this->new_location . $original_filename); if ($option == MERGE_NEW_FILE) { @@ -752,7 +752,7 @@ class install_update extends module if (!empty($_REQUEST['download'])) { - $this->include_file('includes/functions_compress.' . $phpEx); + $this->include_file('includes/functions_compress.' . PHP_EXT); $use_method = request_var('use_method', ''); $methods = array('.tar'); @@ -822,7 +822,7 @@ class install_update extends module } else { - $this->include_file('includes/functions_transfer.' . $phpEx); + $this->include_file('includes/functions_transfer.' . PHP_EXT); // Choose FTP, if not available use fsock... $method = basename(request_var('method', '')); @@ -850,7 +850,7 @@ class install_update extends module if ($test_connection === true) { // Check for common.php file - if (!$transfer->file_exists($phpbb_root_path, 'common.' . $phpEx)) + if (!$transfer->file_exists(PHPBB_ROOT_PATH, 'common.' . PHP_EXT)) { $test_connection = 'ERR_WRONG_PATH_TO_PHPBB'; } @@ -914,11 +914,11 @@ class install_update extends module { if ($use_method == '.zip') { - $compress = new compress_zip('w', $phpbb_root_path . 'store/' . $archive_filename . $use_method); + $compress = new compress_zip('w', PHPBB_ROOT_PATH . 'store/' . $archive_filename . $use_method); } else { - $compress = new compress_tar('w', $phpbb_root_path . 'store/' . $archive_filename . $use_method, $use_method); + $compress = new compress_tar('w', PHPBB_ROOT_PATH . 'store/' . $archive_filename . $use_method, $use_method); } } else @@ -965,7 +965,7 @@ class install_update extends module // New directory too? $dirname = dirname($file_struct['filename']); - if ($dirname && !file_exists($phpbb_root_path . $dirname)) + if ($dirname && !file_exists(PHPBB_ROOT_PATH . $dirname)) { $transfer->make_dir($dirname); } @@ -1013,7 +1013,7 @@ class install_update extends module $compress->close(); $compress->download($archive_filename, $download_filename); - @unlink($phpbb_root_path . 'store/' . $archive_filename . $use_method); + @unlink(PHPBB_ROOT_PATH . 'store/' . $archive_filename . $use_method); exit; } @@ -1038,7 +1038,7 @@ class install_update extends module */ function show_diff(&$update_list) { - global $phpbb_root_path, $template, $user; + global $template, $user; $this->tpl_name = 'install_update_diff'; @@ -1088,7 +1088,7 @@ class install_update extends module case MERGE_NO_MERGE_NEW: case MERGE_NO_MERGE_MOD: - $diff = $this->return_diff(array(), ($option == MERGE_NO_MERGE_NEW) ? $this->new_location . $original_file : $phpbb_root_path . $file); + $diff = $this->return_diff(array(), ($option == MERGE_NO_MERGE_NEW) ? $this->new_location . $original_file : PHPBB_ROOT_PATH . $file); $template->assign_var('S_DIFF_NEW_FILE', true); $diff_mode = 'inline'; @@ -1099,7 +1099,7 @@ class install_update extends module case MERGE_NEW_FILE: case MERGE_MOD_FILE: - $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $file, $this->new_location . $original_file); + $diff = $this->return_diff($this->old_location . $original_file, PHPBB_ROOT_PATH . $file, $this->new_location . $original_file); $tmp = array( 'file1' => array(), @@ -1118,14 +1118,14 @@ class install_update extends module default: - $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $file, $this->new_location . $original_file); + $diff = $this->return_diff($this->old_location . $original_file, PHPBB_ROOT_PATH . $file, $this->new_location . $original_file); $template->assign_vars(array( 'S_DIFF_CONFLICT_FILE' => true, 'NUM_CONFLICTS' => $diff->merged_output(false, false, false, true)) ); - $diff = $this->return_diff($phpbb_root_path . $file, $diff->merged_output()); + $diff = $this->return_diff(PHPBB_ROOT_PATH . $file, $diff->merged_output()); break; } @@ -1139,7 +1139,7 @@ class install_update extends module case MERGE_NO_MERGE_NEW: case MERGE_NO_MERGE_MOD: - $diff = $this->return_diff(array(), ($option == MERGE_NO_MERGE_NEW) ? $this->new_location . $original_file : $phpbb_root_path . $file); + $diff = $this->return_diff(array(), ($option == MERGE_NO_MERGE_NEW) ? $this->new_location . $original_file : PHPBB_ROOT_PATH . $file); $template->assign_var('S_DIFF_NEW_FILE', true); $diff_mode = 'inline'; @@ -1148,14 +1148,14 @@ class install_update extends module break; default: - $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $original_file, $this->new_location . $file); + $diff = $this->return_diff($this->old_location . $original_file, PHPBB_ROOT_PATH . $original_file, $this->new_location . $file); break; } break; case 'not_modified': case 'new_conflict': - $diff = $this->return_diff($phpbb_root_path . $file, $this->new_location . $original_file); + $diff = $this->return_diff(PHPBB_ROOT_PATH . $file, $this->new_location . $original_file); break; case 'new': @@ -1200,7 +1200,7 @@ class install_update extends module */ function get_update_structure(&$update_list) { - global $phpbb_root_path, $phpEx, $user; + global $user; if ($update_list === false) { @@ -1242,7 +1242,7 @@ class install_update extends module return; } - if (!file_exists($phpbb_root_path . $file)) + if (!file_exists(PHPBB_ROOT_PATH . $file)) { // Make sure the update files are consistent by checking if the file is in new_files... if (!file_exists($this->new_location . $file)) @@ -1259,7 +1259,7 @@ class install_update extends module /* Only include a new file as new if the underlying path exist // The path normally do not exist if the original style or language has been removed - if (file_exists($phpbb_root_path . dirname($file))) + if (file_exists(PHPBB_ROOT_PATH . dirname($file))) { $this->get_custom_info($update_list['new'], $file); $update_list['new'][] = array('filename' => $file, 'custom' => false); @@ -1273,7 +1273,7 @@ class install_update extends module } }*/ - if (file_exists($phpbb_root_path . dirname($file)) || (strpos($file, 'styles/') !== 0 && strpos($file, 'language/') !== 0)) + if (file_exists(PHPBB_ROOT_PATH . dirname($file)) || (strpos($file, 'styles/') !== 0 && strpos($file, 'language/') !== 0)) { $this->get_custom_info($update_list['new'], $file); $update_list['new'][] = array('filename' => $file, 'custom' => false); @@ -1327,7 +1327,7 @@ class install_update extends module */ function make_update_diff(&$update_list, $original_file, $file, $custom = false) { - global $phpbb_root_path, $user; + global $user; $update_ary = array('filename' => $file, 'custom' => $custom); @@ -1338,11 +1338,11 @@ class install_update extends module // On a successfull update the new location file exists but the old one does not exist. // Check for this circumstance, the new file need to be up-to-date with the current file then... - if (!file_exists($this->old_location . $original_file) && file_exists($this->new_location . $original_file) && file_exists($phpbb_root_path . $file)) + if (!file_exists($this->old_location . $original_file) && file_exists($this->new_location . $original_file) && file_exists(PHPBB_ROOT_PATH . $file)) { $tmp = array( 'file1' => file_get_contents($this->new_location . $original_file), - 'file2' => file_get_contents($phpbb_root_path . $file), + 'file2' => file_get_contents(PHPBB_ROOT_PATH . $file), ); // We need to diff the contents here to make sure the file is really the one we expect @@ -1377,7 +1377,7 @@ class install_update extends module $tmp = array( 'file1' => file_get_contents($this->old_location . $original_file), - 'file2' => file_get_contents($phpbb_root_path . $file), + 'file2' => file_get_contents(PHPBB_ROOT_PATH . $file), ); // We need to diff the contents here to make sure the file is really the one we expect @@ -1388,7 +1388,7 @@ class install_update extends module $tmp = array( 'file1' => file_get_contents($this->new_location . $original_file), - 'file2' => file_get_contents($phpbb_root_path . $file), + 'file2' => file_get_contents(PHPBB_ROOT_PATH . $file), ); // We need to diff the contents here to make sure the file is really the one we expect @@ -1424,7 +1424,7 @@ class install_update extends module // if the file is modified we try to make sure a merge succeed $tmp = array( 'file1' => file_get_contents($this->old_location . $original_file), - 'file2' => file_get_contents($phpbb_root_path . $file), + 'file2' => file_get_contents(PHPBB_ROOT_PATH . $file), 'file3' => file_get_contents($this->new_location . $original_file), ); @@ -1438,7 +1438,7 @@ class install_update extends module // There is one special case... users having merged with a conflicting file... we need to check this $tmp = array( - 'file1' => file_get_contents($phpbb_root_path . $file), + 'file1' => file_get_contents(PHPBB_ROOT_PATH . $file), 'file2' => implode("\n", $diff->merged_orig_output()), ); @@ -1460,7 +1460,7 @@ class install_update extends module } $tmp = array( - 'file1' => file_get_contents($phpbb_root_path . $file), + 'file1' => file_get_contents(PHPBB_ROOT_PATH . $file), 'file2' => implode("\n", $diff->merged_output()), ); @@ -1512,7 +1512,6 @@ class install_update extends module switch ($mode) { case 'version_info': - global $phpbb_root_path, $phpEx; $info = get_remote_file('www.phpbb.com', '/updatecheck', ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno); if ($info !== false) @@ -1530,7 +1529,7 @@ class install_update extends module if ($info === false) { $update_info = array(); - include($phpbb_root_path . 'install/update/index.php'); + include(PHPBB_ROOT_PATH . 'install/update/index.php'); $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info; if ($info !== false) @@ -1541,10 +1540,8 @@ class install_update extends module break; case 'update_info': - global $phpbb_root_path, $phpEx; - $update_info = array(); - include($phpbb_root_path . 'install/update/index.php'); + include(PHPBB_ROOT_PATH . 'install/update/index.php'); $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info; $errstr = ($info === false) ? $user->lang['WRONG_INFO_FILE_FORMAT'] : ''; @@ -1603,15 +1600,13 @@ class install_update extends module */ function include_file($filename) { - global $phpbb_root_path, $phpEx; - if (!empty($this->update_info['files']) && in_array($filename, $this->update_info['files'])) { include_once($this->new_location . $filename); } else { - include_once($phpbb_root_path . $filename); + include_once(PHPBB_ROOT_PATH . $filename); } } |