From 6302ea841cb418aae4e8ce8c61c46ef1149eba7c Mon Sep 17 00:00:00 2001 From: battye Date: Tue, 26 Dec 2023 15:30:26 +0800 Subject: [PATCH 1/8] First attempt at Codespaces --- .devcontainer/Dockerfile | 20 +++++++++++ .devcontainer/devcontainer.json | 37 ++++++++++++++++++++ .devcontainer/resources/phpbb-config.yml | 38 ++++++++++++++++++++ .devcontainer/resources/setup.sh | 44 ++++++++++++++++++++++++ .devcontainer/resources/xdebug.ini | 11 ++++++ .vscode/launch.json | 18 ++++++++++ .vscode/settings.json | 3 ++ 7 files changed, 171 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/resources/phpbb-config.yml create mode 100644 .devcontainer/resources/setup.sh create mode 100644 .devcontainer/resources/xdebug.ini create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..ceb94dc09 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,20 @@ +# Debian version +ARG VARIANT="buster" +FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} + +# Install PHP +RUN apt-get -y update +RUN apt-get -y install php php-xml php-mbstring php-curl php-zip php-xdebug + +# Install Composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +# Install MySQL +RUN apt-get -y install mysql-server php-mysql + +# Xdebug +ADD resources/xdebug.ini /etc/php/8.1/apache2/conf.d/xdebug.ini + +# Configure Apache +RUN echo "Listen 8080" >> /etc/apache2/ports.conf && \ + a2enmod rewrite diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..7bb0e9cc3 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,37 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/ubuntu +{ + "name": "Ubuntu", + "build": { + "dockerfile": "Dockerfile", + // Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04 + // Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon. + "args": { "VARIANT": "ubuntu-22.04" } + }, + + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + "settings": { + // Allow Xdebug to listen to requests from remote (or container) + "remote.localPortHost": "allInterfaces" + }, + //"devPort": {}, + // Specify which VS Code extensions to install (List of IDs) + "extensions": ["xdebug.php-debug"] + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [80, 9003], + + // Use 'postCreateCommand' to run commands after the container is created. + "postStartCommand": "bash .devcontainer/resources/setup.sh", + + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "features": { + "github-cli": "latest" + } +} diff --git a/.devcontainer/resources/phpbb-config.yml b/.devcontainer/resources/phpbb-config.yml new file mode 100644 index 000000000..75a70ea9a --- /dev/null +++ b/.devcontainer/resources/phpbb-config.yml @@ -0,0 +1,38 @@ +installer: + admin: + name: admin + password: adminadmin + email: admin@example.org + + board: + lang: en + name: My Board + description: My amazing new phpBB board (Titania) + + database: + dbms: mysqli + dbhost: 127.0.0.1 + dbport: 3306 + dbuser: phpbb + dbpasswd: phpbb + dbname: phpbb + table_prefix: phpbb_ + + email: + enabled: false + smtp_delivery : ~ + smtp_host: ~ + smtp_port: ~ + smtp_auth: ~ + smtp_user: ~ + smtp_pass: ~ + + server: + cookie_secure: false + server_protocol: http:// + force_server_vars: false + server_name: localhost + server_port: 80 + script_path: / + + extensions: ['phpbb/titania'] diff --git a/.devcontainer/resources/setup.sh b/.devcontainer/resources/setup.sh new file mode 100644 index 000000000..6c634038c --- /dev/null +++ b/.devcontainer/resources/setup.sh @@ -0,0 +1,44 @@ +# Copy Apache configuration +# sudo rm /etc/apache2/sites-enabled/000-default.conf +# sudo cp .devcontainer/resources/phpbb-apache.conf /etc/apache2/sites-enabled/000-default.conf + +# Start MySQL +sudo service mysql start + +# Start Apache +sudo service apache2 start + +# Add SSH key +echo "$SSH_KEY" > /home/vscode/.ssh/id_rsa && chmod 600 /home/vscode/.ssh/id_rsa + +# Create a MySQL user to use +sudo mysql -u root< Date: Tue, 26 Dec 2023 12:13:33 +0000 Subject: [PATCH 2/8] Fix routes --- README.md | 6 ++++++ controller/helper.php | 4 +++- controller/manage/manage.php | 2 +- styles/all/template/event/overall_header_head_append.html | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b2a0288e8..c2dd784a3 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,12 @@ If you have a translation please read the information on patches. You can get involved by reporting bugs in the bug tracker (see below) and providing patches/improvements (see above). +### Codespaces + +This project can be run in GitHub Codespaces by following the link under port 80 in the `Ports` tab and then navigating to `/app.php/db` in the browser. + +If you run Titania in GitHub Codespaces, make sure to update the server name in ACP -> Server Settings -> Domain Name to match the Codespaces URL. Set `Force server URL settings` to `Yes`. + ## Bug Tracker If you find a bug, please submit it to the [Customisations Database](https://github.com/phpbb/customisation-db/issues) bug tracker. diff --git a/controller/helper.php b/controller/helper.php index c34845106..de6cc2afb 100644 --- a/controller/helper.php +++ b/controller/helper.php @@ -131,7 +131,9 @@ public function route($route, array $params = array(), $is_amp = true, $session_ { $route = parent::route($route, $params, $is_amp, $session_id, $reference_type); - return ($this->config->offsetGet('cookie_secure') && strpos($route, 'http://') === 0) ? 'https://' . substr($route, 7) : $route; + $full_route = ($this->config->offsetGet('cookie_secure') && strpos($route, 'http://') === 0) ? 'https://' . substr($route, 7) : $route; + + return $this->get_real_url($full_route); } /** diff --git a/controller/manage/manage.php b/controller/manage/manage.php index 33de24873..0d64e0d8a 100644 --- a/controller/manage/manage.php +++ b/controller/manage/manage.php @@ -29,7 +29,7 @@ public function base() { if ($page['auth']) { - redirect($page['url']); + redirect($page['url'], false, true); } } diff --git a/styles/all/template/event/overall_header_head_append.html b/styles/all/template/event/overall_header_head_append.html index 4f9325206..72e6418af 100644 --- a/styles/all/template/event/overall_header_head_append.html +++ b/styles/all/template/event/overall_header_head_append.html @@ -1,5 +1,5 @@ {% if S_IN_TITANIA %} - {% INCLUDECSS '@phpbb_titania/stylesheet.css' %} + {% INCLUDECSS T_TITANIA_THEME_PATH ~ '/stylesheet.css' %} {% if S_PLUPLOAD_EXT %} {% INCLUDECSS T_THEME_PATH ~ '/plupload.css?assets_version=' ~ T_ASSETS_VERSION %} {% endif %} From 04b74ed208d02c6cd5211de324774dcee8e536ff Mon Sep 17 00:00:00 2001 From: battye Date: Mon, 29 Jan 2024 08:35:33 +0000 Subject: [PATCH 3/8] Fix link for tag in breadcrumbs --- controller/manage/queue/item.php | 10 +++++++++- controller/manage/queue/queue.php | 1 + includes/objects/queue.php | 31 +++++++++++++++++++++++-------- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/controller/manage/queue/item.php b/controller/manage/queue/item.php index f7451c6fe..f567959b3 100644 --- a/controller/manage/queue/item.php +++ b/controller/manage/queue/item.php @@ -85,6 +85,11 @@ public function display_item($id) return $this->helper->needs_auth(); } + // Create type link information for tags (e.g., make sure the tag hyperlinks back to the type) + $queue_type = $this->types->get($this->queue->queue_type); + $queue_type_name = $queue_type->name; + $queue_type_url = $queue_type->url; + // Display the main queue item $data = \queue_overlord::display_queue_item($this->id); @@ -96,11 +101,14 @@ public function display_item($id) $tag = $this->request->variable('tag', 0); + // Make sure the item category is added to the breadcrumb. + // If the user clicks on a tag (e.g., a tag like "New" or "All") + // then this part ensures it gets added to the navigation breadcrumbs if ($tag) { // Add tag to Breadcrumbs $this->display->generate_breadcrumbs(array( - $this->tags->get_tag_name($tag) => $this->queue->get_url(false, array('tag' => $tag)), + $this->tags->get_tag_name($tag) => $this->queue->get_url(false, array('tag' => $tag), [$queue_type_name => $queue_type_url]), )); } diff --git a/controller/manage/queue/queue.php b/controller/manage/queue/queue.php index 27c12c5de..2b14c6a11 100644 --- a/controller/manage/queue/queue.php +++ b/controller/manage/queue/queue.php @@ -90,6 +90,7 @@ public function display_queue($queue_type) // Add to Breadcrumbs $this->display->generate_breadcrumbs(array( + // This is where the type gets displayed $this->type->lang['lang'] => $this->get_queue_url($this->type->id), )); diff --git a/includes/objects/queue.php b/includes/objects/queue.php index ff7ad54ff..04e4020eb 100644 --- a/includes/objects/queue.php +++ b/includes/objects/queue.php @@ -668,20 +668,35 @@ public function get_queue_discussion_topic($check_only = false) * * @param bool|string $action Optional action to link to. * @param array $params Optional parameters to add to URL. + * @param array $tag Optional link to type if tags shown * * @return string Returns generated URL. */ - public function get_url($action = false, $params = array()) + public function get_url($action = false, $params = array(), $tag = false) { - $controller = 'phpbb.titania.queue.item'; - $params += array( - 'id' => $this->queue_id, - ); + if (!$tag) + { + $controller = 'phpbb.titania.queue.item'; + $params += array( + 'id' => $this->queue_id, + ); + + if ($action) + { + $controller .= '.action'; + $params['action'] = $action; + } + } - if ($action) + else { - $controller .= '.action'; - $params['action'] = $action; + // Link back to the correct type if the tag is shown + $type_name = array_key_first($tag); + + $controller = 'phpbb.titania.queue.type'; + $params += [ + 'queue_type' => $tag[$type_name], + ]; } return $this->controller_helper->route($controller, $params); From 172d3cf8af4b71e0fb4a123ab11419040a3c5f69 Mon Sep 17 00:00:00 2001 From: battye Date: Thu, 30 May 2024 07:45:38 +0000 Subject: [PATCH 4/8] Might have to undo this commit --- .devcontainer/devcontainer.json | 4 ++++ .devcontainer/resources/setup.sh | 9 ++++++--- .devcontainer/resources/xdebug.ini | 2 ++ README.md | 2 +- test1.php | 5 +++++ 5 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 test1.php diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7bb0e9cc3..d046885b7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -29,6 +29,10 @@ // Use 'postCreateCommand' to run commands after the container is created. "postStartCommand": "bash .devcontainer/resources/setup.sh", + "remoteEnv": { + "PHPBB__CODESPACESX12": "true" + }, + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", "features": { diff --git a/.devcontainer/resources/setup.sh b/.devcontainer/resources/setup.sh index 6c634038c..c88cdbe4b 100644 --- a/.devcontainer/resources/setup.sh +++ b/.devcontainer/resources/setup.sh @@ -28,17 +28,20 @@ composer create-project --no-interaction phpbb/phpbb /workspaces/phpbb # Copy phpBB config echo "Copy phpBB config" -cp /workspaces/customisation-db/.devcontainer/resources/phpbb-config.yml /workspaces/phpbb/install/install-config.yml +sudo cp /workspaces/customisation-db/.devcontainer/resources/phpbb-config.yml /workspaces/phpbb/install/install-config.yml + +# https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace +sudo export PHPBB__CODESPACESX=$CODESPACES echo "Symlink extension" sudo rm -rf /var/www/html sudo ln -s /workspaces/phpbb /var/www/html -mkdir /workspaces/phpbb/ext/phpbb +sudo mkdir /workspaces/phpbb/ext/phpbb sudo ln -s /workspaces/customisation-db /workspaces/phpbb/ext/phpbb/titania echo "phpBB CLI install" cd /workspaces/phpbb && composer install --no-interaction sudo php /workspaces/phpbb/install/phpbbcli.php install /workspaces/phpbb/install/install-config.yml -rm -rf /workspaces/phpbb/install +sudo rm -rf /workspaces/phpbb/install echo "Completed" diff --git a/.devcontainer/resources/xdebug.ini b/.devcontainer/resources/xdebug.ini index 495314427..1ae163ec1 100644 --- a/.devcontainer/resources/xdebug.ini +++ b/.devcontainer/resources/xdebug.ini @@ -9,3 +9,5 @@ xdebug.start_with_request=yes xdebug.log='/var/log/xdebug/xdebug.log' xdebug.connect_timeout_ms=2000 xdebug.idekey=VSCODE + +variables_order = "EGPCS" \ No newline at end of file diff --git a/README.md b/README.md index c2dd784a3..9925117f3 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ You can get involved by reporting bugs in the bug tracker (see below) and provid This project can be run in GitHub Codespaces by following the link under port 80 in the `Ports` tab and then navigating to `/app.php/db` in the browser. -If you run Titania in GitHub Codespaces, make sure to update the server name in ACP -> Server Settings -> Domain Name to match the Codespaces URL. Set `Force server URL settings` to `Yes`. +If you run Titania in GitHub Codespaces, make sure to update the server name in ACP -> Server Settings -> Domain Name to match the Codespaces URL. Set the port to 443, copy the server name provided by GitHub automatically when the Codespace is created, and then set `Force server URL settings` to `Yes`. ## Bug Tracker diff --git a/test1.php b/test1.php new file mode 100644 index 000000000..8dfaaa6a3 --- /dev/null +++ b/test1.php @@ -0,0 +1,5 @@ + \ No newline at end of file From 44233670aba0edb08ca4bb4b00d34efc1d45e23a Mon Sep 17 00:00:00 2001 From: battye Date: Thu, 30 May 2024 10:02:09 +0000 Subject: [PATCH 5/8] Parse contrib name so emojis can be used --- config/controllers.yml | 1 + controller/contribution/manage.php | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/controllers.yml b/config/controllers.yml index 3b6bde8bb..59bce8908 100644 --- a/config/controllers.yml +++ b/config/controllers.yml @@ -196,6 +196,7 @@ services: - '@phpbb.titania.attachment.uploader' - '@phpbb.titania.attachment.uploader' - '@phpbb.titania.subscriptions' + - '@text_formatter.parser' phpbb.titania.controller.contrib.revision: class: phpbb\titania\controller\contribution\revision diff --git a/controller/contribution/manage.php b/controller/contribution/manage.php index a4ba5f753..971000329 100644 --- a/controller/contribution/manage.php +++ b/controller/contribution/manage.php @@ -37,6 +37,9 @@ class manage extends base /** @var \phpbb\titania\subscriptions */ protected $subscriptions; + /** @var \phpbb\textformatter\s9e\parser */ + protected $parser; + /** @var bool */ protected $is_moderator; @@ -68,8 +71,9 @@ class manage extends base * @param \phpbb\titania\attachment\uploader $screenshots * @param \phpbb\titania\attachment\uploader $colorizeit_sample * @param \phpbb\titania\subscriptions $subscriptions + * @param \phpbb\textformatter\s9e\parser $parser */ - public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\cache\service $cache, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\access $access, \phpbb\titania\message\message $message, \phpbb\titania\attachment\uploader $screenshots, \phpbb\titania\attachment\uploader $colorizeit_sample, \phpbb\titania\subscriptions $subscriptions) + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\cache\service $cache, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\access $access, \phpbb\titania\message\message $message, \phpbb\titania\attachment\uploader $screenshots, \phpbb\titania\attachment\uploader $colorizeit_sample, \phpbb\titania\subscriptions $subscriptions, \phpbb\textformatter\s9e\parser $parser) { parent::__construct($auth, $config, $db, $template, $user, $helper, $types, $request, $cache, $ext_config, $display, $access); @@ -77,6 +81,7 @@ public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config $this->screenshots = $screenshots; $this->colorizeit_sample = $colorizeit_sample; $this->subscriptions = $subscriptions; + $this->parser = $parser; } /** @@ -490,6 +495,9 @@ protected function submit($authors, $old_settings) // Set custom field values. $this->contrib->set_custom_fields($this->settings['custom']); + // Parse the contrib name so emojis can be used + $this->contrib->contrib_name = $this->parser->parse($this->contrib->contrib_name); + // Create relations $this->contrib->put_contrib_in_categories( $this->settings['categories'], From 63979364962b39dae0cd639ee45e42a8dc4adca4 Mon Sep 17 00:00:00 2001 From: battye Date: Mon, 10 Jun 2024 10:26:48 +0000 Subject: [PATCH 6/8] Bring in the s9e utils to unparse the contrib name - this fixes unparsing in both the contrib page title and the manage contrib form field --- config/controllers.yml | 1 + controller/contribution/manage.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/controllers.yml b/config/controllers.yml index 59bce8908..6f21073ae 100644 --- a/config/controllers.yml +++ b/config/controllers.yml @@ -197,6 +197,7 @@ services: - '@phpbb.titania.attachment.uploader' - '@phpbb.titania.subscriptions' - '@text_formatter.parser' + - '@text_formatter.utils' phpbb.titania.controller.contrib.revision: class: phpbb\titania\controller\contribution\revision diff --git a/controller/contribution/manage.php b/controller/contribution/manage.php index 971000329..82e949e0a 100644 --- a/controller/contribution/manage.php +++ b/controller/contribution/manage.php @@ -40,6 +40,9 @@ class manage extends base /** @var \phpbb\textformatter\s9e\parser */ protected $parser; + /** @var \phpbb\textformatter\s9e\utils */ + protected $utils; + /** @var bool */ protected $is_moderator; @@ -72,8 +75,9 @@ class manage extends base * @param \phpbb\titania\attachment\uploader $colorizeit_sample * @param \phpbb\titania\subscriptions $subscriptions * @param \phpbb\textformatter\s9e\parser $parser + * @param \phpbb\textformatter\s9e\utils $utils */ - public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\cache\service $cache, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\access $access, \phpbb\titania\message\message $message, \phpbb\titania\attachment\uploader $screenshots, \phpbb\titania\attachment\uploader $colorizeit_sample, \phpbb\titania\subscriptions $subscriptions, \phpbb\textformatter\s9e\parser $parser) + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\cache\service $cache, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\access $access, \phpbb\titania\message\message $message, \phpbb\titania\attachment\uploader $screenshots, \phpbb\titania\attachment\uploader $colorizeit_sample, \phpbb\titania\subscriptions $subscriptions, \phpbb\textformatter\s9e\parser $parser, \phpbb\textformatter\s9e\utils $utils) { parent::__construct($auth, $config, $db, $template, $user, $helper, $types, $request, $cache, $ext_config, $display, $access); @@ -82,6 +86,7 @@ public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config $this->colorizeit_sample = $colorizeit_sample; $this->subscriptions = $subscriptions; $this->parser = $parser; + $this->utils = $utils; } /** @@ -716,6 +721,10 @@ protected function assign_vars($error) $this->contrib->type->id ); } + + // Unparse the contrib name + $this->contrib->contrib_name = $this->utils->unparse($this->contrib->contrib_name); + $this->message->display(); $this->contrib->assign_details(); $this->display->assign_global_vars(); From 2c82532d3d73d1addc721e00616333264b649b96 Mon Sep 17 00:00:00 2001 From: battye Date: Mon, 24 Jun 2024 06:50:31 +0000 Subject: [PATCH 7/8] UNDO THIS --- attachment/plupload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attachment/plupload.php b/attachment/plupload.php index d30e46c1e..1820a10a2 100644 --- a/attachment/plupload.php +++ b/attachment/plupload.php @@ -26,7 +26,7 @@ public function configure_ext(\phpbb\titania\config\config $ext_config, \phpbb\t 'S_PLUPLOAD_EXT' => true, 'FILTERS' => $filters, 'CHUNK_SIZE' => $chunk_size, - 'S_PLUPLOAD_URL' => htmlspecialchars_decode($s_action), + 'S_PLUPLOAD_URL' => str_replace('http', 'https', htmlspecialchars_decode($s_action)), //TODO:fix this 'MAX_ATTACHMENTS' => $max_files, 'ATTACH_ORDER' => ($this->config['display_order']) ? 'asc' : 'desc', 'L_TOO_MANY_ATTACHMENTS' => $this->user->lang('TOO_MANY_ATTACHMENTS', $max_files), From 9c26c6347fc95336e5e90fb0dae8254aa5f4ae96 Mon Sep 17 00:00:00 2001 From: battye Date: Mon, 24 Jun 2024 06:51:50 +0000 Subject: [PATCH 8/8] Unparse contrib name when adding a new revision --- config/controllers.yml | 2 ++ controller/contribution/revision.php | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/config/controllers.yml b/config/controllers.yml index 6f21073ae..9d95c826a 100644 --- a/config/controllers.yml +++ b/config/controllers.yml @@ -218,6 +218,8 @@ services: - '@phpbb.titania.attachment.uploader' - '@phpbb.titania.subscriptions' - '@phpbb.titania.message' + - '@text_formatter.parser' + - '@text_formatter.utils' phpbb.titania.controller.contrib.revision.edit: class: phpbb\titania\controller\contribution\revision_edit diff --git a/controller/contribution/revision.php b/controller/contribution/revision.php index f163ccd4a..c309988c5 100644 --- a/controller/contribution/revision.php +++ b/controller/contribution/revision.php @@ -53,6 +53,12 @@ class revision extends base /** @var bool */ private $skip_epv = false; + /** @var \phpbb\textformatter\s9e\parser */ + protected $parser; + + /** @var \phpbb\textformatter\s9e\utils */ + protected $utils; + /** * Constructor * @@ -71,8 +77,10 @@ class revision extends base * @param \phpbb\titania\attachment\uploader $uploader * @param \phpbb\titania\subscriptions $subscriptions * @param \phpbb\titania\message\message $message + * @param \phpbb\textformatter\s9e\parser $parser + * @param \phpbb\textformatter\s9e\utils $utils */ - public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\cache\service $cache, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\access $access, \phpbb\titania\attachment\uploader $uploader, \phpbb\titania\subscriptions $subscriptions, \phpbb\titania\message\message $message) + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\cache\service $cache, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\access $access, \phpbb\titania\attachment\uploader $uploader, \phpbb\titania\subscriptions $subscriptions, \phpbb\titania\message\message $message, \phpbb\textformatter\s9e\parser $parser, \phpbb\textformatter\s9e\utils $utils) { parent::__construct($auth, $config, $db, $template, $user, $helper, $types, $request, $cache, $ext_config, $display, $access); @@ -80,6 +88,9 @@ public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config $this->subscriptions = $subscriptions; $this->message = $message; + $this->parser = $parser; + $this->utils = $utils; + // Increase timeout when dealing with revisions @set_time_limit(90); } @@ -217,6 +228,9 @@ public function add($contrib_type, $contrib) // Load the revisions for this contribution $this->contrib->get_revisions(); + // Unparse the contrib name + $this->contrib->contrib_name = $this->utils->unparse($this->contrib->contrib_name); + if (sizeof($this->contrib->revisions)) { // Find out what the previous revision was, if this is a new revision to an existing contribution