diff options
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/db/migration/tool/module.php | 37 | ||||
-rw-r--r-- | phpBB/phpbb/event/kernel_exception_subscriber.php | 3 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/report_pm.php | 2 |
3 files changed, 31 insertions, 11 deletions
diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index 6d5378e35f..7ea7d1dac1 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -90,7 +90,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; } @@ -197,7 +202,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']); } if (!class_exists('acp_modules')) @@ -448,12 +453,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); @@ -469,11 +473,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; @@ -495,7 +503,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 @@ -517,7 +525,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)) @@ -535,12 +543,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 34c8422b0a..9d15f9370e 100644 --- a/phpBB/phpbb/event/kernel_exception_subscriber.php +++ b/phpBB/phpbb/event/kernel_exception_subscriber.php @@ -68,6 +68,9 @@ class kernel_exception_subscriber implements EventSubscriberInterface $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($message), $exception->get_parameters())); } + // Show <strong> text in bold + $message = preg_replace('#<(/?strong)>#i', '<$1>', $message); + if (!$event->getRequest()->isXmlHttpRequest()) { page_header($this->user->lang('INFORMATION')); diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index 785e5f243d..cc32984ac6 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -52,7 +52,7 @@ class report_pm extends \phpbb\notification\type\pm * * @var string Permission name */ - protected $permission = 'm_report'; + protected $permission = 'm_pm_report'; /** * Notification option data (for outputting to the user) |