My PHPFreeChat node displays the "loading please wait" message, and using firebug i can see an ajax call to the Drupal module handler.php is being called.

GET http://example.com/sites/example.com/modules/phpfreechat/handler.php?pfc_ajax=1&f=loadChat

However this ajax call never returns, and the page never loads. THis is against the freshest -dev build today (Nov 9th).

Comments

emmajane’s picture

+1 for me.

But the demo script works perfectly at:
http://example.com/sites/all/modules/phpfreechat/phpfreechat/demo/demo1_...

It calls:
http://example.com/sites/all/modules/phpfreechat/phpfreechat/demo/demo1_... instead of handler.php for the first GET query.

The chat window does not load because of the following error:
Fatal error: Maximum execution time of 30 seconds exceeded in /usr/home/website/public_html/sites/all/modules/phpfreechat/handler.php on line 83

emmajane’s picture

On further investigation I think I'm confused. :)

When clean URLs are enabled this part of handler.php fails miserably (tested with little "print something then die" injections).

82 while ($arg0 != 'node') {
83 list($arg0, $nid) = $args;
84 array_shift($args);
85 }

If I disable clean URLs the chat appears embedded in the page like it's supposed to.

Clean URLs are important to me so I re-enabled them... and the chat is still properly embedded. I'm not going to try to understand what happened because I know I cleared my browser cache and used the devel "empty cache" option; however, I thought I should update this issue in case my experience means something to someone!

Crimson’s picture

Okay, I got it working with clean URLs.

In handler.php, line 75.

Change:
$path = str_replace(array($base_url, '/?q='), '', $_SERVER['HTTP_REFERER']);

To:
$path = str_replace(array($base_url.'/', '/?q='), '', $_SERVER['HTTP_REFERER']);

The drupal_get_normal_path() function wasn't working because there was still a leading "/" in the path so I added it into the str_replace to get it removed.

budda’s picture

Priority: Normal » Critical

Turning off cleanm urls - or - applying the str_replace fix worked for me.

Without either of these - the module simlpy doesn't work.

budda’s picture

Turning off cleanm urls - or - applying the str_replace fix worked for me.

Without either of these - the module simlpy doesn't work.

budda’s picture

Turning off clean urls - or - applying the str_replace fix worked for me.

Without either of these - the module simlpy doesn't work.

buffos’s picture

even with this change only admin can see the phpchat.
the chat still does not load for users!!

owahab’s picture

Version: 5.x-1.x-dev » 5.x-1.0-rc3
Assigned: Unassigned » owahab

Crimson's patch fixed the bug. Committed.

buffos: please make sure the user has permission to talk on chat rooms.

buffos’s picture

ofcourse i checked it. I set permision to all users (anonymous and authenticated and admins...) to chat.
If i log as a user1 log out and then test as anonymous it loads. BUT if i clear the pc's cache then it wont load.

So you may not notice the bug until you clear your internets temporary files. I did not notice either, until a friend told be that it would not load.

owahab’s picture

Version: 5.x-1.0-rc3 » 5.x-1.0-rc4
Status: Active » Fixed

This was fixed in RC4, please re-open if it still persists.

Sourour Al-khatib’s picture

Title: handler.php never does anything » path problems in drupal 5.5
Status: Fixed » Active

Path is being written wrongly in drupal 5.5 where the module base path is combined with the files w/r phpfreechat path, the result a wrong path.

Strangely the path and URL's parameters looks fine :


Parameters: Array
(
[data_private_path] => /home/domain/public_html/files/phpfreechat/private
[data_public_url] => http://www.domain.com/files/phpfreechat/public
[data_public_path] => /home/domain/public_html/files/phpfreechat/public
[theme_url] => http://www.domain.com/sites/all/modules/phpfreechat/extras/themes
[theme_path] => /home/domain/public_html/files/phpfreechat/public/themes
[theme] => drupal
[serverid] => 1315e07dc5ecfdcec39f54ec16f564b7
[server_script_url] => http://www.domain.com/sites/all/modules/phpfreechat/handler.php
[server_script_path] => /home/domain/public_html/sites/all/modules/phpfreechat/handler.php

And looking into firebug you see that the response returned wrong paths :

pfc.res.setFileUrl("images\/ch.gif","http://www.dmain.com/sites/all/modules/phpfreechat/files/phpfreechat/public/themes/default/images/ch.gif");
pfc.res.setFileUrl("images\/pv.gif","http://www.dmain.com/sites/all/modules/phpfreechat/files/phpfreechat/public/themes/default/images/pv.gif");
pfc.res.setFileUrl("images\/tab_remove.gif","http://www.dmain.com/sites/all/modules/phpfreechat/files/phpfreechat/public/themes/default/images/tab_remove.gif");
pfc.res.setFileUrl("images\/ch-active.gif","http://www.dmain.com/sites/all/modules/phpfreechat/files/phpfreechat/public/themes/default/images/ch-active.gif");
pfc.res.setFileUrl("images\/pv-active.gif","http://www.dmain.com/sites/all/modules/phpfreechat/files/phpfreechat/public/themes/default/images/pv-active.gif");
pfc.res.setFileUrl("images\/user.gif","http://www.dmain.com/sites/all/modules/phpfreechat/files/phpfreechat/public/themes/default/images/user.gif");
pfc.res.setFileUrl("images\/user-me.gif","http://www.dmain.com/sites/all/modules/phpfreechat/files/phpfreechat/public/themes/default/images/user-me.gif");
pfc.res.setFileUrl("images\/user_female.gif","http://www.dmain.com/sites/all/modules/phpfreechat/files/phpfreechat/public/themes/default/images/user_female.gif");
pfc.res.setFileUrl("images\/user_female-me.gif","http://www.dmain.com/sites/all/modules/phpfreechat/files/phpfreechat/public/themes/default/images/user_female-me.gif");

Any help is appreciated

Crimson’s picture

If I'm understanding you correctly (what does "w/r" mean anyways?) I know where your problem lies. By the way, you should have opened up a new issue for this instead of hijacking this one.

This is actually a problem with phpFreeChat itself. If it doesn't find the files (which is coded in pfcglobalconfig.class.php in the src folder) in your themes folder which is set at "/modules/phpfreechat/extras/themes/drupal" it'll use the files from default theme folder.

So what you need to do to properly theme and change the look of phpFreeChat (if you're looking to do this) is to copy the default theme (except customize.js.php) into the /modules/phpfreechat/extras/themes/drupal folder. You also have to change a require line in chat.js.tpl.php to

require_once drupal_get_path('module', 'phpfreechat') .'/phpfreechat/src/pfcjson.class.php';

Also one more inane thing phpFreeChat does is that it always loads the default css theme and then afterwards, loads your theme css and combines the two. The problem with this is that you get a mix of both themes. So to fix that, remove or comment out this code in phpfreechat.class.php (starts at line 375).

    if (!$c->isDefaultFile('style.css.php'))
    {
      $t->setTemplate($c->theme_default_path.'/default/style.css.php');
      $css_code .= $t->getOutput();
    }

This is all assuming you want to change theme stuff, otherwise, you can just leave it as is and it'll work as normal.

Sourour Al-khatib’s picture

Thanks a lot Crimson

I'm very sorry for taking the issue off subject, I'm still new to drupal.org
I meant by w/r : write / read folder in drupal "files" folder.

My problem is in 2 issues :
- the theme is not loading due to wrong path ..which you have suggested a fix I'll try.
- the chat text is not sent nor shown in main chat window , Although nothing seems to be wrong watching DOM objects and debug tools in firebug.I'll apply the fixes you suggested and look to see if this issue is related to my first theme issue.

Crimson’s picture

That second problem might be the prototype library or some type of error-stopping function in phpFreeChat. It seems if you change the chat.html.tbl.php and remove/change the ids/classes of fundamental divs/elements, the hard-coded Javascript in phpFreeChat won't be able to manipulate/call those elements and everything ceases to stop working and no errors are outputed. I would suggest starting with the default theme and seeing if that loads up before implementing any changes and then carefully theming it afterwards.

Sourour Al-khatib’s picture

I have applied the fixes you have suggested sadly with nor result :(

I think I didn't give enough information :
I have phpfreechat 1.0 , and the module 5.x-1.0-rc4

I have installed the module with the phpfreechat according to documentation. I'm not trying to change chat theming or what so ever.I'm using the default installation settings with default theme.

issue description as follows :

Every thing loads fine expect for themes images which the fix didn't result in correcting it.
the other important thing to notice is an error massage that I get inside the main chat window :
_Missing parameter_ (/join {channelname})

I found 2 issues reporting the same error which unfortunately no one replayed to.
http://drupal.org/node/199013
http://drupal.org/node/153704

I hope this issue can attract enough atenetion.

Crimson’s picture

As I've stated before, those fixes I mentioned are to make it themeable only. If the images don't load, look to see if they are actually there in those directories.

Have you tried issuing a command? Like "/join Test" (without quotes) to see if it works? It just seems like you don't have default channels.

Also check to see if all the directories are made under "files/phpfreechat" like "public/js" and "public/themes".

And post your config that's under "private/cache".

If nothing else, you should try to remove phpFreeChat and reinstall it.

Oh yeah, I also changed some code in phpfreechat.inc to get it to work in the beginning. I changed the function _phpfreechat_clear_cache() to:

function _phpfreechat_clear_cache() {
  $params = phpfreechat_load_params();
  _phpfreechat_rm($params['data_private_path'] .'/cache');
  drupal_set_message('phpFreeChat settings cache cleared.');
}

Before, it was removing "public/js", "public/themes" and "private/chat" and phpFreeChat wouldn't remake the public folders for some weird reason so I had to change the code, uninstall the module and reinstall it again.

permutations’s picture

I posted a fix to the missing parameter problem (and many other problems) here:

http://drupal.org/node/250069

That was a problem with the table data not being written.

The theme issue is completely separate. I'm now trying to make a custom phpFreeChat theme for use in Drupal and I'm having problems. phpFreeChat is just ignoring the updated chat.html.tbl.php, no matter where I put it - even when I overwrite the original. Anybody have any ideas?

permutations’s picture

Status: Active » Closed (fixed)

The bug problems are fixed in the 1.2 version of the module, which I just uploaded. I have a theme that is compatible with phpFreeChat but haven't had a chance to upload it here yet. For now, you can get it from my Web site:

http://www.permutations.com/drupal/phpfreechat.php