Phpbb3 posting php mode ангиома



Уведомление о личном сообщении открывается теперь не в отдельном всплывающем окне (которое обычно блокируется браузером), а на той же странице, где находится пользователь.



Встраиваемые в сообщения файлы не переносят строку, что что положительно сказывается на удобстве форматирования сообщения.



После bb-кодов [code], [quote] и [list] не вставляется пустая строка. Визуально темы будут казаться несколько короче :)



Опционально пользователи могут создавать открытые голосования, в которых видно кто и как проголосовал.



Администрация может выдавать три типа предупреждений: замечание, предупреждение и бан. Каждое предупреждение привязано к конкретному сообщению и имеет какой-то срок (кроме замечаний). Предупреждения и баны отображаются в минипрофиле в виде жёлтых и красных карточек. На данный момент все эти карточки носят лишь информационный характер. То есть, если выдать красную карточку (бан), само наказание для пользователя необходимо отдельно применить стандартными средствами форума. В следующих версиях будут созданы специальные группы, в которые система будет помещать пользователя при определённом количестве предупреждений или при бане, а для этих групп будут заданы ограниченные права.

  • Отключение обзора темы на странице полного ответа
  • Задание количества тем и количества сообщений на страницу (от 10 до 100)
  • Новые форматы даты, характерные для СНГ
  • Включение и выключение быстрого ответа и быстрых тем

  • Автоматическое ограничение на количество строк, картинок и ссылок в подписи
  • Право игнорировать ограничение времени редактирования сообщений
  • Задание ключевых слов сайта (meta keywords)
  • Редактирование блока внешних ссылок и уведомления об авторских правах
  • Запрет изменения пользователем стиля, часового пояса, языка
  • Автоматическая склейка подряд идущих сообщений от одного пользователя

Поскольку ресурсы на разработку и тестирование сильно ограничены, phpBBex ограничивается поддержкой русского и английского языков, базы данных MySQL и обновлённого стиля prosilver.

Процесс установки не отличается от phpBB 3. Также поддерживается конвертация уже установленного phpBB 3 в phpBBex. Для этого необходимо на обновлённой до phpBB 3.0.9 базе выполнить скрипт install/phpbbex.sql.
Последнюю версию проекта вы можете скачать на страничке phpbbex.googlecode.com.

This MOD for the phpBB3 forum stops almost all spam by disabling links and bad words in posts, messages, signatures, and profiles until new users reach a certain number of posts and/or age.

Contents

Features








  • Disables links and bad words in posts, messages, signatures, and profiles until a user reaches a specified age and/or number of posts
  • Own-site links are excluded from the filter, other sites can be added to a whitelist
  • Configurable list of forbidden filter words, optionally show the user the trigger term
  • Configurable unicode filters to prevent spam in languages not used in the forum
  • Prevents 'sleeper agents' by disabling posts, signatures, and profiles for old accounts with 0 posts (optional)
  • Zombie registration cleanup deletes old users with no posts (optional)
  • Protections are 'automatically' disabled after the criteria are met (no moderation required)

AUTOMOD

Thanks to Philthy there is now a phpBB3 AUTOMOD version of spam hammer.

AUTOMOD ISSUES

There are two minor automod issues, both are harmless.

SQL ERRORS ON UNINSTALL

  • Several empty SQL errors on uninstall.

I googled but didn't see how to fix it via automod. You can:

  1. Force uninstall anyways, it will just leave the settings in the database and they will be ignored.
  2. Force uninstall and then go to phpmysql, etc, and delete the entries.

SQL ERRORS ON RE-INSTALL

  • Duplicate entry errors on re-install

Related to above error: the entries are still in the settings database. You can:

  1. Force the install, your previous settings will be restored.

phpBB3 MOD configuration

How to configure the phpBB3 MOD.

Minimum number of posts a user must make before they can use links. Users will need this number of posts before they are able to use the [URL] BBCode tag or post external page urls and domain references. Applies to posts, signatures, PMs, and profiles.

  • Enter 0 to disable check
  • This AND the minimum days registered must be met
  • Recommended setting: 1 post

Minimum number of days the account must be registered to post links. Users will need to have registered this many days before they are able to use the [URL] BBCode tag or post external page urls and domain references. Applies to posts, signatures, PMs, and profiles.

  • Enter 0 to disable age check
  • This AND the minimum number of posts must be met
  • Recommended setting: 1 day

Disable posting, signature, and profiles for new users with 0 posts after minimum days (above). Prevents old accounts from coming back as spammers.

phpBB3 MOD error message.

User with 0 posts after minimum account age will be prohibited from posting, signatures, and profiles.

What is this about? We ban links based on age and posts, but imagine a spammer script that:

  1. Registers a bunch of accounts on one day
  2. Comes back after the minimum account age
  3. Posts the minimum account posts until the filter is off
  4. Then blasts the forum full of spam

All that could happen before you have a chance to see and delete the initial posts.

The sleeper agent check stops this. If the new user has not posted an initial post within the minimum account age windows, then posting, signatures, and profiles are disabled and an error is displayed.

Private messages remain active (with filters enabled) so the user can contact an admin.

Most of our members join and post right away, so this is transparent to almost everyone.

First post and guest post must be at least this many characters. 0 to disable.

phpBB3 MOD error message.

Some scripts are so stupid they don't know they have no signature spam and post little "ego posts" anyways. This requires the first post to be this many characters or longer. In the long run this is could lead to longer first posts, but that will also make the spammer more obvious (or they have to make a real contribution to go unnoticed).

  • Enter 0 to disable check
  • Only applies to the first post, not every post until the filter is disabled
  • Always applied to guest posts
  • Recommended stetting: 73 (light touch, less is more, it should go unnoticed by new users)

Anything in this line is considered a link and cannot be posted by a new user.

Our recommended link string (v03):

Words on this list are not allowed, an error is shown.

We recommend only obvious words taken from past spams. Less (20 or so) is more.

In addition to links at the same site as the forum, new users can also posts links to these sites.

Links at the same site as the forum are automatically allowed. Additional URLs to ignore can be added here.

Some spam is in a language not used on the site. This box is for a regular expression that searches for unicode character ranges. Unicode character are usually non-english letters. For example Cyrillic. If the post contains these characters an error is shown.

  • The box is for any full PHP REGEX you'd like to use on posts
  • Requires a full PHP PREG_MATCH style REGEX filter (see examples below)
  • Leave blank to disable this feature
  • Unicode block reference

  • 0400-04FF - Cyrillic (Russian)
  • 0600-06FF - Arabic
  • 3100-312F - Bopomofo (Chinese Mandarin)

Here is an example REGEX to enter in the phpBB MOD ACP:

  • This example is for Cyrillic (0400-04FF) and Arabic (0600-06FF)
  • You need to include the / at the beginning
  • You need to include the /+u at the end

Add the Mandarin Bopomofo block (Chinese characters) to the first REGEX like this.

What percent of a post must be non-unicode characters. Enter as 0.95 for 95%, leave blank to disable.

There is a secondary unicode filter that simply tests for all unicode characters. This is probably best for English and similar language sites only. If your language uses unicode, consider blocking unused ranges with the filter above.

The value represents the percent of post that must be non-unicode. For example 0.95 means that 95% of the post must be non-unicode or an error is displayed.

  • Leave blank to disable this feature
  • Based on this

A link to a post that explains the filter criteria. Leave blank to disable.

A user might want to know why and how long their account is restricted. It's a good idea to write a forum post explaining the limits. If a URL is entered on this line it will be displayed with 'click for help' in the error message.

  • Leave blank to disable this feature
  • Our example help post, feel free to use it

Logs all filter activity to system log. Not recommended.

Enables verbose event logging to the phpBB3 user and admin logs.

Purges users with 0 posts after the number of days set in Days before zombie purge. Purge happens automatically once each day.

We get 100s of script registrations every day. Captchas, challenge questions, and other stuff only stops the stupidest scripts, and annoys users. We forbid them from posting links, but that doesn't stop them from registering.

The zombie registration purge deletes all users with 0 posts who are older than the Days before zombie purge: setting.

This MOD has a few honeypot features that attempt to attract and auto-delete spammers.

Users with 0 posts are deleted if they:

  • Submit a profile
  • Submit a spammy signature
  • Use tons of links in their first post

Enable extreme mode

Extreme mode must be enabled in the source code:

  1. Install the MOD
  2. Open /includes/functions_link_filter.php with a text editor
  3. Find private $extreme=false;
  4. Change to private $extreme=true;
  5. Save and replace the file

This additional setting configures the max number of links in a first post. Users are automatically deleted if they submit more links in their first post.

Users are returned to the post with an error so they can copy and paste the post for later if it was legit.

Class overview

This currently shows the variable in the class and documents what they do.

This list is used to search for links. Update it as needed.

Our recommended link string (v03):

Words on this list are not allowed, an error is shown. We recommend only obvious words taken from past spams. Less (20 or so) is more.

If true the user is shown the word that caused the error. Recommended because the filter is not smart and will match inside another word (think scum).

Links at the same site as the forum are automatically allowed. Additional URLs to ignore can be added here.

This allows links to Google Code and Sourceforge, common sites we use in this forum.

Some spam is in a language not used on the site. This is a regular expression that searches for unicode character ranges. Unicode are the letter sets used for non-english standard characters. For example Cyrillic. If the post contains these characters an error is shown.

  • Requires a full PHP PREG_MATCH style REGEX filter (see examples below)
  • Leave blank to disable this feature
  • Unicode block reference

  • 0400-04FF - Cyrillic (Russian)
  • 0600-06FF - Arabic
  • 3100-312F - Bopomofo (Chinese Mandarin)

Example of chaining together multiple filter blocks. REGEX does the chaining of multiple character sets itself, so it's not quite like the search terms and URL elements. PREG_MATCH evaluates the whole statement at one time.

REGEX in phpBB MOD

Here is an example REGEX to enter in the phpBB MOD ACP:

  • You need to include the / at the beginning
  • You need to include the /+u at the end
  • The box is for any full PHP REGEX you'd like to use on your posts
  • This example is for Cyrillic (0400-04FF) and Arabic (0600-06FF)

Add the Mandarin Bopomofo block (Chinese characters) to the first REGEX like this.

There is a secondary unicode filter that simply tests for all unicode character. This is probably best for English and similar language sites only. If your language uses unicode consider blocking unused ranges with the filter above.

The value represents the percent of post that must be non-unicode. For example 0.95 means that 95% of the post must be non-unicode or an error is displayed.

  • Leave blank to disable this feature
  • Based on this

A user might want to know why and how long their account is restricted. It's a good idea to write a forum post explaining the limits. If a URL is entered on this line it will be displayed with 'click for help' in the error message.

  • Leave blank to disable this feature
  • Our example help post, feel free to use it

The settings can cpme from the database values for the disable links plugin, or frpm the settings in the class. Set to true to use database settings.

Minimum number of days the account must be registered to post links.

  • Enter 0 to disable age check
  • This AND the minimum number of posts must be met
  • Recommended setting: 1 day

Minimum number of posts a user must make before they can use links.

  • Enter 0 to disable check
  • This AND the minimum account age must be met
  • Recommended setting: 1 post

phpBB3 MOD error message.

Some scripts are so stupid they don't know they have no signature spam and post little "ego posts" anyways. This requires the first post to be this many characters or longer. In the long run this is could lead to longer first posts, but that will also make the spammer more obvious (or they have to make a real contribution to go unnoticed).

  • Enter 0 to disable check
  • Only applies to the first post, not every post until the filter is disabled
  • Always applied to guest posts
  • Recommended stetting: 73 (light touch, less is more, it should go unnoticed by new users)

phpBB3 MOD error message.

User with 0 posts after minimum account age will be prohibited from posting, signatures, and profiles.


What is this about? We ban links based on age and posts, but imagine a spammer script that:

  1. Registers a bunch of accounts on one day
  2. Comes back after the minimum account age
  3. Posts the minimum account posts until the filter is off
  4. Then blasts the forum full of spam

All that could happen before you have a chance to see and delete the initial posts.

The sleeper agent check stops this. If the new user has not posted an initial post within the minimum account age windows, then posting, signatures, and profiles are disabled and an error is displayed.

Private messages remain active (with filters enabled) so the user can contact an admin.

Most of our members join and post right away, so this is transparent to almost everyone.

Enables verbose event logging to the phpBB3 user and admin logs.

This is a class-only setting (adjust it in the code) that turns on some extreme honeypot features. Users with 0 posts are deleted if they:

  • Submit a profile
  • Submit a spammy signature
  • Users with more than $extreme_links_delete link in a first post

Enable this feature (not recommended)

Configure the max number of links in a first post. More than this and the user is deleted automatically. Users are returned to the post with an error so they can copy and paste the post for later if it was legit.

We get 100s of script registrations every day. Captchas, challenge questions, and other stuff only stops the stupidest scripts, and annoys users. We forbid them from posting links, but that doesn't stop them from registering.

The zombie registration purge deletes all users with 0 posts who are older than the minimum account age.

Weaknesses

There is still a corner case that should be dealt with:

  1. The spammer has one 'innocent' post before the account is deleted, right at the end of the minimum account age before a moderator notices
  2. The spammer posts until minimum posts are reached
  3. After the restrictions are lifted the spam flows

A future option is to made the minimum account age only apply after the first post is made. That gives admins a better chance to notice the suspicious 'innocent' posts and delete the users before the links start flowing. It will require a database query though, so it has not yet been implemented.

Инструкции по установке мода Posts merging for phpBB3 Версия

Редактируемые файлы

Код: Выделить всё Развернуть * viewtopic.php,
* posting.php,
* includes/acp/acp_board.php

Дополнительные файлы

Код: Выделить всё Развернуть * root/includes/posts_merging.php,
* root/includes/time_delta.php,
* root/language/en/mods/posts_merging.php

php Код: Выделить всё Развернуть INSERT INTO phpbb_config ( config_name , config_value ) VALUES ( 'merge_interval' , 0 );
INSERT INTO phpbb_config ( config_name , config_value ) VALUES ( 'merge_no_forums' , 0 );
INSERT INTO phpbb_config ( config_name , config_value ) VALUES ( 'merge_no_topics' , 0 );
ALTER TABLE phpbb_posts ADD post_created INT ( 11 ) DEFAULT '0' NOT NULL AFTER post_time ;

SQL-запрос выполнен успешно.

Нет результатов

SQL-запрос: Выделить всё INSERT INTO phpbb_config (config_name, config_value) VALUES('merge_no_forums', 0)

Нет результатов

SQL-запрос: Выделить всё INSERT INTO phpbb_config (config_name, config_value) VALUES('merge_no_topics', 0)

Нет результатов

SQL-запрос: Выделить всё ALTER TABLE phpbb_posts ADD post_created INT(11) DEFAULT '0' NOT NULL AFTER post_time

Нет результатов

Установочный фикс для версий начиная с 3.0.2 и выше

php Код: Выделить всё Развернуть $redirect_url = submit_post ( $mode , $post_data [ 'post_subject' ], $post_data [ 'username' ], $post_data [ 'topic_type' ], $poll , $data , $update_message , ( $update_message || $update_subject ) ? true : false );

Фикс для исправления неправильной ссылки в уведомлении о новом сообщении:

php Код: Выделить всё Развернуть // Send Notifications
if ( $auth -> acl_get ( 'f_noapprove' , $data [ 'forum_id' ]) || $auth -> acl_get ( 'm_approve' , $data [ 'forum_id' ]))
<
user_notification ( $mode , $subject , $data [ 'topic_title' ], $data [ 'forum_name' ], $data [ 'forum_id' ], $data [ 'topic_id' ], $data [ 'post_id' ]);
>

php Код: Выделить всё Развернуть // Send Notifications
if ( $auth -> acl_get ( 'f_noapprove' , $data [ 'forum_id' ]) || $auth -> acl_get ( 'm_approve' , $data [ 'forum_id' ]))
<
user_notification ( $mode , $subject , $data [ 'topic_title' ], $data [ 'forum_name' ], $data [ 'forum_id' ], $data [ 'topic_id' ], $merge_post_id );
>

Изменение в поиске строки в includes/acp/acp_board.php при установке:

php Код: Выделить всё Развернуть 'flood_interval' => array ( 'lang' => 'FLOOD_INTERVAL' , 'validate' => 'int' , 'type' => 'text:3:10' , 'explain' => true , 'append' => ' ' . $user -> lang [ 'SECONDS' ]),

php Код: Выделить всё Развернуть 'flood_interval' => array ( 'lang' => 'FLOOD_INTERVAL' , 'validate' => 'int:0' , 'type' => 'text:3:10' , 'explain' => true , 'append' => ' ' . $user -> lang [ 'SECONDS' ]),

Реализации запрета на склеивание на уровне постов:

php Код: Выделить всё Развернуть $merge = false ;
$merge_interval = intval ( $config [ 'merge_interval' ]) * 3600 ;
if (( $current_time - $merge_post_data [ 'topic_last_post_time' ]) $merge_interval )
<
$merge = true ;
>

php Код: Выделить всё Развернуть $do_not_merge = request_var ( 'do_not_merge' , false );
if ( $do_not_merge ) $merge = false ;

php Код: Выделить всё Развернуть 'YOU_NO_NEW_PM' => 'У вас нет новых личных сообщений.' ,

php Код: Выделить всё Развернуть 'DO_NOT_MERGE' => 'Не склеивать с предыдущим' , Код: Выделить всё Развернуть language/en/common.php

php Код: Выделить всё Развернуть 'YOU_NO_NEW_PM' => 'No new private messages are waiting for you.' ,

php Код: Выделить всё Развернуть 'DO_NOT_MERGE' => 'Do not glue the previous' ,

php Код: Выделить всё Развернуть input type = "submit" accesskey = "s" tabindex = "6" name = "post" value = "" class = "button1 default-submit-action" />

php Код: Выделить всё Развернуть IF S_USER_LOGGED_IN --> label class = "not_merge" for = "do_not_merge" > input type = "checkbox" name = "do_not_merge" id = "do_not_merge" />
< L_DO_NOT_MERGE >label > ENDIF -->

Так же, если используется быстрый ответ:

php Код: Выделить всё Развернуть styles / prosilver / template / quickreply_editor . html

php Код: Выделить всё Развернуть input type = "submit" accesskey = "s" tabindex = "6" name = "post" value = "" class = "button1" />

php Код: Выделить всё Развернуть IF S_USER_LOGGED_IN && not S_EDIT_POST --> label class = "not_merge" for = "do_not_merge" > input type = "checkbox" name = "do_not_merge" id = "do_not_merge" />
< L_DO_NOT_MERGE >label > ENDIF -->

If nothing happens, download GitHub Desktop and try again.

If nothing happens, download GitHub Desktop and try again.

If nothing happens, download Xcode and try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

How to convert a phpBB 3.0 MOD into a phpBB 3.1 Extension

This guide should give a quick overview of the needed tasks to MOD-Authors for converting a phpBB 3.0 MOD to a phpBB 3.1 Extension, using NV Newspage as an example.

Table of Contents

##Database Changes UMIL replaced by Migrations

##File edits Better don't edit anything, just use Events and Listeners

The most obvious change should be the location the MODs/Extensions are stored in 3.1. In phpBB 3.0 all files were put into the core's root folder. In version 3.1 a special directory for Extensions has been created. It's called ext/.

Each extension has its own directory. However, you can (and should) also use an additional vendor directory (with your author name or author-group name). In case of my newspage the files will be in

There should not be a need to have files located outside of that direcotiry. No matter which files, may it be styles, language or ACP module files. All of them will be moved into your extension's directory.

Newly added, additional directories have already been listed. Their use will be explained in the following paragraphs.

Important new files

There is a new file, your extension needs, in order to be recognized by the system. It's called composer.json : it specifies the requirements of your extension aswell as some author information. The layout is a simple json array, the keys should really explain enough. Note: you must not change the type element. In the require section you can also specify other extensions which are required in order to install this one. (Validation for this is not yet implemented, but will be in 3.1.0)

The second new file is called ext.php . It can be used to extend the functionality while install/uninstalling your extension:

Front-facing files, routes and services

While in 3.0 you just created a new file in the root directory of phpBB, you might want to use the new controller system of 3.1 in future. Your links change from something like phpBB/newspage.php to phpBB/app.php/newspage in first place, but with a little htaccess rule this can be rewritten to phpBB/newspage

In order to link a specific routing rule to your extension, you need to define the route in your extension's config/routing.yml

For the easy start of the newspage, 2 rules are enough. The first rule is for the basic page currently newspage.php , the second one is for the pagination, like newspage.php?start=5 . The first rule sets a default page (1), while the second rule requires a second part of the url to be an integer.

The string we define for _controller defines a service ( nickvergessen.newspage.controller ) and a method ( base ) of the class which is then called. Services are defined in your extensions config/services.yml. Services are instances of classes. Services are used, so there is only one instance of the class which is used all the time. You can also define the arguments for the constructor of your class. The example definition of the newspage controller service would be something similar to:

Any service that is previously defined in your file, or in the file of the phpBB core phpBB/config/services.yml , can also be used as an argument, aswell as some predefined string (like core.root_path here).

NOTE: The classes from phpBB/ext/ are automatically loaded by their namespace and class names, whereby backslash ( \ ) represent directories. In this case the class nickvergessen\newspage\controller\main would be located in phpBB/ext/nickvergessen/newspage/controller/main.php

For more explanations about Routing and Services see the Symfony 2.1 Documentation.

In this example my controller/main.php would look like the following:

Note: The consecution of arguments in services.yml should match the consecution of arguments passed to the class constructor public function __construct(). Otherwise, error will be thrown and the board will be broken if you try to enable the extension.

You can also have multiple different methods in one controller aswell as having multiple controllers, in order to organize your code a bit better.

If we now add the entry for our extension into the phpbb_ext table, and go to example.tld/app.php/newspage/ you can see your template file. Congratulations! You just finished the "Hello World" example for phpBB Extensions. ;)

This section also applies to MCP and UCP modules.

As mentioned before these files are also moved into your extensions directory. The info-file, currently located in phpBB/includes/acp/info/acp_newspage.php , is going to be ext/nickvergessen/newspage/acp/main_info.php and the module itself is moved from phpBB/includes/acp/acp_newspage.php to ext/nickvergessen/newspage/acp/main_module.php . In order to be able to automatically load the files by their class names we need to make some little adjustments to the classes themselves.

As for the main_info.php I need to adjust the class name from acp_newspage_info to main_info and also change the value of 'filename' in the returned array.

In case of the module, I just adjust the class name:

And there you go. Your Extensions ACP module can now be added through the ACP and you just finished another step of successfully converting a MOD into an Extension.

Database Changes, UMIL replaced by Migrations

Basically migrations to the same as your 3.0 UMIL files. It performs the database changes of your MOD/Extension. The biggest difference between migrations and UMIL hereby is, that while you had one file with one array in UMIL for all your changes, you have one file per version in Migrations. But let's have a look at the newspage again.

The newspage does not have any database schema changes, so I will use the Example from the Wiki. Basically you need to have two methods in your migration class file:

whereby both methods return an array with the changes:

The revert_schema() should thereby revert all changes made by the update_schema() .

The data changes, like adding modules, permissions and configs, are provided with the update_data() function.

This function returns an array aswell. The example for the 1.0.0 version update from the newspage would look like the following:

More information about these data update tools can be found on the Wiki Migrations/Tools.

Dependencies and finishing up migrations

Now there are only two things left, your migration file needs. The first thing is a check, which allows phpbb to see whether the migration is already installed, although it did not run yet (f.e. when updating from a 3.0 MOD to a 3.1 Extension).

The easiest way for this to check, could be the version of the MOD, but when you add columns to tables, you can also check whether they exist:

As the migration files can have almost any name, phpBB might be unable to sort your migration files correctly. To avoid this problem, you can define a set of dependencies which must be installed before your migration can be installed. phpBB will try to install them, before installing your migration. If they can not be found or installed, your installation will fail aswell. For the 1.0.0 migration I will only require the 3.1.0-a1 Migration:

All further updates can now require this Migration and so also require the 3.1.0-a1 Migration.

A complete file could look like this:

Include extension's language files

As the language files in your extension are not detected by the $user->add_lang() any more, you need to use the $user->add_lang_ext() method. This method takes two arguments, the first one is the fullname of the extension (including the vendor) and the second one is the file name or array of file names. so in order to load my newspage language file I now call

to load my language from phpBB/ext/nickvergessen/newspage/language/en/newspage.php

File edits - Better don't edit anything, just use Events and Listeners

As for the newspage Modification, the only thing that is now missing from completion is the link in the header section, so you can start browsing the newspage.

In order to do this, I used to define the template variable in the page_header() -function of phpBB and then edit the overall_header.html . But this is 3.1 so we don't like file edits anymore and added events instead. With events you can hook into several places and execute your code, without editing them.

So instead of adding

to the page_header() , we put that into an event listener, which is then called, everytime page_header() itself is called.

So we add the event/main_listener.php file to our extension, which implements some Symfony class:

In the getSubscribedEvents() method we tell the system for which events we want to get notified and which function should be executed in case it's called. In our case we want to subscribe to the core.page_header -Event (a full list of events can be found here ):

Now we add the function which is then called:

As a last step we need to register the event listener to the system. This is done using the event.listener tag in the service.yml:

After this is added, your listener gets called and we are done with the php-editing.

Your users will not get conflicts on searching for files blocks and other things because another MOD already edited the code. Again like with the controllers, you can have multiple listeners in the event/ directory, aswell as subscribe to multiple events with one listener.

Now the only thing left is, adding the code to the html output. For templates you need one file per event.

The filename thereby includes the event name. In order to add the newspage link next to the FAQ link, we need to use the 'overall_header_navigation_prepend' -event (a full list of events can be found here ).

So we add the styles/prosilver/template/event/overall_header_navigation_prepend_listener.html to our extensions directory and add the html code into it.

And that's it. No file edits required for the template files aswell.

You can also add events to your extensions php and template code. If you miss an event from the core, please post a topic into the [3.x] Event Requests-Forum and we will include it for the next release. We try to include a huge bunch of events by default, but surely we can not cover every place your MODs need to be covered.

And that's it, the 3.0 Modification was successfully converted into a 3.1 Extension.

In some cases the compatibility of functions and classes count not be kept, while increasing their power. You can see a list of things in the Wiki-Article about PhpBB3.1

When you use your old 3.0 code you will receive an error like the following:

Fatal error: Call to undefined function generate_pagination() in . \phpBB3\ext\nickvergessen\newspage\controller\main.php on line 534

The problem is, that the pagination is now not returned by the function anymore, but instead automatically put into the template. In the same step, the function name was updated with a phpbb-prefix.

The old pagination code was similar to:

The new code should look like:

About

A step by step HowTo for converting a phpBB 3.0 Modification into a phpBB 3.1 Extension, using the "NV Newspage" as an Example.

Читайте также: