aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/v3110.php36
-rw-r--r--phpBB/phpbb/db/migration/tool/module.php37
-rw-r--r--phpBB/phpbb/event/kernel_exception_subscriber.php8
-rw-r--r--phpBB/phpbb/template/twig/loader.php10
4 files changed, 81 insertions, 10 deletions
diff --git a/phpBB/phpbb/db/migration/data/v31x/v3110.php b/phpBB/phpbb/db/migration/data/v31x/v3110.php
new file mode 100644
index 0000000000..b89b4cc6e6
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/v3110.php
@@ -0,0 +1,36 @@
+<?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 v3110 extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return phpbb_version_compare($this->config['version'], '3.1.10', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\v3110rc1',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.10')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php
index a7dffbb7f2..b47c426110 100644
--- a/phpBB/phpbb/db/migration/tool/module.php
+++ b/phpBB/phpbb/db/migration/tool/module.php
@@ -97,7 +97,12 @@ class module implements \phpbb\db\migration\tool\tool_interface
$parent_sql = '';
if ($parent !== false)
{
- $parent = $this->get_parent_module_id($parent, $module);
+ $parent = $this->get_parent_module_id($parent, $module, false);
+ if ($parent === false)
+ {
+ return false;
+ }
+
$parent_sql = 'AND parent_id = ' . (int) $parent;
}
@@ -205,7 +210,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
if ($this->exists($class, $parent, $data['module_langname']))
{
- throw new \phpbb\db\migration\exception('MODULE_EXISTS', $module_id);
+ throw new \phpbb\db\migration\exception('MODULE_EXISTS', $data['module_langname']);
}
$module_data = array(
@@ -431,12 +436,11 @@ class module implements \phpbb\db\migration\tool\tool_interface
protected function get_categories_list()
{
// Select the top level categories
- // and 2nd level [sub]categories which exist for ACP only
+ // and 2nd level [sub]categories
$sql = 'SELECT m2.module_id, m2.module_langname
FROM ' . $this->modules_table . ' m1, ' . $this->modules_table . " m2
WHERE m1.parent_id = 0
- AND (m1.module_id = m2.module_id
- OR m2.module_class = 'acp' AND m2.parent_id = m1.module_id)
+ AND (m1.module_id = m2.module_id OR m2.parent_id = m1.module_id)
ORDER BY m1.module_id, m2.module_id ASC";
$result = $this->db->sql_query($sql);
@@ -452,11 +456,15 @@ class module implements \phpbb\db\migration\tool\tool_interface
*
* @param string|int $parent_id The parent module_id|module_langname
* @param int|string|array $data The module_id, module_langname for existance checking or module data array for adding
- * @return int The parent module_id
+ * @param bool $throw_exception The flag indicating if exception should be thrown on error
+ * @return mixed The int parent module_id or false
* @throws \phpbb\db\migration\exception
*/
- public function get_parent_module_id($parent_id, $data = '')
+ public function get_parent_module_id($parent_id, $data = '', $throw_exception = true)
{
+ // Initialize exception object placeholder
+ $exception = false;
+
// Allow '' to be sent as 0
$parent_id = $parent_id ?: 0;
@@ -478,7 +486,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
{
// No parent with the given module_langname exist
case 0:
- throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent_id);
+ $exception = new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent_id);
break;
// Return the module id
@@ -500,7 +508,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
$parent_id = (int) $this->db->sql_fetchfield('parent_id');
if (!$parent_id)
{
- throw new \phpbb\db\migration\exception('PARENT_MODULE_FIND_ERROR', $data['parent_id']);
+ $exception = new \phpbb\db\migration\exception('PARENT_MODULE_FIND_ERROR', $data['parent_id']);
}
}
else if (!empty($data) && !is_array($data))
@@ -518,12 +526,21 @@ class module implements \phpbb\db\migration\tool\tool_interface
else
{
//Unable to get the parent module id, throwing an exception
- throw new \phpbb\db\migration\exception('MODULE_EXIST_MULTIPLE', $parent_id);
+ $exception = new \phpbb\db\migration\exception('MODULE_EXIST_MULTIPLE', $parent_id);
}
break;
}
}
+ if ($exception !== false)
+ {
+ if ($throw_exception)
+ {
+ throw $exception;
+ }
+ return false;
+ }
+
return $parent_id;
}
}
diff --git a/phpBB/phpbb/event/kernel_exception_subscriber.php b/phpBB/phpbb/event/kernel_exception_subscriber.php
index e427abf5e3..3c7375dadf 100644
--- a/phpBB/phpbb/event/kernel_exception_subscriber.php
+++ b/phpBB/phpbb/event/kernel_exception_subscriber.php
@@ -36,6 +36,9 @@ class kernel_exception_subscriber implements EventSubscriberInterface
*/
protected $language;
+ /** @var \phpbb\request\type_cast_helper */
+ protected $type_caster;
+
/**
* Construct method
*
@@ -46,6 +49,7 @@ class kernel_exception_subscriber implements EventSubscriberInterface
{
$this->template = $template;
$this->language = $language;
+ $this->type_caster = new \phpbb\request\type_cast_helper();
}
/**
@@ -59,12 +63,16 @@ class kernel_exception_subscriber implements EventSubscriberInterface
$exception = $event->getException();
$message = $exception->getMessage();
+ $this->type_caster->set_var($message, $message, 'string', false, false);
if ($exception instanceof \phpbb\exception\exception_interface)
{
$message = $this->language->lang_array($message, $exception->get_parameters());
}
+ // Show <strong> text in bold
+ $message = preg_replace('#&lt;(/?strong)&gt;#i', '<$1>', $message);
+
if (!$event->getRequest()->isXmlHttpRequest())
{
page_header($this->language->lang('INFORMATION'));
diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php
index 8b12188a77..d2b42852ce 100644
--- a/phpBB/phpbb/template/twig/loader.php
+++ b/phpBB/phpbb/template/twig/loader.php
@@ -101,6 +101,16 @@ class loader extends \Twig_Loader_Filesystem
}
/**
+ * Adds a realpath call to fix a BC break in Twig 1.26 (https://github.com/twigphp/Twig/issues/2145)
+ *
+ * {@inheritdoc}
+ */
+ public function addPath($path, $namespace = self::MAIN_NAMESPACE)
+ {
+ return parent::addPath($this->filesystem->realpath($path), $namespace);
+ }
+
+ /**
* Find the template
*
* Override for Twig_Loader_Filesystem::findTemplate to add support