Parameters

This page is for 1.x phpfreechat versions. For 2.x versions, check this page

Changing the Parameters

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];

After making a change to a parameter, the system may not reflect the new value. This is due to the PFC caching system. In order to tell PFC to correctly update to the new parameter values, you may need to rehash. The basic form of rehashing is to assure you have admin rights, and use the command ”/rehash” in the chat. More information can be found on the Rehash Your Chatroom page.

Global parameters list

  • serverid

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

  • language

    Used to translate the chat text and messages. Accepted values are the i18n/ sub directories names. (By default, this is the local server language.)

  • output_encoding

    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)

  • nick

    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.)

  • max_nick_len

    This is the maximum nickname length, a longer nickname is forbidden. (Default value: 15)

  • frozen_nick

    Setting this to true will forbid the user to change his/her nickname later. (Default value: false)

  • nickmeta

    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)

  • nickmeta_private

    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)

  • nickmeta_key_to_hide

    Can be used to hide keys in the final displayed whoisbox. (Default value: array() - means that nothing is hidden)

  • isadmin

    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)

  • admins

    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.)

  • firstisadmin

    When this parameter is true, it gives admin rights to the first connected user on the server. (Default value: false)

  • title

    Used to change the chat title that is visible just above the messages list. (Default value: "My Chat")

  • channels

    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")

  • frozen_channels

    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)

  • max_channels

    The maximum number of allowed channels for each user. (Default value: 10)

  • privmsg

    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)

  • max_privmsg

    This is the maximum number of private message allowed at the same time for one user. (Default value: 5)

  • refresh_delay

    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)

  • refresh_delay_steps

    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 ...)

  • timeout

    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)

  • islocked
    When this parameter is true, all the chatters will be redirected to the url indicated by the lockurl parameter. (Default value: false)

  • lockurl
    This url is used when islocked parameter is true. The users will be redirected (http redirect) to this url. (Default value: http://www.phpfreechat.net)
  • skip_proxies

    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)

  • post_proxies

    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)

  • pre_proxies

    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)

  • proxies_cfg

    Contains the proxies configuration. TODO: explain the possible values for each proxies.

  • proxies_path

    A custom proxies path. Used to easily plugin your own proxy to the chat without modifying the code. (Default value: empty path)

  • proxies_path_default

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

  • cmd_path

    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)

  • cmd_path_default

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

  • max_text_len

    This is the maximum message length in characters. A longer message is forbidden. (Default value: 400)

  • max_msg

    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

  • max_displayed_lines

    The maximum number of lines displayed in the window. Old lines will be deleted to save browser's memory on clients. Default value: 150)

  • quit_on_closedwindow

    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)

  • focus_on_connect

    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)

  • connect_at_startup

    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)

  • start_minimized

    Setting it to true will start the chat minimized. (Default value: false)

  • height

    Height of the chat area. (Default value: "440px")

  • shownotice

    • Setting this to 0 will show nothing.
    • Setting it to 1 will show nicknames changes.
    • Setting it to 2 will show connect/disconnect notifications.
    • Setting it to 4 will show kick/ban notifications.
    • Setting it to 7 (1+2+4) will show all the notifications.
    (Default value: 7)

  • nickmarker

    Setting it to false will disable nickname colorization. (Default value: true)

  • clock

    Setting it to false will hide the date/hour column. (Default value: true)

  • startwithsound

    Setting it to false will start the chat without sound notifications. (Default value: true)

  • openlinknewwindow

    Setting it to true will open all links in a new window. (Default value: true)

  • notify_window

    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)

  • short_url

    Setting it to true will shorten long URLs entered by users in the chat area. (Default value: true)

  • short_url_width

    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)

  • display_ping

    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)

  • display_pfc_logo

    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)

  • displaytabimage

    Used to show/hide the images in the channels and pv tabs. (Default value: true)

  • displaytabclosebutton

    Used to show/hide the close button in the channels tabs. (Default value: true)

  • showwhosonline

    Used to show/hide online users list at startup. (Default value: true)

  • showsmileys

    Used to show/hide the smiley selector at startup. (Default value: true)

  • btn_sh_whosonline

    Used to show/hide the showwhosonline button. (Default value: true)

  • btn_sh_smileys

    Used to show/hide the showsmileys button. (Default value: true)

  • bbcode_colorlist

    This is the list of colors that will appears into the bbcode palette. (Default value: contains an array of basic colors: '#FFFFFF', '#000000', ...)

  • nickname_colorlist

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

  • theme

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

  • theme_path

    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)

  • theme_url

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

  • theme_default_path

    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)

  • theme_default_url

    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)

  • container_type

    Used to specify the chat container (chat database). Accepted containers are : File and Mysql (maybe others in the future). (Default value: 'File')

  • server_script_path

    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)

  • server_script_url

    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)

  • client_script_path

    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)

  • data_private_path

    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_public_path
    This path must be reachable by your web server. Javascript and every resources (theme) files will be stored here. (Default value: '' - means dirname(__FILE__)."/../data/public" is used automatically)
  • data_public_url
    This URL should link to the 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)
  • prototypejs_url

    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)

  • debug

    When debug is true, some traces will be shown on the chat clients (Default value: false)

  • time_offset

    Can be used to setup the chat time zone. It is the difference in seconds between chat clock and server clock. (Default value: 0)

  • date_format

    How to display the dates in the chat. (Default value: 'd/m/Y')

  • time_format

    How to display the time in the chat (Default value: 'H:i:s')

  • get_ip_from_xforwardedfor

    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)

  • dyn_params

    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())

  • proxies
    Contains proxies to execute on each commands. Filled in the init step, this parameter cannot be overridden.

Containers parameters list

File container

This is the default container.

  • container_cfg_server_dir : where the private files will be stored (should not be changed)

Mysql container

  • 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 3306
  • container_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 ””

Proxies parameters list

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.

Fork me on GitHub