• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Simple integration of PJIRC with xenforo

bubbl3

Active member
Due to some limitations (adobe auth daemon not installable, mibbit and similar banned) i cannot use existing addons on our IRC server. My only alternative was the pjirc java applet, so inspired by the fantastic code by Shadab i decided to do a simple barebone integration.
What it does is just starting the xenforo session, get the user id, deny access if the user is not registered, get the username if the user is registered and than make him connect to irc with the forum username and the user id in his userinfo string (needed for support purposes). Personally i use this to make users join our help channel, i call the php file inside an iframe in a xenforo custom page, i know it's not elegant but it does what i need. Feel free to use this idea as you please:

PHP:
<?php

$startTime = microtime(true);

$fileDir = '/absolute/path/to/xenforo/root/directory';

require($fileDir . '/library/XenForo/Autoloader.php');

XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');

XenForo_Application::initialize($fileDir . '/library', $fileDir);

XenForo_Application::set('page_start_time', $startTime);

XenForo_Session::startPublicSession();

$visitor = XenForo_Visitor::getInstance();

$user_id = $visitor->getUserId();

if ($user_id != 0) {

$username = $visitor->get('username');

echo '<html>

<head>

<title>WEB IRC</title>

<style type="text/css">

    body{

        padding:0;

        text-align:center;

        margin:0 auto;

        color:#0f0f0f;

        background-color:0f0f0f;

        position:fixed;

        left:50%;

        margin-left:-400px;

    }

</style>

</head>

<body>

<applet code=IRCApplet.class archive="irc.jar,pixx.jar" width=800 height=550>

<param name="CABINETS" value="irc.cab,securedirc.cab,pixx.cab">';

echo "<param name=\"nick\" value=\"" . $username . "\">

<param name=\"alternatenick\" value=\"" . $username . "__\">

<param name=\"name\" value=\"WEB IRC for User ID " . $user_id . "\">

<param name=\"host\" value=\"your.ircserver.net\">

<param name=\"port\" value=\"6667\">";

echo '<param name="command1" value="/join #yourchan">

<param name="gui" value="pixx">

<param name="pixx:color5" value="5a5a5a">

<param name="pixx:color6" value="000000">

<param name="pixx:color9" value="5a5a5a">

<param name="pixx:helppage" value="http://your_help_page.net">

<param name="quitmessage" value="I quit!">

<param name="asl" value="true">

<param name="useinfo" value="true">

<param name="style:bitmapsmileys" value="true">

<param name="style:smiley1" value=":) /irc/img/sourire.gif">

<param name="style:smiley2" value=":-) /irc/img/sourire.gif">

<param name="style:smiley3" value=":-D /irc/img/content.gif">

<param name="style:smiley4" value=":d /irc/img/content.gif">

<param name="style:smiley5" value=":-O /irc/img/OH-2.gif">

<param name="style:smiley6" value=":o /irc/img/OH-1.gif">

<param name="style:smiley7" value=":-P /irc/img/langue.gif">

<param name="style:smiley8" value=":p /irc/img/langue.gif">

<param name="style:smiley9" value=";-) /irc/img/clin-oeuil.gif">

<param name="style:smiley10" value=";) /irc/img/clin-oeuil.gif">

<param name="style:smiley11" value=":-( /irc/img/triste.gif">

<param name="style:smiley12" value=":( /irc/img/triste.gif">

<param name="style:smiley13" value=":-| /irc/img/OH-3.gif">

<param name="style:smiley14" value=":| /irc/img/OH-3.gif">

<param name="style:smiley15" value=":\'( /irc/img/pleure.gif">

<param name="style:smiley16" value=":$ /irc/img/rouge.gif">

<param name="style:smiley17" value=":-$ /irc/img/rouge.gif">

<param name="style:smiley18" value="(H) /irc/img/cool.gif">

<param name="style:smiley19" value="(h) /irc/img/cool.gif">

<param name="style:smiley20" value=":-@ /irc/img/enerve1.gif">

<param name="style:smiley21" value=":@ /irc/img/enerve2.gif">

<param name="style:smiley22" value=":-S /irc/img/roll-eyes.gif">

<param name="style:smiley23" value=":s /irc/img/roll-eyes.gif">

<param name="style:backgroundimage" value="true">

<param name="style:backgroundimage1" value="all all 0 background.gif">

<param name="style:sourcefontrule1" value="all all Tahoma 12">

<param name="style:floatingasl" value="true">

<param name="pixx:timestamp" value="true">

<param name="pixx:highlight" value="true">

<param name="pixx:highlightnick" value="true">

<param name="pixx:nickfield" value="true">

<param name="pixx:styleselector" value="true">

<param name="pixx:setfontonstyle" value="true">

</applet>

</body>

</html>';

} else

echo 'This content is visible to members only.';

It supposes the applet runs from /irc also there are several parameters you need to change. PJIRC can be downloaded here.
 
What a nonsense, mibbit is just a gateway to the irc server - just like pjirc, pjirc is just a java applet, where mibbit is a javascript.
 
What a nonsense, mibbit is just a gateway to the irc server - just like pjirc, pjirc is just a java applet, where mibbit is a javascript.

It's not a nonsense, the remote hosted mibbit gets banned because it's abused. It's impossible to ban single users when they all connect from the same address. Pjirc is a full client, you connect with your ip address. Lightirc would be even better if it didn't need the adobe auth daemon to run on the same server of the irc daemon.
 
That's not how mibbit works. You can ban individual users. Use a server that supports mibbit then?
Mibbit is the same as pjirc, they're both 'just' gateways to the irc server.
 
Top Bottom