• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Contributions (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

PHP-Nuke Integration

Post a bug fix, a new feature, a theme ...

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
3 posts • Page 1 of 1

Postby brsly » Sat Jul 28, 2007 12:12 am

This is how I integrated beta11 into PHP-Nuke.

Install phpFreeChat in the modules directory following the install instructions and replace the index.php file with this one.

Code: Select all
<?php

/*
 * PHP-Nuke module for phpFreeChat
 */

if (!defined('MODULE_FILE')) {
  die ("You can't access this file directly...");
}

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$pagetitle = "$module_name";
global $user;
cookiedecode($user);
$username = $cookie[1];

# Because this won't work with "frozen_nick", ensure only registered users
# run chat, even if the module is enabled for all visitors.
#if ($username == "") {
#  $params["nick"] = "Guest".rand(1,1000);
#}

if ($username == "")
{
  include("header.php");
  OpenTable();
  echo "<center><strong>You are trying to access a restricted area.</strong><br><br>We are Sorry, but this section of our site is for <i>Registered Users Only.</i><br><br>You can register for free by clicking <a href="modules.php?name=Your_Account&op=new_user">here</a>, then you can<br>access this section without restrictions. Thanks.<br><br>[ <a href="javascript:history.go(-1)">Go Back</a> ]";
  CloseTable();
  include("footer.php");
}
else
{
  require_once dirname(__FILE__)."/src/phpfreechat.class.php";
  $params = array();
  $params["serverid"] = md5(__FILE__);
  # these appear to do nothing
  #$params["height"] = "120px";
  #$params["width"] = "400px";
  $params["title"] = "$pagetitle";
  $params["nick"] = "$username";
  $params["frozen_nick"] = true;
  $params["max_channels"] = 1;
  $params["channels"] = array("Main");
  $params["refresh_delay"] = 5000;
  #$params["debug"] = true;

  $chat = new phpFreeChat( $params );
  include("header.php");
  OpenTable();
  $chat->printJavascript();
  $chat->printStyle();
  $chat->printChat();
  CloseTable();
  include("footer.php");
}

?>

Next, there are a few problems with pfcclient.js. It sends the nick with quotes around it which are ignored on the server side. This causes it to open without connecting and gives the error "You must be connected to send a message". I got the most recent svn file and modified it to remove the quotes.

It also sends data if the user just keeps hitting enter, causing unnecessary traffic. I added a check to avoid that.

Here are the diffs:


Code: Select all
$ diff pfcclient.js pfcclient.js.orig
150c150
<         this.sendRequest('/nick '+newnick);
---
>         this.sendRequest('/nick "'+newnick+'"');
152c152
<         this.sendRequest('/connect '+newnick);
---
>         this.sendRequest('/connect "'+newnick+'"');
229c229
<         if (cmd != "join2" || this.gui.tabs.length == 1) this.gui.setTabById(tabid);
---
>         if (cmd != "join2") this.gui.setTabById(tabid);
272c272
<         if (cmd != "privmsg2" || this.gui.tabs.length == 1) this.gui.setTabById(tabid);
---
>         if (cmd != "privmsg2") this.gui.setTabById(tabid);
456c456
<           if (!um) this.sendRequest('/whois2 '+nickid);
---
>           if (!um) this.sendRequest('/whois2 "'+nickid+'"');
584c584
<       if (wval != '') this.sendRequest('/send '+ wval);
---
>       this.sendRequest('/send '+ wval);
1054c1054
<         pfc.sendRequest('/privmsg '+nick);
---
>         pfc.sendRequest('/privmsg "'+nick+'"');
1460c1460
<         this.sendRequest('/connect '+this.nickname);
---
>         this.sendRequest('/connect "'+this.nickname+'"');
1788d1787
<

Because of a problem of using "frozen_nick" with $params["nick"] = "Guest".rand(1,1000), we must lock visitors out (we can't have them stealing other people's nicks).

( see http://www.phpfreechat.net/forum/viewto ... 6668#p6668 )

If would be better if vistors could connect. Maybe the programs authors will fix that.

Unfortunately, I won't be using this on my web site because I have a shared hosting account and phpFreeChat is resource intensive on the server side. Because of the terms of agreement, I could end up getting my account cancelled.
brsly
New member
 
Posts: 3
Joined: Thu Jul 26, 2007 1:57 am
Top

Postby kammi » Wed May 21, 2008 2:00 pm

I have phpnuke Version 8.0 installed and i tried to install phpfreechat 1.1 according to this post (this is for beta 11 version) , what changes should i made when i install version 1.1 , now my site is showing the loading page only but it never loads.
Please help me ...
kammi
New member
 
Posts: 2
Joined: Wed May 21, 2008 1:51 pm
Top

Postby cls » Sat May 24, 2008 10:04 am

I'm not sure, but try to delete the lines

Code: Select all
  $chat->printJavascript();
  $chat->printStyle();

They are not used any more and perhaps can cause this.
cls
Member
 
Posts: 57
Joined: Sat Aug 18, 2007 10:29 pm
Location: Germany
  • Website
Top


Post a reply
3 posts • Page 1 of 1

Return to Contributions (v1.x)

Who is online

Users browsing this forum: No registered users and 11 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub