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:
It supposes the applet runs from /irc also there are several parameters you need to change. PJIRC can be downloaded here.
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.