diff options
Diffstat (limited to 'phpBB/phpbb')
28 files changed, 354 insertions, 149 deletions
diff --git a/phpBB/phpbb/attachment/delete.php b/phpBB/phpbb/attachment/delete.php index 922f24b5dc..3c98e21587 100644 --- a/phpBB/phpbb/attachment/delete.php +++ b/phpBB/phpbb/attachment/delete.php @@ -104,6 +104,8 @@ class delete $this->set_sql_constraints($mode); + $sql_id = $this->sql_id; + /** * Perform additional actions before collecting data for attachment(s) deletion * @@ -122,11 +124,21 @@ class delete ); extract($this->dispatcher->trigger_event('core.delete_attachments_collect_data_before', compact($vars))); + $this->sql_id = $sql_id; + unset($sql_id); + // Collect post and topic ids for later use if we need to touch remaining entries (if resync is enabled) $this->collect_attachment_info($resync); // Delete attachments from database - $this->delete_attachments_from_db(); + $this->delete_attachments_from_db($mode, $ids, $resync); + + $sql_id = $this->sql_id; + $post_ids = $this->post_ids; + $topic_ids = $this->topic_ids; + $message_ids = $this->message_ids; + $physical = $this->physical; + $num_deleted = $this->num_deleted; /** * Perform additional actions after attachment(s) deletion from the database @@ -156,13 +168,21 @@ class delete ); extract($this->dispatcher->trigger_event('core.delete_attachments_from_database_after', compact($vars))); + $this->sql_id = $sql_id; + $this->post_ids = $post_ids; + $this->topic_ids = $topic_ids; + $this->message_ids = $message_ids; + $this->physical = $physical; + $this->num_deleted = $num_deleted; + unset($sql_id, $post_ids, $topic_ids, $message_ids, $physical, $num_deleted); + if (!$this->num_deleted) { return 0; } // Delete attachments from filesystem - $this->remove_from_filesystem(); + $this->remove_from_filesystem($mode, $ids, $resync); // If we do not resync, we do not need to adjust any message, post, topic or user entries if (!$resync) @@ -288,8 +308,14 @@ class delete /** * Delete attachments from database table */ - protected function delete_attachments_from_db() + protected function delete_attachments_from_db($mode, $ids, $resync) { + $sql_id = $this->sql_id; + $post_ids = $this->post_ids; + $topic_ids = $this->topic_ids; + $message_ids = $this->message_ids; + $physical = $this->physical; + /** * Perform additional actions before attachment(s) deletion * @@ -316,6 +342,13 @@ class delete ); extract($this->dispatcher->trigger_event('core.delete_attachments_before', compact($vars))); + $this->sql_id = $sql_id; + $this->post_ids = $post_ids; + $this->topic_ids = $topic_ids; + $this->message_ids = $message_ids; + $this->physical = $physical; + unset($sql_id, $post_ids, $topic_ids, $message_ids, $physical); + // Delete attachments $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $this->db->sql_in_set($this->sql_id, $this->ids); @@ -329,7 +362,7 @@ class delete /** * Delete attachments from filesystem */ - protected function remove_from_filesystem() + protected function remove_from_filesystem($mode, $ids, $resync) { $space_removed = $files_removed = 0; @@ -348,6 +381,13 @@ class delete } } + $sql_id = $this->sql_id; + $post_ids = $this->post_ids; + $topic_ids = $this->topic_ids; + $message_ids = $this->message_ids; + $physical = $this->physical; + $num_deleted = $this->num_deleted; + /** * Perform additional actions after attachment(s) deletion from the filesystem * @@ -380,6 +420,14 @@ class delete ); extract($this->dispatcher->trigger_event('core.delete_attachments_from_filesystem_after', compact($vars))); + $this->sql_id = $sql_id; + $this->post_ids = $post_ids; + $this->topic_ids = $topic_ids; + $this->message_ids = $message_ids; + $this->physical = $physical; + $this->num_deleted = $num_deleted; + unset($sql_id, $post_ids, $topic_ids, $message_ids, $physical, $num_deleted); + if ($space_removed || $files_removed) { $this->config->increment('upload_dir_size', $space_removed * (-1), false); diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 26eb17c265..6d9604db04 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -22,6 +22,12 @@ class manager protected $config; /** + * phpBB event dispatcher + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** * Array that contains a list of enabled drivers * @var array */ @@ -49,11 +55,13 @@ class manager * Construct an avatar manager object * * @param \phpbb\config\config $config phpBB configuration + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher phpBB event dispatcher * @param array $avatar_drivers Avatar drivers passed via the service container */ - public function __construct(\phpbb\config\config $config, $avatar_drivers) + public function __construct(\phpbb\config\config $config, \phpbb\event\dispatcher_interface $phpbb_dispatcher, $avatar_drivers) { $this->config = $config; + $this->phpbb_dispatcher = $phpbb_dispatcher; $this->register_avatar_drivers($avatar_drivers); } @@ -331,6 +339,19 @@ class manager WHERE user_avatar = '" . $db->sql_escape($avatar_data['avatar']) . "'"; $db->sql_query($sql); } + + /** + * Event is triggered after user avatar has been deleted + * + * @event core.avatar_manager_avatar_delete_after + * @var \phpbb\user user phpBB user object + * @var array avatar_data Normalised avatar-related user data + * @var string table Table to delete avatar from + * @var string prefix Column prefix to delete avatar from + * @since 3.2.4-RC1 + */ + $vars = array('user', 'avatar_data', 'table', 'prefix'); + extract($this->phpbb_dispatcher->trigger_event('core.avatar_manager_avatar_delete_after', compact($vars))); } /** diff --git a/phpBB/phpbb/captcha/plugins/gd.php b/phpBB/phpbb/captcha/plugins/gd.php index 831e5bcfdf..6d3c9bb3d2 100644 --- a/phpBB/phpbb/captcha/plugins/gd.php +++ b/phpBB/phpbb/captcha/plugins/gd.php @@ -51,7 +51,7 @@ class gd extends captcha_abstract return 'CAPTCHA_GD'; } - function acp_page($id, &$module) + function acp_page($id, $module) { global $user, $template, $phpbb_log, $request; global $config; diff --git a/phpBB/phpbb/captcha/plugins/gd_wave.php b/phpBB/phpbb/captcha/plugins/gd_wave.php index bde46f8815..4ac26ed2b7 100644 --- a/phpBB/phpbb/captcha/plugins/gd_wave.php +++ b/phpBB/phpbb/captcha/plugins/gd_wave.php @@ -33,7 +33,7 @@ class gd_wave extends captcha_abstract return '\\phpbb\\captcha\\gd_wave'; } - function acp_page($id, &$module) + function acp_page($id, $module) { global $user; diff --git a/phpBB/phpbb/captcha/plugins/nogd.php b/phpBB/phpbb/captcha/plugins/nogd.php index 6845e5935c..da67cd2bf4 100644 --- a/phpBB/phpbb/captcha/plugins/nogd.php +++ b/phpBB/phpbb/captcha/plugins/nogd.php @@ -33,7 +33,7 @@ class nogd extends captcha_abstract return '\\phpbb\\captcha\\non_gd'; } - function acp_page($id, &$module) + function acp_page($id, $module) { global $user; diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index 7797212ac9..70b3f72cc3 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -107,8 +107,7 @@ class qa $sql = 'SELECT q.question_id, q.lang_iso FROM ' . $this->table_captcha_questions . ' q, ' . $this->table_captcha_answers . ' a - WHERE q.question_id = a.question_id - GROUP BY lang_iso'; + WHERE q.question_id = a.question_id'; $result = $db->sql_query($sql, 7200); while ($row = $db->sql_fetchrow($result)) @@ -638,7 +637,7 @@ class qa /** * API function - The ACP backend, this marks the end of the easy methods */ - function acp_page($id, &$module) + function acp_page($id, $module) { global $config, $request, $phpbb_log, $template, $user; @@ -776,7 +775,7 @@ class qa /** * This handles the list overview */ - function acp_question_list(&$module) + function acp_question_list($module) { global $db, $template; diff --git a/phpBB/phpbb/captcha/plugins/recaptcha.php b/phpBB/phpbb/captcha/plugins/recaptcha.php index 152709a9ea..b7c0b5f5e2 100644 --- a/phpBB/phpbb/captcha/plugins/recaptcha.php +++ b/phpBB/phpbb/captcha/plugins/recaptcha.php @@ -66,7 +66,7 @@ class recaptcha extends captcha_abstract throw new \Exception('No generator class given.'); } - function acp_page($id, &$module) + function acp_page($id, $module) { global $config, $template, $user, $phpbb_log, $request; diff --git a/phpBB/phpbb/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php index b47939ccbe..5005f5b894 100644 --- a/phpBB/phpbb/cron/task/core/prune_all_forums.php +++ b/phpBB/phpbb/cron/task/core/prune_all_forums.php @@ -55,21 +55,26 @@ class prune_all_forums extends \phpbb\cron\task\base include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext); } - $sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, forum_flags, prune_freq - FROM ' . FORUMS_TABLE . " - WHERE enable_prune = 1 - AND prune_next < " . time(); + $sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, enable_shadow_prune, prune_shadow_days, prune_shadow_freq, prune_shadow_next, forum_flags, prune_freq + FROM ' . FORUMS_TABLE; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - if ($row['prune_days']) + if ($row['enable_prune'] && $row['prune_next'] < time()) { - auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']); - } + if ($row['prune_days']) + { + auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']); + } - if ($row['prune_viewed']) + if ($row['prune_viewed']) + { + auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']); + } + } + if ($row['enable_shadow_prune'] && $row['prune_shadow_next'] < time() && $row['prune_shadow_days']) { - auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']); + auto_prune($row['forum_id'], 'shadow', $row['forum_flags'], $row['prune_shadow_days'], $row['prune_shadow_freq']); } } $this->db->sql_freeresult($result); diff --git a/phpBB/phpbb/db/driver/mssql_base.php b/phpBB/phpbb/db/driver/mssql_base.php index 514df9eaca..98d16ca7fc 100644 --- a/phpBB/phpbb/db/driver/mssql_base.php +++ b/phpBB/phpbb/db/driver/mssql_base.php @@ -61,6 +61,14 @@ abstract class mssql_base extends \phpbb\db\driver\driver } /** + * {@inheritDoc} + */ + function cast_expr_to_bigint($expression) + { + return 'CONVERT(BIGINT, ' . $expression . ')'; + } + + /** * Build db-specific query data * @access private */ diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php index c018adab46..836cb4577a 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php @@ -58,9 +58,14 @@ class release_3_0_8_rc1 extends \phpbb\db\migration\migration $result = $this->db->sql_query($sql); $extension_groups_updated = array(); - while ($lang_dir = $this->db->sql_fetchfield('lang_dir')) + while ($row = $this->db->sql_fetchrow($result)) { - $lang_dir = basename($lang_dir); + if (empty($row['lang_dir'])) + { + continue; + } + + $lang_dir = basename($row['lang_dir']); // The language strings we need are either in language/.../acp/attachments.php // in the update package if we're updating to 3.0.8-RC1 or later, diff --git a/phpBB/phpbb/db/migration/data/v32x/jquery_update.php b/phpBB/phpbb/db/migration/data/v32x/jquery_update.php new file mode 100644 index 0000000000..6dc58ec638 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/jquery_update.php @@ -0,0 +1,37 @@ +<?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\v32x; + +class jquery_update extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return $this->config['load_jquery_url'] === '//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js'; + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v325rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js')), + ); + } + +} diff --git a/phpBB/phpbb/db/migration/data/v32x/remove_imagick.php b/phpBB/phpbb/db/migration/data/v32x/remove_imagick.php new file mode 100644 index 0000000000..7ad396f8e8 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/remove_imagick.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\v32x; + +class remove_imagick extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v324rc1', + ); + } + + public function update_data() + { + return array( + array('config.remove', array('img_imagick')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v32x/v322rc1.php b/phpBB/phpbb/db/migration/data/v32x/v322rc1.php index 51e9f5fcaa..4fd6270132 100644 --- a/phpBB/phpbb/db/migration/data/v32x/v322rc1.php +++ b/phpBB/phpbb/db/migration/data/v32x/v322rc1.php @@ -23,6 +23,7 @@ class v322rc1 extends \phpbb\db\migration\migration static public function depends_on() { return array( + '\phpbb\db\migration\data\v32x\v321', '\phpbb\db\migration\data\v32x\fix_user_styles', '\phpbb\db\migration\data\v32x\update_prosilver_bitfield', '\phpbb\db\migration\data\v32x\email_force_sender', diff --git a/phpBB/phpbb/db/migration/data/v32x/v323rc1.php b/phpBB/phpbb/db/migration/data/v32x/v323rc1.php index 0ff20d5074..c3fcd1ab0b 100644 --- a/phpBB/phpbb/db/migration/data/v32x/v323rc1.php +++ b/phpBB/phpbb/db/migration/data/v32x/v323rc1.php @@ -23,6 +23,7 @@ class v323rc1 extends \phpbb\db\migration\migration static public function depends_on() { return array( + '\phpbb\db\migration\data\v32x\v322', '\phpbb\db\migration\data\v32x\enable_accurate_pm_button', ); } diff --git a/phpBB/phpbb/db/migration/data/v32x/v324.php b/phpBB/phpbb/db/migration/data/v32x/v324.php new file mode 100644 index 0000000000..cd7783fdee --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/v324.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\v32x; + +class v324 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.2.4', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v324rc1', + '\phpbb\db\migration\data\v32x\remove_imagick', + ); + + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.4')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v32x/v324rc1.php b/phpBB/phpbb/db/migration/data/v32x/v324rc1.php new file mode 100644 index 0000000000..0221e2621a --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/v324rc1.php @@ -0,0 +1,37 @@ +<?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\v32x; + +class v324rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.2.4-RC1', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v323', + '\phpbb\db\migration\data\v32x\forum_topics_per_page_type', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.4-RC1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v32x/v325.php b/phpBB/phpbb/db/migration/data/v32x/v325.php new file mode 100644 index 0000000000..59de4916df --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/v325.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\v32x; + +class v325 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.2.5', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v325rc1', + '\phpbb\db\migration\data\v32x\jquery_update', + ); + + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.5')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v32x/v325rc1.php b/phpBB/phpbb/db/migration/data/v32x/v325rc1.php new file mode 100644 index 0000000000..2d0de0a432 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/v325rc1.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\v32x; + +class v325rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.2.5-RC1', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v324', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.5-RC1')), + ); + } +} diff --git a/phpBB/phpbb/files/upload.php b/phpBB/phpbb/files/upload.php index a9bf74094d..50e15c9844 100644 --- a/phpBB/phpbb/files/upload.php +++ b/phpBB/phpbb/files/upload.php @@ -261,7 +261,7 @@ class upload * * @param filespec $file Instance of filespec class */ - public function common_checks(&$file) + public function common_checks($file) { // Filesize is too big or it's 0 if it was larger than the maxsize in the upload form if ($this->max_filesize && ($file->get('filesize') > $this->max_filesize || $file->get('filesize') == 0)) @@ -297,7 +297,7 @@ class upload * * @return bool True if extension is allowed, false if not */ - public function valid_extension(&$file) + public function valid_extension($file) { return (in_array($file->get('extension'), $this->allowed_extensions)) ? true : false; } @@ -310,7 +310,7 @@ class upload * @return bool True if dimensions are valid or no constraints set, false * if not */ - public function valid_dimensions(&$file) + public function valid_dimensions($file) { if (!$this->max_width && !$this->max_height && !$this->min_width && !$this->min_height) { @@ -350,7 +350,7 @@ class upload * * @return bool True if content is valid, false if not */ - public function valid_content(&$file) + public function valid_content($file) { return ($file->check_content($this->disallowed_content)); } diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php index 21af652f9d..fa5a10c6fc 100644 --- a/phpBB/phpbb/install/helper/database.php +++ b/phpBB/phpbb/install/helper/database.php @@ -76,7 +76,7 @@ class database 'LABEL' => 'Oracle', 'SCHEMA' => 'oracle', 'MODULE' => 'oci8', - 'DELIM' => '/', + 'DELIM' => ';', 'DRIVER' => 'phpbb\db\driver\oracle', 'AVAILABLE' => true, '2.0.x' => false, diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php index 54114e3f9c..ba439609ff 100644 --- a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php +++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php @@ -151,10 +151,6 @@ class add_config_settings extends \phpbb\install\task_base VALUES ('default_lang', '" . $this->db->sql_escape($this->install_config->get('default_lang')) . "')", 'UPDATE ' . $this->config_table . " - SET config_value = '" . $this->db->sql_escape($this->install_config->get('img_imagick')) . "' - WHERE config_name = 'img_imagick'", - - 'UPDATE ' . $this->config_table . " SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_name')) . "' WHERE config_name = 'server_name'", diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_imagick_path.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_imagick_path.php deleted file mode 100644 index 377d96ed1a..0000000000 --- a/phpBB/phpbb/install/module/obtain_data/task/obtain_imagick_path.php +++ /dev/null @@ -1,89 +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\install\module\obtain_data\task; - -class obtain_imagick_path extends \phpbb\install\task_base implements \phpbb\install\task_interface -{ - /** - * @var \phpbb\install\helper\config - */ - protected $config; - - /** - * Constructor - * - * @param \phpbb\install\helper\config $config Installer's config - */ - public function __construct(\phpbb\install\helper\config $config) - { - $this->config = $config; - - parent::__construct(true); - } - - /** - * {@inheritdoc} - */ - public function run() - { - // Can we find ImageMagick anywhere on the system? - $exe = (DIRECTORY_SEPARATOR == '\\') ? '.exe' : ''; - - $magic_home = getenv('MAGICK_HOME'); - $img_imagick = ''; - if (empty($magic_home)) - { - $locations = array('C:/WINDOWS/', 'C:/WINNT/', 'C:/WINDOWS/SYSTEM/', 'C:/WINNT/SYSTEM/', 'C:/WINDOWS/SYSTEM32/', 'C:/WINNT/SYSTEM32/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/', '/opt/', '/usr/imagemagick/', '/usr/bin/imagemagick/'); - $path_locations = str_replace('\\', '/', (explode(($exe) ? ';' : ':', getenv('PATH')))); - - $locations = array_merge($path_locations, $locations); - foreach ($locations as $location) - { - // The path might not end properly, fudge it - if (substr($location, -1, 1) !== '/') - { - $location .= '/'; - } - - if (@file_exists($location) && @is_readable($location . 'mogrify' . $exe) && @filesize($location . 'mogrify' . $exe) > 3000) - { - $img_imagick = str_replace('\\', '/', $location); - continue; - } - } - } - else - { - $img_imagick = str_replace('\\', '/', $magic_home); - } - - $this->config->set('img_imagick', $img_imagick); - } - - /** - * {@inheritdoc} - */ - static public function get_step_count() - { - return 0; - } - - /** - * {@inheritdoc} - */ - public function get_task_lang_name() - { - return ''; - } -} diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index ac6bb3c6da..52c650df5d 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -899,32 +899,19 @@ class manager */ public function get_notification_type_id($notification_type_name) { - $notification_type_ids = $this->cache->get('notification_type_ids'); - - $this->db->sql_transaction('begin'); - - if ($notification_type_ids === false) + $sql = 'SELECT notification_type_id, notification_type_name + FROM ' . $this->notification_types_table; + $result = $this->db->sql_query($sql, 604800); // cache for one week + while ($row = $this->db->sql_fetchrow($result)) { - $notification_type_ids = array(); - - $sql = 'SELECT notification_type_id, notification_type_name - FROM ' . $this->notification_types_table; - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - $notification_type_ids[$row['notification_type_name']] = (int) $row['notification_type_id']; - } - $this->db->sql_freeresult($result); - - $this->cache->put('notification_type_ids', $notification_type_ids); + $notification_type_ids[$row['notification_type_name']] = (int) $row['notification_type_id']; } + $this->db->sql_freeresult($result); if (!isset($notification_type_ids[$notification_type_name])) { if (!isset($this->notification_types[$notification_type_name]) && !isset($this->notification_types['notification.type.' . $notification_type_name])) { - $this->db->sql_transaction('rollback'); - throw new \phpbb\notification\exception('NOTIFICATION_TYPE_NOT_EXIST', array($notification_type_name)); } @@ -934,13 +921,13 @@ class manager )); $this->db->sql_query($sql); + // expose new notification type ID for this request $notification_type_ids[$notification_type_name] = (int) $this->db->sql_nextid(); - $this->cache->put('notification_type_ids', $notification_type_ids); + // destroy cache, we have a new addition which we have to to load next time + $this->cache->destroy('sql', $this->notification_types_table); } - $this->db->sql_transaction('commit'); - return $notification_type_ids[$notification_type_name]; } diff --git a/phpBB/phpbb/notification/method/board.php b/phpBB/phpbb/notification/method/board.php index 931b252daa..faa53576e0 100644 --- a/phpBB/phpbb/notification/method/board.php +++ b/phpBB/phpbb/notification/method/board.php @@ -394,6 +394,6 @@ class board extends \phpbb\notification\method\base WHERE notification_type_id = ' . (int) $notification_type_id; $this->db->sql_query($sql); - $this->cache->destroy('notification_type_ids'); + $this->cache->destroy('sql', $this->notification_types_table); } } diff --git a/phpBB/phpbb/notification/method/email.php b/phpBB/phpbb/notification/method/email.php index 56dd1e9367..6376d13dc7 100644 --- a/phpBB/phpbb/notification/method/email.php +++ b/phpBB/phpbb/notification/method/email.php @@ -65,7 +65,7 @@ class email extends \phpbb\notification\method\messenger_base */ public function is_available(type_interface $notification_type = null) { - return parent::is_available($notification_type) && $this->config['email_enable'] && $this->user->data['user_email']; + return parent::is_available($notification_type) && $this->config['email_enable'] && !empty($this->user->data['user_email']); } /** diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 2ba6d185ad..202e29ce00 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -201,7 +201,8 @@ class context $pos = strpos($blocks[$i], '['); $name = ($pos !== false) ? substr($blocks[$i], 0, $pos) : $blocks[$i]; $block = &$block[$name]; - $index = (!$pos || strpos($blocks[$i], '[]') === $pos) ? (count($block) - 1) : (min((int) substr($blocks[$i], $pos + 1, -1), count($block) - 1)); + $block_count = empty($block) ? 0 : count($block) - 1; + $index = (!$pos || strpos($blocks[$i], '[]') === $pos) ? $block_count : (min((int) substr($blocks[$i], $pos + 1, -1), $block_count)); $block = &$block[$index]; } diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index 6d50eafc9d..12034b7820 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -50,7 +50,12 @@ abstract class includeasset extends \Twig_Node ->write("\$asset->set_path(\$local_file, true);\n") ->outdent() ->write("}\n") - ->write("\$asset->add_assets_version('{$config['assets_version']}');\n") + ->outdent() + ->write("}\n") + ->write("\n") + ->write("if (\$asset->is_relative()) {\n") + ->indent() + ->write("\$asset->add_assets_version('{$config['assets_version']}');\n") ->outdent() ->write("}\n") ->write("\$this->getEnvironment()->get_assets_bag()->add_{$this->get_setters_name()}(\$asset);") diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index ca0e5872e4..7363290e11 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -343,7 +343,7 @@ class user extends \phpbb\session } // Is board disabled and user not an admin or moderator? - if ($config['board_disable'] && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) + if ($config['board_disable'] && !defined('IN_INSTALL') && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) { if ($this->data['is_bot']) { |