Configuring FlashChat

by Kelly Jones

This document covers the /inc/config.php configuration file of FlashChat.

FlashChat is the most highly-configurable chat room on the Net. Most of these options are as simple as changing a value from true or false depending on your needs. This tutorial will go over most of the other options that you may not have known about.

First, let's go to the config.php file. This is located in the "/inc" folder within FlashChat. Many options are self-explanatory, or they are clear just from reading the PHP comments which are abundant in this file.

'backtimeOnLogin' => 0,
This can be set to any positive integer value, or 0. When the chat starts it will show messages that were previously posted before you entered the chat. A value of 10 would show the last 10 minutes of text posted in the main chat window. This is like using the /backtime IRC command immediately when any user enters the chat, so that they can quickly "catch up" on the conversation.

'timeOffset' => 0,
It's usually OK to leave this as 0, but for some countries that don't use daylight savings time, you may set a positive or negative integer value here, to adjust the system time.

'debug' => false,
By default this is set to false. If you are having connection issues with your chat, you can set this to true to see the client/server messages, and check for errors. If set to true, a small window will pop up and start logging FlashChat's client/server communication. This option is only recommended for developers.

'version' => '4.0.8',
This is fairly straight-forward. On each upgrade to FlashChat, this value is changed to show the current version of your chat. This shows up on the index_default.php page and in your chat when the page loads. When logged-in to FlashChat, you can always immediately see the current version by typing this IRC command: /version

'appdata_path' => './appdata/appTime.txt',
appTime.txt must be writable by FlashChat. For added security, you may change the path of this file to outside of your http root. This file slightly reduces the number of MySQL accesses that FlashChat must make to check for new messages. The installer will check to ensure that this file is writable (chmod'd to an appropriate setting, so that it is writable by PHP).

'liveSupportMode' => false,
If you want to run a live support chat this is set to true. If you haven't seen this, then set this to true or go here to see the demo on main site: http://tufat.com/chat.php

Live support mode has a few configurations which are unique to this mode. For example, there is a customer.php file in the inc/layouts folder, which determines the interface layout that customers will see (i.e., non-moderators who login to FlashChat while liveSupportMode is turned on). Non-moderators are logged into FlashChat as "customers", while moderators are logged into FlashChat as "support staff".

When a non-moderator logs-in, a new public "support room" is created for them; moderators can then switch among the various support rooms for each user who needs support.

'hideSelfPopup' => false,
When this option is set to true, you no longer have any "popup options" when you click on your own username. No private message option, etc. In other words, if set to true, you can't private message with yourself (why would you want to anyway?)

'showConfirmation' => true,
Set to true if you want FlashChat to show a confirmation dialog when a user has read an alert message, for example alerts issued by moderators during the chat via the /alert IRC command.

'showTimeStamp' => true,
This option shows the present time of your system in your message posts.

'timeStampPosition' => TIMESTAMP_AFTER,
By default this is set to show the time after your name. You can change this to TIMESTAMP_BEFORE to make the time show before your name in chat posts.

'timeStampFormat' => 'g:i a',
This is set for PHP date function. For a complete list of PHP date formats, please refer to: http://www.php.net/manual/en/function.date.php

'loginsPerIP' => 4,
This option will allow only 4 connections per IP address. If you want this to be less then user a smaller number. Typically, only 1 connection is needed for a single IP address, but you may wish to set this to a larger value for testing purposes.

'disabledIRC' => '',
Now FlashChat comes with several IRC-like commands. If there are some you do not want your users to have access to then you place those names only in this space. For each option you put in seperate each command with a comma. The / is not needed just the name. For example, suppose that you do not want to allow users to use the "back" or "backtime" commands... you would then set this option to:

'disabledIRC' => 'back,backtime'

'maxMessageSize' => 500,
This is the maximum amount of text, in characters or bytes, that can be posted at one time while chatting. Please note that spaces and carriage returns are also counted.

'maxMessageCount' => 1000,
This is the max messages that can be stored in your chat log (the "viewable" area of the chat). This can be larger or smaller. A value too large can cause FlashChat to slow down, especially if your clients are using slower systems. For optimal performance, therefore, it's a good idea to set this is a small value.

'userListAutoExpand' => false,
If you would like to make all the rooms open up automatically for each room a user or users are in then set this to true. By default it's set to false. In other words, if true, then all room lists will expand automatically upon login.

'showLogoutWindow' => true,
This is a small javascript window that opens up to clear your name from the database. If this is disabled you will not be able to login to the chat from 5 and up to 10 minutes depending on the server. If false, then FlashChat will attempt to logout the user by manipulating the Javascript Image.src attribute (the "src=logout.php method"), but do not use the popup method at all.

'logoutWindowDisplayTime' => 3,
This states the length of time the javascript window stays open.

'floodInterval' => 1,
This is for that person who feels it's nessesary to post many repeated messages to FlashChat at the same time. By default this is set to 1 second. If you want this to be a higher value then change that here. Setting this to a higher value will limit the frequency that your users can input messages.

'inactivityInterval' => 24*60*60,
If a user has FlashChat open for 'inactivityInterval' seconds, but they do not type anything, then the user will be automatically logged-out of the chat

Note 60*60 = one hour

This is the time when a user will be logged out of chat when pooling happens all the time but there are no messages sent to chat from this PC during the last number of seconds specified here:

Last note:

There are 60 seconds per minute
There are 60 minutes per hour
so 60*60 is one hour
so 2*60*60 is two hours
so 30*60 is 30 minutes

(all measurements are in seconds)

Also check this resource contributed by Veronica:

http://www.tufat.com/phpBB2/about2806.html

'defaultRoom' => 1,
Each room is given a number by value (the "primary key" id of the room). If you want your chat to open up in a different room other then the default then this value can be changed here to your room number. You can get these values in the admin section of your chat (the "rooms" admin tool). You can also get these values from the _rooms table 'id' field in MySQL.

'autoremoveAfter' => 300,
When users create new room these are active rooms until the last person leaves this room. This room will then auto-destroy after this time has elapsed (300 = 5 minutes).

'roomTitleFormat' => 'ROOM_LABEL - USER_COUNT'
This shows the room name and the count of users per room in the user list pane. You may make minor edits to this, for example if you want to show the user count in parenthesis you can use:

'roomTitleFormat' => 'ROOM_LABEL (USER_COUNT)'

Or, you can remove the user count completely:

'roomTitleFormat' => 'ROOM_LABEL'

'maxUsersPerRoom' => 50,
This is the maximum number of users per room. You can change this value if you like. It can be more or less. If the maximum user count has been reached, users will be rejected when attempted to enter a room. If all rooms are at maximum capacity, then no additional users will be allowed to enter the chat until some users have left.

'listOrder' => 'MOD_THEN_AZ',
This sets the order of how you see users and moderators on your user list. There are four options to this as follows:

AZ = alphabetical order, A to Z
ENTRY = by order of entry only
MOD_THEN_AZ = same as AZ, but moderators at top
MOD_THEN_ENTRY = same as ENTRY, but moderators are always at the top
STATUS = sorted by the user's online status
MOD_STATUS = same as STATUS, bt moderators are always at the top

NOTE: It is very important that you change the next two values to something you would want to use for the admin password and the spy password. Remember others have this chat too, so you don't want to give them admin access to your system!

'adminPassword' => 'adminpass',
This is for stand alone only. You should change your admin/moderator password here. This is the same password you will use to login to the chat as a moderator, as well as edit FlashChat's database configuration via the admin panel (located in the /admin folder). This gives you the admin/moderator status, when FlashChat is used in the "stateless" (aka "free for all") mode. Remember moderators and admins are the same thing (at least up to FlashChat 4.0)

'spyPassword' => 'spypass',
This is another value used for stand-alone chats. If you wish to look in on your users of your chat but don't want to be noticed you can use this option. This password should also be changed after installation - otherwise, anyone will be able to become spies! There are other options you can change for spies in the inc/layouts/spy.php file. This will be covered in another tutorial on layouts.

'layouts' => array(),
As this says in the comments, do not change this. You will have a dead chat.

'sound' => array
This is pretty self explanitory. If you don't want certain sounds you change it's value to true (thus, muting the sound), or false to allow them to play. These will also show up unchecked in your options pane in the chat options section for sounds.

'defaultTheme' => 'macintosh',
This is where you will setup the default theme you want to show when the chat starts up. The name is based on the names of the php file in the inc/themes folder. Type these exactly like they are in the themes folder or they will not work. Case sensitivity is very important to Unix and Linux filesystems. If you've created your own theme, but it's not working, look at the bottom of the theme creation guide for possible reasons.

'defaultSkin' => 'aqua_skin',
This is for the button styles of your chat. You can change the skin option to what you would like of the options in the inc/skins folder. Again type these names exactly for them to work.

'itemToChange' => array
This covers three things in your chat. The font size, font type and font color. The first option is a true or false. If set to false you don't have the option to make all text the same color for you to view. This was added because with some themes the text was other to light or to dark to read so this was an option to make it readable to any theme you used then. Now the other true values set by default if you turn those to false you can not change any of the text to the room. If you want to change the size of the font or the font type by default change the 13 to a number that works for you and the font type that the chat supplies. You can change the font to some other type but it's only going to work for those who have this font installed on there system. These options are the most common fonts found on most systems.

'fontSize' => array
Now if you want to add another size to this then this is the place to do it. Real large font though could slow down your system with large posts and flooders. I would leave these setting alone but this is your option.

'fontFamily' => array
These are the font types FlashChat uses. You can add to this list if you like. Just remember if they don't have the font installed on there computer then it's not going to do any good to anyone but you. You will see it but your users won't.

'preloader' => array
This is the screen you see with the bars on it telling you that your chat is loading. You can change what it says if you want on the right side of the => in between the ' ' quotes.
Not any gain in this but some change it to say funny things.

'fontFamily' => 'Verdana', / / This is the preloader font type.

'fontSize' => '11', / / This is the font size for the preloader
'fontColor' => 0x000000, / / Font color for preloader
'BGColor' => 0xFFFFFF, / / Background color for the page
'barColor' => 0x000000, / / The bar color showing the chat loading

Leave the "0x" part alone, and just change the values after for your color. As you see all colors start with this prefix of 0x. This is how flash is setup to read colors. The remaining values are XXYYZZ = RRGGBB (Red, Green, Blue). There are a lot of color pickers online which you can use to determine appropriate color values.

'smiles' => array
You can change the codes for the FlashChat smilies here; for example, if you're used to certain smilie syntax with other chats, then you can change the values here. This does not allow you to add smilies, however. Adding new smilies requires editing smilies.fla using the FlashMX 2004 authoring environment.

'msgRequestInterval' => 3,
This is the time interval, in seconds, between pings to the database. Setting this value to a lower value will make the chat faster, but will use more bandwidth and produce an increased load on your server (more "hits" per minute). Setting this to a higher number will make the chat post slower, but will reduce the server load. For most users, a value of 3-5 is probably the best.

'msgRequestIntervalAway' => 15,
When you set your status to Away, this option allows the msgRequestInterval to drop automatically to 15 seconds, which can reduce your server load and reduce bandwidth usage.

NOTE: It should not be bigger than a half of autologoutAfter otherwice your users can be disconnected in away mode.

'msgRemoveAfter' => 3600,
Messages will be removed from the database at a set time in seconds here.

'autologoutAfter' => 60,
This is the time set for users that are inactive. After this set time they are automaticly logged off your chat.

'autocloseAfter' => 3600,
This is the time set for when you can log back into the chat. Normally the javascript popup window will clear the database faster but this is if you have this disabled and using the logout.php.

'helpUrl' => 'http://tufat.com/wiki/',
This is the ? you see in your chat. This can be linked to the wiki which will have all the info you need about setting up and altering this chat to your needs. You also have the option to change this to the help.php file in your chat folder (that, by the way, was the old help file, which was being used for FlashChat 3.8), or to another URL of your choice.

'autounbanAfter' => 36000,
You have three options of banning someone on your chat and they are as follows: Ban from room, Ban from chat and Ban by IP. The duration of these bans is determined by this value (in seconds). This value can be changed to a higher or lower value if you wish.

'defaultLanguage' => 'en',
By default FlashChat is setup with the English language. If you want to change this so your language is at the top of the list in this array then you need to get the two letter name of your language file in the /inc/langs folder. Select the two letters from your php file and that is the value that goes there. To disable all languages except for yours, continue down for an explaination on how to do this.

'base' => ,
Don't change this.

'sound_options' => array
You can add your own MP3 sounds here if you like. Please note that your MP3 files should be 64kbps.

'filesharing' => array
Here you have two false statements by default. This is for sharing files with other users on your chat. The first option, if set to true, will allow you and your users to share files in a room. If you set the second option to true, you and your users can share files with the whole chat. This is not a p2p type system. This just allows you to upload a file to the uploaddir folder, and then when it is uploaded a window pops up for the user or users to download the image or file. Once the user has accepted the download a confirmation is sent back to the user who uploaded the file.

You can specify only certain allowed file types, for example files with extensions zip, rar, jpg, gif, sit, pdf. NOTE: I recommend you restrict file types for security reasons. People could upload viruses to your system to share with your users if the file types are not restricted. For added security, you may wish to add an index.htm or html file in this folder to stop unauthorized users from browsing this folder, in case the uploaded files are private.

'maxFileSize' => 0.5*1024*1024,
This determines the size of the file that can be uploaded to the folder. As example: max file size in bytes (2*1024*1024 equals 2 Mb). This can vary up to 8MB, but is dependent on your server. In Apache, for example, the maximum size of a POST request is set to 8MB by default, but can be adjusted in http.conf.

'maxFileHoursLife' => 0.5,
This is the time in hours before the files in the uploaddir folder are deleted. The default setting is for 30 minutes.

'logout' => array
This is an option for when you close your chat window. Possible options are listed below.

'close' => false,
If true, then FlashChat window is closed upon logout using Javascript's close() method.

'redirect' => false,
Please note that for URL redirection to work, RedirectURL must be a valid URL, and the redirect flag must be set to true.

'url' => 'http://www.tufat.com',
'redirect' must be set to true for this to work. This the URL that users will be redirected to upon logout.

'window' => '_blank',
The window to open into. possible values: _blank, _self, _parent, or a named window. For example, you might wish to open an online survey for your users after they exit FlashChat.

'module' => array
This allows you to embed a SWF or JPG file at specific locations in the FlashChat interface. Please refer to the "Module API" PDF which comes with FlashChat for more information.

'achor' => 0,
The anchor points for modules are integers like 0, 1, 2, 3, 4, etc. (0=centered,1-4=corners of space below roomlist). Please see the "Module API" PDF which comes with FlashChat for a screenshot of all possible anchor points.

'path' => ,
To see how this works, use 'banner.swf', or leave empty to disable. This is the path to your module.

'stretch' => false,
If true, anchored SWF is stretched horizontally & vertically to fill all available area.

Include_once lines: All layouts, themes and skins include_once files should not be edited. These values are needed for your chat to run correctly so leave these areas alone. The only time you will change anythings in these catagories will be to add your new created theme and this is covered in the directions for theme creation.

Languages: Now the last thing on the config.php file are the languages. Now these you other want to use them or you don't want to use them. If you don't want all of the languages to load but just your language then comment out all of the languages you don't want to show up in your dropdown options. A comment for this purpose looks like this two forward-slashe. If for example you only wanted the english file you could then use the / / in front of all the other language files as example of a language commented out would be: / / include_once(INC_DIR . 'langs/gm.php'); . This language file will not load the next time you start up your chat. Just for fun if you want the last two language files are Klingon and Pig Latin.

This is the end of the config.php tutorial. I hope it answers all your questions on how this file works. This will be one of a few that we'll go over files like this that have options for you to change in FlashChat.