aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/auth/provider/oauth/oauth.php2
-rw-r--r--phpBB/phpbb/console/command/db/migrate.php1
-rw-r--r--phpBB/phpbb/controller/helper.php52
-rw-r--r--phpBB/phpbb/db/migration/data/v310/rc4.php32
-rw-r--r--phpBB/phpbb/di/container_builder.php5
-rw-r--r--phpBB/phpbb/event/extension_subscriber_loader.php39
-rw-r--r--phpBB/phpbb/extension/base.php10
-rw-r--r--phpBB/phpbb/profilefields/manager.php10
-rw-r--r--phpBB/phpbb/session.php3
-rw-r--r--phpBB/phpbb/template/base.php6
10 files changed, 92 insertions, 68 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php
index 902c6ae84c..c0ce3f1fba 100644
--- a/phpBB/phpbb/auth/provider/oauth/oauth.php
+++ b/phpBB/phpbb/auth/provider/oauth/oauth.php
@@ -105,7 +105,7 @@ class oauth extends \phpbb\auth\provider\base
protected $phpbb_root_path;
/**
- * PHP extenstion
+ * PHP file extension
*
* @var string
*/
diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php
index c3caae5f70..86545c237d 100644
--- a/phpBB/phpbb/console/command/db/migrate.php
+++ b/phpBB/phpbb/console/command/db/migrate.php
@@ -119,6 +119,7 @@ class migrate extends \phpbb\console\command\command
->core_path('phpbb/db/migration/data/')
->extension_directory('/migrations')
->get_classes();
+
$this->migrator->set_migrations($migrations);
}
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php
index dd89d0504a..fc19b855c0 100644
--- a/phpBB/phpbb/controller/helper.php
+++ b/phpBB/phpbb/controller/helper.php
@@ -15,6 +15,7 @@ namespace phpbb\controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGenerator;
+use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RequestContext;
/**
@@ -44,6 +45,11 @@ class helper
protected $symfony_request;
/**
+ * @var \phpbb\filesystem The filesystem object
+ */
+ protected $filesystem;
+
+ /**
* phpBB root path
* @var string
*/
@@ -64,15 +70,17 @@ class helper
* @param \phpbb\controller\provider $provider Path provider
* @param \phpbb\extension\manager $manager Extension manager object
* @param \phpbb\symfony_request $symfony_request Symfony Request object
+ * @param \phpbb\filesystem $filesystem The filesystem object
* @param string $phpbb_root_path phpBB root path
* @param string $php_ext PHP file extension
*/
- public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, \phpbb\symfony_request $symfony_request, $phpbb_root_path, $php_ext)
+ public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, \phpbb\symfony_request $symfony_request, \phpbb\filesystem $filesystem, $phpbb_root_path, $php_ext)
{
$this->template = $template;
$this->user = $user;
$this->config = $config;
$this->symfony_request = $symfony_request;
+ $this->filesystem = $filesystem;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$provider->find_routing_files($manager->get_finder());
@@ -108,10 +116,11 @@ class helper
* @param string $route Name of the route to travel
* @param array $params String or array of additional url parameters
* @param bool $is_amp Is url using & (true) or & (false)
- * @param string|bool $session_id Possibility to use a custom session id instead of the global one
+ * @param string|bool $session_id Possibility to use a custom session id instead of the global one
+ * @param bool|string $reference_type The type of reference to be generated (one of the constants)
* @return string The URL already passed through append_sid()
*/
- public function route($route, array $params = array(), $is_amp = true, $session_id = false)
+ public function route($route, array $params = array(), $is_amp = true, $session_id = false, $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH)
{
$anchor = '';
if (isset($params['#']))
@@ -119,27 +128,46 @@ class helper
$anchor = '#' . $params['#'];
unset($params['#']);
}
- $url_generator = new UrlGenerator($this->route_collection, new RequestContext());
- $route_url = $url_generator->generate($route, $params);
- if (strpos($route_url, '/') === 0)
+ $context = new RequestContext();
+ $context->fromRequest($this->symfony_request);
+
+ $script_name = $this->symfony_request->getScriptName();
+ $page_name = substr($script_name, -1, 1) == '/' ? '' : utf8_basename($script_name);
+
+ $base_url = $context->getBaseUrl();
+
+ // If enable_mod_rewrite is false we need to replace the current front-end by app.php, otherwise we need to remove it.
+ $base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url);
+
+ // We need to update the base url to move to the directory of the app.php file
+ if (empty($this->config['enable_mod_rewrite']))
+ {
+ $base_url = str_replace('/app.' . $this->php_ext, '/' . $this->phpbb_root_path . 'app.' . $this->php_ext, $base_url);
+ }
+ else
{
- $route_url = substr($route_url, 1);
+ $base_url .= preg_replace(get_preg_expression('path_remove_dot_trailing_slash'), '$2', $this->phpbb_root_path);
}
+ $base_url = $this->filesystem->clean_path($base_url);
+
+ $context->setBaseUrl($base_url);
+
+ $url_generator = new UrlGenerator($this->route_collection, $context);
+ $route_url = $url_generator->generate($route, $params, $reference_type);
+
if ($is_amp)
{
$route_url = str_replace(array('&', '&'), array('&', '&'), $route_url);
}
- // If enable_mod_rewrite is false, we need to include app.php
- $route_prefix = $this->phpbb_root_path;
- if (empty($this->config['enable_mod_rewrite']))
+ if ($reference_type === UrlGeneratorInterface::RELATIVE_PATH && empty($this->config['enable_mod_rewrite']))
{
- $route_prefix .= 'app.' . $this->php_ext . '/';
+ $route_url = 'app.' . $this->php_ext . '/' . $route_url;
}
- return append_sid($route_prefix . $route_url . $anchor, false, $is_amp, $session_id);
+ return append_sid($route_url . $anchor, false, $is_amp, $session_id, true);
}
/**
diff --git a/phpBB/phpbb/db/migration/data/v310/rc4.php b/phpBB/phpbb/db/migration/data/v310/rc4.php
new file mode 100644
index 0000000000..47de8291c1
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/rc4.php
@@ -0,0 +1,32 @@
+<?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\v310;
+
+class rc4 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\rc3',
+ '\phpbb\db\migration\data\v310\notifications_use_full_name',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.0-RC4')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php
index 553b723cc8..638c13e86d 100644
--- a/phpBB/phpbb/di/container_builder.php
+++ b/phpBB/phpbb/di/container_builder.php
@@ -15,6 +15,7 @@ namespace phpbb\di;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
+use Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass;
class container_builder
{
@@ -160,11 +161,13 @@ class container_builder
if ($this->use_custom_pass)
{
+ // Symfony Kernel Listeners
$this->container->addCompilerPass(new \phpbb\di\pass\collection_pass());
+ $this->container->addCompilerPass(new RegisterListenersPass('dispatcher', 'event.listener_listener', 'event.listener'));
if ($this->use_kernel_pass)
{
- $this->container->addCompilerPass(new \phpbb\di\pass\kernel_pass());
+ $this->container->addCompilerPass(new RegisterListenersPass('dispatcher'));
}
}
diff --git a/phpBB/phpbb/event/extension_subscriber_loader.php b/phpBB/phpbb/event/extension_subscriber_loader.php
deleted file mode 100644
index fc01961e9f..0000000000
--- a/phpBB/phpbb/event/extension_subscriber_loader.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?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\event;
-
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-
-class extension_subscriber_loader
-{
- private $dispatcher;
- private $listener_collection;
-
- public function __construct(EventDispatcherInterface $dispatcher, \phpbb\di\service_collection $listener_collection)
- {
- $this->dispatcher = $dispatcher;
- $this->listener_collection = $listener_collection;
- }
-
- public function load()
- {
- if (!empty($this->listener_collection))
- {
- foreach ($this->listener_collection as $listener)
- {
- $this->dispatcher->addSubscriber($listener);
- }
- }
- }
-}
diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php
index 288fb7d19c..5bb530bad4 100644
--- a/phpBB/phpbb/extension/base.php
+++ b/phpBB/phpbb/extension/base.php
@@ -35,6 +35,9 @@ class base implements \phpbb\extension\extension_interface
/** @var string */
protected $extension_path;
+ /** @var string[] */
+ private $migrations = false;
+
/**
* Constructor
*
@@ -122,17 +125,16 @@ class base implements \phpbb\extension\extension_interface
*/
protected function get_migration_file_list()
{
- static $migrations = false;
-
- if ($migrations !== false)
+ if ($this->migrations !== false)
{
- return $migrations;
+ return $this->migrations;
}
// Only have the finder search in this extension path directory
$migrations = $this->extension_finder
->extension_directory('/migrations')
->find_from_extension($this->extension_name, $this->extension_path);
+
$migrations = $this->extension_finder->get_classes_from_files($migrations);
return $migrations;
diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php
index 98802d2209..4ad3214ae4 100644
--- a/phpBB/phpbb/profilefields/manager.php
+++ b/phpBB/phpbb/profilefields/manager.php
@@ -245,12 +245,8 @@ class manager
$cp_data = $this->build_insert_sql_array($cp_data);
$cp_data['user_id'] = (int) $user_id;
- $this->db->sql_return_on_error(true);
-
$sql = 'INSERT INTO ' . $this->fields_data_table . ' ' . $this->db->sql_build_array('INSERT', $cp_data);
$this->db->sql_query($sql);
-
- $this->db->sql_return_on_error(false);
}
}
@@ -328,7 +324,7 @@ class manager
* Event to modify profile fields data retrieved from the database
*
* @event core.grab_profile_fields_data
- * @var array user_ids Single user id or an array of ids
+ * @var array user_ids Single user id or an array of ids
* @var array field_data Array with profile fields data
* @since 3.1.0-b3
*/
@@ -377,7 +373,7 @@ class manager
* Event to modify data of the generated profile fields, before the template assignment loop
*
* @event core.generate_profile_fields_template_data_before
- * @var array profile_row Array with users profile field data
+ * @var array profile_row Array with users profile field data
* @var array tpl_fields Array with template data fields
* @var bool use_contact_fields Should we display contact fields as such?
* @since 3.1.0-b3
@@ -445,7 +441,7 @@ class manager
* Event to modify template data of the generated profile fields
*
* @event core.generate_profile_fields_template_data
- * @var array profile_row Array with users profile field data
+ * @var array profile_row Array with users profile field data
* @var array tpl_fields Array with template data fields
* @var bool use_contact_fields Should we display contact fields as such?
* @since 3.1.0-b3
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php
index 7d564742af..da8b848fa5 100644
--- a/phpBB/phpbb/session.php
+++ b/phpBB/phpbb/session.php
@@ -446,7 +446,8 @@ class session
{
$sql_ary = array('session_time' => $this->time_now);
- if ($this->update_session_page)
+ // Do not update the session page for ajax requests, so the view online still works as intended
+ if ($this->update_session_page && !$request->is_ajax())
{
$sql_ary['session_page'] = substr($this->page['page'], 0, 199);
$sql_ary['session_forum_id'] = $this->page['forum'];
diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php
index ab0e1f281d..9a40702ba8 100644
--- a/phpBB/phpbb/template/base.php
+++ b/phpBB/phpbb/template/base.php
@@ -142,11 +142,11 @@ abstract class base implements template
{
global $phpbb_hook;
- if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, $method), $handle, $this))
+ if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array('template', $method), $handle, $this))
{
- if ($phpbb_hook->hook_return(array(__CLASS__, $method)))
+ if ($phpbb_hook->hook_return(array('template', $method)))
{
- $result = $phpbb_hook->hook_return_result(array(__CLASS__, $method));
+ $result = $phpbb_hook->hook_return_result(array('template', $method));
return array($result);
}
}