MW: Java IRC Client

From ChekMate Security Group

Contents

Introduction

JavaIRC is a Mediawiki hack. It provides the MediaWiki framework around the PJIRC Interface.

Maintainer

Shannon McNaught (smcnaught)

License

MediaWiki/PJIRC Hack 
  - Adds Java IRC functionality to MediaWiki

Copyright (C) 2006  Shannon McNaught

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

Installation

Note: This version uses the sbox PJIRC skin. To use the default PIXX skin, just replace all sbox with pixx.

Screenshot

Image:MW-PJIRC.png

Code

index.php

<?php

#apd_set_pprof_trace();
# Main wiki script; see design.doc
#
$wgRequestTime = microtime();

unset( $IP );
@ini_set( 'allow_url_fopen', 0 ); # For security...
if( !file_exists( '../LocalSettings.php' ) ) {
  if ( file_exists( '../config/LocalSettings.php' ) ) {
    die( "To complete the installation, move <tt>config/LocalSettings.php</tt> t
o the parent directory.\n" );
  } else {
    die( "You'll have to <a href='config/index.php'>set the wiki up</a> first!"
);
  }
}

# Valid web server entry point, enable includes.
# Please don't move this line to includes/Defines.php. This line essentially def
ines
# a valid entry point. If you put it in includes/Defines.php, then any script that includes
# it becomes an entry point, thereby defeating its purpose.
define( 'MEDIAWIKI', true );

require_once( '../includes/Defines.php' );
require_once( '../LocalSettings.php' );
require_once( '../includes/Setup.php' );

wfProfileIn( 'main-misc-setup' );
OutputPage::setEncodings(); # Not really used yet

# Debug statement for user levels
# print_r($wgUser);

# If the user is not logged in, the Namespace:title of the article must be in
# the Read array in order for the user to see it. (We have to check here to
# catch special pages etc. We check again in Article::view())
if ( !is_null( $wgTitle ) && !$wgTitle->userCanRead() ) {
$wgOut->loginToUse();
$wgOut->output();
exit;
}

if ($wgUser->getID() != 0) {
$wgOut->setArticleFlag( false );

$wgTitle = Title::makeTitle( NS_SPECIAL, "Custom" );
$wgUserName = $wgUser->getName();
$wgOut->setArticleRelated( false );
$wgOut->setRobotPolicy( "noindex,follow" );

$text .= "   <table align='center'>";
$text .= "      <tr>";
$text .= "      <td align=center >";
$text .= "        <form name='jform' id='jform' action='Applet.php' target='_self' method=get>";
$text .= "         <table border='0' cellspacing='0'>";
$text .= "           <tr>";
$text .= "            <td valign='center' colspan='4' align='center'>";
$text .= "       <p align='center'>";
$text .= "       If you have a password type it into the box. Otherwise do not change it.<font color=blue><br>";
$text .= "               </font>";
$text .= "            </td>";
$text .= "           </tr>";
$text .= "              <tr>";
$text .= "            <td align='center'>";
$text .= "               <font color=blue>";
$text .= "                    Your Default Channel";
$text .= "               </font>";
$text .= "            </td>";
$text .= "            <td align='center' colspan='2'>";
$text .= "               <font color=blue>";
$text .= "                    Your Nick</font>";
$text .= "            </td>";
$text .= "            <td align='center'>";
$text .= "                    <font color='blue'>Your Identify Password";
$text .= "                    </font>";
$text .= "            </td>";
$text .= "              </tr>";
$text .= "              <tr>";
$text .= "            <td align='center'>";
$text .= "               <font color=blue>";
$text .= "               <input name='chan' type=textbox value='ChekMate'>";
$text .= "               </font>";
$text .= "            </td>";
$text .= "            <td align='center' colspan='2'>";
$text .= "               <font color=blue>";
$text .= "               <input name='nick' type=textbox value='$wgUserName'>";
$text .= "               </font>";
$text .= "            </td>";
$text .= "            <td align='center'>";
$text .= "               <font color=blue>";
$text .= "               <input name='pass' type=password value=''></font>";
$text .= "            </td>";
$text .= "              </tr>";
$text .= "              <tr>";
$text .= "            <td valign='center' colspan='4' align='center'>";
$text .= "                  <br>";
$text .= "            </td>";
$text .= "              </tr>";
$text .= "              <tr>";
$text .= "            <td valign='center' colspan='4' align='center'>";
$text .= "       If the fields are correct please just hit <font color=blue>";
$text .= "       <br>";
$text .= "       <input name='submit' type=submit value='Let`s Chat'></font>";
$text .= "            </td>";
$text .= "              </tr>";
$text .= "           </table>";
$text .= "        </form>";
$text .= "      </td>";
$text .= "     </tr>";
$text .= "</table>";

$wTitle = "ChekMate Java IRC Client";
$wgOut->setPageTitle($wTitle);

$wgOut->addWikiText( "<br clear=all>\n" );
$wgOut->addWikiText( $wtext );
$wgOut->addWikiText( "<br clear=all>\n" );

$wgOut->addHTML( $text );
$wgOut->output();
exit;

} else {
$wgOut->loginToUse();
$wgOut->output();
exit;
}
?>

Applet.php

<?php

#apd_set_pprof_trace();
# Main wiki script; see design.doc
#
$wgRequestTime = microtime();

unset( $IP );
@ini_set( 'allow_url_fopen', 0 ); # For security...
if( !file_exists( '../LocalSettings.php' ) ) {
  if ( file_exists( '../config/LocalSettings.php' ) ) {
    die( "To complete the installation, move <tt>config/LocalSettings.php</tt> to the parent directory.\n" );
  } else {
    die( "You'll have to <a href='config/index.php'>set the wiki up</a> first!" );
  }
}

# Valid web server entry point, enable includes.
# Please don't move this line to includes/Defines.php. This line essentially defines
# a valid entry point. If you put it in includes/Defines.php, then any script that includes
# it becomes an entry point, thereby defeating its purpose.
define( 'MEDIAWIKI', true );

require_once( '../includes/Defines.php' );
require_once( '../LocalSettings.php' );
require_once( '../includes/Setup.php' );

wfProfileIn( 'main-misc-setup' );
OutputPage::setEncodings(); # Not really used yet

# Debug statement for user levels
# print_r($wgUser);

# If the user is not logged in, the Namespace:title of the article must be in
# the Read array in order for the user to see it. (We have to check here to
# catch special pages etc. We check again in Article::view())
if ( !is_null( $wgTitle ) && !$wgTitle->userCanRead() ) {
$wgOut->loginToUse();
$wgOut->output();
exit;
}

if ($wgUser->getID() != 0) {
$wgOut->setArticleFlag( false );

$wgTitle = Title::makeTitle( NS_SPECIAL, "Custom" );

$wgOut->setArticleRelated( false );
$wgOut->setRobotPolicy( "noindex,follow" );

$nick = $_GET['nick'];
$chan = $_GET['chan'];
$pass = $_GET['pass'];

$text = <<<TEST
<table width='90%' height='90%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr height='13'>
        <td colspan='2' rowspan='2'>
<applet code=IRCApplet.class archive='irc.jar,sbox.jar' width=100% height=500>
<param name='CABINETS' value='irc.cab,securedirc.cab,sbox.cab'>

<param name='nick' value='$nick'>
<param name='alternatenick' value='$nick??'>
<param name='name' value='WikiUser'>
<param name='host' value='west.ca.syndicateirc.com'>
<param name='gui' value='sbox'>
<param name='command1' value='join #$chan'>
<param name='command2' value='join #YourChannel'>
<param name='command3' value='/msg nickserv identify $pass'>

<param name='quitmessage' value='Downloaded from http://www.chekmate.org/'>
<param name='asl' value='true'>
<param name='useinfo' value='false'>
<param name="sbox:showstatus" value="true">
<param name='sbox:helppage' value='http://www.chekmate.org/wiki/index.php/IRCHelp'>

<param name='style:highlightlinks' value='true'>
<param name='autorejoin' value='true'>
<param name='style:maximumlinecount' value='1024'>
<param name='allowdccfile' value='true'>
<param name='allowdccchat' value='true'>
<param name='fingerreply' value='Careful - I might like it..'>

<param name='sbox:showabout' value='false'>

<param name='style:bitmapsmileys' value='true'>
<param name='style:smiley1' value=':) img/sourire.gif'>
<param name='style:smiley2' value=':-) img/sourire.gif'>
<param name='style:smiley3' value=':-D img/content.gif'>
<param name='style:smiley4' value=':d img/content.gif'>
<param name='style:smiley5' value=':-O img/OH-2.gif'>
<param name='style:smiley6' value=':o img/OH-1.gif'>
<param name='style:smiley7' value=':-P img/langue.gif'>
<param name='style:smiley8' value=':p img/langue.gif'>
<param name='style:smiley9' value=';-) img/clin-oeuil.gif'>
<param name='style:smiley10' value=';) img/clin-oeuil.gif'>
<param name='style:smiley11' value=':-( img/triste.gif'>
<param name='style:smiley12' value=':( img/triste.gif'>
<param name='style:smiley13' value=':-| img/OH-3.gif'>
<param name='style:smiley14' value=':| img/OH-3.gif'>
<param name='style:smiley15' value=':'( img/pleure.gif'>
<param name='style:smiley16' value=':$ img/rouge.gif'>
<param name='style:smiley17' value=':-$ img/rouge.gif'>
<param name='style:smiley18' value='(H) img/cool.gif'>
<param name='style:smiley19' value='(h) img/cool.gif'>
<param name='style:smiley20' value=':-@ img/enerve1.gif'>
<param name='style:smiley21' value=':@ img/enerve2.gif'>
<param name='style:smiley22' value=':-S img/roll-eyes.gif'>
<param name='style:smiley23' value=':s img/roll-eyes.gif'>
<param name='style:smiley24' value='8-) img/cool.gif'>
<param name='style:backgroundimage' value='true'>

<param name='sbox:configurepopup' value='true' />

<param name='sbox:popupmenustring1' value='Whois' />
<param name='sbox:popupmenustring2' value='Query' />
<param name='sbox:popupmenustring3' value='Kick' />
<param name='sbox:popupmenustring4' value='Kick + Ban' />
<param name='sbox:popupmenustring5' value='Ban' />
<param name='sbox:popupmenustring6' value='--' />
<param name='sbox:popupmenustring7' value='Op' />
<param name='sbox:popupmenustring8' value='DeOp' />
<param name='sbox:popupmenustring9' value='HalfOp' />
<param name='sbox:popupmenustring10' value='DeHalfOp' />
<param name='sbox:popupmenustring11' value='Voice' />
<param name='sbox:popupmenustring12' value='DeVoice' />
<param name='sbox:popupmenustring13' value='--' />
<param name='sbox:popupmenustring14' value='Ping' />
<param name='sbox:popupmenustring15' value='Version' />
<param name='sbox:popupmenustring16' value='Time' />
<param name='sbox:popupmenustring17' value='Finger' />
<param name='sbox:popupmenustring18' value='--' />
<param name='sbox:popupmenustring19' value='DCC Send' />
<param name='sbox:popupmenustring20' value='DCC Chat' />
<param name='sbox:popupmenucommand1_1' value='/Whois %1' />
<param name='sbox:popupmenucommand2_1' value='/Query %1' />

<param name='sbox:popupmenucommand3_1' value='/mode %2 -o %1' />
<param name='sbox:popupmenucommand3_2' value='/kick %2 %1' />
<param name='sbox:popupmenucommand4_1' value='/mode %2 -o %1' />
<param name='sbox:popupmenucommand4_2' value='/mode %2 +b %1' />
<param name='sbox:popupmenucommand4_3' value='/kick %2 %1' />
<param name='sbox:popupmenucommand5_1' value='/mode %2 -o %1' />
<param name='sbox:popupmenucommand5_2' value='/mode %2 +b %1' />

<param name='sbox:popupmenucommand7_1' value='/mode %2 +o %1' />
<param name='sbox:popupmenucommand8_1' value='/mode %2 -o %1' />
<param name='sbox:popupmenucommand9_1' value='/mode %2 +h %1' />
<param name='sbox:popupmenucommand10_1' value='/mode %2 -h %1' />

<param name='sbox:popupmenucommand11_1' value='/mode %2 +v %1' />
<param name='sbox:popupmenucommand12_1' value='/mode %2 -v %1' />
<param name='sbox:popupmenucommand14_1' value='/CTCP PING %1' />
<param name='sbox:popupmenucommand15_1' value='/CTCP VERSION %1' />
<param name='sbox:popupmenucommand16_1' value='/CTCP TIME %1' />
<param name='sbox:popupmenucommand17_1' value='/CTCP FINGER %1' />
<param name='sbox:popupmenucommand19_1' value='/DCC SEND %1' />
<param name='sbox:popupmenucommand20_1' value='/DCC CHAT %1' />

<param name='style:sourcefontrule1' value='all all SanSerif 12'>
<param name='style:floatingasl' value='true'>

<param name="sbox:nickprefix" value="<\b">
<param name="sbox:nickpostfix" value="\b> ">

<param name='sbox:timestamp' value='true'>
<param name='sbox:highlight' value='true'>
<param name='sbox:highlightnick' value='true'>
<param name='sbox:nickfield' value='true'>
<param name='sbox:styleselector' value='true'>
<param name='sbox:setfontonstyle' value='true'>
</applet></td>
        <td width='9'><img width='9' height='100%' border='0' src='shadows/shadow.ne.gif'></td>
</tr>
<tr>
        <td width='9'><img width='9' height='491' border='0' src='shadows/shadow.e.gif'></td>
</tr>
<tr height='9'>
        <td width='13'><img width='13' height='9' border='0' src='shadows/shadow.sw.gif'></td>
        <td><img width='100%' height='9' border='0' src='shadows/shadow.s.gif'></td>
        <td><img width='9' height='9' border='0' src='shadows/shadow.se.gif'></td>
</tr>
</table>
TEST;


$wgOut->setPageTitle($wTitle);

$wgOut->addHTML( $text );
$wgOut->output();
exit;

} else {
$wgOut->loginToUse();
$wgOut->output();
exit;
}
?>