Making changes to parameters is easy, and allows you to customize how your chat works. To change them, first open index.php in the root of your Php Free Chat folder. Look for several lines that start with $params; this is your parameters list. The parameters list is set into the $params array and passed into the class. To add a new parameter, simply follow the same syntax as the others:
$params['parameter_name'] = [parameter value, either as a string or array depending on the parameter];
This is the only mandatory parameter used to identify the chat server. You can compare it to the server ip/host like on an IRC server. If you don't know what to write, just try : $params["serverid"] = md5(__FILE__);
Used to translate the chat text and messages. Accepted values are the i18n/
sub directories names. (By default, this is the local server language.)
Set a sepcific encoding for chat labels. This is really useful when the Web page embedding the chat is not UTF-8 encoded. This parameter should be the same as the chat web page. Could be ISO-8859-1 or anything else but it must be supported by iconv php module. (Default value: UTF-8)
If you have already identified the user (forum, portal...) you can force the user's nickname with this parameter. Defining a nick will skip the "Please enter your nickname" popup.
Warning : Nicknames must be encoded in UTF-8. For example, if you get nicks from a databases where they are ISO-8859-1 encoded, you must convert it: $params["nick"] = iconv("ISO-8859-1", "UTF-8", $bdd_nickname);
(Of course, change the $bdd_nickname
parameter for your needs.)
(Default value: "" - means users must choose a nickname when s/he connects.)
This is the maximum nickname length, a longer nickname is forbidden. (Default value: 15)
Setting this to true will forbid the user to change his/her nickname later. (Default value: false)
Contains some extra data (metadata) about the user that can be used to customize the display. For example: the user's gender, age, real name, etc. can be setup in order to display it in the user's info box. A example for gender is : $params["nickmeta"] = array('gender'=>'f');
(Default value: empty array)
Can be used to set user metadata that is only visible to admins. (Default value: array('ip')
- means that the user's IP address is shown to admins only)
Can be used to hide keys in the final displayed whoisbox. (Default value: array()
- means that nothing is hidden)
Set this parameter to true if you want to give admin rights to the connected user. Attention : if you don't use any external registration system, all your users will be admins. You have to test current user rights before setting this parameter to true. (Default value: false)
This parameter contains a list of key/value that identify admin access. The keys are the nicknames and the values are the corresponding passwords. Note: The "isadmin" parameter does not depend on this variable. (Default value: nick 'admin' with no password is available. Don't forget to change it.)
When this parameter is true, it gives admin rights to the first connected user on the server. (Default value: false)
Used to change the chat title that is visible just above the messages list. (Default value: "My Chat")
Used to create default rooms (auto-joined at startup). It contains an array of rooms names. (Default value: one room is created named "My room")
This parameter can be used to restrict channels to users. If the array is empty, it allows users to create their own channels. (Default value: empty array)
The maximum number of allowed channels for each user. (Default value: 10)
This array contains the nicknames list you want to initiate a private message at chat loading. Of course, the listed nicknames should be online or it will just be ignored. (Default value: empty array)
This is the maximum number of private message allowed at the same time for one user. (Default value: 5)
This is the time to wait between two refreshes. A refresh is an HTTP request which asks the server if there are new messages to display. If there are no new messages, then an empty HTTP response is returned. This parameter will be dynamically changed depending on the chat activity, see refresh_delay_steps parameter for more information. (Default value: 2000 it means 2000 ms or 2 seconds)
This parameter is used to control the refresh_delay value dynamically. More the chat is active, more the refresh_delay is low, that means more the chat is responsive. The first parameter is a refresh delay value, the second is a time inactivity boundary etc ... (Default value: array(2000,20000,3000,60000 ... that means: start with 2s delay after 20s of inactivity, 3s delay after 60s of inactivity ...)
This is the time of inactivity to wait before considering a user is disconnected (in milliseconds). A user is inactive only if s/he closed his/her chat window. A user with an open chat window is not inactive because s/he sends each refresh_delay
an HTTP request. (Default value: 35000 it means 35000 ms or 35 seconds)
lockurl
parameter. (Default value: false)islocked
parameter is true. The users will be redirected (http redirect) to this url. (Default value: http://www.phpfreechat.net)Contains the list of proxies to ingore. For example: append 'censor' to the list to disable words censoring. The list of system proxies can be found in src/proxies/. Attention: 'checktimeout' and 'checknickchange' proxies should not be disabled or the chat will not work anymore. (Default value: empty array - no proxies will be skipped)
This array contains the proxies that will be handled just before to process a command and just after the system proxies. You can use this array to execute your own proxy. (Default value: empty array)
This array ocntains the proxies that will be handled just before system proxies. You can use this array to execute your own proxy. (Default value: empty array)
Contains the proxies configuration. TODO: explain the possible values for each proxies.
A custom proxies path. Used to easily plugin your own proxy to the chat without modifying the code. (Default value: empty path)
Contains the default proxies location. Do not change this parameter if you don't know what you are doing. If you try to add your own proxy, check the proxies_path
parameter. (Default value: dirname(__FILE__).'/proxies'
)
This parameter indicates your own commands directory location. The chat uses commands to communicate between client and server. As an example, when a message is sent, the /send your message
command is used, when a nickname is changed, the /nick newnickname
command is used. To create a new command, you have to write it and indicate in this parameter where it is located. (Default value: empty string - means no custom command path is used)
Contains the default command path used by the system. Do not change this parameter if you don't know what you are doing. If you try to add your own command, check the cmd_path
parameter. (Default value: dirname(__FILE__).'/commands'
)
This is the maximum message length in characters. A longer message is forbidden. (Default value: 400)
This is the number of messages kept in the history. This is what you see when you reload the chat. The number of messages s/he can see is defined by this parameter. (Default value: 20
The maximum number of lines displayed in the window. Old lines will be deleted to save browser's memory on clients. Default value: 150)
Setting this to true will send a /quit
command when the user closes his/her window. (NOTE: Doesn't work on Firefox). This parameter isn't true by default because on IE and Konqueror/Safari, reloading the window (F5) will generate the same event as closing the window which can be annoying. (Default value: false)
Setting this to true will give the focus to the input text box when connecting to the chat. It can be useful not to touch the focus when integrating the chat into an existing website because when the focus is changed, the viewport follows the focus location. (Default value: true)
Setting this to false will oblige user to click on the connect button if s/he wants to chat. (Default value: true - a connection to the chat is automaticaly performed)
Setting it to true will start the chat minimized. (Default value: false)
Height of the chat area. (Default value: "440px")
Setting it to false will disable nickname colorization. (Default value: true)
Setting it to false will hide the date/hour column. (Default value: true)
Setting it to false will start the chat without sound notifications. (Default value: true)
Setting it to true will open all links in a new window. (Default value: true)
Setting it to false will disable the window title notification. When a message is received and this parameter is true, the window title is modified with [n]
(n is the number of new posted messages). (Default value: true)
Setting it to true will shorten long URLs entered by users in the chat area. (Default value: true)
Final width of the shortened URL in characters. (This includes the elipsis on shortened URLs.) This parameter is taken into account only when short_url
is true. (Default value: 40)
Used to show/hide the ping information near the phpfreechat linkback logo. The ping is the time between a client request and a server response. More the ping is low, faster the chat is responding. (Default value: true)
Used to hide the phpfreechat linkback logo. Be sure that you are conform to the license page before setting this to false! (Default value: true)
Used to show/hide the images in the channels and pv tabs. (Default value: true)
Used to show/hide the close button in the channels tabs. (Default value: true)
Used to show/hide online users list at startup. (Default value: true)
Used to show/hide the smiley selector at startup. (Default value: true)
Used to show/hide the showwhosonline button. (Default value: true)
Used to show/hide the showsmileys button. (Default value: true)
This is the list of colors that will appears into the bbcode palette. (Default value: contains an array of basic colors: '#FFFFFF', '#000000', ...)
This is the list of colors that will be used to automaticaly and randomly colorize the nicknames in the chat. (Default value: contains an array of basic colors: '#CCCCCC','#000000')
This parameter specifies which theme the chat will use. A theme is a package that makes it possible to completly change the chat appearance (CSS) and the chat dynamics (JS) You can find official themes in the themes/
directory on your local phpfreechat distribution. (Default value: 'default')
Indicates where the themes are located. Use this parameter if you want to store your own theme in a special location. (by default the same as theme_default_path
)
This url indicates the theme_path
location. It will be used by the browser to load theme resources : images, css, js. If this parameter is not indicated, the themes will be copied to data_public_path/themes
and this parameter value will be set to data_public_url/theme
. (Default value: '')
Indicate where the official pfc default theme is located. Do not change this parameter if you don't know what you are doing. If you try to add your own theme, check the theme_path
parameter. (Default value: '' - empty string means dirname(__FILE__).'/../themes'
is used automatically)
This url indicates the theme_default_path
location. Do not change this parameter if you don't know what you are doing. If you try to add your own theme, check the theme_path
parameter. (Default value: the theme is copied into data_public_path/themes
and this parameter will be set to data_public_url/theme
)
Used to specify the chat container (chat database). Accepted containers are : File and Mysql (maybe others in the future). (Default value: 'File')
Used to specify the script that will handle asynchronous requests. Very useful when the chat (client) script is resource consuming (ex: forum or portal chat integration). (Default value: '' - means this parameter is automatically calculated)
This url indicates the server_script_path
. It will be used to do AJAX requests from the browser. Therefore, this URL should be a browsable public url. This parameter is useful when using URL rewriting because basic auto-calculation will fail. (Default value: '' - means this parameter is automatically calculated)
Used to specify the script path which first displays the chat. This path will be used to calculate relatives paths for resources: javascript lib and images. Useful when the php configuration is uncommon. This option can be used to force the automatic detection process. (Default value: '' - means this parameter is automatically calculated)
Used to store private data like cache, logs and chat history. Tip: you can optimize your chat performances, see this FAQ entry. (Default value: '' - means dirname(__FILE__)."/../data/private"
is used automatically)
data_private_path
directory so that the clients' browsers will be able to load needed javascript files and theme resources. It can be useful when url rewriting is done on the server. (Default value: '' - means this parameter is automatically calculated from data_private_path
)This is the prototype javascript library URL. Use this parameter to use your external library. (Default value: '' - means data/js/prototype.js
is used automatically)
When debug is true, some traces will be shown on the chat clients (Default value: false)
Can be used to setup the chat time zone. It is the difference in seconds between chat clock and server clock. (Default value: 0)
How to display the dates in the chat. (Default value: 'd/m/Y'
)
How to display the time in the chat (Default value: 'H:i:s'
)
This parameter is useful when your chat server is behind a reverse proxy that forwards client ip address in HTTP_X_FORWARDED_FOR http header. Some discutions about this parameter are available on the forum. (Default value: false)
Most of the chat parameters are stored in a internal cache for performances issues. It means that for all the clients the chat will have the same parameters. However sometime you need to customize some parameters for each clients. For example: the 'language' parameter could depends on the chatter profil so it could interesting to ignore the cache for this parameter. The 'dyn_params' contains the parameters that need to be dynamic (not stored in the cache). (Default value: array())
This is the default container.
container_cfg_server_dir
: where the private files will be stored (should not be changed)container_cfg_mysql_host
: the host of your Database. Default value is “localhost”container_cfg_mysql_port
: the port of your database. default value is 3306container_cfg_mysql_database
: your database's name. Default value is “phpfreechat”container_cfg_mysql_table
: the table within your database. Default value is “phpfreechat”container_cfg_mysql_username
: username to connect to your Database. Default value is “root”container_cfg_mysql_password
: password to identify the username that connects to the database. Default value is ””Phpfreechat supports command proxies. These proxies can be compared to plugins. Some proxies are provided with the phpfreechat source code and can be configured. Please have a look to the proxies documentation to know the available parameters.