Joined: Oct 01, 2010 Posts: 415 Location: Houston, Tx
Posted:
Mon Aug 01, 2011 6:57 pm
The instructions are fairly simple and straight forward.
Here are the instructions:
Only registered users can see links on this board! Get registered or login to the forums!
If you still have issues... I might be able to help you. (Have installed it on my web email client)
*** NOTE *** If you plan on having HEAVY traffic using it... make sure to set a cron job to clear the messages at an interval or your database with become massive with messages. Just an FYI
define('SET_SESSION_NAME',''); // Session name
define('DO_NOT_START_SESSION','1'); // Set to 1 if you have already started the session
define('DO_NOT_DESTROY_SESSION','0'); // Set to 1 if you do not want to destroy session on logout
define('SWITCH_ENABLED','1');
define('INCLUDE_JQUERY','1');
define('FORCE_MAGIC_QUOTES','0');
define('ADD_LAST_ACTIVITY','1');
function getFriendsList($userid,$time) {
$sql = ("select ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." lastactivity,(select storage_path from ".TABLE_PREFIX."storage_files where type = 'thumb.icon' and parent_file_id = ".TABLE_PREFIX.DB_USERTABLE.".photo_id) avatar, ".TABLE_PREFIX.DB_USERTABLE.".username link, cometchat_status.message, cometchat_status.status from ".TABLE_PREFIX."user_membership join ".TABLE_PREFIX."users on ".TABLE_PREFIX."user_membership.user_id = ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." left join cometchat_status on ".TABLE_PREFIX.DB_USERTABLE.".user_id = cometchat_status.userid where ".TABLE_PREFIX."user_membership.resource_id = '".mysql_real_escape_string($userid)."' and active = 1 order by username asc");
if (defined('DISPLAY_ALL_USERS') && DISPLAY_ALL_USERS == 1) {
$sql = ("select ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." lastactivity,(select storage_path from ".TABLE_PREFIX."storage_files where type = 'thumb.icon' and parent_file_id = ".TABLE_PREFIX.DB_USERTABLE.".photo_id) avatar, ".TABLE_PREFIX.DB_USERTABLE.".username link, cometchat_status.message, cometchat_status.status from ".TABLE_PREFIX."users left join cometchat_status on ".TABLE_PREFIX.DB_USERTABLE.".user_id = cometchat_status.userid where ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." <> '".mysql_real_escape_string($userid)."' and ('".$time."'-".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." < '".((ONLINE_TIMEOUT)*2)."') order by username asc");
}
return $sql;
}
function getUserDetails($userid) {
$sql = ("select ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX."users.".DB_USERTABLE_NAME." username, ".TABLE_PREFIX."users.".DB_USERTABLE_LASTACTIVITY." lastactivity, ".TABLE_PREFIX.DB_USERTABLE.".username link, (select storage_path from ".TABLE_PREFIX."storage_files where type = 'thumb.icon' and parent_file_id = ".TABLE_PREFIX.DB_USERTABLE.".photo_id) avatar, cometchat_status.message, cometchat_status.status from ".TABLE_PREFIX."users left join cometchat_status on ".TABLE_PREFIX."users.user_id = cometchat_status.userid where ".TABLE_PREFIX."users.user_id = '".mysql_real_escape_string($userid)."'");
return $sql;
}
function updateLastActivity($userid) {
$sql = ("update `".TABLE_PREFIX.DB_USERTABLE."` set ".DB_USERTABLE_LASTACTIVITY." = '".getTimeStamp()."' where ".DB_USERTABLE_USERID." = '".mysql_real_escape_string($userid)."'");
return $sql;
}
function getUserStatus($userid) {
$sql = ("select ".TABLE_PREFIX."users.status message, cometchat_status.status from ".TABLE_PREFIX."users left join cometchat_status on ".TABLE_PREFIX."users.user_id = cometchat_status.userid where ".TABLE_PREFIX."users.user_id = '".mysql_real_escape_string($userid)."'");
return $sql;
}
function getLink($link) {
return BASE_URL."../profile/".$link;
}
function getAvatar($image) {
if (is_file(dirname(dirname(__FILE__))."/".$image)) {
return BASE_URL."../".$image;
} else {
return BASE_URL."../application/modules/User/externals/images/nophoto_user_thumb_profile.png";
}
}
Joined: Oct 01, 2010 Posts: 415 Location: Houston, Tx
Posted:
Tue Aug 02, 2011 7:12 am
prekill wrote:
may I upload cometchat to modules/Chat? or it has to be /comechat?
No... cometchat needs to reside in the "ROOT" directory (i.e. public_html) I tried putting it in the modules directory as well... but it messes up the internal linking of cometchat.
prekill wrote:
can you please post the integration.php?
I forget what version my cometchat is... but I believe it's older than yours. Also, I had to modify some parts of it to work with my mail client so it's not a good idea to use mine anyhow. Use the integration.php that came with the package.
prekill wrote:
does we use session or cookie?
I would use session if possible because it will load them into the bar instantly. If you use the cookie method (which had to do on my email client)... what happens is the "FIRST" time someone logs in... it will not log them into the bar. They would have to refresh the page to show up in the chat bar.
/*
* Config File for Cometchat 1.60
* for DragonFlyCMS.org 9.22
*
* This File Comes with No warranty.
* Version: 1.0
* Jun 21 2010
* Author:
Only registered users can see links on this board! Get registered or login to the forums!
*
*
*
*
*
*
* Set your path to the dragon fly installation base dir
* Dont forget the trailing SLASH
* */
$dragonfly_path ='/home/sitename/public_html/';
define('XMLFEED', 1);
require_once($dragonfly_path.'includes/cmsinit.inc');
require_once($dragonfly_path.'includes/classes/security.php');
require_once($dragonfly_path.'includes/classes/session.php');
require_once($dragonfly_path.'includes/classes/cpg_member.php');
unset($dragonfly_path);
global $dbhost,$dbname, $dbuname,$dbuname,$prefix, $user_prefix,$CensorList, $SESS,$MAIN_CFG;
$CPG_SESS = array();
$SESS =& new cpg_session();
$CLASS['member'] =& new cpg_member();
$userinfo =& $_SESSION['CPG_USER'];
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
unset($language);
/* LANGUAGE */
$language[0] = "CometChat Options";
$language[1] = "Type your status and hit the enter key!";
$language[2] = "My Status";
$language[3] = "Available";
$language[4] = "Busy";
$language[5] = "Invisible";
$language[6] = "Add Friend";
$language[7] = '<a href="Member_List.html">Add more friends</a>';
$language[8] = "Please login to use CometChat";
$language[9] = "Who\'s Online";
$language[10] = "Me";
$language[11] = "Go Offline";
$language[12] = "Who\'s Online";
$language[13] = "Disable sound notifications";
$language[14] = "You have no friends in your friend list, please add a few friends to use chat";
$language[15] = "New Messages...";
$language[16] = 'Your_Account.html'; // Login link when user clicks on yellow triangle (specify only link i.e. http://yoursite.com/login.php)
$language[17] = "Offline";
$theme = 'default'; // Default theme, if no cookie preference is found
if (!empty($_COOKIE[$cookiePrefix."theme"])) {
$theme = $_COOKIE[$cookiePrefix."theme"];
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* MISCELLANEOUS */
$autoPopupChatbox = 1; // Auto-open chatbox when a new message arrives
$messageBeep = 0; // Beep on arrival of new messages (user can over-ride this setting)
$minHeartbeat = 3000; // Minimum poll-time
$maxHeartbeat = 12000; // Maximum poll-time
define('REFRESH_BUDDYLIST','60'); // Time in seconds after which the user's "Who's Online" list is refreshed
define('ONLINE_TIMEOUT','180'); // Time in seconds after which a user is considered offline
define('DISABLE_SMILEYS','0'); // Set to 1 if you want to disable smileys
define('DISABLE_LINKING','0'); // Set to 1 if you want to disable auto linking
define('DISABLE_YOUTUBE','0'); // Set to 1 if you want to disable YouTube thumbnail
define('DEV_MODE','0'); // Set to 1 only during development
define('ERROR_LOGGING','0'); // Set to 1 to log all errors (error.log file)
define('SET_SESSION_NAME',''); // Session name
define('DO_NOT_START_SESSION','0'); // Set to 1 if you have already started the session
define('DO_NOT_DESTROY_SESSION','0'); // Set to 1 if you do not want to destroy session on logout
function getFriendsList($userid,$time) {
$userid = intval($userid);
/* This generates a user list based n the nuke_session table, aka users online
* comment this line to use the friendlist provided by Buddys Module.
*/
$sql = ("select DISTINCT ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." lastactivity, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." avatar, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." link, cometchat_status.message, cometchat_status.status from ".TABLE_PREFIX."session join ".TABLE_PREFIX.DB_USERTABLE." on ".TABLE_PREFIX."session.uname = ".TABLE_PREFIX.DB_USERTABLE.".username left join cometchat_status on ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = cometchat_status.userid where ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." != '".mysql_real_escape_string($userid)."' order by username asc");
/*
* un comment this line to use the friendlist provided by the Buddys Module. */
//$sql = ("select DISTINCT ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." lastactivity, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." avatar, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." link, cometchat_status.message, cometchat_status.status from ".TABLE_PREFIX."buddys join ".TABLE_PREFIX.DB_USERTABLE." on ".TABLE_PREFIX."buddys.user_id = ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." left join cometchat_status on ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = cometchat_status.userid where ".TABLE_PREFIX."buddys.buddy_id = '".mysql_real_escape_string($userid)."' order by username asc");
return $sql;
}
function getUserDetails($userid) {
$userid = intval($userid);
$sql = ("select ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." lastactivity, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." link, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." avatar, cometchat_status.message, cometchat_status.status from ".TABLE_PREFIX.DB_USERTABLE." left join cometchat_status on ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = cometchat_status.userid where ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = '".mysql_real_escape_string($userid)."'");
return $sql;
}
function updateLastActivity($userid) {
$userid = intval($userid);
//$sql = ("update `".TABLE_PREFIX.DB_USERTABLE."` set ".DB_USERTABLE_LASTACTIVITY." = '".getTimeStamp()."' where ".DB_USERTABLE_USERID." = '".mysql_real_escape_string($userid)."'");
$sql = ("update ".TABLE_PREFIX.DB_USERTABLE.", ".TABLE_PREFIX."session set ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." = '".gmtime()."', ".TABLE_PREFIX."session.time = '".gmtime()."' where ".DB_USERTABLE_USERID." = '".$userid."' AND ".TABLE_PREFIX.DB_USERTABLE.".username = ".TABLE_PREFIX."session.uname");
return $sql;
}
function getUserStatus($userid) {
$userid = intval($userid);
$sql = ("select cometchat_status.message, cometchat_status.status from cometchat_status where userid = '".mysql_real_escape_string($userid)."'");
return $sql;
}
/* GETLINK() CHANGES
*
* To Avoid conflicts with DF getlink() function
* you should edit:
*
* /cometchat/cometchat_receive.php
* find (about line 199)
* $link = getLink($chat['link']);
*
* and change it to
* $link = cc_getLink($chat['link']);
*
* repeat with
* /cometchat/cometchat_getid.php
*
* find : (about line 83)
* $link = getLink($chat['link']);
*
* and change it to:
* $link = cc_getLink($chat['link']);
*
*
*
* function getLink($link) {
return 'users.php?id='.$link;
}
* */
function cc_getLink($link) {
return getlink('Your_Account&profile='.intval($link).'');
}
function getAvatar($image) {
global $MAIN_CFG;
$avatar_info = getusrdata(intval($image),'user_avatar,user_allowavatar,user_avatar_type');
if ($avatar_info['user_avatar'] && $avatar_info['user_avatar_type'] && $avatar_info['user_allowavatar']) {
switch($avatar_info['user_avatar_type']){
case "1":
$avatar_tag = $MAIN_CFG['avatar']['path'].'/'.$avatar_info['user_avatar'];
break;
case "2":
$avatar_tag = $avatar_info['user_avatar'];
break;
case "3":
$avatar_tag = $MAIN_CFG['avatar']['gallery_path'].'/'.$avatar_info['user_avatar'];
break;
}
}
else {$avatar_tag = $MAIN_CFG['avatar']['path'].'/'.$MAIN_CFG['avatar']['default'];}
return $avatar_tag;
}
Joined: Oct 01, 2010 Posts: 415 Location: Houston, Tx
Posted:
Wed Aug 03, 2011 11:00 am
You need the "standalone" version of cometchat. No need to convert it at that point... just the necessary columns to the database.
Also, the version you provided (1.60) is highly outdated. According to their site... they are in version "3" and don't show support for dragonfly anywhere in the documentation.
Joined: Oct 01, 2010 Posts: 415 Location: Houston, Tx
Posted:
Mon Aug 08, 2011 9:32 am
Don't worry... I've finally setup a dev server at my home so I can toy with things as well as developing for RN. The first thing I'm doing is writing up step by step instructions on how to install cometchat to work with our favorite CMS.
Bout half way through it now so just hang with me.
Joined: Oct 01, 2010 Posts: 415 Location: Houston, Tx
Posted:
Tue Aug 09, 2011 11:22 am
ok... I've semi-built and semi-tested an ad-hoc bridge for cometchat but here's the catch... if you want to use the "friends list" function (i.e. only showing friends of friends instead of everyone who is logged in to everyone) it requires you to setup your database differently and manually edit the database per the instructions on cometchat website.
Here's my warning... if you are wanting to use the friends list functionality... you're going to be making LOTS of manual changes to the database in order to establish the FRIEND ---> FRIEND connections. This can be overcome though... with an added backend GUI in Ravennuke so that you can point and click. (this however, is further than I'm willing to go free of charge)
The getlink() function gets to the FORUMS profile exactly like the site info block does. I'm not keen on doing this because it ties cometchat directly to the forums. I'm not big on making (A) reliant on (B).
The getAvatar() function needs to be re-written to use RN avatars (or a totally seperate avatar directory)... however, I'm not willing to do this one free of charge either because (A) I don't know what size the avatar should be (B) I don't know how this function works yet (C) I just don't have the time to figure it all out, write the new function & test it all.
So I ask you two... how do you plan on using this on your websites?
As it stands now... cometchat works as EVERYONE to EVERYONE with support for links (forum user profiles) & no support for avatars (user images).
All of this is based on RN 2.40.01 & cometchat 2.0.4 (that is the version I have) The intergration should be about the same anyhow.
Joined: Jul 26, 2009 Posts: 117 Location: Scunthorpe, UK
Posted:
Wed Aug 10, 2011 1:08 pm
killing-hours wrote:
ok... I've semi-built and semi-tested an ad-hoc bridge for cometchat but here's the catch... if you want to use the "friends list" function (i.e. only showing friends of friends instead of everyone who is logged in to everyone) it requires you to setup your database differently and manually edit the database per the instructions on cometchat website.
Here's my warning... if you are wanting to use the friends list functionality... you're going to be making LOTS of manual changes to the database in order to establish the FRIEND ---> FRIEND connections. This can be overcome though... with an added backend GUI in Ravennuke so that you can point and click. (this however, is further than I'm willing to go free of charge)
The getlink() function gets to the FORUMS profile exactly like the site info block does. I'm not keen on doing this because it ties cometchat directly to the forums. I'm not big on making (A) reliant on (B).
The getAvatar() function needs to be re-written to use RN avatars (or a totally seperate avatar directory)... however, I'm not willing to do this one free of charge either because (A) I don't know what size the avatar should be (B) I don't know how this function works yet (C) I just don't have the time to figure it all out, write the new function & test it all.
So I ask you two... how do you plan on using this on your websites?
As it stands now... cometchat works as EVERYONE to EVERYONE with support for links (forum user profiles) & no support for avatars (user images).
All of this is based on RN 2.40.01 & cometchat 2.0.4 (that is the version I have) The intergration should be about the same anyhow.
Wow!!!
This is brilliant mate, again thank you for taking your valuable time up on completing this.
I am fine with the lack of avatar function, but would of been interested in the friends --- to friends ability.
What do you mean by this part
Quote:
This can be overcome though... with an added backend GUI in Ravennuke so that you can point and click
how and where would the end users add and choose the other users they are to be friends with ?
Out of interest how much would you be wanting to implement this feature ?
I am in the future thinking of using either phpbb3 stand alone with a bridge, or maybe the module that I have heard trickedoutnews are maybe going to work on, I believe phpbb3 has a friends and foes feature built in, would that effect this, or maybe be able to work better with this ?
As if it works better then I will wait and maybe ask and pay you to make the changes then if you wanted to take that on that is?
Again thank you for doing this, and I look forward to the install guide.
Joined: Oct 01, 2010 Posts: 415 Location: Houston, Tx
Posted:
Wed Aug 10, 2011 1:18 pm
kenno wrote:
how and where would the end users add and choose the other users they are to be friends with ?
Out of interest how much would you be wanting to implement this feature ?
The reason for this is because of the way CometChat implements the friends list feature. In order for it to work... a table has to be setup on the database and a two way link must be established within that table between the two users.
Quote:
Update Who’s Online list fetching mechanism
We modify the getFriendsList() function.
The getFriendsList() function returns all the users’ details part of the Who’s Online list. This list need not necessarily be friends of the logged in user. It may simply be all online users instead. You can customize this to return any set of users.
The default configuration assumes that you have a table called friends with the following fields:
toid integer
fromid integer
All entries are assumed to be two-way i.e. if user A (id:1) and user B (id:2) are friends, then there will be two entries in the table:
So in order to make these changes to the database... (A) The user would need some sort of access to the database in order to assign/remove their friends (B) An entire system must be designed to keep user X from altering users Y's list etc etc etc. It just becomes a huge headache unless the admin will become the sole arbiter between the users at which point the headache is passed to the admin.
As far as the phpbb3 stuff... I don't know because I don't fool with forums nor run any. That is beyond the scope of my understanding.
Joined: Jul 26, 2009 Posts: 117 Location: Scunthorpe, UK
Posted:
Wed Aug 10, 2011 1:31 pm
Right I see what you mean now, yes that would become a head ache and I would not wish to be the admin who takes on the responsibility of adding on request friends.
It would of been a nice feature but I can see it would require a lot of work from scratch implementing and getting this to work.
I am sure in the phpbb3 forum profile area they have a friend and foe section where users can choose there friends so in essence that area you talked about where users would need an area with access to the database to make these choices might be already built in phpbb3.
**Edit**
Infact look here, cometchat comes with a prebuilt integration for phpbb3 and says can use the friends feature of that, so I guess that answers my question.
Only registered users can see links on this board! Get registered or login to the forums!
Last edited by kenno on Wed Aug 10, 2011 1:34 pm; edited 1 time in total
Joined: Oct 01, 2010 Posts: 415 Location: Houston, Tx
Posted:
Wed Aug 10, 2011 1:34 pm
Very well could be. I don't know anything about phpbb so I can't say with confidence. If it already has a friends list type thing built in... why use CometChat???
Joined: Oct 01, 2010 Posts: 415 Location: Houston, Tx
Posted:
Wed Aug 10, 2011 1:38 pm
Yes...when you get CometChat... make sure to get the phpbb3 version and you won't need this tutorial to set it up. It's already pre-configured to work with phpbb3. The tutorial I'm writing only covers using CometChat with Ravennuke CMS.
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum