diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index c5b44fc..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,14 +0,0 @@ -# These are supported funding model platforms - -github: rmcgirr83 -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry -polar: # Replace with a single Polar username -buy_me_a_coffee: rmcgirr83 -custom: https://www.paypal.com/paypalme/rmcgirr83 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..ef48cd3 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,38 @@ +name: Lint + +# PHP syntax check on the lowest PHP version this extension supports and the +# newest one phpBB 3.3 supports. tests.yml covers PHP 8.2 with phpBB's own +# checks (code sniffer, EPV). +on: + push: + branches: + - master + pull_request: + branches: + - master + +permissions: + contents: read + +jobs: + lint: + name: PHP ${{ matrix.php }} lint + runs-on: ubuntu-latest + strategy: + matrix: + php: ['7.4', '8.4'] + steps: + - uses: actions/checkout@v4 + + - name: Set up PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + tools: composer:v2 + + - name: PHP syntax check + run: find . -name '*.php' -not -path './.git/*' -not -path './vendor/*' -print0 | xargs -0 -n1 php -l + + - name: Validate composer.json + run: composer validate --no-check-all --no-check-publish diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4ef4b05..897f464 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,7 +1,7 @@ name: Tests env: - EXTNAME: rmcgirr83/contactadmin # Your extension vendor/package name + EXTNAME: phpbbmodders/contactadmin # Your extension vendor/package name SNIFF: 1 # Run code sniffer on your code? 1 or 0 IMAGE_ICC: 1 # Run icc profile sniffer on your images? 1 or 0 EPV: 1 # Run EPV (Extension Pre Validator) on your code? 1 or 0 diff --git a/README.MD b/README.MD deleted file mode 100644 index 5bdb0b1..0000000 --- a/README.MD +++ /dev/null @@ -1,26 +0,0 @@ -#  Contact Admin for phpBB3 - -phpBB extension that allows guests and/or registered users to either send an email to admins or to either send a PM or make a Post in a designated forum. It also overrides the default contact admin link found on the forum. A port of the phpBB 3.0.x mod “Contact Board Administration” - -[](https://github.com/rmcgirr83/contactadmin/actions) - -## Installation - -### 1. clone -Clone (or download and move) the repository into the folder ext/rmcgirr83/contactadmin: - -``` -cd phpBB3 -git clone https://github.com/rmcgirr83/contactadmin.git ext/rmcgirr83/contactadmin/ -``` - -### 2. activate -Go to admin panel -> tab customise -> Manage extensions -> enable Contact Admin - -Within the Admin panel visit the Extensions tab and choose the settings for the extension. - -## Update instructions: -1. Go to you phpBB-Board > Admin Control Panel > Customise > Manage extensions > Contact Admin: disable -2. Delete all files of the extension from ext/rmcgirr83/contactadmin -3. Upload all the new files to the same locations -4. Go to you phpBB-Board > Admin Control Panel > Customise > Manage extensions > Contact Admin: enable diff --git a/README.md b/README.md new file mode 100644 index 0000000..2ee78c6 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# Contact Admin + +[](https://github.com/phpbbmodders/contactadmin/actions/workflows/tests.yml) [](https://github.com/phpbbmodders/contactadmin/actions/workflows/lint.yml) + +A contact form that lets guests and members reach the board administrators by email, private message or forum post. + +## Features + +- Replaces phpBB's built-in contact page and links to it from the header, the footer, failed logins and the registration page. +- Messages go out by email, as a private message, or as a post in a forum you choose. Send to all administrators, the board founder or the board's default email address. +- Optional list of contact reasons for the sender to pick from. +- Private messages and posts can come from a "contact bot" user, for guests only or for everyone. +- Optional CAPTCHA (for everyone or guests only, with an attempt limit), attachments, a privacy-policy checkbox, and checks that stop guests from using a registered member's username or email address. +- Settings under **ACP → Extensions → Contact Admin**. +- Works with [Stop Forum Spam](https://github.com/phpbbmodders/stopforumspam), which can check messages sent through the form. + +## Requirements + +- phpBB 3.3.19 or later +- PHP 7.4 or later + +## Installation + +1. Copy the extension to `/ext/phpbbmodders/contactadmin` +2. In the Administration Control Panel, go to **Customise → Manage extensions** +3. Enable the **Contact Admin** extension +4. Choose the settings under **ACP → Extensions → Contact Admin** + +### Upgrading from `rmcgirr83/contactadmin` + +This extension used to be installed as `rmcgirr83/contactadmin`. Your settings carry over: + +1. Disable the old **Contact Admin** extension in the ACP. Do **not** delete its data. +2. Upload this version to `/ext/phpbbmodders/contactadmin` and enable it. The old install's migration history and ACP module are moved to the new name automatically. +3. Delete the `/ext/rmcgirr83/contactadmin` folder and purge the board cache. + +If you use [Stop Forum Spam](https://github.com/phpbbmodders/stopforumspam), update it as well so it keeps checking the contact form. + +If you disable the old extension from the command line (`bin/phpbbcli.php`) instead of the ACP, run `bin/phpbbcli.php cache:purge` before enabling the new one; the command-line disable doesn't clear the cache. + +## Contributing + +Contributions are welcome! + +- **Bug reports**: [Open an issue](https://github.com/phpbbmodders/contactadmin/issues). +- **Everything else** (questions, feature requests, ideas, general discussion): [Use Discussions](https://github.com/orgs/phpbbmodders/discussions), or the [community forum](https://www.phpbbmodders.com/community/). +- Pull requests are welcome for bug fixes or discussed features. + +## Acknowledgments + +- A port of the phpBB 3.0 **Contact Board Administration** MOD. +- Extension by Rich McGirr ([RMcGirr83](https://github.com/rmcgirr83)). +- Code review, bug fixes, and documentation assisted by [Claude](https://www.anthropic.com/claude). + +## License + +This extension is licensed under the **GNU General Public License v2.0**. + +See [license.txt](license.txt) for more information. diff --git a/acp/contactadmin_info.php b/acp/contactadmin_info.php index 926a4a4..ea39166 100644 --- a/acp/contactadmin_info.php +++ b/acp/contactadmin_info.php @@ -1,24 +1,25 @@ '\rmcgirr83\contactadmin\acp\contactadmin_module', + 'filename' => '\phpbbmodders\contactadmin\acp\contactadmin_module', 'title' => 'ACP_CAT_CONTACTADMIN', 'version' => '1.0.0', 'modes' => [ - 'configuration' => ['title' => 'ACP_CONTACTADMIN_CONFIG', 'auth' => 'ext_rmcgirr83/contactadmin && acl_a_board', 'cat' => ['ACP_CAT_CONTACTADMIN']], + 'configuration' => ['title' => 'ACP_CONTACTADMIN_CONFIG', 'auth' => 'ext_phpbbmodders/contactadmin && acl_a_board', 'cat' => ['ACP_CAT_CONTACTADMIN']], ], ]; } diff --git a/acp/contactadmin_module.php b/acp/contactadmin_module.php index bc46c63..b6e4180 100644 --- a/acp/contactadmin_module.php +++ b/acp/contactadmin_module.php @@ -1,14 +1,15 @@ page_title = $phpbb_container->get('language')->lang('ACP_CAT_CONTACTADMIN'); // Get an instance of the admin controller - $admin_controller = $phpbb_container->get('rmcgirr83.contactadmin.admin.controller'); + $admin_controller = $phpbb_container->get('phpbbmodders.contactadmin.admin.controller'); // Make the $u_action url available in the admin controller $admin_controller->set_page_url($this->u_action); diff --git a/adm/style/acp_contactadmin.html b/adm/style/acp_contactadmin.html index a64b837..15947e2 100644 --- a/adm/style/acp_contactadmin.html +++ b/adm/style/acp_contactadmin.html @@ -7,13 +7,6 @@ var imageTag = false;
{{ CONTACT_ERROR }}
diff --git a/composer.json b/composer.json index 3343157..489aa52 100644 --- a/composer.json +++ b/composer.json @@ -1,25 +1,32 @@ { - "name": "rmcgirr83/contactadmin", + "name": "phpbbmodders/contactadmin", "type": "phpbb-extension", - "description": "This form allows guests and/or registered users to either send an email to admins or to either send a PM or make a Post in a designated forum. It also overrides the default contact admin link found on the forum. A port of the phpBB 3.0.x mod “Contact Board Adminnistration”", - "homepage": "https://github.com/rmcgirr83/contactadmin", + "description": "A contact form that lets guests and members reach the board administrators by email, private message or forum post.", + "homepage": "https://www.phpbbmodders.com/", "version": "1.4.4", "time": "2025-01-15", "keywords": [ "phpbb", "extension", - "contact admin" + "contact admin", + "contact-form" ], "license": "GPL-2.0-only", "authors": [ + { + "name": "phpBB Modders", + "email": "board@phpbbmodders.com", + "homepage": "https://www.phpbbmodders.com/", + "role": "Extension Developer" + }, { "name": "Rich McGirr", - "role": "Developer" + "role": "Past Developer" } ], "require": { "php": ">=7.4", - "phpbb/phpbb": ">=3.3", + "phpbb/phpbb": ">=3.3.19", "composer/installers": "^1.0 || ^2.0" }, "require-dev": { @@ -28,7 +35,7 @@ "extra": { "display-name": "Contact Admin", "soft-require": { - "phpbb/phpbb": ">=3.3" + "phpbb/phpbb": ">=3.3.19,<4.0.0@dev" }, "version-check": { "host": "www.phpbb.com", diff --git a/config/routing.yml b/config/routing.yml index 329a329..099876f 100644 --- a/config/routing.yml +++ b/config/routing.yml @@ -1,9 +1,9 @@ -rmcgirr83_contactadmin_displayform: +phpbbmodders_contactadmin_displayform: path: /contactadmin - defaults: { _controller: rmcgirr83.contactadmin.main.controller:displayform } + defaults: { _controller: phpbbmodders.contactadmin.main.controller:displayform } -rmcgirr83_contactadmin_botuserinfo: +phpbbmodders_contactadmin_botuserinfo: path: /contact_bot_info/{user_id} - defaults: { _controller: rmcgirr83.contactadmin.core:bot_user_info } + defaults: { _controller: phpbbmodders.contactadmin.core:bot_user_info } requirements: user_id: \d+ \ No newline at end of file diff --git a/config/services.yml b/config/services.yml index 3edb049..41fe806 100644 --- a/config/services.yml +++ b/config/services.yml @@ -2,8 +2,8 @@ imports: - {resource: contact_constants.yml} services: - rmcgirr83.contactadmin.admin.controller: - class: rmcgirr83\contactadmin\controller\admin_controller + phpbbmodders.contactadmin.admin.controller: + class: phpbbmodders\contactadmin\controller\admin_controller arguments: - '@auth' - '@config' @@ -15,13 +15,13 @@ services: - '@request' - '@template' - '@user' - - '@rmcgirr83.contactadmin.core' + - '@phpbbmodders.contactadmin.core' - '%core.root_path%' - '%core.php_ext%' - '%contact_constants%' - rmcgirr83.contactadmin.main.controller: - class: rmcgirr83\contactadmin\controller\main_controller + phpbbmodders.contactadmin.main.controller: + class: phpbbmodders\contactadmin\controller\main_controller arguments: - '@auth' - '@config' @@ -34,14 +34,14 @@ services: - '@request' - '@template' - '@user' - - '@rmcgirr83.contactadmin.core' + - '@phpbbmodders.contactadmin.core' - '@captcha.factory' - '%core.root_path%' - '%core.php_ext%' - '%contact_constants%' - rmcgirr83.contactadmin.listener: - class: rmcgirr83\contactadmin\event\listener + phpbbmodders.contactadmin.listener: + class: phpbbmodders\contactadmin\event\listener arguments: - '@config' - '@controller.helper' @@ -51,8 +51,8 @@ services: tags: - { name: event.listener } - rmcgirr83.contactadmin.core: - class: rmcgirr83\contactadmin\core\contactadmin + phpbbmodders.contactadmin.core: + class: phpbbmodders\contactadmin\core\contactadmin arguments: - '@auth' - '@cache' diff --git a/controller/admin_controller.php b/controller/admin_controller.php index d01ca3d..c5136b9 100644 --- a/controller/admin_controller.php +++ b/controller/admin_controller.php @@ -1,14 +1,15 @@ language->add_lang(['acp/board', 'posting']); - $this->language->add_lang('acp_contact', 'rmcgirr83/contactadmin'); + $this->language->add_lang('acp_contact', 'phpbbmodders/contactadmin'); // Create a form key for preventing CSRF attacks add_form_key('contactadmin_settings'); @@ -295,7 +296,7 @@ public function display_options() 'S_BBCODE_FLASH' => true, 'S_LINKS_ALLOWED' => true, - 'AJAX_BOT_USER_INFO' => $this->helper->route('rmcgirr83_contactadmin_botuserinfo', ['user_id' => (int) $this->config['contactadmin_bot_user']]), + 'AJAX_BOT_USER_INFO' => $this->helper->route('phpbbmodders_contactadmin_botuserinfo', ['user_id' => (int) $this->config['contactadmin_bot_user']]), 'U_ACTION' => $this->u_action, ]); diff --git a/controller/main_controller.php b/controller/main_controller.php index 3ea0ed8..097039f 100644 --- a/controller/main_controller.php +++ b/controller/main_controller.php @@ -1,13 +1,14 @@ language->add_lang(['ucp', 'posting']); - $this->language->add_lang('contact', 'rmcgirr83/contactadmin'); + $this->language->add_lang('contact', 'phpbbmodders/contactadmin'); // move this from the constructor so the query isn't run on every page $contact_reasons = $this->db_text->get_array(['contactadmin_reasons']); @@ -390,13 +391,13 @@ public function displayform() /** * Modify data and error strings * - * @event rmcgirr83.contactadmin.modify_data_and_error + * @event phpbbmodders.contactadmin.modify_data_and_error * @var array error Error strings * @var array data An array with data * @since 1.0.0 */ $vars = ['error', 'data']; - extract($this->dispatcher->trigger_event('rmcgirr83.contactadmin.modify_data_and_error', compact($vars))); + extract($this->dispatcher->trigger_event('phpbbmodders.contactadmin.modify_data_and_error', compact($vars))); // no errors, let's proceed if (!sizeof($error)) @@ -518,7 +519,7 @@ public function displayform() // build an array of all lang directories for the extension and check to make sure we have the lang available that is being chosen // if the lang isn't present then errors will present themselves due to no email template found - $dir_array = $this->contactadmin->dir_to_array($this->root_path .'ext/rmcgirr83/contactadmin/language'); + $dir_array = $this->contactadmin->dir_to_array($this->root_path .'ext/phpbbmodders/contactadmin/language'); $size = count($contact_users); // Loop through our list of users @@ -550,7 +551,7 @@ public function displayform() // now check if the email template may exist. Can't be helped if there is a lang dir and no email dir // use en if not exist $contact_users[$i]['user_lang'] = (in_array($contact_users[$i]['user_lang'], $dir_array)) ? $contact_users[$i]['user_lang'] : 'en'; - $messenger->template('@rmcgirr83_contactadmin/contact', $contact_users[$i]['user_lang']); + $messenger->template('@phpbbmodders_contactadmin/contact', $contact_users[$i]['user_lang']); $messenger->to($contact_users[$i]['user_email'], $contact_users[$i]['username']); $messenger->im($contact_users[$i]['user_jabber'], $contact_users[$i]['username']); @@ -674,7 +675,7 @@ public function displayform() 'S_CONTACT_ADMIN' => true, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_ERROR' => (isset($error) && count($error)) ? implode('