Extension:CgiIrcLogin

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
CgiIrcLogin
Release status: unmaintained
Implementation User interface
Description Provides a small textbox to login automatically in CGI:IRC
Author(s) (SeBas891talk)
Latest version 0.1
License No license specified
Download see below
Check usage and version matrix.

What can this extension do?[edit]

It provides a small textbox to login automatically in CGI:IRC, which is a web-based IRC client.

Usage[edit]

Just add the following line to any page.

<cgiirclogin>http://example.com/cgi-bin/cgiirc/irc.cgi</cgiirclogin>

Make sure you put the right url to your irc.cgi

Download instructions[edit]

Please cut and paste the code found below and place it in $IP/extensions/cgiirclogin.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation[edit]

To install this extension, add the following to LocalSettings.php:

require_once("$IP/extensions/cgiirclogin.php");

Configuration parameters[edit]

Don't forget to configure the channel you wish to connect, it's hardcoded in the extension.

Code[edit]

<?php
# This is my first extension, it is inspired by the mailman extension.
#
# To activate the extension add this line to your file LocalSettings.php
# require_once("extensions/cgiirclogin.php");
#
# To use it insert in a page the following with the correct URL to your
# installacion of irc.cgi
# <cgiirclogin>http://example.com/cgi-bin/cgiirc/irc.cgi</cgiirclogin>
#
# Change the Channel in the form below....

$wgExtensionCredits['parserhook'][] = array(
        'name' => 'CgiIrcLogin',
        'version' => 0.1,
        'author' => 'SeBas891',
        'url' => 'http://www.mediawiki.org/wiki/Extension:CgiIrcLogin',
        'description' => 'Provides a small textbox to login automatically in CGI:IRC.',
);

$wgExtensionFunctions[] = "wfCgiIrcLoginExtension";

function wfCgiIrcLoginExtension() {
     global $wgParser;
     $wgParser->setHook( "cgiirclogin", "printCgiIrcLoginForm" );
}

function printCgiIrcLoginForm( $input, $argv ) {

     global $wgParser;
     $wgParser->disableCache();

     $output = "<form action=\"$input\" method=\"post\">".
       "Tu nombre: <input name=\"Nickname\" type=\"text\" value=\"\" />".
       "<input name=\"Channel\" type=\"hidden\" value=\"#mediawiki\" />".
       "<input name=\"format\" type=\"hidden\" value=\"default\" />".
       "<input name=\"interface\" type=\"hidden\" value=\"ie\" />".
       "<input type=\"submit\" value=\"Chat\">".
       "</form>";
     return $output;
}