Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A wiki for phpBB with version history, side-by-side compare, and a moderation qu
- Start an article from the overview page's **New article title** box, or by linking to `/wiki/<article-name>` and following the link.
- Link to another article by writing `[[Article name]]`, in articles and in forum posts; links to articles that don't exist yet are shown in red and open the editor. Each article lists the articles that link to it under **What links here**. See [Linking between articles](#linking-between-articles).
- Every edit is saved as a new version; compare any two versions. The compare page opens in a **Readable** view: the newer version as readers see it, with added text in green and underlined, removed text in red and struck through, and the changed words marked inside a line, list item or table row that changed. **Source** shows the BBCode diff. A `Template:` page is compared as written.
- **Protect article**, under **Moderator controls** in the version history, names the phpBB groups whose members may edit an article. It narrows the board-wide edit permission for that one article and never widens it: everyone else can no longer edit it, restore an older version, upload files to it or move it, and a note under the article names the groups. Edits by those members still wait for approval as before. Tick no group to lift it. It needs the **Can protect an article** permission, which moderators get when the extension is updated, and whose holders may always edit. Protection moves with the article and is removed with it.
- **Protect article** (the padlock button on an article, or **Moderator controls** in the version history) names the phpBB groups whose members may edit an article. It narrows the board-wide edit permission for that one article and never widens it: everyone else can no longer edit it, restore an older version, upload files to it or move it, and a note under the article names the groups. Edits by those members still wait for approval as before. Tick no group to lift it. It needs the **Can protect an article** permission, which moderators get when the extension is updated, and whose holders may always edit. Protection moves with the article and is removed with it. In the overview, Recent changes, search results and category pages, a lock beside the title marks a protected article; hovering it names the groups.
- **Two people editing at once.** The ACP setting **When two people edit an article** (under **Extensions > Wiki > Settings**) chooses what happens. **Notice** (the default) names on the edit form whoever else has the article open, and since when. **Lock** lets only the first to open the edit form edit the article: the others see who holds it and until when, a moderator (with "Can set an article version active") can break the lock, and the moderators are notified once when a lock keeps someone out. If the lock changes hands while someone's form is open, their save is refused and their text kept. **Nothing** keeps the old behaviour. An editor is held for **Minutes an editor holds an article** (30 by default, 5 to 240) after their last sign of work; the open edit form extends it every few minutes, and so does Preview.
- **Restore** in the version history brings back an older version by saving its text, title, description, sources and redirect as a new version, so no version is lost. Members who may edit can restore; the restored version goes live straight away for members who may set versions active, and otherwise waits for approval like any edit.
- **Move article**, under **Moderator controls** in the version history, gives an article a new name (its address) and, if wanted, a new title. Every version, its uploaded files and its watchers move with it, and a redirect is left at the old name unless that box is cleared; an article can be moved back over its own redirect. Links in other articles are not rewritten, so the redirect keeps them working, and articles that use a moved template keep showing it through the redirect. Moving a template that articles use shows how many and asks for a second confirmation. It needs the **Can move an article to a new name** permission, which moderators get when the extension is updated.
Expand Down
4 changes: 4 additions & 0 deletions config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ services:
- '%core.root_path%'
- '%core.php_ext%'
- '%tables.wiki.article%'
- '@phpbbmodders.wiki.protection'

phpbbmodders.wiki.recent_changes:
class: phpbbmodders\wiki\controller\recent_changes
Expand All @@ -44,6 +45,7 @@ services:
- '%tables.wiki.article%'
- '%core.root_path%'
- '%core.php_ext%'
- '@phpbbmodders.wiki.protection'

phpbbmodders.wiki.categories:
class: phpbbmodders\wiki\wiki\categories
Expand All @@ -66,6 +68,7 @@ services:
- '@phpbbmodders.wiki.categories'
- '@phpbbmodders.wiki.main'
- '%tables.wiki.article%'
- '@phpbbmodders.wiki.protection'

phpbbmodders.wiki.template_list:
class: phpbbmodders\wiki\controller\template_list
Expand Down Expand Up @@ -445,6 +448,7 @@ services:
- '%tables.wiki.search_text%'
- '%core.root_path%'
- '%core.php_ext%'
- '@phpbbmodders.wiki.protection'

phpbbmodders.wiki.search:
class: phpbbmodders\wiki\controller\search
Expand Down
8 changes: 7 additions & 1 deletion controller/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class category
/** How many of a category's articles the list of categories shows under it */
const PREVIEW_MEMBERS = 5;

/** @var \phpbbmodders\wiki\wiki\protection */
protected $protection;

/** @var \phpbb\auth\auth */
protected $auth;

Expand Down Expand Up @@ -69,8 +72,9 @@ class category
* @param \phpbbmodders\wiki\controller\main $main
* @param string $article_table
*/
public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\pagination $pagination, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, categories $categories, \phpbbmodders\wiki\controller\main $main, $article_table)
public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\pagination $pagination, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, categories $categories, \phpbbmodders\wiki\controller\main $main, $article_table, \phpbbmodders\wiki\wiki\protection $protection)
{
$this->protection = $protection;
$this->auth = $auth;
$this->config = $config;
$this->db = $db;
Expand Down Expand Up @@ -101,6 +105,7 @@ protected function assign_members($name)
{
$this->template->assign_block_vars('category_members', array(
'TITLE' => $row['article_title'],
'PROTECTED' => $this->protection->list_label($row['article_url']),
'DESCRIPTION' => $row['article_description'],
'U_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $row['article_url'])),
));
Expand Down Expand Up @@ -217,6 +222,7 @@ public function index()
{
$this->template->assign_block_vars('categories.members', array(
'TITLE' => $member['article_title'],
'PROTECTED' => $this->protection->list_label($member['article_url']),
'U_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $member['article_url'])),
));
}
Expand Down
11 changes: 10 additions & 1 deletion controller/overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

class overview
{
/** @var \phpbbmodders\wiki\wiki\protection */
protected $protection;

/** @var \phpbb\auth\auth */
protected $auth;

Expand Down Expand Up @@ -64,8 +67,9 @@ class overview
* @param string $php_ext
* @param string $article_table
*/
public function __construct(\phpbb\auth\auth $auth, \phpbb\controller\helper $helper, \phpbb\db\driver\driver_interface $db, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, \phpbbmodders\wiki\wiki\edit $edit, \phpbbmodders\wiki\wiki\compare $compare, \phpbbmodders\wiki\wiki\view $view, $phpbb_root_path, $php_ext, $article_table)
public function __construct(\phpbb\auth\auth $auth, \phpbb\controller\helper $helper, \phpbb\db\driver\driver_interface $db, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, \phpbbmodders\wiki\wiki\edit $edit, \phpbbmodders\wiki\wiki\compare $compare, \phpbbmodders\wiki\wiki\view $view, $phpbb_root_path, $php_ext, $article_table, \phpbbmodders\wiki\wiki\protection $protection)
{
$this->protection = $protection;
$this->auth = $auth;
$this->helper = $helper;
$this->db = $db;
Expand Down Expand Up @@ -106,6 +110,7 @@ public function base()
{
$this->template->assign_block_vars('all_wiki_article', array(
'U_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $all_wiki_article['article_url'])),
'PROTECTED' => $this->protection->list_label($all_wiki_article['article_url']),
'ARTICLE_NAME' => $all_wiki_article['article_title'],
'ARTICLE_DESCRIPTION' => $all_wiki_article['article_description'],
'ARTICLE_VIEWS' => $all_wiki_article['article_views'],
Expand All @@ -128,6 +133,7 @@ public function base()
{
$this->template->assign_block_vars('latest_wiki_article', array(
'U_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $all_wiki_article['article_url'])),
'PROTECTED' => $this->protection->list_label($all_wiki_article['article_url']),
'ARTICLE_NAME' => $all_wiki_article['article_title'],
'ARTICLE_DESCRIPTION' => $all_wiki_article['article_description'],
'ARTICLE_VIEWS' => $all_wiki_article['article_views'],
Expand All @@ -150,6 +156,7 @@ public function base()
{
$this->template->assign_block_vars('hot_wiki_article', array(
'U_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $all_wiki_article['article_url'])),
'PROTECTED' => $this->protection->list_label($all_wiki_article['article_url']),
'ARTICLE_NAME' => $all_wiki_article['article_title'],
'ARTICLE_DESCRIPTION' => $all_wiki_article['article_description'],
'ARTICLE_VIEWS' => $all_wiki_article['article_views'],
Expand All @@ -173,6 +180,7 @@ public function base()
{
$this->template->assign_block_vars('sticky_wiki_article', array(
'U_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $all_wiki_article['article_url'])),
'PROTECTED' => $this->protection->list_label($all_wiki_article['article_url']),
'ARTICLE_NAME' => $all_wiki_article['article_title'],
'ARTICLE_DESCRIPTION' => $all_wiki_article['article_description'],
'ARTICLE_VIEWS' => $all_wiki_article['article_views'],
Expand Down Expand Up @@ -220,6 +228,7 @@ public function base()

$this->template->assign_block_vars('pending_wiki_article', array(
'U_ARTICLE' => $this->helper->route('phpbbmodders_wiki_article', array('article' => $pending_wiki_article['article_url'])),
'PROTECTED' => $this->protection->list_label($pending_wiki_article['article_url']),
'ARTICLE_NAME' => $pending_wiki_article['article_title'],
'ARTICLE_LASTEDIT' => $this->user->format_date($pending_wiki_article['article_last_edit']),
'S_STALE' => $is_stale,
Expand Down
7 changes: 6 additions & 1 deletion controller/recent_changes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
*/
class recent_changes
{
/** @var \phpbbmodders\wiki\wiki\protection */
protected $protection;

/** @var \phpbb\auth\auth */
protected $auth;

Expand Down Expand Up @@ -68,8 +71,9 @@ class recent_changes
* @param string $phpbb_root_path
* @param string $php_ext
*/
public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\pagination $pagination, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, $article_table, $phpbb_root_path, $php_ext)
public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\pagination $pagination, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, $article_table, $phpbb_root_path, $php_ext, \phpbbmodders\wiki\wiki\protection $protection)
{
$this->protection = $protection;
$this->auth = $auth;
$this->config = $config;
$this->db = $db;
Expand Down Expand Up @@ -165,6 +169,7 @@ public function page()

$this->template->assign_block_vars('changes', array(
'ARTICLE_TITLE' => $row['article_title'],
'PROTECTED' => $this->protection->list_label($row['article_url']),
'EDIT_REASON' => $row['article_edit_reason'],
'EDIT_TIME' => $this->user->format_date($row['article_last_edit']),
'USER' => \phpbbmodders\wiki\wiki\author::link($this->helper, $row['user_id'], $row['username'], $row['user_colour']),
Expand Down
Binary file modified docs/images/wiki-protected-article.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/wiki-protected-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion language/en/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@
'WIKI_EDIT_LOCK_BROKEN' => 'The lock was broken. The article can be edited again.',
'WIKI_EDIT_LOCK_EDIT_NOW' => 'Edit the article',
'WIKI_PROTECT_ARTICLE' => 'Protect article',
'WIKI_PROTECT_CHANGE' => 'Protected: change who may edit',
'WIKI_PROTECT_EXPLAIN' => 'Choose the groups whose members may edit this article. Only they, and members who may protect articles, can then edit it, restore an older version, upload files to it or move it. Members still need the permission to edit articles, and their edits still wait for approval as before. Tick no group to let everyone who may edit articles edit this one again.',
'WIKI_PROTECT_GROUPS' => 'Groups that may edit',
'WIKI_PROTECT_GROUPS_EXPLAIN' => 'Members of any ticked group may edit.',
'WIKI_PROTECT_SAVED' => 'The article is protected. Only members of these groups may edit it: %s.',
'WIKI_PROTECT_LIFTED' => 'The article is no longer protected. Everyone who may edit articles may edit it.',
'WIKI_PROTECTED_NOTE' => 'Only members of %s can edit this article.',
'WIKI_PROTECTED_NO_EDIT' => 'This article is protected. Only members of %s can edit it.',
'VERSIONS_OF_ARTICLE' => 'Version history',
'VERSION_COMPARE_HEADLINE' => 'Changes from version <a href="%3$s">%1$d</a> to <a href="%4$s">%2$d</a>',
Expand Down
2 changes: 2 additions & 0 deletions language/en/link.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
'WIKI_NOTIFICATION_STARTER_TEMPLATES_OPTION' => 'The wiki鈥檚 starter templates repository has new or changed templates',
'WIKI_EDIT_LOCK_BLOCKED' => '<strong>%1$s</strong> could not edit the wiki article <strong>%2$s</strong>, because %3$s holds it.',
'WIKI_EDIT_LOCK_BLOCKED_OPTION' => 'An edit lock keeps someone out of a wiki article',
// Under a protected article, and beside it in lists on any page (the board search too)
'WIKI_PROTECTED_NOTE' => 'Only members of %s can edit this article.',
'WIKI_TOC' => 'Contents',
'WIKI_LINK_BUTTON' => 'Wiki link: [[Article name]] or [[Article name|link text]]',
'WIKI_LINK_NEW_ARTICLE' => 'This article doesn鈥檛 exist yet. Follow the link to create it.',
Expand Down
7 changes: 6 additions & 1 deletion styles/prosilver/template/article_body.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h2 itemprop="headline name">{ARTICLE_TITLE}<!-- IF ARTICLE_VERSION --> - {L_VER
{L_ARTICLE_HAS_NEW} <a href="{U_NEW_VERSION}">{L_SET_ACTIVE}</a>
</p>
<!-- ENDIF -->
<!-- IF S_EDIT or S_VERSIONS or U_TOPIC or U_START_DISCUSSION or S_WIKI_CAN_WATCH -->
<!-- IF S_EDIT or S_VERSIONS or U_TOPIC or U_START_DISCUSSION or S_WIKI_CAN_WATCH or S_WIKI_CAN_PROTECT -->
<ul class="post-buttons wiki-buttons">
<!-- IF S_EDIT -->
<li>
Expand All @@ -26,6 +26,11 @@ <h2 itemprop="headline name">{ARTICLE_TITLE}<!-- IF ARTICLE_VERSION --> - {L_VER
<a href="{U_VERSIONS}" title="{L_VERSIONS_WIKI}" class="button button-icon-only"><i class="icon o-icon o-icon-font fas fa-history fa-fw" aria-hidden="true"></i><span>{L_VERSIONS_WIKI}</span></a>
</li>
<!-- ENDIF -->
<!-- IF S_WIKI_CAN_PROTECT -->
<li>
<a href="{U_WIKI_PROTECT}" title="<!-- IF S_WIKI_PROTECTED -->{L_WIKI_PROTECT_CHANGE}<!-- ELSE -->{L_WIKI_PROTECT_ARTICLE}<!-- ENDIF -->" class="button button-icon-only<!-- IF S_WIKI_PROTECTED --> wiki-protect-on<!-- ENDIF -->"><i class="icon o-icon o-icon-font fas <!-- IF S_WIKI_PROTECTED -->fa-lock<!-- ELSE -->fa-unlock<!-- ENDIF --> fa-fw" aria-hidden="true"></i><span><!-- IF S_WIKI_PROTECTED -->{L_WIKI_PROTECT_CHANGE}<!-- ELSE -->{L_WIKI_PROTECT_ARTICLE}<!-- ENDIF --></span></a>
</li>
<!-- ENDIF -->
<!-- IF S_WIKI_CAN_WATCH -->
<li>
<a href="{U_WIKI_WATCH}" title="<!-- IF S_WIKI_WATCHING -->{L_WIKI_UNWATCH}<!-- ELSE -->{L_WIKI_WATCH}<!-- ENDIF -->" class="button button-icon-only"><i class="icon o-icon o-icon-font fas <!-- IF S_WIKI_WATCHING -->fa-bell-slash<!-- ELSE -->fa-bell<!-- ENDIF --> fa-fw" aria-hidden="true"></i><span><!-- IF S_WIKI_WATCHING -->{L_WIKI_UNWATCH}<!-- ELSE -->{L_WIKI_WATCH}<!-- ENDIF --></span></a>
Expand Down
2 changes: 1 addition & 1 deletion styles/prosilver/template/category_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h2>{L_WIKI_CATEGORIES}</h2>
<p>{categories.WRITE_IN}</p>
<!-- IF .categories.members -->
<p>{L_WIKI_CATEGORY_MEMBERS}{L_COLON}
<!-- BEGIN members --><a href="{categories.members.U_ARTICLE}">{categories.members.TITLE}</a><!-- IF not categories.members.S_LAST_ROW -->, <!-- ENDIF --><!-- END members -->
<!-- BEGIN members --><a href="{categories.members.U_ARTICLE}">{categories.members.TITLE}</a><!-- IF categories.members.PROTECTED --> <i class="icon o-icon o-icon-font fas fa-lock fa-fw wiki-protected-icon" title="{categories.members.PROTECTED}" aria-hidden="true"></i><span class="sr-only">{categories.members.PROTECTED}</span><!-- ENDIF --><!-- IF not categories.members.S_LAST_ROW -->, <!-- ENDIF --><!-- END members -->
<!-- IF categories.MORE --> {categories.MORE}<!-- ENDIF -->
</p>
<!-- ENDIF -->
Expand Down
2 changes: 1 addition & 1 deletion styles/prosilver/template/category_members.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h3>{L_WIKI_CATEGORY_MEMBERS}</h3>
<tbody>
<!-- BEGIN category_members -->
<tr class="<!-- IF category_members.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
<td><a href="{category_members.U_ARTICLE}"><strong>{category_members.TITLE}</strong></a></td>
<td><a href="{category_members.U_ARTICLE}"><strong>{category_members.TITLE}</strong></a><!-- IF category_members.PROTECTED --> <i class="icon o-icon o-icon-font fas fa-lock fa-fw wiki-protected-icon" title="{category_members.PROTECTED}" aria-hidden="true"></i><span class="sr-only">{category_members.PROTECTED}</span><!-- ENDIF --></td>
<td>{category_members.DESCRIPTION}</td>
</tr>
<!-- END category_members -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<dl class="row-item">
<dt>
<div class="list-inner">
<a href="{wiki_matches.U_ARTICLE}" class="topictitle">{wiki_matches.TITLE}</a>
<a href="{wiki_matches.U_ARTICLE}" class="topictitle">{wiki_matches.TITLE}</a><!-- IF wiki_matches.PROTECTED --> <i class="icon o-icon o-icon-font fas fa-lock fa-fw wiki-protected-icon" title="{wiki_matches.PROTECTED}" aria-hidden="true"></i><span class="sr-only">{wiki_matches.PROTECTED}</span><!-- ENDIF -->
<!-- IF wiki_matches.DESCRIPTION --><br />{wiki_matches.DESCRIPTION}<!-- ENDIF -->
<!-- IF wiki_matches.SNIPPET --><br /><span>{wiki_matches.SNIPPET}</span><!-- ENDIF -->
<br />{wiki_matches.AUTHOR} &raquo; {wiki_matches.DATE}
Expand Down
Loading
Loading