RPXnow and MediaWiki

Z mj41.cz

Obsah

Install

Install MediaWiki

Download and follow instructions.

Install PHP OpenID library

Download php-openid-2.1.3.zip and install it (extract Auth directory to path where you have PHP libraries).

Or extract somewhere else and add these path to your PHP include_path, e.g. add these two lines to LocalSettings.php:

$path = '/var/www/html/mj41cz/www-test/phplib';
set_include_path( get_include_path() . PATH_SEPARATOR . $path);

You can also follow instructions on Extension:OpenID#Pre-requisites (mediawiki.org).

Get and extract OpenID-RPXnow

Download mediawiki-rpx.zip and extrace. So you will have OpenID direcotry inside your mediawiki 'extensions' directory.

Configure your RPX

Configure your RPX Application on rpxnow.com.

Sign-in: Setup Guide -> 1 Get the Widget

On 'What is your token URL?' put something like http://wiki.mj41.cz/w/index.php?title=Special:OpenIDLogin/FinishRPX

Click on 'Generate code' (blue button).

Now you can see code

<iframe src="http:// ... %3AOpenIDLogin%2FFinishRPX"  scrolling="no"  ...

You will need URL 'http:// ... %3AOpenIDLogin%2FFinishRPX' so copy it.

Update LocalSettings.php

Example for wiki on http://wiki.mj41.cz and for RPXnow http://mj41cz-wiki.rpxnow.com:

# If you have problem with randsource.
#define('Auth_OpenID_RAND_SOURCE', null); 

$wgTrustRoot = '"http://wiki.mj41.cz/';

#$path = '/var/www/html/mj41cz/www-test/phplib';
#set_include_path( get_include_path() . PATH_SEPARATOR . $path);

require_once("$IP/extensions/OpenID/OpenID.setup.php");

$wgAuthRPXApiKey = 'wiki.mj41.cz_API_Key_here';  
$wgOpenIDRPXLinkURL = 'http://mj41cz-wiki.rpxnow.com/openid/embed?token_url=http%3A%2F%2Ftest.mj41.cz%2Fw%2Findex.php%3Ftitle%3DSpecial%3AOpenIDLogin%2FFinishRPX';

# Configure to login only throught RPXnow.
$wgGroupPermissions['*']['createaccount'] = false;
$wgHideOpenIDLoginLink = false;
$wgOpenIDOpenIDLink = false;
$wgOpenIDRPXLink = true;
$wgOpenIDOnly = true;

Modal overal

Update LocalSettings.php

Disable link to 'embeded' version.

$wgOpenIDRPXLink = false;

Update skin/MonoBook.php

Find where personal urls are printed. There is foreach block

<?php           foreach($this->data['personal_urls'] as $key => $item) { ?>
...
                echo htmlspecialchars($item['text']) ?></a></li>
<?php           } ?>
            </ul>

after

<?php           } ?>

line add


<?php			
			global $wgUser;
			if ( ! $wgUser->isLoggedIn() ) {
				global $wgOpenIDRPXLinkURL;
?>
				<li>
				 <a class="rpxnow" onclick="return false;" href="<?php echo $wgOpenIDRPXLinkURL; ?>"> Sign In </a> 
				 <script type="text/javascript">
				  var rpxJsHost = (("https:" == document.location.protocol) ? "https://" : "http://static.");
				  document.write(unescape("%3Cscript src='" + rpxJsHost + "rpxnow.com/js/lib/rpx.js' type='text/javascript'%3E%3C/script%3E"));
				</script>
				<script type="text/javascript">
				  RPXNOW.overlay = true;
				  RPXNOW.language_preference = 'en';
				</script>
				</li>
<?php 		} ?>


OpenID with RPXnow - history

OpenID source

Subversion

Download mediawiki-src.zip (extracted).

Apply RPXnow patch

Download mediawiki-OpenID-rpxnow.patch.

OpenID r66573 with RPXnow patch applied

Download mediawiki-rpx.zip (extracted).

Download

Example

See also

spřízněné weby
Jazyk