Extension:PublicCat.php

From Organic Design wiki
Revision as of 23:03, 15 June 2007 by Nad (talk | contribs) (private wiki/public web needs to be an extension for easy maintenance and re-use)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<?php

  1. Extension:PublicCat
Info.svg These are the MediaWiki extensions we're using and/or developing. Please refer to the information on the mediawiki.org wiki for installation and usage details. Extensions here which have no corresponding mediawiki article are either not ready for use or have been superseded. You can also browse our extension code in our local Subversion repository or our GitHub mirror.

Template:Php

  1. - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
  2. - Author: User:NadCategory:Extensions created with Template:Extension

if (!defined('MEDIAWIKI')) die('Not an entry point.');

define('PUBLICCAT_VERSION','1.0.0, 2007-06-16');

$wgExtensionFunctions[] = 'wfSetupPublicCat'; $wgHooks['LanguageGetMagic'][] = 'wfPublicCatLanguageGetMagic';

  1. Anonymous users

$wgGroupPermissions['*']['createaccount'] = false; $wgGroupPermissions['*']['read'] = false; $wgGroupPermissions['*']['edit'] = false; $wgGroupPermissions['*']['createpage'] = false; $wgGroupPermissions['*']['createtalk'] = false; $wgWhitelistRead = array('Special:Userlogin','Main Page','-');

$wgExtensionCredits['other'][] = array( 'name' => 'PublicCat', 'author' => 'User:Nad', 'description' => 'Divides wiki into private and public by domain name, but allows unrestricted access to articles in a public category.', 'url' => 'http://www.mediawiki.org/wiki/Extension:PublicCat', 'version' => PUBLICCAT_VERSION );

if (!ereg('^wiki.',$_SERVER['HTTP_HOST'])) { if ($_REQUEST['action'] != 'view' && $_REQUEST['action'] != 'raw') $_REQUEST['action'] = 'view'; }

  1. Called from $wgExtensionFunctions array when initialising extensions

function wfSetupPublicCat() { }

function wf404() { header('HTTP/1.0 404 Not Found'); $err = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>404 Not Found</t$

<body>

Not Found

The requested URL was not found on this server.

</body>$

if (in_array('Content-Encoding: gzip',headers_list())) $err = gzencode($err); echo $err; die; }

?>