aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/auth/provider/oauth/oauth.php21
-rw-r--r--phpBB/phpbb/auth/provider/oauth/token_storage.php232
-rw-r--r--phpBB/phpbb/avatar/driver/driver.php16
-rw-r--r--phpBB/phpbb/avatar/driver/driver_interface.php14
-rw-r--r--phpBB/phpbb/avatar/manager.php16
-rw-r--r--phpBB/phpbb/captcha/gd.php5
-rw-r--r--phpBB/phpbb/captcha/gd_wave.php5
-rw-r--r--phpBB/phpbb/captcha/plugins/captcha_abstract.php10
-rw-r--r--phpBB/phpbb/captcha/plugins/gd.php11
-rw-r--r--phpBB/phpbb/captcha/plugins/gd_wave.php2
-rw-r--r--phpBB/phpbb/composer.json7
-rw-r--r--phpBB/phpbb/db/driver/driver.php2
-rw-r--r--phpBB/phpbb/db/driver/oracle.php2
-rw-r--r--phpBB/phpbb/db/extractor/oracle_extractor.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/increase_size_of_dateformat.php35
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/update_custom_bbcodes_with_idn.php1
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/v317.php31
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/v317pl1.php31
-rw-r--r--phpBB/phpbb/db/migration/data/v320/oauth_states.php56
-rw-r--r--phpBB/phpbb/db/migration/data/v320/v320a2.php38
-rw-r--r--phpBB/phpbb/db/migrator.php2
-rw-r--r--phpBB/phpbb/db/tools/tools.php2
-rw-r--r--phpBB/phpbb/debug/debug.php80
-rw-r--r--phpBB/phpbb/debug/error_handler.php31
-rw-r--r--phpBB/phpbb/di/container_builder.php36
-rw-r--r--phpBB/phpbb/file_downloader.php2
-rw-r--r--phpBB/phpbb/files/types/remote.php4
-rw-r--r--phpBB/phpbb/install/console/command/install/config/validate.php2
-rw-r--r--phpBB/phpbb/install/controller/helper.php6
-rw-r--r--phpBB/phpbb/install/controller/install.php1
-rw-r--r--phpBB/phpbb/install/helper/iohandler/iohandler_base.php2
-rw-r--r--phpBB/phpbb/log/log.php2
-rw-r--r--phpBB/phpbb/report/report_handler_post.php2
-rw-r--r--phpBB/phpbb/request/type_cast_helper.php1
-rw-r--r--phpBB/phpbb/search/fulltext_native.php7
-rw-r--r--phpBB/phpbb/search/fulltext_postgres.php4
-rw-r--r--phpBB/phpbb/search/fulltext_sphinx.php7
-rw-r--r--phpBB/phpbb/session.php16
-rw-r--r--phpBB/phpbb/template/twig/node/includejs.php2
-rw-r--r--phpBB/phpbb/textformatter/s9e/factory.php2
-rw-r--r--phpBB/phpbb/textformatter/s9e/parser.php3
-rw-r--r--phpBB/phpbb/textformatter/s9e/renderer.php1
-rw-r--r--phpBB/phpbb/tree/nestedset.php2
-rw-r--r--phpBB/phpbb/user.php2
-rw-r--r--phpBB/phpbb/version_helper.php13
46 files changed, 662 insertions, 109 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php
index be0fbf5831..bfeac2dd32 100644
--- a/phpBB/phpbb/auth/provider/oauth/oauth.php
+++ b/phpBB/phpbb/auth/provider/oauth/oauth.php
@@ -63,6 +63,13 @@ class oauth extends \phpbb\auth\provider\base
protected $auth_provider_oauth_token_storage_table;
/**
+ * OAuth state table
+ *
+ * @var string
+ */
+ protected $auth_provider_oauth_state_table;
+
+ /**
* OAuth account association table
*
* @var string
@@ -120,6 +127,7 @@ class oauth extends \phpbb\auth\provider\base
* @param \phpbb\request\request_interface $request
* @param \phpbb\user $user
* @param string $auth_provider_oauth_token_storage_table
+ * @param string $auth_provider_oauth_state_table
* @param string $auth_provider_oauth_token_account_assoc
* @param \phpbb\di\service_collection $service_providers Contains \phpbb\auth\provider\oauth\service_interface
* @param string $users_table
@@ -127,7 +135,7 @@ class oauth extends \phpbb\auth\provider\base
* @param string $phpbb_root_path
* @param string $php_ext
*/
- public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, $phpbb_root_path, $php_ext)
+ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_state_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, $phpbb_root_path, $php_ext)
{
$this->db = $db;
$this->config = $config;
@@ -135,6 +143,7 @@ class oauth extends \phpbb\auth\provider\base
$this->request = $request;
$this->user = $user;
$this->auth_provider_oauth_token_storage_table = $auth_provider_oauth_token_storage_table;
+ $this->auth_provider_oauth_state_table = $auth_provider_oauth_state_table;
$this->auth_provider_oauth_token_account_assoc = $auth_provider_oauth_token_account_assoc;
$this->service_providers = $service_providers;
$this->users_table = $users_table;
@@ -188,7 +197,7 @@ class oauth extends \phpbb\auth\provider\base
// Get the service credentials for the given service
$service_credentials = $this->service_providers[$service_name]->get_service_credentials();
- $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
+ $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table);
$query = 'mode=login&login=external&oauth_service=' . $service_name_original;
$service = $this->get_service($service_name_original, $storage, $service_credentials, $query, $this->service_providers[$service_name]->get_auth_scope());
@@ -456,7 +465,7 @@ class oauth extends \phpbb\auth\provider\base
*/
protected function link_account_login_link(array $link_data, $service_name)
{
- $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
+ $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table);
// Check for an access token, they should have one
if (!$storage->has_access_token_by_session($service_name))
@@ -499,7 +508,7 @@ class oauth extends \phpbb\auth\provider\base
*/
protected function link_account_auth_link(array $link_data, $service_name)
{
- $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
+ $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table);
$query = 'i=ucp_auth_link&mode=auth_link&link=1&oauth_service=' . strtolower($link_data['oauth_service']);
$service_credentials = $this->service_providers[$service_name]->get_service_credentials();
$scopes = $this->service_providers[$service_name]->get_auth_scope();
@@ -544,7 +553,7 @@ class oauth extends \phpbb\auth\provider\base
public function logout($data, $new_session)
{
// Clear all tokens belonging to the user
- $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
+ $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table);
$storage->clearAllTokens();
return;
@@ -627,7 +636,7 @@ class oauth extends \phpbb\auth\provider\base
// Clear all tokens belonging to the user on this servce
$service_name = 'auth.provider.oauth.service.' . strtolower($link_data['oauth_service']);
- $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
+ $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table);
$storage->clearToken($service_name);
}
}
diff --git a/phpBB/phpbb/auth/provider/oauth/token_storage.php b/phpBB/phpbb/auth/provider/oauth/token_storage.php
index 9b6afae255..e922342ef6 100644
--- a/phpBB/phpbb/auth/provider/oauth/token_storage.php
+++ b/phpBB/phpbb/auth/provider/oauth/token_storage.php
@@ -17,6 +17,7 @@ use OAuth\OAuth1\Token\StdOAuth1Token;
use OAuth\Common\Token\TokenInterface;
use OAuth\Common\Storage\TokenStorageInterface;
use OAuth\Common\Storage\Exception\TokenNotFoundException;
+use OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException;
/**
* OAuth storage wrapper for phpbb's cache
@@ -42,7 +43,14 @@ class token_storage implements TokenStorageInterface
*
* @var string
*/
- protected $auth_provider_oauth_table;
+ protected $oauth_token_table;
+
+ /**
+ * OAuth state table
+ *
+ * @var string
+ */
+ protected $oauth_state_table;
/**
* @var object|TokenInterface
@@ -50,17 +58,24 @@ class token_storage implements TokenStorageInterface
protected $cachedToken;
/**
+ * @var string
+ */
+ protected $cachedState;
+
+ /**
* Creates token storage for phpBB.
*
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\user $user
- * @param string $auth_provider_oauth_table
+ * @param string $oauth_token_table
+ * @param string $oauth_state_table
*/
- public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $auth_provider_oauth_table)
+ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $oauth_token_table, $oauth_state_table)
{
$this->db = $db;
$this->user = $user;
- $this->auth_provider_oauth_table = $auth_provider_oauth_table;
+ $this->oauth_token_table = $oauth_token_table;
+ $this->oauth_state_table = $oauth_state_table;
}
/**
@@ -104,9 +119,11 @@ class token_storage implements TokenStorageInterface
'session_id' => $this->user->data['session_id'],
);
- $sql = 'INSERT INTO ' . $this->auth_provider_oauth_table . '
+ $sql = 'INSERT INTO ' . $this->oauth_token_table . '
' . $this->db->sql_build_array('INSERT', $data);
$this->db->sql_query($sql);
+
+ return $this;
}
/**
@@ -143,7 +160,7 @@ class token_storage implements TokenStorageInterface
$this->cachedToken = null;
- $sql = 'DELETE FROM ' . $this->auth_provider_oauth_table . '
+ $sql = 'DELETE FROM ' . $this->oauth_token_table . '
WHERE user_id = ' . (int) $this->user->data['user_id'] . "
AND provider = '" . $this->db->sql_escape($service) . "'";
@@ -153,6 +170,8 @@ class token_storage implements TokenStorageInterface
}
$this->db->sql_query($sql);
+
+ return $this;
}
/**
@@ -162,7 +181,123 @@ class token_storage implements TokenStorageInterface
{
$this->cachedToken = null;
- $sql = 'DELETE FROM ' . $this->auth_provider_oauth_table . '
+ $sql = 'DELETE FROM ' . $this->oauth_token_table . '
+ WHERE user_id = ' . (int) $this->user->data['user_id'];
+
+ if ((int) $this->user->data['user_id'] === ANONYMOUS)
+ {
+ $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'";
+ }
+
+ $this->db->sql_query($sql);
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function storeAuthorizationState($service, $state)
+ {
+ $service = $this->get_service_name_for_db($service);
+
+ $this->cachedState = $state;
+
+ $data = array(
+ 'user_id' => (int) $this->user->data['user_id'],
+ 'provider' => $service,
+ 'oauth_state' => $state,
+ 'session_id' => $this->user->data['session_id'],
+ );
+
+ $sql = 'INSERT INTO ' . $this->oauth_state_table . '
+ ' . $this->db->sql_build_array('INSERT', $data);
+ $this->db->sql_query($sql);
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function hasAuthorizationState($service)
+ {
+ $service = $this->get_service_name_for_db($service);
+
+ if ($this->cachedState)
+ {
+ return true;
+ }
+
+ $data = array(
+ 'user_id' => (int) $this->user->data['user_id'],
+ 'provider' => $service,
+ );
+
+ if ((int) $this->user->data['user_id'] === ANONYMOUS)
+ {
+ $data['session_id'] = $this->user->data['session_id'];
+ }
+
+ return (bool) $this->get_state_row($data);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function retrieveAuthorizationState($service)
+ {
+ $service = $this->get_service_name_for_db($service);
+
+ if ($this->cachedState)
+ {
+ return $this->cachedState;
+ }
+
+ $data = array(
+ 'user_id' => (int) $this->user->data['user_id'],
+ 'provider' => $service,
+ );
+
+ if ((int) $this->user->data['user_id'] === ANONYMOUS)
+ {
+ $data['session_id'] = $this->user->data['session_id'];
+ }
+
+ return $this->get_state_row($data);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function clearAuthorizationState($service)
+ {
+ $service = $this->get_service_name_for_db($service);
+
+ $this->cachedState = null;
+
+ $sql = 'DELETE FROM ' . $this->oauth_state_table . '
+ WHERE user_id = ' . (int) $this->user->data['user_id'] . "
+ AND provider = '" . $this->db->sql_escape($service) . "'";
+
+ if ((int) $this->user->data['user_id'] === ANONYMOUS)
+ {
+ $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'";
+ }
+
+ $this->db->sql_query($sql);
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function clearAllAuthorizationStates()
+ {
+ $this->cachedState = null;
+
+ $sql = 'DELETE FROM ' . $this->oauth_state_table . '
WHERE user_id = ' . (int) $this->user->data['user_id'];
if ((int) $this->user->data['user_id'] === ANONYMOUS)
@@ -171,6 +306,8 @@ class token_storage implements TokenStorageInterface
}
$this->db->sql_query($sql);
+
+ return $this;
}
/**
@@ -185,7 +322,7 @@ class token_storage implements TokenStorageInterface
return;
}
- $sql = 'UPDATE ' . $this->auth_provider_oauth_table . '
+ $sql = 'UPDATE ' . $this->oauth_token_table . '
SET ' . $this->db->sql_build_array('UPDATE', array(
'user_id' => (int) $user_id
)) . '
@@ -218,6 +355,29 @@ class token_storage implements TokenStorageInterface
}
/**
+ * Checks to see if a state exists solely by the session_id of the user
+ *
+ * @param string $service The name of the OAuth service
+ * @return bool true if they have state, false if they don't
+ */
+ public function has_state_by_session($service)
+ {
+ $service = $this->get_service_name_for_db($service);
+
+ if ($this->cachedState)
+ {
+ return true;
+ }
+
+ $data = array(
+ 'session_id' => $this->user->data['session_id'],
+ 'provider' => $service,
+ );
+
+ return (bool) $this->get_state_row($data);
+ }
+
+ /**
* A helper function that performs the query for has access token functions
*
* @param array $data
@@ -245,6 +405,23 @@ class token_storage implements TokenStorageInterface
return $this->_retrieve_access_token($data);
}
+ public function retrieve_state_by_session($service)
+ {
+ $service = $this->get_service_name_for_db($service);
+
+ if ($this->cachedState)
+ {
+ return $this->cachedState;
+ }
+
+ $data = array(
+ 'session_id' => $this->user->data['session_id'],
+ 'provider' => $service,
+ );
+
+ return $this->_retrieve_state($data);
+ }
+
/**
* A helper function that performs the query for retrieve access token functions
* Also checks if the token is a valid token
@@ -276,6 +453,26 @@ class token_storage implements TokenStorageInterface
}
/**
+ * A helper function that performs the query for retrieve state functions
+ *
+ * @param array $data
+ * @return mixed
+ * @throws \OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException
+ */
+ protected function _retrieve_state($data)
+ {
+ $row = $this->get_state_row($data);
+
+ if (!$row)
+ {
+ throw new AuthorizationStateNotFoundException();
+ }
+
+ $this->cachedState = $row['oauth_state'];
+ return $this->cachedState;
+ }
+
+ /**
* A helper function that performs the query for retrieving an access token
*
* @param array $data
@@ -283,7 +480,24 @@ class token_storage implements TokenStorageInterface
*/
protected function get_access_token_row($data)
{
- $sql = 'SELECT oauth_token FROM ' . $this->auth_provider_oauth_table . '
+ $sql = 'SELECT oauth_token FROM ' . $this->oauth_token_table . '
+ WHERE ' . $this->db->sql_build_array('SELECT', $data);
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ return $row;
+ }
+
+ /**
+ * A helper function that performs the query for retrieving a state
+ *
+ * @param array $data
+ * @return mixed
+ */
+ protected function get_state_row($data)
+ {
+ $sql = 'SELECT oauth_state FROM ' . $this->oauth_state_table . '
WHERE ' . $this->db->sql_build_array('SELECT', $data);
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php
index c849533166..45681f3e59 100644
--- a/phpBB/phpbb/avatar/driver/driver.php
+++ b/phpBB/phpbb/avatar/driver/driver.php
@@ -125,6 +125,22 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface
}
/**
+ * {@inheritdoc}
+ */
+ public function get_config_name()
+ {
+ return preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($this));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_acp_template_name()
+ {
+ return 'acp_avatar_options_' . $this->get_config_name() . '.html';
+ }
+
+ /**
* Sets the name of the driver.
*
* @param string $name Driver name
diff --git a/phpBB/phpbb/avatar/driver/driver_interface.php b/phpBB/phpbb/avatar/driver/driver_interface.php
index 835609745a..7d6c2cff8a 100644
--- a/phpBB/phpbb/avatar/driver/driver_interface.php
+++ b/phpBB/phpbb/avatar/driver/driver_interface.php
@@ -26,6 +26,13 @@ interface driver_interface
public function get_name();
/**
+ * Returns the config name of the driver. To be used in accessing the CONFIG variables.
+ *
+ * @return string Config name of driver.
+ */
+ public function get_config_name();
+
+ /**
* Get the avatar url and dimensions
*
* @param array $row User data or group data that has been cleaned with
@@ -110,4 +117,11 @@ interface driver_interface
* @return string Avatar driver's template name
*/
public function get_template_name();
+
+ /**
+ * Get the avatar driver's template name (ACP)
+ *
+ * @return string Avatar driver's template name
+ */
+ public function get_acp_template_name();
}
diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php
index 8d83152ed6..26eb17c265 100644
--- a/phpBB/phpbb/avatar/manager.php
+++ b/phpBB/phpbb/avatar/manager.php
@@ -246,7 +246,7 @@ class manager
*/
public function is_enabled($driver)
{
- $config_name = $this->get_driver_config_name($driver);
+ $config_name = $driver->get_config_name();
return $this->config["allow_avatar_{$config_name}"];
}
@@ -260,7 +260,7 @@ class manager
*/
public function get_avatar_settings($driver)
{
- $config_name = $this->get_driver_config_name($driver);
+ $config_name = $driver->get_config_name();
return array(
'allow_avatar_' . $config_name => array('lang' => 'ALLOW_' . strtoupper(str_replace('\\', '_', $config_name)), 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
@@ -268,18 +268,6 @@ class manager
}
/**
- * Get the config name of an avatar driver
- *
- * @param object $driver Avatar driver object
- *
- * @return string Avatar driver config name
- */
- public function get_driver_config_name($driver)
- {
- return preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($driver));
- }
-
- /**
* Replace "error" strings with their real, localized form
*
* @param \phpbb\user phpBB User object
diff --git a/phpBB/phpbb/captcha/gd.php b/phpBB/phpbb/captcha/gd.php
index 652df28f8a..e9538439c6 100644
--- a/phpBB/phpbb/captcha/gd.php
+++ b/phpBB/phpbb/captcha/gd.php
@@ -97,13 +97,12 @@ class gd
if ($config['captcha_gd_3d_noise'])
{
- $xoffset = mt_rand(0,9);
$noise_bitmaps = $this->captcha_noise_bg_bitmaps();
for ($i = 0; $i < $code_len; ++$i)
{
$noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, sizeof($noise_bitmaps['data'])));
- list($min, $max) = $noise[$i]->range();
+ $noise[$i]->range();
//$box = $noise[$i]->dimensions($sizes[$i]);
}
$xoffset = 0;
@@ -151,8 +150,6 @@ class gd
*/
function wave($img)
{
- global $config;
-
$period_x = mt_rand(12,18);
$period_y = mt_rand(7,14);
$amp_x = mt_rand(5,10);
diff --git a/phpBB/phpbb/captcha/gd_wave.php b/phpBB/phpbb/captcha/gd_wave.php
index d48fc753a5..f2ec4137d2 100644
--- a/phpBB/phpbb/captcha/gd_wave.php
+++ b/phpBB/phpbb/captcha/gd_wave.php
@@ -23,8 +23,6 @@ class gd_wave
function execute($code, $seed)
{
- global $starttime;
-
// seed the random generator
mt_srand($seed);
@@ -77,7 +75,6 @@ class gd_wave
// TODO
$background = imagecolorallocate($img, mt_rand(155, 255), mt_rand(155, 255), mt_rand(155, 255));
imagefill($img, 0, 0, $background);
- $black = imagecolorallocate($img, 0, 0, 0);
$random = array();
$fontcolors = array();
@@ -155,7 +152,7 @@ class gd_wave
// rather than recalculating from absolute coordinates
// What we cache into the $img_buffer contains the raised text coordinates.
$img_pos_prev = $img_buffer[0][0] = array($box['upper_left']['x'], $box['upper_left']['y']);
- $cur_height = $prev_height = $this->wave_height(0, 0, $subdivision_factor);
+ $prev_height = $this->wave_height(0, 0, $subdivision_factor);
$full_x = $plane_x * $subdivision_factor;
$full_y = $plane_y * $subdivision_factor;
diff --git a/phpBB/phpbb/captcha/plugins/captcha_abstract.php b/phpBB/phpbb/captcha/plugins/captcha_abstract.php
index b29f144f97..82b08704ff 100644
--- a/phpBB/phpbb/captcha/plugins/captcha_abstract.php
+++ b/phpBB/phpbb/captcha/plugins/captcha_abstract.php
@@ -34,7 +34,7 @@ abstract class captcha_abstract
function init($type)
{
- global $config, $db, $user, $request;
+ global $config, $request;
// read input
$this->confirm_id = $request->variable('confirm_id', '');
@@ -56,8 +56,6 @@ abstract class captcha_abstract
function execute_demo()
{
- global $user;
-
$this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
$this->seed = hexdec(substr(unique_id(), 4, 10));
@@ -117,7 +115,7 @@ abstract class captcha_abstract
function get_demo_template($id)
{
- global $config, $user, $template, $request, $phpbb_admin_path, $phpEx;
+ global $config, $template, $request, $phpbb_admin_path, $phpEx;
$variables = '';
@@ -153,7 +151,7 @@ abstract class captcha_abstract
function garbage_collect($type)
{
- global $db, $config;
+ global $db;
$sql = 'SELECT DISTINCT c.session_id
FROM ' . CONFIRM_TABLE . ' c
@@ -193,7 +191,7 @@ abstract class captcha_abstract
function validate()
{
- global $config, $db, $user;
+ global $user;
if (!$user->is_setup())
{
diff --git a/phpBB/phpbb/captcha/plugins/gd.php b/phpBB/phpbb/captcha/plugins/gd.php
index 1727dcc1bb..831e5bcfdf 100644
--- a/phpBB/phpbb/captcha/plugins/gd.php
+++ b/phpBB/phpbb/captcha/plugins/gd.php
@@ -53,18 +53,11 @@ class gd extends captcha_abstract
function acp_page($id, &$module)
{
- global $db, $user, $auth, $template, $phpbb_log, $request;
- global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
+ global $user, $template, $phpbb_log, $request;
+ global $config;
$user->add_lang('acp/board');
- $config_vars = array(
- 'enable_confirm' => 'REG_ENABLE',
- 'enable_post_confirm' => 'POST_ENABLE',
- 'confirm_refresh' => 'CONFIRM_REFRESH',
- 'captcha_gd' => 'CAPTCHA_GD',
- );
-
$module->tpl_name = 'captcha_gd_acp';
$module->page_title = 'ACP_VC_SETTINGS';
$form_key = 'acp_captcha';
diff --git a/phpBB/phpbb/captcha/plugins/gd_wave.php b/phpBB/phpbb/captcha/plugins/gd_wave.php
index e1d44df778..bde46f8815 100644
--- a/phpBB/phpbb/captcha/plugins/gd_wave.php
+++ b/phpBB/phpbb/captcha/plugins/gd_wave.php
@@ -35,7 +35,7 @@ class gd_wave extends captcha_abstract
function acp_page($id, &$module)
{
- global $config, $db, $template, $user;
+ global $user;
trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action));
}
diff --git a/phpBB/phpbb/composer.json b/phpBB/phpbb/composer.json
index 8241091dc1..758125234f 100644
--- a/phpBB/phpbb/composer.json
+++ b/phpBB/phpbb/composer.json
@@ -23,5 +23,10 @@
},
"require": {
"php": ">=5.4"
- }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2.x-dev"
+ }
+ }
}
diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php
index 5f06cb08fc..30cb667344 100644
--- a/phpBB/phpbb/db/driver/driver.php
+++ b/phpBB/phpbb/db/driver/driver.php
@@ -1012,7 +1012,7 @@ abstract class driver implements driver_interface
*/
function sql_report($mode, $query = '')
{
- global $cache, $starttime, $phpbb_root_path, $phpbb_path_helper, $user;
+ global $cache, $starttime, $phpbb_root_path, $phpbb_path_helper;
global $request;
if (is_object($request) && !$request->variable('explain', false))
diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php
index 89e1b68aac..54238a15ef 100644
--- a/phpBB/phpbb/db/driver/oracle.php
+++ b/phpBB/phpbb/db/driver/oracle.php
@@ -84,8 +84,6 @@ class oracle extends \phpbb\db\driver\driver
* but I assume its because the Oracle extension provides a direct method to access it
* without a query.
*/
-
- $use_cache = false;
/*
global $cache;
diff --git a/phpBB/phpbb/db/extractor/oracle_extractor.php b/phpBB/phpbb/db/extractor/oracle_extractor.php
index 05f7b8ac95..79a991889b 100644
--- a/phpBB/phpbb/db/extractor/oracle_extractor.php
+++ b/phpBB/phpbb/db/extractor/oracle_extractor.php
@@ -192,8 +192,6 @@ class oracle_extractor extends base_extractor
$ary_name[$i] = ocicolumnname($result, $i + 1);
}
- $sql_data = '';
-
while ($row = $this->db->sql_fetchrow($result))
{
$schema_vals = $schema_fields = array();
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php
index 9f6e3efb91..084d00a13a 100644
--- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php
@@ -118,7 +118,7 @@ class release_3_0_5_rc1 extends container_aware_migration
$result = $this->db->sql_query($sql);
// Skip first row, this is our original auth option we want to preserve
- $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_fetchrow($result);
while ($row = $this->db->sql_fetchrow($result))
{
diff --git a/phpBB/phpbb/db/migration/data/v31x/increase_size_of_dateformat.php b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_dateformat.php
new file mode 100644
index 0000000000..bdf83f3d62
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_dateformat.php
@@ -0,0 +1,35 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v31x;
+
+class increase_size_of_dateformat extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\v317',
+ );
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'change_columns' => array(
+ $this->table_prefix . 'users' => array(
+ 'user_dateformat' => array('VCHAR_UNI:64', 'd M Y H:i'),
+ ),
+ ),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v31x/update_custom_bbcodes_with_idn.php b/phpBB/phpbb/db/migration/data/v31x/update_custom_bbcodes_with_idn.php
index 854ed1f568..14b7b7b0f6 100644
--- a/phpBB/phpbb/db/migration/data/v31x/update_custom_bbcodes_with_idn.php
+++ b/phpBB/phpbb/db/migration/data/v31x/update_custom_bbcodes_with_idn.php
@@ -45,7 +45,6 @@ class update_custom_bbcodes_with_idn extends \phpbb\db\migration\migration
$sql_ary = array();
while ($row = $this->db->sql_fetchrow($result))
{
- $data = array();
if (preg_match('/(URL|LOCAL_URL|RELATIVE_URL)/', $row['bbcode_match']))
{
$data = $bbcodes->build_regexp($row['bbcode_match'], $row['bbcode_tpl']);
diff --git a/phpBB/phpbb/db/migration/data/v31x/v317.php b/phpBB/phpbb/db/migration/data/v31x/v317.php
new file mode 100644
index 0000000000..15ba2a1feb
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/v317.php
@@ -0,0 +1,31 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v31x;
+
+class v317 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\v317rc1',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.7')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v31x/v317pl1.php b/phpBB/phpbb/db/migration/data/v31x/v317pl1.php
new file mode 100644
index 0000000000..2e1b0e9b9d
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/v317pl1.php
@@ -0,0 +1,31 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v31x;
+
+class v317pl1 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\v317',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.7-pl1')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v320/oauth_states.php b/phpBB/phpbb/db/migration/data/v320/oauth_states.php
new file mode 100644
index 0000000000..22ab2dabb3
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/oauth_states.php
@@ -0,0 +1,56 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v320;
+
+class oauth_states extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v310\auth_provider_oauth');
+ }
+
+ public function effectively_installed()
+ {
+ return $this->db_tools->sql_table_exists($this->table_prefix . 'oauth_states');
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'add_tables' => array(
+ $this->table_prefix . 'oauth_states' => array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0),
+ 'session_id' => array('CHAR:32', ''),
+ 'provider' => array('VCHAR', ''),
+ 'oauth_state' => array('VCHAR', ''),
+ ),
+ 'KEYS' => array(
+ 'user_id' => array('INDEX', 'user_id'),
+ 'provider' => array('INDEX', 'provider'),
+ ),
+ ),
+ ),
+ );
+ }
+
+ public function revert_schema()
+ {
+ return array(
+ 'drop_tables' => array(
+ $this->table_prefix . 'oauth_states',
+ ),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v320/v320a2.php b/phpBB/phpbb/db/migration/data/v320/v320a2.php
new file mode 100644
index 0000000000..ae53a73210
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/v320a2.php
@@ -0,0 +1,38 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v320;
+
+class v320a2 extends \phpbb\db\migration\container_aware_migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.2.0-a2', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\v317rc1',
+ '\phpbb\db\migration\data\v320\text_reparser',
+ '\phpbb\db\migration\data\v320\v320a1',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.2.0-a2')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index a809bc14f9..d91860949a 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -535,7 +535,7 @@ class migrator
}
// Reverse the step that was run
- $result = $this->run_step($reverse_step, false, !$revert);
+ $this->run_step($reverse_step, false, !$revert);
}
// rethrow the exception
diff --git a/phpBB/phpbb/db/tools/tools.php b/phpBB/phpbb/db/tools/tools.php
index 1d7b2ddfff..f06871a1d7 100644
--- a/phpBB/phpbb/db/tools/tools.php
+++ b/phpBB/phpbb/db/tools/tools.php
@@ -1116,7 +1116,7 @@ class tools implements tools_interface
}
// Get type
- list($column_type, $orig_column_type) = $this->get_column_type($column_data[0]);
+ list($column_type) = $this->get_column_type($column_data[0]);
// Adjust default value if db-dependent specified
if (is_array($column_data[1]))
diff --git a/phpBB/phpbb/debug/debug.php b/phpBB/phpbb/debug/debug.php
new file mode 100644
index 0000000000..c5ffada2e5
--- /dev/null
+++ b/phpBB/phpbb/debug/debug.php
@@ -0,0 +1,80 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\debug;
+
+use Symfony\Component\Debug\BufferingLogger;
+use Symfony\Component\Debug\DebugClassLoader;
+use Symfony\Component\Debug\ExceptionHandler;
+
+/**
+ * Registers all the debug tools.
+
+ * @see Symfony\Component\Debug\Debug
+ */
+class debug
+{
+ private static $enabled = false;
+
+ /**
+ * Enables the debug tools.
+ *
+ * This method registers an error handler and an exception handler.
+ *
+ * If the Symfony ClassLoader component is available, a special
+ * class loader is also registered.
+ *
+ * @param int $errorReportingLevel The level of error reporting you want
+ * @param bool $displayErrors Whether to display errors (for development) or just log them (for production)
+ */
+ public static function enable($errorReportingLevel = null, $displayErrors = true)
+ {
+ if (static::$enabled)
+ {
+ return;
+ }
+
+ static::$enabled = true;
+
+ if ($errorReportingLevel !== null)
+ {
+ error_reporting($errorReportingLevel);
+ }
+ else
+ {
+ error_reporting(-1);
+ }
+
+ if ('cli' !== php_sapi_name())
+ {
+ ini_set('display_errors', 0);
+ ExceptionHandler::register();
+ }
+ else if ($displayErrors && (!ini_get('log_errors') || ini_get('error_log')))
+ {
+ // CLI - display errors only if they're not already logged to STDERR
+ ini_set('display_errors', 1);
+ }
+
+ if ($displayErrors)
+ {
+ error_handler::register(new error_handler(new BufferingLogger()));
+ }
+ else
+ {
+ error_handler::register()->throwAt(0, true);
+ }
+
+ DebugClassLoader::enable();
+ }
+}
diff --git a/phpBB/phpbb/debug/error_handler.php b/phpBB/phpbb/debug/error_handler.php
new file mode 100644
index 0000000000..246e724f56
--- /dev/null
+++ b/phpBB/phpbb/debug/error_handler.php
@@ -0,0 +1,31 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\debug;
+
+use Symfony\Component\Debug\ErrorHandler;
+
+class error_handler extends ErrorHandler
+{
+ public function handleError($type, $message, $file, $line, array $context, array $backtrace = null)
+ {
+ if ($type === E_USER_WARNING || $type === E_USER_NOTICE)
+ {
+ $handler = defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler';
+
+ $handler($type, $message, $file, $line);
+ }
+
+ return parent::handleError($type, $message, $file, $line, $context, $backtrace);
+ }
+}
diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php
index 0a94aac98d..8f175c966c 100644
--- a/phpBB/phpbb/di/container_builder.php
+++ b/phpBB/phpbb/di/container_builder.php
@@ -22,6 +22,7 @@ use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
use Symfony\Component\Filesystem\Exception\IOException;
+use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
class container_builder
@@ -158,6 +159,11 @@ class container_builder
// Event listeners "Symfony style"
$this->container->addCompilerPass(new RegisterListenersPass('dispatcher'));
+ if ($this->use_extensions)
+ {
+ $this->register_ext_compiler_pass();
+ }
+
$filesystem = new filesystem();
$loader = new YamlFileLoader($this->container, new FileLocator($filesystem->realpath($this->get_config_path())));
$loader->load($this->container->getParameter('core.environment') . '/config.yml');
@@ -512,4 +518,34 @@ class container_builder
{
return $this->environment ?: PHPBB_ENVIRONMENT;
}
+
+ private function register_ext_compiler_pass()
+ {
+ $finder = new Finder();
+ $finder
+ ->name('*_pass.php')
+ ->path('di/pass')
+ ->files()
+ ->ignoreDotFiles(true)
+ ->ignoreUnreadableDirs(true)
+ ->ignoreVCS(true)
+ ->followLinks()
+ ->in($this->phpbb_root_path . 'ext/')
+ ;
+
+ /** @var \SplFileInfo $pass */
+ foreach ($finder as $pass)
+ {
+ $filename = $pass->getPathname();
+ $filename = substr($filename, 0, -strlen('.' . $pass->getExtension()));
+ $filename = str_replace(DIRECTORY_SEPARATOR, '/', $filename);
+ $className = preg_replace('#^.*ext/#', '', $filename);
+ $className = '\\' . str_replace('/', '\\', $className);
+
+ if (class_exists($className) && in_array('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface', class_implements($className), true))
+ {
+ $this->container->addCompilerPass(new $className());
+ }
+ }
+ }
}
diff --git a/phpBB/phpbb/file_downloader.php b/phpBB/phpbb/file_downloader.php
index 462b87ca51..ab9505a14c 100644
--- a/phpBB/phpbb/file_downloader.php
+++ b/phpBB/phpbb/file_downloader.php
@@ -42,7 +42,7 @@ class file_downloader
$this->error_number = 0;
$this->error_string = '';
- if ($socket = @fsockopen($host, $port, $this->error_number, $this->error_string, $timeout))
+ if ($socket = @fsockopen(($port == 443 ? 'tls://' : '') . $host, $port, $this->error_number, $this->error_string, $timeout))
{
@fputs($socket, "GET $directory/$filename HTTP/1.0\r\n");
@fputs($socket, "HOST: $host\r\n");
diff --git a/phpBB/phpbb/files/types/remote.php b/phpBB/phpbb/files/types/remote.php
index 44feab0ece..33cbfb00ae 100644
--- a/phpBB/phpbb/files/types/remote.php
+++ b/phpBB/phpbb/files/types/remote.php
@@ -97,7 +97,6 @@ class remote extends base
$url['path'] = implode('', $url['path']);
$upload_ary['name'] = utf8_basename($url['path']) . (($ext) ? '.' . $ext : '');
- $filename = $url['path'];
$filesize = 0;
$remote_max_filesize = $this->get_max_file_size();
@@ -200,8 +199,7 @@ class remote extends base
return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'EMPTY_REMOTE_DATA');
}
- $tmp_path = (!$this->php_ini->getBool('safe_mode')) ? false : $this->phpbb_root_path . 'cache';
- $filename = tempnam($tmp_path, unique_id() . '-');
+ $filename = tempnam(sys_get_temp_dir(), unique_id() . '-');
if (!($fp = @fopen($filename, 'wb')))
{
diff --git a/phpBB/phpbb/install/console/command/install/config/validate.php b/phpBB/phpbb/install/console/command/install/config/validate.php
index 19b6f99a8b..3bbbc23e34 100644
--- a/phpBB/phpbb/install/console/command/install/config/validate.php
+++ b/phpBB/phpbb/install/console/command/install/config/validate.php
@@ -117,7 +117,7 @@ class validate extends \phpbb\console\command\command
try
{
- $config = $processor->processConfiguration($configuration, $config);
+ $processor->processConfiguration($configuration, $config);
}
catch (Exception $e)
{
diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php
index ed817f7396..2dad42b4b6 100644
--- a/phpBB/phpbb/install/controller/helper.php
+++ b/phpBB/phpbb/install/controller/helper.php
@@ -270,10 +270,10 @@ class helper
'L_SELECT_LANG' => $this->language->lang('SELECT_LANG'),
'L_SKIP' => $this->language->lang('SKIP'),
'PAGE_TITLE' => $this->language->lang($page_title),
- 'T_IMAGE_PATH' => $this->path_helper->get_web_root_path() . $path . 'images/',
+ 'T_IMAGE_PATH' => $this->path_helper->get_web_root_path() . $path . 'images',
'T_JQUERY_LINK' => $this->path_helper->get_web_root_path() . $path . '../assets/javascript/jquery.min.js',
- 'T_TEMPLATE_PATH' => $this->path_helper->get_web_root_path() . $path . 'style/',
- 'T_ASSETS_PATH' => $this->path_helper->get_web_root_path() . $path . '../assets/',
+ 'T_TEMPLATE_PATH' => $this->path_helper->get_web_root_path() . $path . 'style',
+ 'T_ASSETS_PATH' => $this->path_helper->get_web_root_path() . $path . '../assets',
'S_CONTENT_DIRECTION' => $this->language->lang('DIRECTION'),
'S_CONTENT_FLOW_BEGIN' => ($this->language->lang('DIRECTION') === 'ltr') ? 'left' : 'right',
diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php
index 8bf9062b08..b987d91c6a 100644
--- a/phpBB/phpbb/install/controller/install.php
+++ b/phpBB/phpbb/install/controller/install.php
@@ -19,7 +19,6 @@ use phpbb\install\helper\navigation\navigation_provider;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpFoundation\Response;
use phpbb\install\helper\iohandler\factory;
-use phpbb\install\controller\helper;
use phpbb\template\template;
use phpbb\request\request_interface;
use phpbb\install\installer;
diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php
index 8dee5390a9..7271fe9bc0 100644
--- a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php
+++ b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php
@@ -101,7 +101,7 @@ abstract class iohandler_base implements iohandler_interface
*/
public function add_error_message($error_title, $error_description = false)
{
- if (strpos($error_title, '<br />') !== false)
+ if (!is_array($error_title) && strpos($error_title, '<br />') !== false)
{
$error_title = strip_tags(htmlspecialchars_decode($error_title));
}
diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php
index f0ba120625..436c21bdad 100644
--- a/phpBB/phpbb/log/log.php
+++ b/phpBB/phpbb/log/log.php
@@ -420,7 +420,7 @@ class log implements \phpbb\log\log_interface
$this->entry_count = 0;
$this->last_page_offset = $offset;
- $post_id_list = $topic_id_list = $reportee_id_list = array();
+ $topic_id_list = $reportee_id_list = array();
$profile_url = ($this->get_is_admin() && $this->phpbb_admin_path) ? append_sid("{$this->phpbb_admin_path}index.{$this->php_ext}", 'i=users&amp;mode=overview') : append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=viewprofile');
diff --git a/phpBB/phpbb/report/report_handler_post.php b/phpBB/phpbb/report/report_handler_post.php
index ce4ed67d27..5574a16dc0 100644
--- a/phpBB/phpbb/report/report_handler_post.php
+++ b/phpBB/phpbb/report/report_handler_post.php
@@ -66,7 +66,7 @@ class report_handler_post extends report_handler
'reported_post_enable_magic_url' => $this->report_data['enable_magic_url'],
);
- $report_id = $this->create_report($report_data);
+ $this->create_report($report_data);
$sql = 'UPDATE ' . POSTS_TABLE . '
SET post_reported = 1
diff --git a/phpBB/phpbb/request/type_cast_helper.php b/phpBB/phpbb/request/type_cast_helper.php
index bc654e6182..96e66950ca 100644
--- a/phpBB/phpbb/request/type_cast_helper.php
+++ b/phpBB/phpbb/request/type_cast_helper.php
@@ -172,7 +172,6 @@ class type_cast_helper implements \phpbb\request\type_cast_helper_interface
}
list($default_key, $default_value) = each($default);
- $value_type = gettype($default_value);
$key_type = gettype($default_key);
$_var = $var;
diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php
index 3a74955a18..521eebb7ee 100644
--- a/phpBB/phpbb/search/fulltext_native.php
+++ b/phpBB/phpbb/search/fulltext_native.php
@@ -352,9 +352,6 @@ class fulltext_native extends \phpbb\search\base
$this->must_not_contain_ids = array();
$this->must_exclude_one_ids = array();
- $mode = '';
- $ignore_no_id = true;
-
foreach ($query as $word)
{
if (empty($word))
@@ -597,7 +594,6 @@ class fulltext_native extends \phpbb\search\base
$id_ary = array();
$sql_where = array();
- $group_by = false;
$m_num = 0;
$w_num = 0;
@@ -1328,7 +1324,6 @@ class fulltext_native extends \phpbb\search\base
$match[] = '#\[\/?[a-z0-9\*\+\-]+(?:=.*?)?(?::[a-z])?(\:?[0-9a-z]{5,})\]#';
$min = $this->word_length['min'];
- $max = $this->word_length['max'];
$isset_min = $min - 1;
@@ -1737,7 +1732,7 @@ class fulltext_native extends \phpbb\search\base
protected function cleanup($text, $allowed_chars = null, $encoding = 'utf-8')
{
static $conv = array(), $conv_loaded = array();
- $words = $allow = array();
+ $allow = array();
// Convert the text to UTF-8
$encoding = strtolower($encoding);
diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php
index ab28fd2957..42425cbc6b 100644
--- a/phpBB/phpbb/search/fulltext_postgres.php
+++ b/phpBB/phpbb/search/fulltext_postgres.php
@@ -501,7 +501,6 @@ class fulltext_postgres extends \phpbb\search\base
$sql_select = ($type == 'posts') ? 'p.post_id' : 'DISTINCT t.topic_id';
$sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : '';
$field = ($type == 'posts') ? 'post_id' : 'topic_id';
- $sql_author = (sizeof($author_ary) == 1) ? ' = ' . $author_ary[0] : 'IN (' . implode(', ', $author_ary) . ')';
if (sizeof($author_ary) && $author_name)
{
@@ -526,7 +525,6 @@ class fulltext_postgres extends \phpbb\search\base
$sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
$sql_where_options .= $sql_match_where;
- $tmp_sql_match = array();
$sql_match = str_replace(',', " || ' ' ||", $sql_match);
$tmp_sql_match = "to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', " . $sql_match . ") @@ to_tsquery ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', '" . $this->db->sql_escape($this->tsearch_query) . "')";
@@ -838,7 +836,7 @@ class fulltext_postgres extends \phpbb\search\base
GROUP BY t.topic_id, $sort_by_sql[$sort_key]";
}
- $result = $this->db->sql_query($sql_count);
+ $this->db->sql_query($sql_count);
$result_count = (int) $this->db->sql_fetchfield('result_count');
if (!$result_count)
diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php
index 372a2792cf..504065e8cd 100644
--- a/phpBB/phpbb/search/fulltext_sphinx.php
+++ b/phpBB/phpbb/search/fulltext_sphinx.php
@@ -404,7 +404,7 @@ class fulltext_sphinx
$variable = $section->get_variable_by_name($key);
if (!$variable)
{
- $variable = $section->create_variable($key, $value);
+ $section->create_variable($key, $value);
}
else
{
@@ -413,7 +413,7 @@ class fulltext_sphinx
}
else
{
- $variable = $section->create_variable($key, $value);
+ $section->create_variable($key, $value);
}
}
}
@@ -437,7 +437,6 @@ class fulltext_sphinx
$match = array('#\sand\s#i', '#\sor\s#i', '#\snot\s#i', '#\+#', '#-#', '#\|#', '#@#');
$replace = array(' & ', ' | ', ' - ', ' +', ' -', ' |', '');
- $replacements = 0;
$keywords = preg_replace($match, $replace, $keywords);
$this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED);
}
@@ -490,8 +489,6 @@ class fulltext_sphinx
$id_ary = array();
- $join_topic = ($type != 'posts');
-
// Sorting
if ($type == 'topics')
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php
index 5575c22846..3f7146c59b 100644
--- a/phpBB/phpbb/session.php
+++ b/phpBB/phpbb/session.php
@@ -494,7 +494,7 @@ class session
*/
function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true)
{
- global $SID, $_SID, $db, $config, $cache, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
+ global $SID, $_SID, $db, $config, $cache, $phpbb_container, $phpbb_dispatcher;
$this->data = array();
@@ -883,7 +883,7 @@ class session
*/
function session_kill($new_session = true)
{
- global $SID, $_SID, $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
+ global $SID, $_SID, $db, $phpbb_container, $phpbb_dispatcher;
$sql = 'DELETE FROM ' . SESSIONS_TABLE . "
WHERE session_id = '" . $db->sql_escape($this->session_id) . "'
@@ -975,7 +975,7 @@ class session
*/
function session_gc()
{
- global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
+ global $db, $config, $phpbb_container, $phpbb_dispatcher;
$batch_size = 10;
@@ -1226,7 +1226,7 @@ class session
if ($banned && !$return)
{
- global $template, $phpbb_root_path, $phpEx;
+ global $phpbb_root_path, $phpEx;
// If the session is empty we need to create a valid one...
if (empty($this->session_id))
@@ -1403,7 +1403,7 @@ class session
*/
function set_login_key($user_id = false, $key = false, $user_ip = false)
{
- global $config, $db;
+ global $db;
$user_id = ($user_id === false) ? $this->data['user_id'] : $user_id;
$user_ip = ($user_ip === false) ? $this->ip : $user_ip;
@@ -1413,7 +1413,7 @@ class session
$sql_ary = array(
'key_id' => (string) md5($key_id),
- 'last_ip' => (string) $this->ip,
+ 'last_ip' => (string) $user_ip,
'last_login' => (int) time()
);
@@ -1450,7 +1450,7 @@ class session
*/
function reset_login_keys($user_id = false)
{
- global $config, $db;
+ global $db;
$user_id = ($user_id === false) ? (int) $this->data['user_id'] : (int) $user_id;
@@ -1574,7 +1574,7 @@ class session
public function update_session_infos()
{
- global $db, $request;
+ global $config, $db, $request;
// No need to update if it's a new session. Informations are already inserted by session_create()
if (isset($this->data['session_created']) && $this->data['session_created'])
diff --git a/phpBB/phpbb/template/twig/node/includejs.php b/phpBB/phpbb/template/twig/node/includejs.php
index 0f67f9ff60..e77f2afeed 100644
--- a/phpBB/phpbb/template/twig/node/includejs.php
+++ b/phpBB/phpbb/template/twig/node/includejs.php
@@ -28,8 +28,6 @@ class includejs extends \phpbb\template\twig\node\includeasset
*/
protected function append_asset(\Twig_Compiler $compiler)
{
- $config = $this->environment->get_phpbb_config();
-
$compiler
->raw("<script type=\"text/javascript\" src=\"' . ")
->raw("\$asset_file")
diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php
index 7fdc5afeed..8c273c342e 100644
--- a/phpBB/phpbb/textformatter/s9e/factory.php
+++ b/phpBB/phpbb/textformatter/s9e/factory.php
@@ -99,7 +99,7 @@ class factory implements \phpbb\textformatter\cache_interface
]{TEXT2}[/QUOTE]",
'size' => '[SIZE={FONTSIZE}]{TEXT}[/SIZE]',
'u' => '[U]{TEXT}[/U]',
- 'url' => '[URL={URL;useContent}]{TEXT}[/URL]',
+ 'url' => '[URL={URL;useContent} $forceLookahead=true]{TEXT}[/URL]',
);
/**
diff --git a/phpBB/phpbb/textformatter/s9e/parser.php b/phpBB/phpbb/textformatter/s9e/parser.php
index ffaffbc63c..e2653d60f0 100644
--- a/phpBB/phpbb/textformatter/s9e/parser.php
+++ b/phpBB/phpbb/textformatter/s9e/parser.php
@@ -50,6 +50,7 @@ class parser implements \phpbb\textformatter\parser_interface
$this->dispatcher = $dispatcher;
$this->parser = $parser;
+
$parser = $this;
/**
@@ -195,7 +196,7 @@ class parser implements \phpbb\textformatter\parser_interface
$errors = array();
foreach ($this->parser->getLogger()->get() as $entry)
{
- list($type, $msg, $context) = $entry;
+ list(, $msg, $context) = $entry;
if ($msg === 'Tag limit exceeded')
{
diff --git a/phpBB/phpbb/textformatter/s9e/renderer.php b/phpBB/phpbb/textformatter/s9e/renderer.php
index 2206605ba2..9be20b7f53 100644
--- a/phpBB/phpbb/textformatter/s9e/renderer.php
+++ b/phpBB/phpbb/textformatter/s9e/renderer.php
@@ -233,6 +233,7 @@ class renderer implements \phpbb\textformatter\renderer_interface
{
$xml = $this->quote_helper->inject_metadata($xml);
}
+
$renderer = $this;
/**
diff --git a/phpBB/phpbb/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php
index 8490c7c299..7149513fd9 100644
--- a/phpBB/phpbb/tree/nestedset.php
+++ b/phpBB/phpbb/tree/nestedset.php
@@ -391,7 +391,6 @@ abstract class nestedset implements \phpbb\tree\tree_interface
throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
- $diff = sizeof($move_items) * 2;
$sql_exclude_moved_items = $this->db->sql_in_set($this->column_item_id, $move_items, true);
$this->db->sql_transaction('begin');
@@ -490,7 +489,6 @@ abstract class nestedset implements \phpbb\tree\tree_interface
throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
- $diff = sizeof($move_items) * 2;
$sql_exclude_moved_items = $this->db->sql_in_set($this->column_item_id, $move_items, true);
$this->db->sql_transaction('begin');
diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php
index 173b20ee53..5262e10e87 100644
--- a/phpBB/phpbb/user.php
+++ b/phpBB/phpbb/user.php
@@ -747,8 +747,6 @@ class user extends \phpbb\session
*/
function leave_newly_registered()
{
- global $db;
-
if (empty($this->data['user_new']))
{
return false;
diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php
index e4f68f5aab..a1e66ba8fe 100644
--- a/phpBB/phpbb/version_helper.php
+++ b/phpBB/phpbb/version_helper.php
@@ -34,6 +34,11 @@ class version_helper
protected $file = 'versions.json';
/**
+ * @var bool Use SSL or not
+ */
+ protected $use_ssl = false;
+
+ /**
* @var string Current version installed
*/
protected $current_version;
@@ -85,13 +90,15 @@ class version_helper
* @param string $host Host (e.g. version.phpbb.com)
* @param string $path Path to file (e.g. /phpbb)
* @param string $file File name (Default: versions.json)
+ * @param bool $use_ssl Use SSL or not (Default: false)
* @return version_helper
*/
- public function set_file_location($host, $path, $file = 'versions.json')
+ public function set_file_location($host, $path, $file = 'versions.json', $use_ssl = false)
{
$this->host = $host;
$this->path = $path;
$this->file = $file;
+ $this->use_ssl = $use_ssl;
return $this;
}
@@ -244,7 +251,7 @@ class version_helper
*/
public function get_versions($force_update = false, $force_cache = false)
{
- $cache_file = '_versioncheck_' . $this->host . $this->path . $this->file;
+ $cache_file = '_versioncheck_' . $this->host . $this->path . $this->file . $this->use_ssl;
$info = $this->cache->get($cache_file);
@@ -255,7 +262,7 @@ class version_helper
else if ($info === false || $force_update)
{
try {
- $info = $this->file_downloader->get($this->host, $this->path, $this->file);
+ $info = $this->file_downloader->get($this->host, $this->path, $this->file, $this->use_ssl ? 443 : 80);
}
catch (\phpbb\exception\runtime_exception $exception)
{