Skype Extension for Wikimedia

I’m constantly championing Skype within my non-profit organization as a way to increase communication while decreasing costs. As part of our developing MediaWiki intranet I wanted to create a directory of staff members and their skype usernames. I also wanted to add buttons (http://www.skype.com/share/buttons/wizard.html) for calling, chatting, and adding skype users.

Existing skype extensions focused only on showing a users Skype status. (http://meta.wikimedia.org/wiki/Skype_extension) In true wiki style, I added my own variaton on the code to allow editors to create buttons for different skype actions.

<?php
  $wgExtensionFunctions[] = "wfskype";

function wfSkype() {
global $wgParser;
$wgParser->setHook( “skype”, “renderSkype” );
}

# The callback function for converting the input text to HTML output
function renderSkype( $input, $argv ) {

if( !isset( $argv[‘action’] ) ){
$skype_action = “call” ;
} else {
$skype_action = $argv[‘action’] ;
}

switch( $skype_action ){

case “call”:
$skype_width = 70 ;
$skype_height = 23 ;
$skype_style=”call_blue_transparent_70x23.png”;
break;

case “add”:
$skype_width = 118 ;
$skype_height = 23 ;
$skype_style=”add_blue_transparent_118x23.png”;
break;

case “chat”:
$skype_width = 97 ;
$skype_height = 23 ;
$skype_style=”chat_blue_transparent_97x23.png”;
break;

default:
$skype_action = “call” ;
$skype_width = 70 ;
$skype_height = 23 ;
$skype_style=”call_blue_transparent_70x23.png”;

}

$output = ‘<!– Skype buttons http://www.skype.com/go/skypebuttons –>’;
$output .= ‘<!– MediaWiki extension http://meta.wikimedia.org/w/&#8217;;

     $output .= 'index.php?title=Skype_extension -->';
     $output .= '     $output .= '/js/skypeCheck.js">';
     $output .= '<a href="skype:'.$input.'?'.$skype_action.'">';
     $output .= '<img src="http://download.skype.com/share/skypebuttons/';
     $output .= 'buttons/'.$skype_style.'" ' ;
     $output .= 'style="border: none; width: '.$skype_width.'px; height: '.$skype_height.'px;" alt="Skype me" /></a>';
     $output .= '<!-- end of skype button -->';

return $output;
}
?>

  1. Copy the code into a file (e.g. skype.php)
  2. Save the file in the extensions directory of your mediawiki folder
  3. Add the line include('extensions/skype.php'); to the end of your LocalSettings.php file

In any wiki post, you can add <skype action="specified_action">Skype-Username</skype> where specified_action is call, chat, or add and Skype-Username is a valid skype username.

Buttons appear as

Call me!
Add me to Skype

Chat with me

Advertisements

Configuring WikiMedia for an Active Directory based intranet

One of my current projects involves creating an internal knowledge base. Wiki’s being a natural for this sort of collaborative content building, I started exploring MediaWiki the engine behind Wikipedia.

An intranet implies a much more closed community than that of the typical Wiki implementation. That being the case, our requirements were;

  1. Authenticate users using their standard Windows Domain username/password.
  2. Resrtict access (read, write) to only authenticated users

I wasn’t sure if domain authentication would be possible using the standard LAMP setup. So, instead I opted to use IIS 6. A great step by step guide for installing MediaWiki on Windows 2003 can be found at http://meta.wikimedia.org/wiki/Installing_MediaWiki_on_Windows_Server_2003_SP1

After getting PHP, MySql, IIS, and MediaWiki installed, you can start configuring LocalSettings.php in the root directory of your wiki installation. To perform the following, simple append the code snippet to LocalSettings.php.

1. Restrict edit to logged in users

$wgGroupPermissions[‘*’][‘edit’] = false;
$wgGroupPermissions[‘user’][‘edit’] = true;

2. Prevent new registrations from anonymous users (Sysops can still create new account)

$wgGroupPermissions[‘*’][‘createaccount’] = false;

3. Define the pages un-authenticate users can see. This is crucial. Otherwise, there’s no way for people to login.

$wgWhitelistRead = array( "Main Page", "Special:Userlogin", "-", "MediaWiki:Monobook.css" );
$wgGroupPermissions[‘*’    ][‘read’]            = false;

4. Authenticate users from an Active Directory.

You will need to download LDAPauthenticate.php from http://bugzilla.wikipedia.org/show_bug.cgi?id=814 to the includes directory in the root of your wiki installation. Details on this file and its usage can be found at http://meta.wikimedia.org/wiki/LDAP. There are links to some configuration examples. However I found the one for AD did not work without modifcation. Here is what I eventually had success with. In my example, the AD name is ad_name.org and the hostname of the server hosting the AD (domain controller) is DC1 and the domain is Domain_name. Subsitute your AD name and Hostname in the following code. In some cases the Active Directory name and Domain name may be the same.

require_once( ‘LdapAuthentication.php’ );
$wgAuth = new LdapAuthenticationPlugin();
$wgLDAPDomainNames = array( "
ad_name.org" );
$wgLDAPServerNames = array( "
ad_name.org"=>"dc1"  );
$wgLDAPUseSSL = false;
$wgLDAPUseLocal = false;
$wgLDAPAddLDAPUsers = false;
$wgLDAPUpdateLDAP = false;
$wgLDAPMailPassword = false;
$wgLDAPRetrievePrefs = true;
$wgMinimalPasswordLength = 1;
$wgLDAPSearchStrings = array( "
ad_name.org"=>"Domain_name\\USER-NAME"  );

Viola. Your wiki is now restricted to only users with valid domain accounts. The lines, $wgLDAPAddLDAPUsers = false; and $wgLDAPUpdateLDAP = false; restrict users from updating their LDAP info via the wiki interface.

Unfortunately there are two things I have not had success with. I have not had success populating the fields (name, email, etc) in the preferences tab after a user has logged in. The tag $wgLDAPRetrievePrefs = true; is supposed to make this happen but it does not.

Additional, I have yet to secure authentication by implementing SSL. Note – $wgLDAPUseSSL = false; This I fairly important and should be done before rolling this out to my users.

I’ll update this post with any additonal information I find. Please let me know if you have an success with these last two items.

3/20/2007 – There is a new version (1.1) of the LDAPauthentication extension. Some of this article may be outmoded as a result. See Part 3 of the series.

Mission Statement

As a technologist, so much of what I do requires that I know something about everything in my field. Given the pace with which new innovations and technololgies are introduced, it’s impossible to be an expert in all things technical. The best one can hope for is a generalists’ understanding and access to Google. I rely on the latter so much, in fact, that it prompted the start of this site.

Mission:
Digital Karma. To give back to the online spring of knowledge from which I drink so often.