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

Joomla 1.7 and pfc 1.3

Integration help for Joomla, Drupal, and Wordpress

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

Post a reply
6 posts • Page 1 of 1

Postby scalpguy » Sat Jan 28, 2012 6:06 pm

I have the following code:

Code: Select all
// --- start of the user check
define( "_JEXEC", 1 );
define( "DS", "/" );
define("JPATH_BASE", "..");
require_once ( JPATH_BASE.DS."includes".DS."defines.php" );
require_once ( JPATH_BASE.DS."includes".DS."framework.php" );
$uc_maifra =& JFactory::getApplication("site");
$uc_maifra->initialise();
$uc_user = JFactory::getUser();
$uc_usenam = $uc_user->get("username");
print $uc_usenam;
// --- end of the user check

which I have in the test.php file and while I make a call from the Joomla menu item (type URL) it prints out the username without any problems. I can access all the user info via uc_user->get() command.

When I am trying to include this code to the pfc's index.php as follows,

Code: Select all
<?php

require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "MyDomain.NET";
$params["channels"] = array("Room");

//$params["nick"] = "guest".rand(1,1000);  // setup the intitial nickname
// --- start of the user check
define( "_JEXEC", 1 );
define( "DS", "/" );
define("JPATH_BASE", "..");
require_once ( JPATH_BASE.DS."includes".DS."defines.php" );
require_once ( JPATH_BASE.DS."includes".DS."framework.php" );
$uc_maifra =& JFactory::getApplication("site");
$uc_maifra->initialise();
$uc_user = JFactory::getUser();
$uc_usenam = $uc_user->get("username");
$params["nick"] = $uc_usenam;
// --- end of the user check

$params['firstisadmin'] = false;
//$params["isadmin"] = true; // makes everybody admin: do not use it on production servers ;)
$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat
$params["debug"] = false;
$params["shownotice"] = 0;
$params["max_msg"] = 1000;
$params["max_displayed_lines"] = 1000;
$params['admins'] = array('admin  => 'huuhaahii');
$params["refresh_delay"] = 2000; // 2000ms = 2s
$params["refresh_delay_steps"] = array(3000,20000,4000,60000,5000,120000);
$params["theme"] = "phoenity";

$chat = new phpFreeChat( $params );

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Chat</title>
  <link rel="stylesheet" title="classic" type="text/css" href="style/content.css" />
  <link rel="shortcut icon" href="favicon.ico"> 
 </head>
 <body>

<div class="content">
  <?php $chat->printChat(); ?>
  <?php if (isset($params["isadmin"]) && $params["isadmin"]) { ?>
    <p style="color:red;font-weight:bold;">Warning: because of "isadmin" parameter, everybody is admin. Please modify this script before using it on production servers !</p>
  <?php } ?>
</div>
   
</body></html>

I will receive the following error message:
Fatal error: Cannot redeclare utf8_substr() (previously declared in /home/me/public_html/phpchat/lib/utf8/utf8_substr.php:18) in /home/me/public_html/libraries/phputf8/mbstring/core.php on line 104

Can someone more experienced please check what goes wrong and how to fix it?
Or at least tell me what could be the problem and what kind of fix could do it?

If this could be done this would be very easy way to integrate the Joomla's user authentication with the pfc.

Or am I missing something and trying to do something impossible ?
Last edited by scalpguy on Sun Jan 29, 2012 12:07 pm, edited 1 time in total.
scalpguy
New member
 
Posts: 4
Joined: Sat Jan 28, 2012 5:40 pm
Top

Postby scalpguy » Sun Jan 29, 2012 12:43 pm

Declaration error can be fixed by placing this "user check" code to the beginning of the file.

But now there is some kind of chat window initialization problem. Does not work well...
scalpguy
New member
 
Posts: 4
Joined: Sat Jan 28, 2012 5:40 pm
Top

Postby scalpguy » Sun Jan 29, 2012 3:43 pm

There is a difference when coming in to chat with or without "user check" code. I have to use the same method for all chat buddies.

So it is working ok now.
Last edited by scalpguy on Sun Jan 29, 2012 3:44 pm, edited 1 time in total.
scalpguy
New member
 
Posts: 4
Joined: Sat Jan 28, 2012 5:40 pm
Top

Postby FrangaL » Mon Feb 13, 2012 7:53 pm

Change in file lib/utf8/utf8_substr.php

if (!function_exists('utf8_substr')) {
function utf8_substr($str,$start,$len=null) {

to:

if (!function_exists('PFC_utf8_substr')) {
function PFC_utf8_substr($str,$start,$len=null) {
Last edited by FrangaL on Mon Feb 13, 2012 7:53 pm, edited 1 time in total.
FrangaL
New member
 
Posts: 6
Joined: Wed Jan 25, 2012 12:00 pm
Top

Re: Joomla 1.7 and pfc 1.3

Postby jazza » Thu Nov 15, 2012 10:03 pm

Thanks calpguy, I was trying to figure this out and getting no where.
jazza
New member
 
Posts: 1
Joined: Thu Nov 15, 2012 10:00 pm
Top

Re: Joomla 1.7 and pfc 1.3

Postby sardakir » Thu Nov 29, 2012 5:57 am

thank scalpguy, like tuts :)
sardakir
New member
 
Posts: 3
Joined: Thu Nov 29, 2012 5:54 am
Top


Post a reply
6 posts • Page 1 of 1

Return to Joomla, Drupal, and Wordpress (v1.x)

Who is online

Users browsing this forum: No registered users and 4 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