Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
kenno
Worker
Worker



Joined: Jul 26, 2009
Posts: 117
Location: Scunthorpe, UK

PostPosted: Wed Aug 10, 2011 1:44 pm Reply with quote

I am still very much interested in your tutorial, I have been saying for ages I am maybe going to try the trickedoutnews bridge for phpbb3.

I intend to stick with Ravennuke regardless of what I decide, and would really like to in the future maybe use a phpbb3 module if there is ever one created for Ravennuke.

I await your tutorial in anticipation.

Thanks Again

Kenno
 
View user's profile Send private message
killing-hours
RavenNuke(tm) Development Team



Joined: Oct 01, 2010
Posts: 438
Location: Houston, Tx

PostPosted: Wed Aug 10, 2011 2:23 pm Reply with quote

Here ya go... give this a shot and see if it gets you setup or not. I think I covered all my bases but I may have missed something somewhere as there were many different things I tested and changed during the course.
[ Only registered users can see links on this board! Get registered or login! ]

_________________
Money is the measurement of time - Me
"You can all go to hell…I’m going to Texas" -Davy Crockett 
View user's profile Send private message
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Wed Aug 10, 2011 2:40 pm Reply with quote

Just to let you know, I have started on the phpBB3 module for RavenNuke. I even have most of the easy stuff done on it.
I should have a beta release within a month. Here is a demo of it so far:
[ Only registered users can see links on this board! Get registered or login! ]

_________________
Tricked Out News 
View user's profile Send private message Send e-mail Visit poster's website
kenno







PostPosted: Wed Aug 10, 2011 5:23 pm Reply with quote

killing-hours wrote:
Here ya go... give this a shot and see if it gets you setup or not. I think I covered all my bases but I may have missed something somewhere as there were many different things I tested and changed during the course.
[ Only registered users can see links on this board! Get registered or login! ]


Thanks I have just downloaded CometChat, but its getting a bit late here so will give this ago tomorrow

Thanks Kenno
 
kenno







PostPosted: Wed Aug 10, 2011 5:24 pm Reply with quote

nuken wrote:
Just to let you know, I have started on the phpBB3 module for RavenNuke. I even have most of the easy stuff done on it.
I should have a beta release within a month. Here is a demo of it so far:
[ Only registered users can see links on this board! Get registered or login! ]


Thats great news it looks very good.

I look forward to this release

Kenno
 
prekill
Worker
Worker



Joined: Oct 22, 2005
Posts: 201

PostPosted: Thu Aug 11, 2011 5:17 am Reply with quote

just tried the manual:

- The Who's Online is stuck on 0 even when im loged in from 2 different users.

- The Chatroom is working nice and I can see users.

- For some reseon when I click on a user nothing happends (in chatrooms).. (should it pop a private message window? or go to user details?)

- Even if im not login it shows the Who Online and not please login icon, and then if i click chatrooms i get the following:

Code:
Notice: Undefined index: user in modules/Chat/integration.php on line 44

Please login to use our chatrooms.


Thanks!!
 
View user's profile Send private message
killing-hours







PostPosted: Thu Aug 11, 2011 7:09 am Reply with quote

Post your intergration.php & config.php as it is right now.
 
prekill







PostPosted: Thu Aug 11, 2011 3:20 pm Reply with quote

here Smile

Code:
<?php


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* SOFTWARE SPECIFIC INFORMATION (DO NOT TOUCH) */

include dirname(__FILE__).DIRECTORY_SEPARATOR.'integration.php';

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* BASE URL START */

define('BASE_URL','/testsite/modules/Chat/');

/* BASE URL END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* LANGUAGE START */

$lang = 'en';
$rtl = 1;

/* LANGUAGE END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* ICONS START */

$trayicon[] = array('home','Home','/','','','','','','');
$trayicon[] = array('announcements','Announcements','modules/announcements/index.php','_popup','280','300','','1','');
$trayicon[] = array('themechanger','Change Theme','modules/themechanger/index.php','_popup','200','100','','1','');
$trayicon[] = array('translate','Translate This Page','modules/translate/index.php','_popup','280','300','','1','');
$trayicon[] = array('share','Share This Page','modules/share/index.php','_popup','340','50','','1','');
$trayicon[] = array('chatrooms','Chatrooms','modules/chatrooms/index.php','_popup','500','300','','1','');
$trayicon[] = array('games','Single Player Games','modules/games/index.php','_popup','500','300','','1','');
$trayicon[] = array('scrolltotop','Scroll To Top','javascript:jqcc.cometchat.scrollToTop();','','','','','','');
$trayicon[] = array('realtimetranslate','Translate Conversations','modules/realtimetranslate/index.php','_popup','280','300','','1','');
$trayicon[] = array('facebook','Facebook Fan Page','modules/facebook/index.php','_popup','500','300','','1','');

/* ICONS END */
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* PLUGINS START */

$plugins = array('handwrite','games','smilies','writeboard','whiteboard','filetransfer','chathistory','save','chattime','clearconversation');

/* PLUGINS END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* CHATROOMPLUGINS START */

$crplugins = array('smilies','handwrite','chattime');

/* CHATROOMPLUGINS END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* SMILEYS START */

$smileys = array(

   ':)'   =>   'smiley.png',
   ':-)'   =>   'smiley.png',
   ':('   =>   'smiley-sad.png',
   ':-('   =>   'smiley-sad.png',
   ':D'   =>   'smiley-lol.png',
   ';-)'   =>   'smiley-wink.png',
   ';)'   =>   'smiley-wink.png',
   ':o'   =>   'smiley-surprise.png',
   ':-o'   =>   'smiley-surprise.png',
   '8-)'   =>   'smiley-cool.png',
   '8)'   =>   'smiley-cool.png',
   ':|'   =>   'smiley-neutral.png',
   ':-|'   =>   'smiley-neutral.png',
   ":'("   =>   'smiley-cry.png',
   ":'-("   =>   'smiley-cry.png',
   ":p"   =>   'smiley-razz.png',
   ":-p"   =>   'smiley-razz.png',
   ":s"   =>   'smiley-confuse.png',
   ":-s"   =>   'smiley-confuse.png',
   ":x"   =>   'smiley-mad.png',
   ":-x"   =>   'smiley-mad.png'
);

/* SMILEYS END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* BANNED START */

$bannedWords = array( 'asshole','f***','bastard','bitch','suck', );
$bannedUserIDs = array();
$bannedMessage = 'Sorry, you have been banned from using this service. Your messages will not be delivered.';

/* BANNED END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* ADMIN START */

define('ADMIN_USER','cometchat');
define('ADMIN_PASS','cometchat');

/* ADMIN END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* COOKIE */

$cookiePrefix = 'cc_';            // Modify only if you have multiple CometChat instances on the same site

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* SETTINGS START */

$lightWeight = '0';         // Switch on light-weight chat?
$hideOffline = '0';         // Hide offline users in Whos Online list?
$autoPopupChatbox = '0';         // Auto-open chatbox when a new message arrives
$messageBeep = '1';         // Beep on arrival of message from new user?
$beepOnAllMessages = '1';         // Beep on arrival of all messages?
$barType = 'fluid';         // Bar layout
$barWidth = '960';         // If set to fixed, enter the width of the bar in pixels
$barAlign = 'center';         // If set to fixed, enter alignment of the bar
$barPadding = '20';         // Padding of bar from the end of the window
$minHeartbeat = '3000';         // Minimum poll-time in milliseconds (1 second = 1000 milliseconds)
$maxHeartbeat = '12000';         // Maximum poll-time in milliseconds
$longNameLength = '22';         // The length after which characters will be truncated in long names
$shortNameLength = '11';         // The length after which characters will be truncated in short names
$autoLoadModules = '0';         // If set to yes, modules open in previous page, will open in new page
$fullName = '0';         // If set to yes, both first name and last name will be shown in chat conversations
$searchDisplayNumber = '10';         // The number of users in Whos Online list after which search bar will be displayed
$thumbnailDisplayNumber = '40';         // The number of users in Whos Online list after which thumbnails will be hidden
$typingTimeout = '10000';         // The number of milliseconds after which typing to will timeout
$idleTimeout = '300';         // The number of seconds after which user will be considered as idle
$displayOfflineNotification = '1';         // If yes, user offline notification will be displayed
$displayOnlineNotification = '1';         // If yes, user online notification will be displayed
$displayBusyNotification = '1';         // If yes, user busy notification will be displayed
$notificationTime = '5000';         // The number of milliseconds for which a notification will be displayed
$announcementTime = '15000';         // The number of milliseconds for which an announcement will be displayed
$scrollTime = '1';         // Can be set to 800 for smooth scrolling when moving from one chatbox to another
$armyTime = '0';         // If set to yes, show time plugin will use 24-hour clock format
$disableForIE6 = '0';         // If set to yes, CometChat will be hidden in IE6
$disableForMobileDevices = '1';         // If set to yes, CometChat will be hidden in mobile devices
$iPhoneView = '0';         // iPhone style messages in chatboxes?
$hideBar = '1';         // Hide bar for non-logged in users?
$startOffline = '0';         // Load bar in offline mode for all first time users?
$fixFlash = '0';         // Set to yes, if Adobe Flash animations/ads are appearing on top of the bar (experimental)


/* SETTINGS END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* THEME START */



$theme = 'default';



/* THEME END */

if (!empty($_COOKIE[$cookiePrefix."theme"])) {
   $theme = $_COOKIE[$cookiePrefix."theme"];
}

if ($lightWeight == 1) {
   $theme = 'lite';
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* DISPLAYSETTINGS START */

define('DISPLAY_ALL_USERS','1');

/* DISPLAYSETTINGS END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* DISABLEBAR START */

define('BAR_DISABLED','0');

/* DISABLEBAR END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* COMET START */

define('USE_COMET','0');
define('COMET_HISTORY_LIMIT','100');
define('KEY_A','');
define('KEY_B','');
define('KEY_C','');
define('SAVE_LOGS','0');

/* COMET END */

define('TRANSPORT','beaconpush');

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* ADVANCED */

define('REFRESH_BUDDYLIST','60');      // Time in seconds after which the user's "Who's Online" list is refreshed
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('CACHING_ENABLED','0');         // Set to 1 if you would like to cache CometChat
define('GZIP_ENABLED','0');            // Set to 1 if you would like to compress output of JS and CSS
define('DEV_MODE','1');               // Set to 1 only during development
define('ERROR_LOGGING','1');         // Set to 1 to log all errors (error.log file)
define('ONLINE_TIMEOUT',USE_COMET?REFRESH_BUDDYLIST*2:($maxHeartbeat/1000*2.5));         
                              // Time in seconds after which a user is considered offline
define('DISABLE_ANNOUNCEMENTS','0');   // Reduce server stress by disabling announcements
define('DISABLE_ISTYPING','1');         // Reduce server stress by disabling X is typing feature
define('CROSS_DOMAIN','0');            // Do not activate without consulting the CometChat Team

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Pulls the language file if found

include dirname(__FILE__).DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.'en.php';
if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$lang.'.php')) {
   include dirname(__FILE__).DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$lang.'.php';
}


Code:
<?php


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* ADVANCED */

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');

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* DATABASE */
if( !defined('_ENGINE_R_MAIN') ) {
  define('_ENGINE_R_CONF', true);
  define('_ENGINE_R_INIT', true);
}

// Hardcode the following:
define('DB_SERVER',               'localhost');
define('DB_PORT',               '3306');
define('DB_USERNAME',            'prefligh_testsit');
define('DB_PASSWORD',            'XXXXXXXX');
define('DB_NAME',               'prefligh_testsite');
define('TABLE_PREFIX',            'nuke_');
define('DB_USERTABLE',            'users');
define('DB_USERTABLE_NAME',         'username');
define('DB_USERTABLE_USERID',      'user_id');
define('DB_USERTABLE_LASTACTIVITY',   'lastsitevisit');


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* FUNCTIONS */


function getUserID() {
    $userid = 0;

    $user = $_COOKIE['user'];
    if(!is_array($user)) {
        $user = base64_decode($user);
        $user = addslashes($user);
        $cookie = explode(':', $user);
    }
   
    if($cookie[0] == 1){
        $userid = 0;
    }else{
        $userid = $cookie[0];
    }

    return $userid;
}

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() {
   return "/modules.php?name=Forums&file=profile&mode=viewprofile&u=".getUserID();
}

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";
   }
}


function getTimeStamp() {
   return time();
}

function processTime($time) {
   return $time;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* HOOKS */

function hooks_statusupdate($userid,$statusmessage) {
   $sql = ("update ".TABLE_PREFIX."users set status = '".mysql_real_escape_string($statusmessage)."', status_date = '".getTimeStamp()."' where user_id = '".mysql_real_escape_string($userid)."'");
    $query = mysql_query($sql);
}

function hooks_forcefriends() {
   
}

function hooks_activityupdate($userid,$status) {

}

function hooks_message($userid,$unsanitizedmessage) {
   
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* LICENSE */

$p_ = 4;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
killing-hours







PostPosted: Thu Aug 11, 2011 3:34 pm Reply with quote

Hrmm... First thing I notice is that you are putting this (A) on a test site which is in a sub directory (B) within the "modules" folder. That "may" throw linking errors but I can't verify that... Just a thought.

Also, this with it showing "0" even when you're logged out says to me that somewhere something is not making a correct connection or something. While testing... I noticed that if I messed something up with the function or didn't get it right... that's exactly what would happen... it would show logged in "0" when it really wasn't.

I'm leaning towards the internal linking as being messed up somewhere... but can't really say for certainty because I don't see how it is on your actual server.

Try following the tutorial and installing to the server ROOT as I mentioned. If that doesn't work... try setting the "session start" constant to 0. Wink
 
killing-hours







PostPosted: Mon Aug 15, 2011 8:35 am Reply with quote

Any update on this?? I'm curious to know from those who followed the tutorial on how it went and if the tutorial was good or needs any modifications/clarifications. (preferably leave a comment on the tutorial for others who find it via search engines rather than this topic)
 
kenno







PostPosted: Wed Aug 17, 2011 2:34 pm Reply with quote

Sorry for the delay.

I have just purchased and downloaded CometChat tonight and intend to take my live site off line tomorrow after work to give this a go.

I will let you know the out come and how I get on.

Prekill, did you get yours installed

Thanks Kenno
 
prekill







PostPosted: Mon Aug 22, 2011 2:47 pm Reply with quote

Nop, still having problems here, i will try to get into this tommorow, will update.
 
kenno







PostPosted: Mon Aug 29, 2011 3:49 am Reply with quote

I have just followed your tutorial and have managed to install this.

It had no errors on the install and everything seemed to go well and the bar shows up on when logged out and when logged into the site.

When logged out it advises you need to login to use the chat feature but the problems lie when you actually login, no one shows up in the list to be available to chat even though I know there are users logged into the site including myself and a test account.

When you go over to the chatroom feature (which I actually will be disabling hopefully) it does show both users who join that particular chatroom so it does know you are logged in but it will not show anyone logged into the actual chat list and always advises the Who`s Online as (0)

Any ideas on what the problem might be ?

I see in the database there is now a column in the users table about the "lastactivity" (no underscore) but the code used we are asking for

Code:
define('ADD_LAST_ACTIVITY', '1');


which is LAST_ACTIVITY, maybe nothing or makes any difference I have no idea

I would of posted this on your site but could not find where to make comments

Thanks Mark
 
killing-hours







PostPosted: Mon Aug 29, 2011 7:11 am Reply with quote

The comments are below the story and are hosted by Disqus.

Sounds like the database settings are not correct. It "should" be writing a unix timestamp to that field (last_activity) in the database.

Before moving onto anything else (i.e. chatroom feature) let's ensure we are logging in and getting the list to show all logged in users.

If you don't mind, will you pm me your intergration.php as it stands now so I can see what you've got.
 
kenno







PostPosted: Mon Aug 29, 2011 1:20 pm Reply with quote

On your site I see nothing below the actual tutorial other then the "Related" "Rate this" and "Share" icons.

Anyway I will pm you the integration.php

I actually looked in phpmyadmin and it did look to be adding a unix timestamp in that column for the users who had visited

Thanks Mark
 
kenno







PostPosted: Mon Aug 29, 2011 1:26 pm Reply with quote

For some reason it would not allow me to post this in a private message so here it is

Code:
<?php


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* ADVANCED */

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','0');      
define('INCLUDE_JQUERY','1');   
define('FORCE_MAGIC_QUOTES','0');

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* DATABASE */

define('DB_SERVER',               'localhost'                        );
define('DB_PORT',               '3306'                           );
define('DB_USERNAME',            '***********'                           );
define('DB_PASSWORD',            '***********'                        );
define('DB_NAME',               'bulldogs_rvnuke1'                        );
define('TABLE_PREFIX',            'nuke_'                              );
define('DB_USERTABLE',            'users'                           );
define('DB_USERTABLE_NAME',         'username'                        );
define('DB_USERTABLE_USERID',      'user_id'                        );
define('DB_USERTABLE_LASTACTIVITY',   'lastactivity'                     );

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* FUNCTIONS */

function getUserID() {
    $userid = 0;

    $user = $_COOKIE['user'];
    if(!is_array($user)) {
        $user = base64_decode($user);
        $user = addslashes($user);
        $cookie = explode(':', $user);
    }
   
    if($cookie[0] == 1){
        $userid = 0;
    }else{
        $userid = $cookie[0];
    }

    return $userid;
}


function getFriendsList($userid,$time) {
   $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."friends join ".TABLE_PREFIX.DB_USERTABLE." on  ".TABLE_PREFIX."friends.toid = ".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."friends.fromid = '".mysql_real_escape_string($userid)."' order by username asc");
   return $sql;
}

function getUserDetails($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) {
   $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 cometchat_status.message, cometchat_status.status from cometchat_status where userid = '".mysql_real_escape_string($userid)."'");
    return $sql;
}

function getLink($link) {
//    return 'users.php?id='.$link;
      return "/modules.php?name=Forums&file=profile&mode=viewprofile&u=".getUserID();
}

function getAvatar($image) {
    if (is_file(dirname(dirname(__FILE__)).'/images/'.$image.'.gif')) {
        return 'images/'.$image.'.gif';
    } else {
        return 'images/noavatar.gif';
    }
}


function getTimeStamp() {
   return time();
}

function processTime($time) {
   return $time;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* HOOKS */

function hooks_statusupdate($userid,$statusmessage) {
   
}

function hooks_forcefriends() {
   
}

function hooks_activityupdate($userid,$status) {

}

function hooks_message($userid,$unsanitizedmessage) {
   
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* LICENSE */

include_once(dirname(__FILE__).'/license.php');
$);

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


Anything stand out at all to you ?
 
killing-hours







PostPosted: Mon Aug 29, 2011 1:36 pm Reply with quote

Hrm...

1: Is the actual database name "bulldogs_rvnuke1" ? or is the "bulldogs" a prefix of some sort?

2: In the "config.php" ... did you set "define('DISPLAY_ALL_USERS','1') {default is 0} ??
 
kenno







PostPosted: Mon Aug 29, 2011 1:48 pm Reply with quote

Hmm

Now you mention it the database is called "bulldogs_rvnuke1" but it does seem the "bulldog" is a prefix as when I go into create another database they all start with bulldogs_

Here is my config.php

Code:
<?php


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* SOFTWARE SPECIFIC INFORMATION (DO NOT TOUCH) */

include dirname(__FILE__).DIRECTORY_SEPARATOR.'integration.php';

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* BASE URL START */

define('BASE_URL','cometchat/');

/* BASE URL END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* LANGUAGE START */

$lang = 'en';
$rtl = 0;

/* LANGUAGE END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* ICONS START */

$trayicon[] = array('home','Home','/','','','','','','');
$trayicon[] = array('chatrooms','Chatrooms','modules/chatrooms/index.php','_popup','500','300','','1','1');
$trayicon[] = array('announcements','Announcements','modules/announcements/index.php','_popup','280','300','','1','');
$trayicon[] = array('games','Single Player Games','modules/games/index.php','_popup','500','300','','1','');
$trayicon[] = array('translate','Translate This Page','modules/translate/index.php','_popup','280','300','','1','');
$trayicon[] = array('share','Share This Page','modules/share/index.php','_popup','340','50','','1','');
$trayicon[] = array('scrolltotop','Scroll To Top','javascript:jqcc.cometchat.scrollToTop();','','','','','','');

/* ICONS END */
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* PLUGINS START */

$plugins = array('smilies','games','handwrite','chattime','clearconversation');

/* PLUGINS END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* CHATROOMPLUGINS START */

$crplugins = array('smilies','handwrite','chattime');

/* CHATROOMPLUGINS END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* SMILEYS START */

$smileys = array(

   ':)'   =>   'smiley.png',
   ':-)'   =>   'smiley.png',
   ':('   =>   'smiley-sad.png',
   ':-('   =>   'smiley-sad.png',
   ':D'   =>   'smiley-lol.png',
   ';-)'   =>   'smiley-wink.png',
   ';)'   =>   'smiley-wink.png',
   ':o'   =>   'smiley-surprise.png',
   ':-o'   =>   'smiley-surprise.png',
   '8-)'   =>   'smiley-cool.png',
   '8)'   =>   'smiley-cool.png',
   ':|'   =>   'smiley-neutral.png',
   ':-|'   =>   'smiley-neutral.png',
   ":'("   =>   'smiley-cry.png',
   ":'-("   =>   'smiley-cry.png',
   ":p"   =>   'smiley-razz.png',
   ":-p"   =>   'smiley-razz.png',
   ":s"   =>   'smiley-confuse.png',
   ":-s"   =>   'smiley-confuse.png',
   ":x"   =>   'smiley-mad.png',
   ":-x"   =>   'smiley-mad.png'
);

/* SMILEYS END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* BANNED START */

$bannedWords = array( 'asshole','f***','bastard','bitch','suck', );
$bannedUserIDs = array();
$bannedMessage = 'Sorry, you have been banned from using this service. Your messages will not be delivered.';

/* BANNED END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* ADMIN START */

define('ADMIN_USER','cometchat');
define('ADMIN_PASS','cometchat');

/* ADMIN END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* COOKIE */

$cookiePrefix = 'cc_';            // Modify only if you have multiple CometChat instances on the same site

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* SETTINGS START */

$lightWeight = '0';         // Switch on light-weight chat?
$hideOffline = '0';         // Hide offline users in Whos Online list?
$autoPopupChatbox = '0';         // Auto-open chatbox when a new message arrives
$messageBeep = '1';         // Beep on arrival of message from new user?
$beepOnAllMessages = '1';         // Beep on arrival of all messages?
$barType = 'fluid';         // Bar layout
$barWidth = '960';         // If set to fixed, enter the width of the bar in pixels
$barAlign = 'center';         // If set to fixed, enter alignment of the bar
$barPadding = '20';         // Padding of bar from the end of the window
$minHeartbeat = '3000';         // Minimum poll-time in milliseconds (1 second = 1000 milliseconds)
$maxHeartbeat = '12000';         // Maximum poll-time in milliseconds
$longNameLength = '22';         // The length after which characters will be truncated in long names
$shortNameLength = '11';         // The length after which characters will be truncated in short names
$autoLoadModules = '0';         // If set to yes, modules open in previous page, will open in new page
$fullName = '0';         // If set to yes, both first name and last name will be shown in chat conversations
$searchDisplayNumber = '10';         // The number of users in Whos Online list after which search bar will be displayed
$thumbnailDisplayNumber = '40';         // The number of users in Whos Online list after which thumbnails will be hidden
$typingTimeout = '10000';         // The number of milliseconds after which typing to will timeout
$idleTimeout = '300';         // The number of seconds after which user will be considered as idle
$displayOfflineNotification = '1';         // If yes, user offline notification will be displayed
$displayOnlineNotification = '1';         // If yes, user online notification will be displayed
$displayBusyNotification = '1';         // If yes, user busy notification will be displayed
$notificationTime = '5000';         // The number of milliseconds for which a notification will be displayed
$announcementTime = '15000';         // The number of milliseconds for which an announcement will be displayed
$scrollTime = '1';         // Can be set to 800 for smooth scrolling when moving from one chatbox to another
$armyTime = '0';         // If set to yes, show time plugin will use 24-hour clock format
$disableForIE6 = '0';         // If set to yes, CometChat will be hidden in IE6
$disableForMobileDevices = '1';         // If set to yes, CometChat will be hidden in mobile devices
$iPhoneView = '0';         // iPhone style messages in chatboxes?
$hideBar = '1';         // Hide bar for non-logged in users?
$startOffline = '0';         // Load bar in offline mode for all first time users?
$fixFlash = '0';         // Set to yes, if Adobe Flash animations/ads are appearing on top of the bar (experimental)


/* SETTINGS END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* THEME START */

$theme = 'default';

/* THEME END */

if (!empty($_COOKIE[$cookiePrefix."theme"])) {
   $theme = $_COOKIE[$cookiePrefix."theme"];
}

if ($lightWeight == 1) {
   $theme = 'lite';
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* DISPLAYSETTINGS START */

define('DISPLAY_ALL_USERS','1');
define('ADD_LAST_ACTIVITY','1');

/* DISPLAYSETTINGS END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* DISABLEBAR START */

define('BAR_DISABLED','0');

/* DISABLEBAR END */

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* COMET START */

define('USE_COMET','0');
define('COMET_HISTORY_LIMIT','100');
define('KEY_A','');
define('KEY_B','');
define('KEY_C','');
define('SAVE_LOGS','0');

/* COMET END */

define('TRANSPORT','cometservice');

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* ADVANCED */

define('REFRESH_BUDDYLIST','60');      // Time in seconds after which the user's "Who's Online" list is refreshed
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('CACHING_ENABLED','0');         // Set to 1 if you would like to cache CometChat
define('GZIP_ENABLED','1');            // Set to 1 if you would like to compress output of JS and CSS
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('ONLINE_TIMEOUT',USE_COMET?REFRESH_BUDDYLIST*2:($maxHeartbeat/1000*2.5));         
                              // Time in seconds after which a user is considered offline
define('DISABLE_ANNOUNCEMENTS','0');   // Reduce server stress by disabling announcements
define('DISABLE_ISTYPING','1');         // Reduce server stress by disabling X is typing feature
define('CROSS_DOMAIN','0');            // Do not activate without consulting the CometChat Team

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Pulls the language file if found

include dirname(__FILE__).DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.'en.php';
if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$lang.'.php')) {
   include dirname(__FILE__).DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$lang.'.php';
}


Is the prefix bulldogs_ causing the issue ?
 
killing-hours







PostPosted: Mon Aug 29, 2011 2:06 pm Reply with quote

AH HA!! I see your problem. It's your "getFriendsList()" function. You function is incorrect. It should look like this or something similar.

Code:
function getFriendsList($userid,$time) {


   $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."userlist join ".TABLE_PREFIX.DB_USERTABLE." on  ".TABLE_PREFIX."userlist.relationid = ".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."userlist.friend = 'yes' and ".TABLE_PREFIX."userlist.userid = '".mysql_real_escape_string($userid)."' order by username asc");

   if (defined('DISPLAY_ALL_USERS') && DISPLAY_ALL_USERS == 1) {

      $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.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)."' and ('".$time."'-lastactivity < '".((ONLINE_TIMEOUT)*2)."') and (cometchat_status.status IS NULL OR cometchat_status.status <> 'invisible' OR cometchat_status.status <> 'offline') order by username asc");

   }
   
   return $sql;
}


Replace your function with this one above and see what happens. (it's int he integration.php) Wink As it stands now... your function only tries to get the friends list without the option of displaying all users. That's why you're seeing everything work fine except showing who's online.
 
kenno







PostPosted: Mon Aug 29, 2011 2:26 pm Reply with quote

AH HA!! Nice one that has done it.
It now shows these users who are on-line brilliant.

How did I miss that one then, was I supposed to add that function in there then ?

So this function will now list everyone on-line and in chat regardless of if say they have there site access as hidden for example. I guess these users can just close the chat down though can`t they if they wanted to come out of it.
I am wandering if this part in the config.php would actually work

$hideOffline = '0'; // Hide offline users in Whos Online list?

Thanks again for your trouble to write the tutorial it was a great help

Mark
 
killing-hours







PostPosted: Mon Aug 29, 2011 2:30 pm Reply with quote

No... Not sure how your function got messed up like that... I just barely caught it myself.

Your users can just click to close the bar on the right.. it logs them out of the bar and will show them offline. If you change the setting $hideOffline = 0 ( to 1) it will not show them in the list when they are offline. Might be a good thing to set on yours. Otherwise.. .their name will be in the list but showing them as "offline".

Glad ya got it working. Wink
 
kenno







PostPosted: Mon Aug 29, 2011 2:34 pm Reply with quote

Yes I have just done this actually and it is working well, I also have activated the lightchat and got rid of the full bottom bar as I only wanted the chat feature between user and user and not the chat rooms.

One other slight issue I have noticed is on all of the users name link I guess it should take them to the forum profile page, well this seems to all link to my own account forum view page.
I wander if this has something to do with me being logged in as admin.

I will try logging out of that and have a look

Thanks Mark
 
killing-hours







PostPosted: Mon Aug 29, 2011 2:39 pm Reply with quote

Hrm... not sure. BTW... one thing I noticed on my own the other day was that the chat list looks for an image to display next to their name. If you don't set something... it's going to show tons of hits on your site as 404 pages. When you see those show up in your tracked sentinal page... find out where it's looking for the image and put a 1x1 px blank image in there so it doesn't throw off your hit counter. Otherwise .... you have to manually make images for everyone. (bah on that)

Here is a 1x1 px image. [ Only registered users can see links on this board! Get registered or login! ]
 
prekill







PostPosted: Mon Aug 29, 2011 3:01 pm Reply with quote

will it solve my problem as well? sounds both problem are the same..

will try tommorow..

Smile

killing-hours you are the best!
 
killing-hours







PostPosted: Mon Aug 29, 2011 3:17 pm Reply with quote

Please... don't forget to set a cron job to delete old messages after some time otherwise the database will be filled with messages and slow things down.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©