diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/Article.php ./includes/Article.php
--- ../mediawiki-1.4.9/includes/Article.php 2005-08-30 01:50:10.000000000 +0200
+++ ./includes/Article.php 2005-08-30 10:28:00.000000000 +0200
@@ -757,7 +757,12 @@
# Another whitelist check in case oldid or redirects are altering the title
if ( !$this->mTitle->userCanRead() ) {
- $wgOut->loginToUse();
+ if ( $this->mTitle->isRestricted() ) {
+ $wgOut->restrictGroupRequired();
+ } else {
+ $wgOut->loginToUse();
+ }
+
$wgOut->output();
exit;
}
@@ -1341,7 +1346,7 @@
global $wgUser, $wgOut, $wgRequest;
if ( ! $wgUser->isAllowed('protect') ) {
- $wgOut->sysopRequired();
+ $wgOut->restrictGroupRequired();
return;
}
if ( wfReadOnly() ) {
@@ -1366,6 +1371,10 @@
if( !$moveonly ) {
$restrictions .= ":edit=" . $limit;
}
+ if(current($this->mTitle->getRestrictions('view'))) {
+ $restrictions .= ":view=1";
+ }
+
if (wfRunHooks('ArticleProtect', array(&$this, &$wgUser, $limit == 'sysop', $reason, $moveonly))) {
$dbw =& wfGetDB( DB_MASTER );
@@ -1483,6 +1492,149 @@
function unprotect() {
return $this->protect( '' );
}
+
+
+ /**
+ * restrict a page
+ * (restrict-patch by Jerome Combaz)
+ */
+ function restrict( $limit = true ) {
+ global $wgUser, $wgOut, $wgRequest, $wgEnableRestrict;
+
+ if ( ! $wgEnableRestrict == true ) return;
+
+ if ( ! $wgUser->isAllowed('restrict') ) {
+ $wgOut->sysopRequired();
+ return;
+ }
+ if ( wfReadOnly() ) {
+ $wgOut->readOnlyPage();
+ return;
+ }
+ $id = $this->mTitle->getArticleID();
+ if ( 0 == $id ) {
+ $wgOut->fatalError( wfMsg( 'badarticleerror' ) );
+ return;
+ }
+
+ $confirm = $wgRequest->getBool( 'wpConfirmRestrict' ) &&
+ $wgRequest->wasPosted() &&
+ $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) );
+ $reason = $wgRequest->getText( 'wpReasonRestrict' );
+
+ if ( $confirm ) {
+
+ $edit = "edit=".current($this->mTitle->getRestrictions('edit'));
+ $move = "move=".current($this->mTitle->getRestrictions('move'));
+ $view = ($limit ? 'view=1' : 'view=0');
+ $restrictions = implode(':', array($edit, $move, $view));
+
+ if (wfRunHooks('ArticleRestrict', array(&$this, &$wgUser, $limit == true, $reason))) {
+
+ $dbw =& wfGetDB( DB_MASTER );
+ $dbw->update( 'cur',
+ array( /* SET */
+ 'cur_touched' => $dbw->timestamp(),
+ 'cur_restrictions' => $restrictions
+ ), array( /* WHERE */
+ 'cur_id' => $id
+ ), 'Article::restrict'
+ );
+
+ wfRunHooks('ArticleRestrictComplete', array(&$this, &$wgUser, $limit == true, $reason));
+
+ $log = new LogPage( 'restrict' );
+ if ( $limit == false ) {
+ $log->addEntry( 'unrestrict', $this->mTitle, $reason );
+ } else {
+ $log->addEntry( 'restrict', $this->mTitle, $reason );
+ }
+ $wgOut->redirect( $this->mTitle->getFullURL() );
+ }
+ return;
+ } else {
+ $reason = htmlspecialchars( wfMsg( 'restrictreason' ) );
+ return $this->confirmRestrict( '', $reason, $limit );
+ }
+ }
+
+ /**
+ * Output protection confirmation dialog
+ * (restrict-patch by Jerome Combaz)
+ */
+ function confirmRestrict( $par, $reason, $limit = true ) {
+ global $wgOut, $wgUser;
+
+ wfDebug( "Article::confirmRestrict\n" );
+
+ $sub = htmlspecialchars( $this->mTitle->getPrefixedText() );
+ $wgOut->setRobotpolicy( 'noindex,nofollow' );
+
+ $check = '';
+ $protcom = '';
+
+ if ( $limit == false ) {
+ $wgOut->setPageTitle( wfMsg( 'confirmunrestrict' ) );
+ $wgOut->setSubtitle( wfMsg( 'unrestrictsub', $sub ) );
+ $wgOut->addWikiText( wfMsg( 'confirmunrestricttext' ) );
+ $check = htmlspecialchars( wfMsg( 'confirmunrestrict' ) );
+ $protcom = htmlspecialchars( wfMsg( 'unrestrictcomment' ) );
+ $formaction = $this->mTitle->escapeLocalURL( 'action=unrestrict' . $par );
+ } else {
+ $wgOut->setPageTitle( wfMsg( 'confirmrestrict' ) );
+ $wgOut->setSubtitle( wfMsg( 'restrictsub', $sub ) );
+ $wgOut->addWikiText( wfMsg( 'confirmrestricttext' ) );
+ $check = htmlspecialchars( wfMsg( 'confirmrestrict' ) );
+ $protcom = htmlspecialchars( wfMsg( 'restrictcomment' ) );
+ $formaction = $this->mTitle->escapeLocalURL( 'action=restrict' . $par );
+ }
+
+ $confirm = htmlspecialchars( wfMsg( 'confirm' ) );
+ $token = htmlspecialchars( $wgUser->editToken() );
+
+ $wgOut->addHTML( "
+
\n" );
+
+ $wgOut->returnToMain( false );
+ }
+
+ /**
+ * Unprotect the pages
+ * (restrict-patch by Jerome Combaz)
+ */
+ function unrestrict() {
+ return $this->restrict( false );
+ }
/*
* UI entry point for page deletion
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/DefaultSettings.php ./includes/DefaultSettings.php
--- ../mediawiki-1.4.9/includes/DefaultSettings.php 2005-08-30 01:50:10.000000000 +0200
+++ ./includes/DefaultSettings.php 2005-08-30 10:28:00.000000000 +0200
@@ -1090,6 +1090,26 @@
$wgExternalStores = false;
+/**
+ * If true, a new menu action allows to restrict pages access to sysop
+ */
+$wgEnableRestrict = false;
+
+/**
+ * Group allowed to restrict and read restricted pages
+ */
+$wgRestrictGroup = 'sysop';
+
+/**
+ * Hide restriction log entries for non-members users
+ */
+$wgHideRestrictLog = false;
+
+/**
+ * Restrict user pages to their owner (as well as restrict members)
+ */
+$wgUserPageRestrict = false;
+
} else {
die("MEDIAWIKI not defined, this is not a valid entry point\n");
}
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/Defines.php ./includes/Defines.php
--- ../mediawiki-1.4.9/includes/Defines.php 2005-05-29 07:54:25.000000000 +0200
+++ ./includes/Defines.php 2005-08-30 10:28:00.000000000 +0200
@@ -70,7 +70,7 @@
* database.
*/
$wgAvailableRights = array('read', 'edit', 'move', 'delete', 'undelete',
-'protect', 'block', 'userrights', 'createaccount', 'upload', 'asksql',
+'protect', 'restrict', 'block', 'userrights', 'createaccount', 'upload', 'asksql',
'rollback', 'patrol', 'editinterface', 'siteadmin', 'bot');
/**
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/LogPage.php ./includes/LogPage.php
--- ../mediawiki-1.4.9/includes/LogPage.php 2005-01-14 14:46:04.000000000 +0100
+++ ./includes/LogPage.php 2005-08-30 10:28:00.000000000 +0200
@@ -36,7 +36,7 @@
var $updateRecentChanges = true;
function LogPage( $type ) {
- # Type is one of 'block', 'protect', 'rights', 'delete', 'upload'
+ # Type is one of 'block', 'protect', 'restrict', 'rights', 'delete', 'upload'
$this->type = $type;
}
@@ -79,7 +79,7 @@
* @static
*/
function validTypes() {
- static $types = array( '', 'block', 'protect', 'rights', 'delete', 'upload' );
+ static $types = array( '', 'block', 'protect', 'restrict', 'rights', 'delete', 'upload' );
return $types;
}
@@ -91,6 +91,7 @@
'' => NULL,
'block' => array( 'block', 'unblock' ),
'protect' => array( 'protect', 'unprotect' ),
+ 'restrict'=> array( 'restrict', 'unrestrict' ),
'rights' => array( 'rights' ),
'delete' => array( 'delete', 'restore' ),
'upload' => array( 'upload' )
@@ -113,6 +114,7 @@
'' => 'log',
'block' => 'blocklogpage',
'protect' => 'protectlogpage',
+ 'restrict'=> 'restrictlogpage',
'rights' => 'bureaucratlog',
'delete' => 'dellogpage',
'upload' => 'uploadlogpage',
@@ -128,6 +130,7 @@
'' => 'alllogstext',
'block' => 'blocklogtext',
'protect' => 'protectlogtext',
+ 'restrict'=> 'restrictlogtext',
'rights' => 'rightslogtext',
'delete' => 'dellogpagetext',
'upload' => 'uploadlogpagetext'
@@ -144,6 +147,8 @@
'block/unblock' => 'unblocklogentry',
'protect/protect' => 'protectedarticle',
'protect/unprotect' => 'unprotectedarticle',
+ 'restrict/restrict' => 'restrictedarticle',
+ 'restrict/unrestrict' => 'unrestrictedarticle',
'rights/rights' => 'bureaucratlogentry',
'delete/delete' => 'deletedarticle',
'delete/restore' => 'undeletedarticle',
@@ -168,7 +173,7 @@
/**
* Add a log entry
- * @param string $action one of 'block', 'protect', 'rights', 'delete', 'upload'
+ * @param string $action one of 'block', 'protect', 'restrict', 'rights', 'delete', 'upload'
* @param &$target
* @param string $comment Description associated
*/
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/OutputPage.php ./includes/OutputPage.php
--- ../mediawiki-1.4.9/includes/OutputPage.php 2005-07-07 08:26:35.000000000 +0200
+++ ./includes/OutputPage.php 2005-08-30 10:28:00.000000000 +0200
@@ -137,6 +137,10 @@
return wfMsg('protect');
case 'unprotect':
return wfMsg('unprotect');
+ case 'restrict':
+ return wfMsg('restrict');
+ case 'unrestrict':
+ return wfMsg('unrestrict');
case 'delete':
return wfMsg('delete');
case 'watch':
@@ -590,6 +594,21 @@
$this->returnToMain();
}
+ function restrictGroupRequired() {
+ global $wgUser, $wgTitle;
+
+ $this->setPageTitle( wfMsg( 'restricttitle' ) );
+ $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) );
+ $this->setRobotpolicy( 'noindex,nofollow' );
+ $this->setArticleRelated( false );
+ $this->mBodytext = '';
+
+ $sk = $wgUser->getSkin();
+ $ap = $sk->makeKnownLink( wfMsgForContent( 'administrators' ), '' );
+ $this->addHTML( wfMsg( 'restricttext', $ap ) );
+ $this->returnToMain( false );
+ }
+
function loginToUse() {
global $wgUser, $wgTitle, $wgContLang;
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/Parser.php ./includes/Parser.php
--- ../mediawiki-1.4.9/includes/Parser.php 2005-08-30 01:50:10.000000000 +0200
+++ ./includes/Parser.php 2005-09-02 09:28:23.000000000 +0200
@@ -2156,7 +2156,15 @@
if ( $this->incrementIncludeCount( $dbk ) ) {
# This should never be reached.
$article = new Article( $title );
- $articleContent = $article->getContentWithoutUsingSoManyDamnGlobals();
+
+ /**
+ * remplace with an empty string if the template is a restricted page
+ * (restrict-patch by Jerome Combaz)
+ */
+ if (!$title->userCanRead())
+ $articleContent = "";
+ else
+ $articleContent = $article->getContentWithoutUsingSoManyDamnGlobals();
if ( $articleContent !== false ) {
$found = true;
$text = $articleContent;
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/QueryPage.php ./includes/QueryPage.php
--- ../mediawiki-1.4.9/includes/QueryPage.php 2005-05-25 06:05:57.000000000 +0200
+++ ./includes/QueryPage.php 2005-08-30 10:28:00.000000000 +0200
@@ -297,11 +297,16 @@
* feedItemDesc()
*/
function feedResult( $row ) {
+ global $wgEnableRestrict, $wgUser;
+
if( !isset( $row->title ) ) {
return NULL;
}
$title = Title::MakeTitle( IntVal( $row->namespace ), $row->title );
if( $title ) {
+ if ( $wgEnableRestrict == true && $title->isRestricted() && ! $wgUser->isAllowed('restrict'))
+ return NULL;
+
if( isset( $row->timestamp ) ) {
$date = $row->timestamp;
} else {
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SearchEngine.php ./includes/SearchEngine.php
--- ../mediawiki-1.4.9/includes/SearchEngine.php 2005-04-10 02:05:12.000000000 +0200
+++ ./includes/SearchEngine.php 2005-08-30 10:28:00.000000000 +0200
@@ -190,6 +190,22 @@
return 'AND cur_namespace IN (' . $namespaces . ')';
}
+ /**
+ * Return a partial WHERE clause to limit the search to
+ * the unrestricted pages if user not in 'restrict' group
+ * (restrict-patch by Jerome Combaz)
+ * @return string
+ * @access private
+ */
+ function queryRestricted() {
+ global $wgUser, $wgEnableRestrict;
+
+ if ( $wgEnableRestrict == true and ! $wgUser->isAllowed('restrict') )
+ return 'AND cur_restrictions NOT LIKE "%view=1%"';
+ else
+ return '';
+ }
+
/**
* Return a LIMIT clause to limit results on the query.
* @return string
@@ -209,7 +225,8 @@
function getQuery( $filteredTerm, $fulltext ) {
return $this->queryMain( $filteredTerm, $fulltext ) . ' ' .
$this->queryRedirect() . ' ' .
- $this->queryNamespaces() . ' ' .
+ $this->queryNamespaces() . ' ' .
+ $this->queryRestricted() . ' ' .
$this->queryLimit();
}
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/Skin.php ./includes/Skin.php
--- ../mediawiki-1.4.9/includes/Skin.php 2005-04-22 22:41:58.000000000 +0200
+++ ./includes/Skin.php 2005-08-30 10:28:00.000000000 +0200
@@ -799,7 +799,7 @@
}
function bottomLinks() {
- global $wgOut, $wgUser, $wgTitle;
+ global $wgOut, $wgUser, $wgTitle, $wgEnableRestrict;
$sep = " |\n";
$s = '';
@@ -831,6 +831,8 @@
$s .= "\n
";
if($wgUser->isAllowed('delete')) { $s .= $this->deleteThisPage(); }
if($wgUser->isAllowed('protect')) { $s .= $sep . $this->protectThisPage(); }
+ if( $wgEnableRestrict == true
+ && $wgUser->isAllowed('restrict')) { $s .= $sep . $this->restrictThisPage(); }
if($wgUser->isAllowed('move')) { $s .= $sep . $this->moveThisPage(); }
}
$s .= "
\n" . $this->otherLanguages();
@@ -1089,6 +1091,31 @@
return $s;
}
+ /**
+ * (restrict-patch by Jerome Combaz)
+ * @access private
+ */
+ function restrictThisPage() {
+ global $wgUser, $wgOut, $wgTitle, $wgRequest;
+
+ $diff = $wgRequest->getVal( 'diff' );
+ if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('restrict') ) {
+ $n = $wgTitle->getPrefixedText();
+
+ if ( $wgTitle->isRestricted() ) {
+ $t = wfMsg( 'unrestrictthispage' );
+ $q = 'action=unrestrict';
+ } else {
+ $t = wfMsg( 'restrictthispage' );
+ $q = 'action=restrict';
+ }
+ $s = $this->makeKnownLink( $n, $t, $q );
+ } else {
+ $s = '';
+ }
+ return $s;
+ }
+
function watchThisPage() {
global $wgUser, $wgOut, $wgTitle;
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SkinTemplate.php ./includes/SkinTemplate.php
--- ../mediawiki-1.4.9/includes/SkinTemplate.php 2005-06-25 02:51:05.000000000 +0200
+++ ./includes/SkinTemplate.php 2005-08-30 10:28:00.000000000 +0200
@@ -455,7 +455,7 @@
$fname = 'SkinTemplate::buildContentActionUrls';
wfProfileIn( $fname );
- global $wgTitle, $wgUser, $wgRequest, $wgUseValidation;
+ global $wgTitle, $wgUser, $wgRequest, $wgUseValidation, $wgEnableRestrict;
$action = $wgRequest->getText( 'action' );
$section = $wgRequest->getText( 'section' );
$oldid = $wgRequest->getVal( 'oldid' );
@@ -560,6 +560,22 @@
);
}
}
+ if( $wgEnableRestrict == true && $wgUser->isAllowed('restrict')){
+ if(!$wgTitle->isRestricted()){
+ $content_actions['restrict'] = array(
+ 'class' => ($action == 'restrict') ? 'selected' : false,
+ 'text' => wfMsg('restrict'),
+ 'href' => $wgTitle->getLocalUrl( 'action=restrict' )
+ );
+
+ } else {
+ $content_actions['unrestrict'] = array(
+ 'class' => ($action == 'unrestrict') ? 'selected' : false,
+ 'text' => wfMsg('unrestrict'),
+ 'href' => $wgTitle->getLocalUrl( 'action=unrestrict' )
+ );
+ }
+ }
if($wgUser->isAllowed('delete')){
$content_actions['delete'] = array(
'class' => ($action == 'delete') ? 'selected' : false,
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialAllpages.php ./includes/SpecialAllpages.php
--- ../mediawiki-1.4.9/includes/SpecialAllpages.php 2005-05-06 07:49:28.000000000 +0200
+++ ./includes/SpecialAllpages.php 2005-08-30 10:28:00.000000000 +0200
@@ -59,7 +59,7 @@
}
function indexShowToplevel ( $namespace = 0 ) {
- global $wgOut, $indexMaxperpage, $toplevelMaxperpage, $wgContLang, $wgRequest, $wgUser;
+ global $wgOut, $indexMaxperpage, $toplevelMaxperpage, $wgContLang, $wgRequest, $wgUser, $wgEnableRestrict;
$sk = $wgUser->getSkin();
$fname = "indexShowToplevel";
$namespace = intval ($namespace);
@@ -70,6 +70,11 @@
$dbr =& wfGetDB( DB_SLAVE );
$cur = $dbr->tableName( 'cur' );
$fromwhere = "FROM $cur WHERE cur_namespace=$namespace";
+
+ if ( $wgEnableRestrict == true and ! $wgUser->isAllowed('restrict') ) {
+ $fromwhere .= " AND cur_restrictions NOT LIKE '%view=1%'";
+ }
+
$order_arr = array ( 'ORDER BY' => 'cur_title' );
$order_str = 'ORDER BY cur_title';
$out = "";
@@ -179,7 +184,7 @@
}
function indexShowChunk( $from, $namespace = 0 ) {
- global $wgOut, $wgUser, $indexMaxperpage, $wgContLang;
+ global $wgOut, $wgUser, $indexMaxperpage, $wgContLang, $wgEnableRestrict;
$sk = $wgUser->getSkin();
$maxPlusOne = $indexMaxperpage + 1;
$namespacee = intval($namespace);
@@ -192,8 +197,13 @@
$fromKey = is_null( $fromTitle ) ? '' : $fromTitle->getDBkey();
$sql = "SELECT cur_title FROM $cur WHERE cur_namespace=$namespacee" .
- " AND cur_title >= ". $dbr->addQuotes( $fromKey ) .
- " ORDER BY cur_title LIMIT " . $maxPlusOne;
+ " AND cur_title >= ". $dbr->addQuotes( $fromKey );
+
+ if ( $wgEnableRestrict == true and ! $wgUser->isAllowed('restrict') ) {
+ $sql .= " AND cur_restrictions NOT LIKE '%view=1%'";
+ }
+
+ $sql .= " ORDER BY cur_title LIMIT " . $maxPlusOne;
$res = $dbr->query( $sql, "indexShowChunk" );
### FIXME: side link to previous
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialAncientpages.php ./includes/SpecialAncientpages.php
--- ../mediawiki-1.4.9/includes/SpecialAncientpages.php 2005-04-24 07:13:30.000000000 +0200
+++ ./includes/SpecialAncientpages.php 2005-08-30 10:28:00.000000000 +0200
@@ -28,16 +28,24 @@
function isSyndicated() { return false; }
function getSQL() {
+ global $wgEnableRestrict, $wgUser;
+
$db =& wfGetDB( DB_SLAVE );
$cur = $db->tableName( 'cur' );
$use_index = $db->useIndexClause( 'cur_timestamp' );
- return
+ $sql =
"SELECT 'Ancientpages' as type,
cur_namespace as namespace,
cur_title as title,
UNIX_TIMESTAMP(cur_timestamp) as value
FROM $cur $use_index
WHERE cur_namespace=0 AND cur_is_redirect=0";
+
+ if ( $wgEnableRestrict == true and ! $wgUser->isAllowed('restrict') ) {
+ $sql .= " AND cur_restrictions NOT LIKE '%view=1%'";
+ }
+
+ return $sql;
}
function sortDescending() {
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialBrokenRedirects.php ./includes/SpecialBrokenRedirects.php
--- ../mediawiki-1.4.9/includes/SpecialBrokenRedirects.php 2005-04-24 07:13:30.000000000 +0200
+++ ./includes/SpecialBrokenRedirects.php 2005-08-30 10:28:00.000000000 +0200
@@ -30,12 +30,19 @@
}
function getSQL() {
+ global $wgEnableRestrict, $wgUser;
+
$dbr =& wfGetDB( DB_SLAVE );
extract( $dbr->tableNames( 'cur', 'brokenlinks' ) );
$sql = "SELECT 'BrokenRedirects' as type, cur_namespace as namespace," .
"cur_title as title,bl_to FROM $brokenlinks,$cur " .
"WHERE cur_is_redirect=1 AND bl_from=cur_id ";
+
+ if ( $wgEnableRestrict == true and ! $wgUser->isAllowed('restrict') ) {
+ $sql .= " AND cur_restrictions NOT LIKE '%view=1%'";
+ }
+
return $sql;
}
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialContributions.php ./includes/SpecialContributions.php
--- ../mediawiki-1.4.9/includes/SpecialContributions.php 2005-05-06 13:20:19.000000000 +0200
+++ ./includes/SpecialContributions.php 2005-08-30 10:28:00.000000000 +0200
@@ -13,7 +13,7 @@
* @param string $par (optional) user name of the user for which to show the contributions
*/
function wfSpecialContributions( $par = null ) {
- global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest;
+ global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgEnableRestrict;
$fname = 'wfSpecialContributions';
$target = isset($par) ? $par : $wgRequest->getVal( 'target' );
@@ -23,6 +23,12 @@
return;
}
+ if ( $wgEnableRestrict == true and ! $wgUser->isAllowed('restrict') ) {
+ $restrict = "AND cur_restrictions NOT LIKE '%view=1%'";
+ } else {
+ $restrict = '';
+ }
+
# FIXME: Change from numeric offsets to date offsets
list( $limit, $offset ) = wfCheckLimits( 50, '' );
$offlimit = $limit + $offset;
@@ -96,7 +102,7 @@
'LIMIT' => $querylimit ) );
$sql = "SELECT cur_namespace,cur_title,cur_timestamp,cur_comment,cur_minor_edit,cur_is_new,cur_user_text FROM $cur $useIndex " .
- "WHERE cur_user_text='" . $dbr->strencode( $nt->getText() ) . "' {$cmq} " .
+ "WHERE cur_user_text='" . $dbr->strencode( $nt->getText() ) . "' {$cmq} {$restrict} " .
"ORDER BY inverse_timestamp $tailOpts";
$res1 = $dbr->query( $sql, $fname );
@@ -110,7 +116,7 @@
'LIMIT' => $querylimit ) );
$sql = "SELECT cur_namespace,cur_title,cur_timestamp,cur_comment,cur_minor_edit,cur_is_new,cur_user_text FROM $cur $useIndex " .
- "WHERE cur_user {$userCond} {$cmq} ORDER BY inverse_timestamp $tailOpts";
+ "WHERE cur_user {$userCond} {$cmq} {$restrict} ORDER BY inverse_timestamp $tailOpts";
$res1 = $dbr->query( $sql, $fname );
$sql = "SELECT old_namespace,old_title,old_timestamp,old_comment,old_minor_edit,old_user_text,old_id FROM $old $useIndex " .
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialDeadendpages.php ./includes/SpecialDeadendpages.php
--- ../mediawiki-1.4.9/includes/SpecialDeadendpages.php 2004-11-13 21:40:28.000000000 +0100
+++ ./includes/SpecialDeadendpages.php 2005-08-30 10:28:00.000000000 +0200
@@ -43,13 +43,20 @@
* @return string an sqlquery
*/
function getSQL() {
+ global $wgEnableRestrict, $wgUser;
+
$dbr =& wfGetDB( DB_SLAVE );
extract( $dbr->tableNames( 'cur', 'links' ) );
- return "SELECT 'Deadendpages' as type, cur_namespace AS namespace, cur_title as title, cur_title AS value " .
+ $sql = "SELECT 'Deadendpages' as type, cur_namespace AS namespace, cur_title as title, cur_title AS value " .
"FROM $cur LEFT JOIN $links ON cur_id = l_from " .
"WHERE l_from IS NULL " .
"AND cur_namespace = 0 " .
"AND cur_is_redirect = 0";
+ if ( $wgEnableRestrict == true and ! $wgUser->isAllowed('restrict') ) {
+ $sql .= " AND cur_restrictions NOT LIKE '%view=1%'";
+ }
+
+ return $sql;
}
}
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialExport.php ./includes/SpecialExport.php
--- ../mediawiki-1.4.9/includes/SpecialExport.php 2005-05-09 02:58:27.000000000 +0200
+++ ./includes/SpecialExport.php 2005-08-30 10:28:00.000000000 +0200
@@ -79,12 +79,14 @@
}
function page2xml( $page, $curonly, $full = false ) {
- global $wgLang;
+ global $wgLang, $wgUser;
$fname = 'page2xml';
wfProfileIn( $fname );
$title = Title::NewFromText( $page );
- if( !$title ) {
+ if( !$title
+ || ( $title->isRestricted()
+ && ! $wgUser->isAllowed('restrict') ) ) {
wfProfileOut( $fname );
return "";
}
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialLog.php ./includes/SpecialLog.php
--- ../mediawiki-1.4.9/includes/SpecialLog.php 2005-06-19 23:10:19.000000000 +0200
+++ ./includes/SpecialLog.php 2005-08-30 10:28:00.000000000 +0200
@@ -59,11 +59,16 @@
* @private
*/
function setupQuery( $request ) {
+ global $wgUser, $wgEnableRestrict, $wgHideRestrictLog;
$cur = $this->db->tableName( 'cur' );
$user = $this->db->tableName( 'user' );
$this->joinClauses = array( "LEFT OUTER JOIN $cur ON log_namespace=cur_namespace AND log_title=cur_title" );
$this->whereClauses = array( 'user_id=log_user' );
-
+
+ if ( ($wgEnableRestrict and $wgHideRestrictLog and ! $wgUser->isAllowed('restrict'))
+ or ! $wgEnableRestrict )
+ $this->whereClauses[] = 'log_type != "restrict"';
+
$this->limitType( $request->getVal( 'type' ) );
$this->limitUser( $request->getText( 'user' ) );
$this->limitTitle( $request->getText( 'page' ) );
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialLonelypages.php ./includes/SpecialLonelypages.php
--- ../mediawiki-1.4.9/includes/SpecialLonelypages.php 2004-11-13 21:40:28.000000000 +0100
+++ ./includes/SpecialLonelypages.php 2005-08-30 10:28:00.000000000 +0200
@@ -31,12 +31,20 @@
function isSyndicated() { return false; }
function getSQL() {
+ global $wgEnableRestrict, $wgUser;
+
$dbr =& wfGetDB( DB_SLAVE );
extract( $dbr->tableNames( 'cur', 'links' ) );
- return "SELECT 'Lonelypages' as type, cur_namespace AS namespace, cur_title AS title, cur_title AS value " .
+ $sql = "SELECT 'Lonelypages' as type, cur_namespace AS namespace, cur_title AS title, cur_title AS value " .
"FROM $cur LEFT JOIN $links ON cur_id=l_to ".
"WHERE l_to IS NULL AND cur_namespace=0 AND cur_is_redirect=0";
+
+ if ( $wgEnableRestrict == true and ! $wgUser->isAllowed('restrict') ) {
+ $sql .= " AND cur_restrictions NOT LIKE '%view=1%'";
+ }
+
+ return $sql;
}
}
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialPage.php ./includes/SpecialPage.php
--- ../mediawiki-1.4.9/includes/SpecialPage.php 2005-05-29 07:18:41.000000000 +0200
+++ ./includes/SpecialPage.php 2005-08-30 10:28:00.000000000 +0200
@@ -45,6 +45,11 @@
'Unusedimages' => new SpecialPage( 'Unusedimages' )
);
+global $wgEnableRestrict, $wgRestrictGroup;
+if( $wgEnableRestrict == true ) {
+ $wgSpecialPages['Restrictedpages'] = new SpecialPage( 'Restrictedpages', 'restrict' );
+}
+
global $wgDisableCounters;
if( !$wgDisableCounters ) {
$wgSpecialPages['Popularpages'] = new SpecialPage( 'Popularpages' );
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialPopularpages.php ./includes/SpecialPopularpages.php
--- ../mediawiki-1.4.9/includes/SpecialPopularpages.php 2004-11-13 21:40:28.000000000 +0100
+++ ./includes/SpecialPopularpages.php 2005-08-30 10:28:00.000000000 +0200
@@ -28,16 +28,24 @@
function isSyndicated() { return false; }
function getSQL() {
+ global $wgEnableRestrict, $wgUser;
+
$dbr =& wfGetDB( DB_SLAVE );
$cur = $dbr->tableName( 'cur' );
- return
+ $sql =
"SELECT 'Popularpages' as type,
cur_namespace as namespace,
cur_title as title,
cur_counter as value
FROM $cur
WHERE cur_namespace=0 AND cur_is_redirect=0";
+
+ if ( $wgEnableRestrict == true and ! $wgUser->isAllowed('restrict') ) {
+ $sql .= " AND cur_restrictions NOT LIKE '%view=1%'";
+ }
+
+ return $sql;
}
function formatResult( $skin, $result ) {
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialRandompage.php ./includes/SpecialRandompage.php
--- ../mediawiki-1.4.9/includes/SpecialRandompage.php 2004-11-29 19:25:13.000000000 +0100
+++ ./includes/SpecialRandompage.php 2005-08-30 10:28:00.000000000 +0200
@@ -8,7 +8,7 @@
* Constructor
*/
function wfSpecialRandompage() {
- global $wgOut, $wgTitle, $wgArticle, $wgExtraRandompageSQL;
+ global $wgOut, $wgTitle, $wgArticle, $wgExtraRandompageSQL, $wgEnableRestrict, $wgUser;
$fname = 'wfSpecialRandompage';
# NOTE! We use a literal constant in the SQL instead of the RAND()
@@ -35,7 +35,13 @@
$sqlget = "SELECT cur_id,cur_title
FROM $cur $use_index
WHERE cur_namespace=0 AND cur_is_redirect=0 $extra
- AND cur_random>$randstr
+ AND cur_random>$randstr";
+
+ if ( $wgEnableRestrict == true and ! $wgUser->isAllowed('restrict') ) {
+ $sqlget .= " AND cur_restrictions NOT LIKE '%view=1%'";
+ }
+
+ $sqlget .= "
ORDER BY cur_random
LIMIT 1";
$res = $db->query( $sqlget, $fname );
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialRestrictedpages.php ./includes/SpecialRestrictedpages.php
--- ../mediawiki-1.4.9/includes/SpecialRestrictedpages.php 1970-01-01 01:00:00.000000000 +0100
+++ ./includes/SpecialRestrictedpages.php 2005-08-30 10:28:00.000000000 +0200
@@ -0,0 +1,64 @@
+tableName( 'cur' );
+ $use_index = $db->useIndexClause( 'cur_timestamp' );
+ return
+ "SELECT 'Restrictedpages' as type,
+ cur_namespace as namespace,
+ cur_title as title,
+ cur_timestamp as value
+ FROM $cur $use_index
+ WHERE cur_namespace=0 AND cur_restrictions LIKE '%view=1%'";
+ }
+
+ function sortDescending() {
+ return false;
+ }
+
+ function formatResult( $skin, $result ) {
+ global $wgLang, $wgContLang;
+
+ $d = $wgLang->timeanddate( wfTimestamp( TS_MW, $result->value ), true );
+ $link = $skin->makeKnownLink( $result->title, $wgContLang->convert( $result->title) );
+ return "{$link} ({$d})";
+ }
+}
+
+function wfSpecialRestrictedpages() {
+ list( $limit, $offset ) = wfCheckLimits();
+
+ $app = new RestrictedPagesPage();
+
+ $app->doQuery( $offset, $limit );
+}
+
+?>
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialShortpages.php ./includes/SpecialShortpages.php
--- ../mediawiki-1.4.9/includes/SpecialShortpages.php 2004-11-13 21:40:28.000000000 +0100
+++ ./includes/SpecialShortpages.php 2005-08-30 10:28:00.000000000 +0200
@@ -28,17 +28,25 @@
function isSyndicated() { return false; }
function getSQL() {
+ global $wgEnableRestrict, $wgUser;
+
$dbr =& wfGetDB( DB_SLAVE );
$cur = $dbr->tableName( 'cur' );
$name = $dbr->addQuotes( $this->getName() );
- return
+ $sql =
"SELECT $name as type,
cur_namespace as namespace,
cur_title as title,
LENGTH(cur_text) AS value
FROM $cur
WHERE cur_namespace=0 AND cur_is_redirect=0";
+
+ if ( $wgEnableRestrict == true and ! $wgUser->isAllowed('restrict') ) {
+ $sql .= " AND cur_restrictions NOT LIKE '%view=1%'";
+ }
+
+ return $sql;
}
function sortDescending() {
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/SpecialUncategorizedpages.php ./includes/SpecialUncategorizedpages.php
--- ../mediawiki-1.4.9/includes/SpecialUncategorizedpages.php 2004-12-01 15:19:57.000000000 +0100
+++ ./includes/SpecialUncategorizedpages.php 2005-08-30 10:28:00.000000000 +0200
@@ -32,12 +32,20 @@
function isSyndicated() { return false; }
function getSQL() {
+ global $wgEnableRestrict, $wgUser;
+
$dbr =& wfGetDB( DB_SLAVE );
extract( $dbr->tableNames( 'cur', 'categorylinks' ) );
- return "SELECT 'Uncategorizedpages' as type, cur_namespace AS namespace, cur_title AS title, cur_title AS value " .
+ $sql = "SELECT 'Uncategorizedpages' as type, cur_namespace AS namespace, cur_title AS title, cur_title AS value " .
"FROM $cur LEFT JOIN $categorylinks ON cur_id=cl_from ".
"WHERE cl_from IS NULL AND cur_namespace=$this->requestedNamespace AND cur_is_redirect=0";
+
+ if ( $wgEnableRestrict == true and ! $wgUser->isAllowed('restrict') ) {
+ $sql .= " AND cur_restrictions NOT LIKE '%view=1%'";
+ }
+
+ return $sql;
}
}
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/Title.php ./includes/Title.php
--- ../mediawiki-1.4.9/includes/Title.php 2005-05-06 05:25:43.000000000 +0200
+++ ./includes/Title.php 2005-09-18 19:40:45.061309216 +0200
@@ -747,6 +747,23 @@
}
/**
+ * Does the title correspond to a restricted article?
+ * (restrict-patch by Jerome Combaz)
+ * @return boolean
+ * @access public
+ */
+ function isRestricted() {
+ global $wgEnableRestrict;
+
+ if ( $wgEnableRestrict == true ) {
+ $a = $this->getRestrictions("view");
+ if ( !empty($a) && $a[0] == true ) return true;
+ }
+
+ return false;
+ }
+
+ /**
* Is $wgUser is watching this page?
* @return boolean
* @access public
@@ -855,8 +872,22 @@
* @access public
*/
function userCanRead() {
- global $wgUser;
-
+ global $wgUser, $wgUserPageRestrict,$wgEnableRestrict;
+
+ // restricted page ?
+ if ( $this->isRestricted() && ! $wgUser->isAllowed('restrict') ) {
+ return false;
+ }
+
+ // restricted user pages ?
+ if ( $wgUserPageRestrict == true
+ && $this->getNamespace() == NS_USER
+ && $wgUser->getName() != $this->getText() ) {
+ if ( ! $wgUser->isAllowed('restrict') ) {
+ return false;
+ }
+ }
+
if( $wgUser->isAllowed('read') ) {
return true;
} else {
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/includes/User.php ./includes/User.php
--- ../mediawiki-1.4.9/includes/User.php 2005-06-12 20:12:09.000000000 +0200
+++ ./includes/User.php 2005-08-30 10:28:00.000000000 +0200
@@ -793,7 +793,7 @@
return true;
}
- global $wgWhitelistRead;
+ global $wgWhitelistRead, $wgRestrictGroup;
$groupRights = array(
'asksql' => 'nobody',
'siteadmin' => 'developer',
@@ -801,6 +801,7 @@
'userrights' => 'bureaucrat',
'patrol' => 'sysop',
'protect' => 'sysop',
+ 'restrict' => $wgRestrictGroup,
'delete' => 'sysop',
'rollback' => 'sysop',
'block' => 'sysop',
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/index.php ./index.php
--- ../mediawiki-1.4.9/index.php 2005-07-03 07:56:52.000000000 +0200
+++ ./index.php 2005-08-30 10:28:00.000000000 +0200
@@ -54,7 +54,11 @@
# the Read array in order for the user to see it. (We have to check here to
# catch special pages etc. We check again in Article::view())
if ( !is_null( $wgTitle ) && !$wgTitle->userCanRead() ) {
- $wgOut->loginToUse();
+ if ( $wgTitle->isRestricted() ) {
+ $wgOut->restrictGroupRequired();
+ } else {
+ $wgOut->loginToUse();
+ }
$wgOut->output();
exit;
}
@@ -136,6 +140,8 @@
case 'rollback':
case 'protect':
case 'unprotect':
+ case 'restrict':
+ case 'unrestrict':
case 'validate':
case 'info':
case 'markpatrolled':
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/languages/LanguageDe.php ./languages/LanguageDe.php
--- ../mediawiki-1.4.9/languages/LanguageDe.php 2005-04-09 08:44:13.000000000 +0200
+++ ./languages/LanguageDe.php 2005-08-30 10:28:00.000000000 +0200
@@ -1171,6 +1171,30 @@
'speciallogtitlelabel' => 'Titel: ',
'passwordtooshort' => 'Ihr Passwort ist zu kurz. Es muss mindestens $1 Zeichen lang sein.',
+#Restrict patch (http://meta.wikimedia.org/wiki/Page_access_restriction_with_MediaWiki)
+'restrict' => 'Sperren',
+'restrictthispage' => 'Diese Seite sperren',
+'unrestrict' => "Sperrung aufheben",
+'unrestrictthispage' => "Sperrung der Seite aufheben",
+'restricttitle' => 'Gesperrte Seite',
+"restricttext" => "Diese Seite ist gesperrt. Um sie zu betrachten, musst du ein Mitglied der Gruppe \"restrict\" sein.",
+'restrictpheading' => 'Sperrebene',
+'restrictedpages' => 'Gesperrte Seiten',
+"restrictlogpage" => "Log der Sperrungen",
+"restrictlogtext" => "Unten folgt eine Liste mit gesperrten Seiten. Vgl. [[Project:Restricted page]] für mehr Information.",
+"restrictedarticle" => "Gesperrter $1",
+"unrestrictedarticle" => "Ungesperrter $1",
+"restrictsub" => "(Gesperrter \"$1\")",
+"confirmrestrict" => "Sperrung bestätigen",
+"confirmrestricttext" => "Willst du die Seite wirklich sperren?",
+"restrictcomment" => "Grund für die Sperrung",
+"unrestrictsub" => "(Entsperren \"$1\")",
+"confirmunrestricttext" => "Willst du die Seite wirklich entsperren?",
+"confirmunrestrict" => "Entsperrung bestätigen",
+"unrestrictcomment" => "Grund für Entsperrung",
+"restrictreason" => "(einen Grund angeben)",
+'tooltip-restrict' => 'Diese Seite sperren'
+
);
class LanguageDe extends LanguageUtf8 {
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/languages/LanguageFr.php ./languages/LanguageFr.php
--- ../mediawiki-1.4.9/languages/LanguageFr.php 2005-08-25 15:26:29.000000000 +0200
+++ ./languages/LanguageFr.php 2005-08-30 10:28:00.000000000 +0200
@@ -876,11 +876,11 @@
"revertpage" => "restitution de la dernière modification de $1",
"protectlogpage" => "Log_de_protection",
"protectlogtext" => "Voir les [[{{ns:4}}:Page protégée|directives concernant les pages protégées]].",
-"protectedarticle" => "a protégée $1",
+"protectedarticle" => "a protégé $1",
"unprotectedarticle" => "a déprotégé $1",
"protectsub" => "(Bloque \"$1\")",
-"confirmprotect" => "Confimer le bloquage",
+"confirmprotect" => "Confirmer le bloquage",
"confirmprotecttext" => "Voulez vous vraiment bloquer cette page ?",
"protectcomment" => "Raison du bloquage",
@@ -1201,6 +1201,29 @@
'mw_math_source' => "Laisser le code TeX original",
'mw_math_modern' => "Pour les navigateurs modernes",
'mw_math_mathml' => 'MathML',
+
+#Restrict patch (http://meta.wikimedia.org/wiki/Page_access_restriction_with_MediaWiki)
+'restrict' => 'Restreindre',
+'restrictthispage' => 'Restreindre cette page',
+"unrestrict" => "Autoriser",
+"unrestrictthispage" => "Autoriser cette page",
+'restricttitle' => "Page restreinte",
+"restricttext" => "L'accès à cette page a été restreint. Pour pouvoir y accéder vous devez être membre du groupe 'restrict'",
+"restrictlogpage" => "Log_de_restriction",
+"restrictlogtext" => "Voir les [[{{ns:4}}:Page restreinte|directives concernant les pages restreintes]].",
+"restrictedarticle" => "a restreint $1",
+"unrestrictedarticle" => "a autorisé $1",
+"restrictsub" => "(Restreint \"$1\")",
+"confirmrestrict" => "Confirmer la restriction",
+"confirmrestricttext" => "Voulez vous vraiment restreindre l'accès à cette page ?",
+"restrictcomment" => "Raison de la restriction",
+"unrestrictsub" => "(Autorise \"$1\")",
+"confirmunrestricttext" => "Voulez-vous vraiment autoriser l'accès à cette page ?",
+"confirmunrestrict" => "Confirmer l'autorisation",
+"unrestrictcomment" => "Raison de l'autorisation",
+"restrictreason" => "(indiquez une raison)",
+'tooltip-restrict' => 'Restreindre cette page',
+
);
class LanguageFr extends LanguageUtf8 {
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/languages/Language.php ./languages/Language.php
--- ../mediawiki-1.4.9/languages/Language.php 2005-06-01 08:02:22.000000000 +0200
+++ ./languages/Language.php 2005-08-30 10:28:00.000000000 +0200
@@ -1681,6 +1681,32 @@
# List of bad images
'bad_image_list' => '',
+
+#Restrict patch (http://meta.wikimedia.org/wiki/Page_access_restriction_with_MediaWiki)
+'restrict' => 'Restrict',
+'restrictthispage' => 'Restrict this page',
+'unrestrict' => "Unrestrict",
+'unrestrictthispage' => "Unrestrict this page",
+'restricttitle' => 'Restricted page',
+"restricttext" => "This page is restricted. To view it you have to be member of the \"restrict\" group.",
+'restrictpheading' => 'restrict level',
+'restrictedpages' => 'Restricted pages',
+"restrictlogpage" => "Restriction_log",
+"restrictlogtext" => "Below is a list of page restrictions.
+See [[Project:Restricted page]] for more information.",
+"restrictedarticle" => "restricted $1",
+"unrestrictedarticle" => "unrestricted $1",
+"restrictsub" => "(Restrict \"$1\")",
+"confirmrestrict" => "Confirm the restriction",
+"confirmrestricttext" => "Do you really want to restrict this page?",
+"restrictcomment" => "Reason for restricting",
+"unrestrictsub" => "(Unrestrict \"$1\")",
+"confirmunrestricttext" => "Do you really want to unrestrict this page?",
+"confirmunrestrict" => "Confirm unrestriction",
+"unrestrictcomment" => "Reason for unrestricting",
+"restrictreason" => "(give a reason)",
+'tooltip-restrict' => 'Restrict this page'
+
);
#--------------------------------------------------------------------------
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/README.restriction-patch ./README.restriction-patch
--- ../mediawiki-1.4.9/README.restriction-patch 1970-01-01 01:00:00.000000000 +0100
+++ ./README.restriction-patch 2005-09-02 09:33:15.000000000 +0200
@@ -0,0 +1,69 @@
+
+Article restriction patch for MediaWiki 1.4.9
+---------------------------------------------
+
+Here is a patch to enable article restriction under MediaWiki. Pages can be articles or categories. It adds a new |restrict| tab link allowing to restrict access to members of the group ''restrict''. Others users cannot see, search, export, etc, the restricted pages. You can still |protect| them for editing. A restricted page is distinguished by a red background tab, and you have a special page (Special:RestrictedPages) to list the restricted pages. All restriction/unrestriction actions are loggued in the wiki log. Optionaly the user's pages can be restricted to their owner. Currently it is localized in english and french.
+
+This feature is mainly useful for intranet relying on WikiMedia as a non-encyclopedic content management system, like e-learning platforms or informational systems. To respect the wiki philosophy, it is not appropriate to use it to restrict public access!
+
+To install restriction-patch, download MediaWiki (do a security backup if you patch your own installation).
+
+- Apply patch :
+
+ mv restriction-beta-0.54.mediawiki-1.4.9.patch ./mediawiki-1.4.9
+ cd ./mediawiki-1.4.9
+ patch -p0 < restriction-beta-0.54.mediawiki-1.4.9.patch
+
+- Configure :
+
+Restriction is disabled by default. Add in your ''./LocalSettings.php'' file (below require_once( "includes/DefaultSettings.php" );) :
+
+
+ // Enable the restriction feature.
+ // If set to false, all protected pages are accessible.
+ $wgEnableRestrict = true;
+
+ // sysop users can use restrict feature
+ $wgRestrictGroup = 'sysop';
+
+ // Hide restriction log entries for non-members users
+ $wgHideRestrictLog = true;
+
+ // Restrict user pages to their owner (as well as restrict members)
+ $wgUserPageRestrict = true;
+
+You can change the members allowed to restrict : 'bureaucrat', 'developer', or 'user' to allow only the registred users. If $wgUserPageRestrict is true, user pages are restricted to their respective owner, as well as members of the restrict group.
+
+Don't write sensible information in page titles, they could be retrieved in some cases. This is beta and GPL, test and feedback welcome !
+
+
+jerome combaz (restrict-patch /at/ velay.greta.fr)
+
+
+ Download patch, updates, screenshots and comments here :
+ http://conseil-recherche-innovation.net/index.php/1974/04/10/31-restrict-pages-under-mediawiki
+
+
+ChangeLog
+---------
+
+Version beta-0.54 (09-02-2005)
+- SECURITY FIX: avoid to display restricted pages as template (with {{:RestrictedPageTitle}}) for non allowed users (thanks to Peter)
+
+Version beta-0.53 (07-28-2005)
+- Missing missing ending comma in LanguageDe.php (thanks to Marc Meurrens)
+
+Version beta-0.52 (07-12-2005)
+- Missing brace in SpecialAncientpages.php (thanks to Nils Radtke/www.Think-Future.de)
+
+Version beta-0.51 (06-29-2005)
+- German version (thanks to Dr. Walter H. Schreiber)
+
+Version beta-0.5 (05-02-2005)
+- User pages restriction
+
+Version beta-0.4 (05-02-2005)
+- Feeds hide restricted articles for non allowed users
+
+Version beta-0.3 (04-11-2005)
+- First public release
diff -x '*~' -x LocalSettings.php -x '*.orig' -x '*.patch' -Naur ../mediawiki-1.4.9/skins/monobook/main.css ./skins/monobook/main.css
--- ../mediawiki-1.4.9/skins/monobook/main.css 2005-05-07 08:06:35.000000000 +0200
+++ ./skins/monobook/main.css 2005-08-30 10:28:00.000000000 +0200
@@ -749,7 +749,6 @@
padding: 0 0 0.2em 0;
}
#p-cactions li a {
- background-color: White;
color: #002bb8;
border: none;
padding: 0 0.8em 0.3em 0.8em;
@@ -776,6 +775,8 @@
li#ca-talk { margin-right: 1.6em; }
li#ca-watch, li#ca-unwatch, li#ca-varlang-0 { margin-left: 1.6em; }
+li#ca-unrestrict { background-color: #ba0000; }
+li#ca-unrestrict a { color: white; }
/*
** the remaining portlets