Personal tools

Extension:PublicRevision.php

From OrganicDesign Wiki

Jump to: navigation, search
<?php
# Extension:PublicRevision
# - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
# - Author: [http://www.organicdesign.co.nz/nad User:Nad]
 
if (!defined('MEDIAWIKI')) die('Not an entry point.');
 
define('PUBLICREVISION_VERSION','0.0.1, 2007-09-27');
 
$wgExtensionFunctions[] = 'wfSetupPublicRevision';
$wgExtensionCredits['other'][] = array(
	'name'        => 'PublicRevision',
	'author'      => '[http://www.organicdesign.co.nz/nad User:Nad]',
	'description' => 'Allow articles to be held at a particular revision until subsequent edits are authorised by a user with sufficient permissions.',
	'url'         => 'http://www.mediawiki.org/wiki/Extension:PublicRevision',
	'version'     => PUBLICREVISION_VERSION
	);
 
# Called from $wgExtensionFunctions array when initialising extensions
function wfSetupPublicRevision() {
	global $wgExtraNamespaces;
 
	# If a held-back revision id article exists for the requested title, put its value into oldid
	$title = Title::newFromText($wgExtraNamespaces[NS_PUBLICREVISION].':'.$_REQUEST['title']);
	if (is_object($title) && $title->exists()) {
		$article = new Article($title);
		if (ereg('^\\s*([0-9]+)',$article->fetchContent(0,false,false),$m)) $_REQUEST['oldid'] = $m[1];
		}
 
	}
 
?>

The GNU Project Debian Linux Ubuntu Linux Wikipedia online encycopedia MediaWiki