I have phpfreechat built in to my drupal site thanks to permutations modifications of the original phpfreechat module. I too wanted to add an away command but could not see a version yet released by permutations. My php skills are very very basic but I am muddling through and learning as I go.
First of all my who's chatting block will not work no matter what I try. I have built the chat rooms so each of about 7 nodes has it's own separate chat room named after the node. When a user is in any of these chat rooms the who's chatting block does not indicate this.
Secondly, I have followed cls's steps for adding an away command and everything worked great but I am having one issue. When I use the away command it works the first time but then no longer works. I click 'set away status on' and it says away next to the nick, I click 'set away status off' and the away disappears and it announces I am back. However, after the first time using this when I click 'set away status on' it says 'nick is back' and nothing else changes, no away status and the text button does not change.
My chat room can be accessed at http://www.pharmacyintern.ca/chat/4
You can login with the user name phpfreechat and password is password.
On the chat rooms access page you can see links to the different chat rooms and a who's chatting block...which is empty no matter what.
The code I am using is as follows........
phpfreechat module
- Code: Select all
<?php
// $Id: phpfreechat.module,v 1.5.2.19 2007/12/07 19:35:55 owahab Exp $
/* Contains bug fixes by permutations. See readme.txt */
/**
* @file
* Enables the creation of phpFreeChat channels on any page on the site.
*/
require_once('phpfreechat.inc');
/**
* Implementation of hook_help().
*/
function phpfreechat_help($section) {
return _phpfreechat_help($section);
}
/**
* Implementation of hook_menu().
*/
function phpfreechat_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'phpfreechat/nuke',
'title' => t('Clear chats!'),
'callback' => 'phpfreechat_nuke',
'callback arguments' => array(arg(2)),
'access' => user_access('admin phpfreechat'),
'type' => MENU_CALLBACK);
$items[] = array(
'path' => 'admin/settings/phpfreechat',
'title' => t('phpFreeChat'),
'description' => t('Settings to configure phpFreeChat.'),
'callback' => 'drupal_get_form',
'callback arguments' => array('phpfreechat_settings'),
'access' => user_access('admin phpfreechat'),
'type' => MENU_NORMAL_ITEM);
}
return $items;
}
/**
* Delete logs of a chat room.
* @params $rid
* Room Id
*/
function phpfreechat_nuke($rid) {
_phpfreechat_nuke($rid);
}
/**
* Implementation of hook_perm().
*/
function phpfreechat_perm() {
return array('talk on chat channels', 'create nodes with chatrooms', 'moderate chat channels');
}
function phpfreechat_nodedata($type) {
if (variable_get('phpfreechat_nodeapi_'.$type, 'never') == 'pernode' ||
variable_get('phpfreechat_nodeapi_custom_'.$type, '') == true) {
return true;
}
else
return false;
}
/**
* Implementation of hook_form_alter() - alterations before a form is rendered.
*/
function phpfreechat_form_alter($form_id, &$form) {
global $user;
$type = (isset($form['type']) && isset($form['type']['#value'])) ? $form['type']['#value'] : NULL;
$node = isset($form['#node']) ? $form['#node'] : NULL;
if ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
// Content-type edit form
$form['workflow']['phpfreechat_nodeapi'] = array(
'#type' => 'radios',
'#title' => t('Show chat room'),
'#default_value' => variable_get('phpfreechat_nodeapi_'.$form['#node_type']->type, 'never'),
'#options' => array('never' => t('Never'), 'always' => t('Always'), 'pernode' => t('Per Node')),
'#description' => t('None: Nodes of this content type can never have a chat room.<br />' .
'Always: Nodes of this content type will always have a chat room.<br />' .
'Per Node: Nodes of this content type can choose to have a chat room if desired.'),
);
$form['workflow']['phpfreechat_nodeapi_custom'] = array(
'#type' => 'checkbox',
'#title' => t('Allow node to set title & channels'),
'#return_value' => 1,
'#default_value' => variable_get('phpfreechat_nodeapi_custom_'.$form['#node_type']->type, ''),
'#description' => t('If this is checked then node editors will be able to set the chat ' .
'title and select what channels to join.'),
);
$form['workflow']['phpfreechat_nodeapi_title'] = array(
'#type' => 'textfield',
'#title' => t('Default Chat Channel Title'),
'#default_value' => variable_get('phpfreechat_nodeapi_title_'.$form['#node_type']->type, ''),
'#size' => 70,
'#maxlength' => 128,
'#description' => t('This is the default channel title for this content type. ' .
'Leaving this blank will use the global or node chat ' .
'title, or the node title if these are also blank.'),
);
$form['workflow']['phpfreechat_nodeapi_channels'] = array(
'#type' => 'textfield',
'#title' => t('Default Chat Channels'),
'#default_value' => variable_get('phpfreechat_nodeapi_channels_'.$form['#node_type']->type, ''),
'#size' => 70,
'#maxlength' => 128,
'#description' => t('Enter the default channel or channels to be joined for this content type. ' .
'Separate multiple channels by commas (e.g. <em>Channel1, Channel2</em>). Leaving this ' .
'blank will use the global or node channel(s), or the node title if these are also blank.'),
);
}
elseif (isset($form['type'])) {
// Node edit form
if (phpfreechat_nodedata($type) && user_access('create nodes with chatrooms')) {
$form['phpfreechat'] = array(
'#type' => 'fieldset',
'#title' => t('phpFreeChat Settings'),
);
if (variable_get('phpfreechat_nodeapi_'.$form['type']['#value'], 'never') == 'pernode') {
$form['phpfreechat']['phpfreechat_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Show Chat Room'),
'#return_value' => 1,
'#default_value' => ($node->phpfreechat_enabled == 1 ? true : false),
'#description' => 'If this is selected a chat room will be displayed below the content',
);
}
if (variable_get('phpfreechat_nodeapi_custom_'.$form['type']['#value'], '') == true) {
$form['phpfreechat']['phpfreechat_title'] = array(
'#type' => 'textfield',
'#title' => t('Chat Channel Title'),
'#default_value' => $node->phpfreechat_title,
'#size' => 70,
'#maxlength' => 128,
'#description' => t('This is the chat title. You can leave this blank to use the default.'),
);
$form['phpfreechat']['phpfreechat_channels'] = array(
'#type' => 'textfield',
'#title' => t('Chat Channel'),
'#default_value' => $node->phpfreechat_channels,
'#size' => 70,
'#maxlength' => 128,
'#description' => t('Enter the channel or channels to be joined for this chat. ' .
'Separate multiple channels by commas (e.g. <em>Channel1, Channel2</em>). ' .
'You can leave this blank to use the default.'),
);
}
}
}
}
/**
* Implementation of hook_nodeapi() - act on nodes defined by other modules (extending modules versus creating new ones).
*/
function phpfreechat_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
switch ($op) {
case 'view':
$content_chat = variable_get('phpfreechat_nodeapi_'. $node->type, 'never');
if (($content_chat == 'always' || ($content_chat == 'pernode' && $node->phpfreechat_enabled)) && $teaser === FALSE) {
$node->content['phpfreechat'] = array(
'#value' => phpfreechat_room($node),
'#weight' => 40,
);
}
break;
case 'update':
if (phpfreechat_nodedata($node->type)) {
// Clear the cache
_phpfreechat_clear_cache();
}
case 'insert':
// Need to delete/insert because we can't assume an existing entry for 'pernode' content type
if (phpfreechat_nodedata($node->type)) {
db_query('DELETE FROM {phpfreechat} WHERE nid = %d', $node->nid);
$rs = db_query('INSERT INTO {phpfreechat} (nid, phpfreechat_enabled, phpfreechat_title, phpfreechat_channels) VALUES (%d, %d, "%s", "%s")', $node->nid, $node->phpfreechat_enabled, $node->phpfreechat_title, $node->phpfreechat_channels);
}
break;
case 'delete':
// Always try and delete - the node could have data from before the content type was set to 'never'
db_query('DELETE FROM {phpfreechat} WHERE nid = %d', $node->nid);
break;
case 'load':
if (phpfreechat_nodedata($node->type)) {
return db_fetch_array(db_query('SELECT * FROM {phpfreechat} WHERE nid = %d', $node->nid));
}
break;
}
}
/**
* Implementation of hook_user()
*/
function phpfreechat_user($op, &$edit, &$user, $category = NULL) {
switch ($op) {
case 'logout':
case 'login':
// Remove the users cookie so their nick is not auto-set for anonymous user
setcookie('phpfreechat', '', time() - 3600);
break;
}
}
/**
* Implementation of hook_block().
*/
function phpfreechat_block($op = 'list', $delta = 0, $edit = array()) {
global $user, $base_url;
if ($op == 'list') {
$block[0]['info'] = t('Who is chatting');
$block[1]['info'] = t('Who is chatting on...');
$block[2]['info'] = t('Latest from...');
return $block;
}
else if ($op == 'configure' && $delta > 0) {
$form['phpfreechat_block'] = array(
'#type' => 'textfield',
'#title' => t('Channel Name'),
'#default_value' => variable_get('phpfreechat_block_channel_'.$delta, ''),
'#description' => t('Enter the channel name to use')
);
return $form;
}
else if ($op == 'save' && $delta > 0) {
variable_set('phpfreechat_block_channel_'.$delta, $edit['phpfreechat_block']);
}
else if ($op == 'view') {
if (user_access('access content')) {
if (!_phpfreechat_check_install()) {
$block['content'] = _phpfreechat_not_found();
return $block;
}
$params = phpfreechat_load_params();
// Get get all chat nodes (node id).
$query = db_query('SELECT * FROM {phpfreechat}');
$chat_nodes = array();
// Drop the nodes that don't have chats on them.
while ($room = db_fetch_object($query)) {
$node = node_load($room->nid);
// drupal_set_message("executing phpfreechat_block - node: <pre>".print_r($node, TRUE)."</pre>");
$params = phpfreechat_prepare_params($params, $node, $user);
$chat_content = variable_get('phpfreechat_nodeapi_'.$node->type, '');
if (($chat_content == 'always') || ($chat_content == 'pernode' && $room->phpfreechat_enabled)) {
$chat_nodes[] = $node->nid;
}
}
// Use only the first chat server in the blocks (quick and dirty solution).
$serverid_node = md5('node'.$chat_nodes[0]);
require_once ('phpfreechat/src/pfcinfo.class.php');
$info = new pfcInfo($serverid_node, $params['data_private_path']);
if ($delta == 0) {
$users = $info->getOnlineNick(NULL);
if ($users)
$block['content'] .= theme_item_list($users);
else
$block['content'] .= "* empty *";
$block['subject'] = t('Who is Chatting');
}
if ($delta == 1) {
$channel = variable_get('phpfreechat_block_channel_1', '');
$users = $info->getOnlineNick($channel);
if ($users)
$block['content'] .= theme_item_list($users);
else
$block['content'] .= "* empty *";
$block['subject'] = t('Who is chatting on ').$channel;
}
if ($delta == 2) {
$channel = variable_get('phpfreechat_block_channel_2', '');
$lastmsg_raw = $info->getLastMsg($channel, 10);
$output = '';
if ($lastmsg_raw)
{
foreach($lastmsg_raw["data"] as $m) {
$output .= $m["sender"].': ';
$output .= '<em>' . $m["param"].'</em><br />';
$date = $m["date"];
$time = $m["time"];
}
}
$output .= t('Last chat: ');
// Convert to US style date
$date = preg_replace("/^s*([0-9]{1,2})[/. -]+([0-9]{1,2})[/. -]+([0-9]{1,4})/", "\2/\1/\3", $date);
$output .= format_interval(time() - strtotime($date.' '.$time));
$output .= t(' ago');
$block['content'] .= $output;
$block['subject'] = t('latest from ').$channel;
}
return $block;
}
}
}
/**
* Implementation of hook_settings().
*/
function phpfreechat_settings() {
return system_settings_form(_phpfreechat_settings());
}
/**
* Returns an array of all (non-node & non-user specific) parameters
*/
function phpfreechat_load_params() {
global $base_url;
$params = array();
// Configure file paths
$params['data_private_path'] = file_check_location(PHPFREECHAT_PRIVATE_DIR);
$params['data_public_url'] = $base_url . '/'. PHPFREECHAT_PUBLIC_DIR;
$params['data_public_path'] = file_check_location(PHPFREECHAT_PUBLIC_DIR);
$params['theme_url'] = $base_url .'/'. drupal_get_path('module', 'phpfreechat') . '/extras/themes';
$params['theme_path'] = file_check_location(drupal_get_path('module', 'phpfreechat') . '/extras/themes');
$params['theme'] = 'drupal';
$params['server_script_url'] = $base_url .'/'. drupal_get_path('module', 'phpfreechat') .'/handler.php';
$params['server_script_path'] = file_check_location(drupal_get_path('module', 'phpfreechat') .'/handler.php');
// Public settings from phpFreeChat v1.1, pfcglobalconfig.class.php.
$settings = array(
'serverid',
'language',
'output_encoding',
'nick',
'max_nick_len',
'frozen_nick',
'nickmeta',
'nickmeta_private',
'nickmeta_key_to_hide',
'isadmin',
'admins',
'firstisadmin',
'title',
'channels',
'frozen_channels',
'max_channels',
'privmsg',
'max_privmsg',
'refresh_delay',
'refresh_delay_steps',
'timeout',
'islocked',
'lockurl',
'skip_proxies',
'post_proxies',
'pre_proxies',
'proxies_cfg',
'proxies_path',
'proxies_path_default',
'cmd_path',
'cmd_path_default',
'max_text_len',
'max_msg',
'max_displayed_lines',
'quit_on_closedwindow',
'focus_on_connect',
'connect_at_startup',
'start_minimized',
'height',
'shownotice',
'nickmarker',
'clock',
'startwithsound',
'openlinknewwindow',
'notify_window',
'short_url',
'short_url_width',
'display_ping',
'display_pfc_logo',
'displaytabimage',
'displaytabclosebutton',
'showwhosonline',
'showsmileys',
'btn_sh_whosonline',
'btn_sh_smileys',
'bbcode_colorlist',
'nickname_colorlist',
'theme',
'theme_path',
'theme_url',
'theme_default_path',
'theme_default_url',
'container_type',
'server_script_path',
'server_script_url',
'client_script_path',
'data_private_path',
'data_public_path',
'data_public_url',
'prototypejs_url',
'debug',
'time_offset',
'date_format',
'time_format',
'get_ip_from_xforwardedfor',
'dyn_params',
);
foreach ($settings as $setting) {
$value = variable_get('phpfreechat_'.$setting, '');
/*
if ($setting == 'timeout') {
if (empty($value) || $value < 35000) {
variable_set('phpfreechat_'.$setting, 35000);
$value = 35000;
}
}
*/
if (!empty($value)) {
if ($value == 'true') $params[$setting] = true;
else if ($value == 'false') $params[$setting] = false;
else $params[$setting] = $value;
}
}
return $params;
}
/**
* Tunes parameters according to specific node's details.
*
* @param $params
* Default parameters which might be overridden by the function
* @param $node
* The node which will carry the chat instance
* @param $target
* The user loading the chat
*
*/
function phpfreechat_prepare_params(&$params, &$node, &$target) {
global $user, $base_url;
// Setup nick
if (variable_get('phpfreechat_auto_nick', '') != 'false') {
if ($target->uid == 0) { // Assign autonumber for guests (not logged in)
$params['nick'] = t('Anonymous') . rand(1, 1000);
}
else { // Use Drupal name as nickname
$params['nick'] = $target->name;
}
}
else { // Ask for nickname
$params['nick'] = '';
}
// Set the serverid to the node ID
$params['serverid'] = md5('node'. $node->nid);
// This global setting will be overridden by any content-type or node settings below
$global_title = variable_get('phpfreechat_title', '');
$params['title'] = empty($global_title) ? $node->title : $global_title;
// This global setting will be overridden by any content-type or node settings below
$global_channels = variable_get('phpfreechat_channels', '');
if (!empty($global_channels)) {
$params['channels'] = explode(',', $global_channels);
}
else {
$params['channels'] = $node->title;
}
// Overrides from content type
$content_title = variable_get('phpfreechat_nodeapi_title_'.$node->type, '');
if (!empty($content_title)) {
$params['title'] = $content_title;
}
$content_channels = variable_get('phpfreechat_nodeapi_channels_'.$node->type, '');
if (!empty($content_channels)) {
$params['channels'] = explode(',', $content_channels);
}
// Overrides from node (global and node parameters have the same name!!)
if (!empty($node->phpfreechat_title)) {
$params['title'] = $node->phpfreechat_title;
}
if (!empty($node->phpfreechat_channels)) {
$params['channels'] = explode(',', $node->phpfreechat_channels);
}
// Setup admins
if (user_access('moderate chat channels') || $node->uid == $target->uid) {
$params['isadmin'] = true;
}
foreach($params as $key => $value)
{
if (!is_array($value)) {
$integer_string = (preg_match("/[0-9]/", $value) && !preg_match("/[^0-9]/", $value)) ? true : false;
if ($integer_string) {
settype($value, "int");
}
}
}
// Add useful info to appear in user's menu only if the selected theme is the shipped one
if ($params['theme_path'] == file_check_location(drupal_get_path('module', 'phpfreechat') . '/extras/themes') && $params['theme'] == 'drupal') {
$params['nickmeta'] = array(
'profile' => '<a target="_blank" href="' . $base_url . '/user/' . $target->uid . '">Profile</a>',
);
}
return $params;
}
/**
* Format a chat room for a nodeapi insert
*
* @param node
* The node which needs a chat room inserted
*/
function phpfreechat_room($node) {
global $user, $base_url;
static $chat;
if (user_access('talk on chat channels')) {
if (_phpfreechat_check_install() && _phpfreechat_check_files()) {
// now build the room HTML content
$output = '<div class="phpfreechat phpfreechat-'.$node->type.'">';
// Load global params
$params = phpfreechat_load_params();
// Prepare params for current node
$params = phpfreechat_prepare_params($params, $node, $user);
// We need to put user ID in session to be able to retrieve it from handler
if (is_numeric($user->uid)) {
$_SESSION['drupal_user'] = $user;
}
// Start/resume chat session (loads handler.php, which contains [ new phpFreeChat($params); ])
require_once($params['server_script_path']);
if (variable_get('phpfreechat_params', '') == 'true') {
// Handy for debugging
$output .= '<pre>Parameters: ' . print_r($params, TRUE) . '</pre>';
// $output .= '<pre>Session: ' . print_r($_SESSION, TRUE) . '</pre>';
// $output .= '<pre>Cookies: ' . print_r($_COOKIE, TRUE) . '</pre>';
}
// This line outputs the actual chat
$output .= $chat->printChat(TRUE);
if (user_access('admin phpfreechat')) {
$output .= l('Clear chat log for '.$node->title, 'phpfreechat/nuke/'.strtolower(str_replace(' ', '', $node->title)));
}
$output .= '</div>';
}
else {
$output .= _phpfreechat_not_found();
}
}
else if ($user->uid == 0) {
$output .= t('Please !login to chat', array('!login' => l('login', 'user/login')));
}
return $output;
}
/**
* phpFreeChat APIs.
*
* @param $action
* The action to be taken, this might have one of these values:
* kick, notify, error and redirect
* @param $param
* Extra parameter for actions like kick to be shown to the user
* @param $target
* User to take actions on
* @param $nid
* An ID of a node to apply action on
*
*/
function phpfreechat_api($action, $param, $target, $nid = NULL) {
global $user;
//This function is never called.
// drupal_set_message("executing phpfreechat_api");
// get chat parameters
$params = phpfreechat_load_params();
// get few files from phpfreechat required to resume a chat session
require_once drupal_get_path('module', 'phpfreechat') .'/phpfreechat/src/pfcglobalconfig.class.php';
require_once drupal_get_path('module', 'phpfreechat') .'/phpfreechat/src/pfcuserconfig.class.php';
require_once drupal_get_path('module', 'phpfreechat') .'/phpfreechat/src/pfccommand.class.php';
if (!is_null($nid)) {
$query = db_query('SELECT nid FROM {phpfreechat} WHERE nid = %d', $nid);
}
else {
// Get all chat rooms:
$query = db_query('SELECT nid FROM {phpfreechat}');
}
while ($room = db_fetch_object($query)) {
$c = $ct = $u = null;
$node = node_load($room->nid);
$params = phpfreechat_prepare_params($params, $node, $target);
$c =& pfcGlobalConfig::Instance($params);
$ct =& pfcContainer::Instance();
$u =& pfcUserConfig::Instance();
// since we might have more than one channel per room:
foreach ($u->channels as $channel) {
// kicking a user just add a command to play to the aimed user metadata.
$nick = $ct->getNickId($target->name);
switch ($action) {
case 'kick':
// first notify all rooms that user was kicked:
phpfreechat_api('notice', t('!target was kicked by !source, reason: !reason.', array('!target' => $target->name, '!source' => $user->name, '!reason' => $param)));
$cmdstr = 'leave';
$cmdp = array();
$cmdp['params'][] = 'ch';
$cmdp['params'][] = $channel['name']; // channel name
$cmdp['params'][] = $param; // reason
pfcCommand::AppendCmdToPlay($nick, $cmdstr, $cmdp);
break;
case 'notify':
$cmdstr = 'notice';
$cmdp = array();
// notice level: 1, 2, 3
$cmdp['flag'] = 1;
$cmdp['param'] = $param; // reason
pfcCommand::AppendCmdToPlay($nick, $cmdstr, $cmdp);
break;
case 'error':
$cmdstr = 'error';
$cmdp = array();
$cmdp['flag'] = 1;
$cmdp['param'] = $param;
pfcCommand::AppendCmdToPlay($nick, $cmdstr, $cmdp);
break;
case 'redirect':
$cmdstr = 'redirect';
$cmdp = array();
$cmdp['param'] = $param;
pfcCommand::AppendCmdToPlay($nick, $cmdstr, $cmdp);
break;
}
}
}
}
?>
phpfreechat.inc
[code]<?php
// $Id: phpfreechat.inc,v 1.4.2.14 2007/12/07 19:35:55 owahab Exp $
/* Contains bug fixes by permutations. See readme.txt */
/**
* Define data folders
*/
define('PHPFREECHAT_DATA_DIR', 'files/phpfreechat');
define('PHPFREECHAT_PUBLIC_DIR', 'files/phpfreechat/public');
define('PHPFREECHAT_PRIVATE_DIR', 'files/phpfreechat/private');
/**
* Private hook_help function, to reduce module overhead
*/
function _phpfreechat_help($section) {
switch ($section) {
case 'admin/help#phpfreechat':
return t('<p>This module allows you to create phpFreeChat chatboxes on any page of the site. You first must enable phpFreeChat for any content types you would like a chatbox on by going to: ' . l('/admin/content/types', 'admin/content/types') . '.</p>' .
'<p>phpFreeChat chatboxes use channels or "rooms". Chatboxes can contain multiple channels, and can connect to one or more channels on startup. By default, one new channel with the name of the page title is created for each chatbox. If you use the 'Default Channels' setting below, you can have each chatbox join the same channel, creating a site-wide chatroom. You also can override the channel at the content-type or node level, which allows you to create a content-type channel that multiple nodes can share.</p>');
case 'admin/settings/phpfreechat':
return t('<p>This module allows you to create phpFreeChat chatboxes on any page of the site. You first must enable phpFreeChat for any content types you would like a chatbox on by going to: ' . l('/admin/content/types', 'admin/content/types') . '.</p>' .
'<p>Please read the ' . l('phpFreeChat help page', 'admin/help/phpfreechat') . ' to learn how to configure phpFreeChat channels.</p>' .
'<p>Leaving a text setting blank will cause that setting to use the default value. Don't change a setting unless you know what you're doing. All the phpFreeChat 1.1 settings are listed. Some aren't appropriate in the Drupal environment and could crash the chat.</p>' .
'<p>Note that some settings may not take effect until you clear the phpFreeChat cache with the chatbox /rehash command.</p>');
}
}
/**
* Make sure that third party files exist.
*/
function _phpfreechat_check_install() {
$install_path = drupal_get_path('module', 'phpfreechat').'/phpfreechat';
if (file_exists($install_path .'/src/phpfreechat.class.php') &&
file_exists($install_path .'/src/pfcinfo.class.php')) {
return true;
}
return false;
}
/**
* Make sure data directories are created.
*/
function _phpfreechat_check_files() {
// Create data folders:
// PS: I had to pass first parameter as a variable since file_check_directory
// accepts only variables since it references the first parameter
return (
file_check_directory(file_directory_path(), FILE_CREATE_DIRECTORY, 'op')
&& file_check_directory($f = PHPFREECHAT_DATA_DIR, FILE_CREATE_DIRECTORY, 'op')
&& file_check_directory($f = PHPFREECHAT_PRIVATE_DIR, FILE_CREATE_DIRECTORY, 'op')
&& file_check_directory($f = PHPFREECHAT_PUBLIC_DIR, FILE_CREATE_DIRECTORY, 'op'));
}
/**
* Clears cached data from cookies
*/
function _phpfreechat_clear_cookies() {
setcookie('phpfreechat', '', time() - 3600);
setcookie('pfc_nickmarker', '', time() - 3600);
setcookie('pfc_clock', '', time() - 3600);
setcookie('pfc_minmax_status', '', time() - 3600);
setcookie('pfc_current_text_color', '', time() - 3600);
setcookie('pfc_showsmileys', '', time() - 3600);
setcookie('pfc_showwhosonline', '', time() - 3600);
}
/**
* Clears cached data from the configuration cache
*/
function _phpfreechat_clear_cache() {
$params = phpfreechat_load_params();
$params = phpfreechat_prepare_params($params, $node, $user);
require_once ('phpfreechat/src/pfcinfo.class.php');
$info = new pfcInfo($params['serverid'], $params['data_private_path']);
$result = $info->rehash();
/*
_phpfreechat_rm($params['data_private_path'] .'/chat');
// Deleting the public directory seems to cause a hang.
// _phpfreechat_rm($params['data_public_path']);
*/
drupal_set_message('phpFreeChat settings cache cleared.');
}
/**
* Delete logs of a chat room.
* @params $rid
* Room Id
*/
function _phpfreechat_nuke($rid) {
$params = phpfreechat_load_params();
$data = $params['data_private_path'] .'/chat/'. $rid .'/messages.data';
$index = $params['data_private_path'] .'/chat/'. $rid .'/messages.index';
file_delete($data);
file_create_path($data);
file_delete($index); // bug fix: typo (http://drupal.org/node/199592)
file_create_path($index);
drupal_set_message('Chat room contents cleared.');
drupal_goto('');
}
/**
* Private hook_settings function, to reduce module overhead
*/
function _phpfreechat_settings() {
if (!empty($_POST['op'])) {
_phpfreechat_clear_cache();
_phpfreechat_clear_cookies();
}
if (!_phpfreechat_check_install()) {
form_set_error('op', _phpfreechat_not_found());
}
if (!_phpfreechat_check_files()) {
form_set_error('op', t('Unable to create data folders for phpfreechat.'));
}
$params = phpfreechat_load_params();
$form['module'] = array(
'#type' => 'fieldset',
'#title' => t('phpFreeChat Module Settings'),
);
$form['module']['phpfreechat_title'] = array(
'#type' => 'textfield',
'#title' => t('Default Title'),
'#default_value' => variable_get('phpfreechat_title', ''),
'#size' => 70,
'#maxlength' => 128,
'#description' => t('This is the default title shown at the top of the chat box. The default, My Chat, can be overridden at the content-type or node level. If all of these are empty, the node title will be used.'),
);
$form['module']['phpfreechat_channels'] = array(
'#type' => 'textfield',
'#title' => t('Default Channels'),
'#default_value' => variable_get('phpfreechat_channels', ''),
'#size' => 70,
'#maxlength' => 128,
'#description' => t('These are the default channels (auto-joined at startup). They can be overridden at the content type or node level. You can enter multiple rooms separated by commas. Leaving this blank will auto-generate a string based on the title parameter.'),
);
$form['chat'] = array(
'#type' => 'fieldset',
'#title' => t('Chat Room Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['chat']['phpfreechat_theme'] = array(
'#type' => 'select',
'#title' => t('Theme'),
'#options' => _phpfreechat_ls($params['theme_path']),
'#default_value' => variable_get('phpfreechat_theme', 'default'),
'#description' => t('This parameter specifies which theme this chat will use.'),
);
$form['chat']['phpfreechat_language'] = array(
'#type' => 'select',
'#title' => t('Language'),
'#options' => _phpfreechat_ls(drupal_get_path('module', 'phpfreechat') . '/phpfreechat/i18n'),
'#default_value' => variable_get('phpfreechat_language', 'en_US'),
'#description' => t('Used to specify the chat labels language. Accepted values are i18n/* sub directories names. (Default value: the local server language)'),
);
$form['chat']['phpfreechat_auto_nick'] = array(
'#type' => 'select',
'#title' => t('Auto Nick'),
'#default_value' => variable_get('phpfreechat_auto_nick', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Use the Drupal username as the nick, rather than prompting the user to enter their own nick. (Default value: true)'),
);
$form['chat']['phpfreechat_frozen_nick'] = array(
'#type' => 'select',
'#title' => t('Frozen Nick'),
'#default_value' => variable_get('phpfreechat_frozen_nick', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Setting this to true will prevent user from changing their nicknames. (Default value: true)'),
);
$form['chat']['phpfreechat_max_nick_len'] = array(
'#type' => 'textfield',
'#title' => t('Maximum Nick Length'),
'#default_value' => variable_get('phpfreechat_max_nick_len', ''),
'#description' => t('This is the maximum nickname length, a longer nickname is forbidden. (Default: 15 characters)'),
);
$form['chat']['phpfreechat_nickmeta'] = array(
'#type' => 'textfield',
'#title' => t('Nickmeta'),
'#default_value' => variable_get('phpfreechat_nickmeta', ''),
'#description' => t('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: set internally)'),
);
$form['chat']['phpfreechat_nickmeta_private'] = array(
'#type' => 'textfield',
'#title' => t('Nickmeta Private'),
'#default_value' => variable_get('phpfreechat_nickmeta_private', ''),
'#description' => t('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)'),
);
$form['chat']['phpfreechat_nickmeta_key_to_hide'] = array(
'#type' => 'textfield',
'#title' => t('Nickmeta Key To Hide'),
'#default_value' => variable_get('phpfreechat_nickmeta_key_to_hide', ''),
'#description' => t('Can be used to hide keys in the final displayed whoisbox. (Default value: array() - means that nothing is hidden)'),
);
$form['chat']['phpfreechat_max_text_len'] = array(
'#type' => 'textfield',
'#title' => t('Maximum Message Length'),
'#default_value' => variable_get('phpfreechat_max_text_len', ''),
'#description' => t('This is the maximum message length, a longer message is forbidden. (Default value: 400)'),
);
$form['chat']['phpfreechat_max_msg'] = array(
'#type' => 'textfield',
'#title' => t('Message History Length'),
'#default_value' => variable_get('phpfreechat_max_msg', ''),
'#description' => t('This is the number of messages kept in the history. When users connect, they can see the history. The number of messages they can see is defined by this. (Default value: 20)'),
);
$form['chat']['phpfreechat_startwithsound'] = array(
'#type' => 'select',
'#title' => t('Startwithsound'),
'#default_value' => variable_get('phpfreechat_startwithsound', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t(' Setting it to false will start the chat without sound notifications. (Default value: true)'),
);
$form['chat']['phpfreechat_start_minimized'] = array(
'#type' => 'select',
'#title' => t('Start Minimized'),
'#default_value' => variable_get('phpfreechat_start_minimized', 'false'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Setting it to true will start the chat minimized. (Default value: false)'),
);
$form['chat']['phpfreechat_height'] = array(
'#type' => 'textfield',
'#title' => t('Chat Height'),
'#default_value' => variable_get('phpfreechat_height', ''),
'#description' => t('Height of the chat area. (Default value: "440px")'),
);
$form['chat']['phpfreechat_shownotice'] = array(
'#type' => 'textfield',
'#title' => t('Show Notice'),
'#default_value' => variable_get('phpfreechat_shownotice', ''),
'#description' => t('Setting this to 0 will disable all notices. Setting it to 1 will show nicknames changes. Setting it to 2 will show connect/disconnect notifications. Setting it to 3 (1+2) will show nicknames and connect/disconnect notifications. (Default value: 3)'),
);
$form['chat']['phpfreechat_nickmarker'] = array(
'#type' => 'select',
'#title' => t('Nick Marker'),
'#default_value' => variable_get('phpfreechat_nickmarker', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Setting this to false will disable nickname colorization. (Default value: true)'),
);
$form['chat']['phpfreechat_clock'] = array(
'#type' => 'select',
'#title' => t('Clock'),
'#default_value' => variable_get('phpfreechat_clock', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Setting this to false will hide the date/hour column. (Default value: true)'),
);
$form['chat']['phpfreechat_openlinknewwindow'] = array(
'#type' => 'select',
'#title' => t('Open Links in New Window'),
'#default_value' => variable_get('phpfreechat_openlinknewwindow', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Setting this to true will add target="_blank" into parsed links. This attribute is used to open the followed link in a new window. (Default value: true)'),
);
$form['chat']['phpfreechat_showwhosonline'] = array(
'#type' => 'select',
'#title' => t('Show Who's Online'),
'#default_value' => variable_get('phpfreechat_showwhosonline', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Used to show/hide online users at startup. (Default value: true)'),
);
$form['chat']['phpfreechat_showsmileys'] = array(
'#type' => 'select',
'#title' => t('Show Smileys'),
'#default_value' => variable_get('phpfreechat_showsmileys', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Used to show/hide the smiley list at startup. (Default value: true)'),
);
$form['chat']['phpfreechat_btn_sh_whosonline'] = array(
'#type' => 'select',
'#title' => t('Show Who's Online Button'),
'#default_value' => variable_get('phpfreechat_btn_sh_whosonline', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Used to show/hide the showwhosonline button. (Default value: true)'),
);
$form['chat']['phpfreechat_btn_sh_smileys'] = array(
'#type' => 'select',
'#title' => t('Show Smileys Button'),
'#default_value' => variable_get('phpfreechat_btn_sh_smileys', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Used to show/hide the showsmileys button. (Default value: true)'),
);
$form['chat']['phpfreechat_display_ping'] = array(
'#type' => 'select',
'#title' => t('Display Ping'),
'#default_value' => variable_get('phpfreechat_display_ping', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('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)'),
);
$form['chat']['phpfreechat_display_pfc_logo'] = array(
'#type' => 'select',
'#title' => t('Display Pfc Logo'),
'#default_value' => variable_get('phpfreechat_display_pfc_logo', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('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)'),
);
$form['chat']['phpfreechat_displaytabimage'] = array(
'#type' => 'select',
'#title' => t('Displaytabimage'),
'#default_value' => variable_get('phpfreechat_displaytabimage', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Used to show/hide the images in the channels and pv tabs. (Default value: true)'),
);
$form['chat']['phpfreechat_displaytabclosebutton'] = array(
'#type' => 'select',
'#title' => t('Displaytabclosebutton'),
'#default_value' => variable_get('phpfreechat_displaytabclosebutton', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Used to show/hide the close button in the channels tabs. (Default value: true)'),
);
$form['chat']['phpfreechat_bbcode_colorlist'] = array(
'#type' => 'textfield',
'#title' => t('Bbcode Colorlist'),
'#default_value' => variable_get('phpfreechat_bbcode_colorlist', ''),
'#description' => t('This is the list of colors that will appears into the bbcode palette. (Default value: contains an array of basic colors: '#FFFFFF', '#000000', ...)'),
);
$form['chat']['phpfreechat_nickname_colorlist'] = array(
'#type' => 'textfield',
'#title' => t('Nickname Colorlist'),
'#default_value' => variable_get('phpfreechat_nickname_colorlist', ''),
'#description' => t('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')'),
);
$form['chat']['phpfreechat_max_displayed_lines'] = array(
'#type' => 'textfield',
'#title' => t('Max Displayed Lines'),
'#default_value' => variable_get('phpfreechat_max_displayed_lines', ''),
'#description' => t('The maximum number of lines displayed in the window. Old lines will be deleted to save browser's memory on clients. Default value: 150)'),
);
$form['chat']['phpfreechat_date_format'] = array(
'#type' => 'textfield',
'#title' => t('Date Format'),
'#default_value' => variable_get('phpfreechat_date_format', ''),
'#description' => t('How to display the dates in the chat. (Default value: 'd/m/Y')'),
);
$form['chat']['phpfreechat_time_format'] = array(
'#type' => 'textfield',
'#title' => t('Time Format'),
'#default_value' => variable_get('phpfreechat_time_format', ''),
'#description' => t('How to display the time in the chat (Default value: 'H:i:s')'),
);
$form['chat']['phpfreechat_time_offset'] = array(
'#type' => 'textfield',
'#title' => t('Time Offset'),
'#default_value' => variable_get('phpfreechat_time_offset', ''),
'#description' => t('Can be used to setup the chat time zone. It is the difference in seconds between chat clock and server clock. (Default value: 0)'),
);
$form['chat']['phpfreechat_short_url'] = array(
'#type' => 'select',
'#title' => t('Short Url'),
'#default_value' => variable_get('phpfreechat_short_url', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('Setting it to true will shorten long URLs entered by users in the chat area. (Default value: true)'),
);
$form['chat']['phpfreechat_short_url_width'] = array(
'#type' => 'textfield',
'#title' => t('Short Url Width'),
'#default_value' => variable_get('phpfreechat_short_url_width', ''),
'#description' => t('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)'),
);
$form['chat']['phpfreechat_notify_window'] = array(
'#type' => 'select',
'#title' => t('Notify Window'),
'#default_value' => variable_get('phpfreechat_notify_window', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('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)'),
);
$form['system'] = array(
'#type' => 'fieldset',
'#title' => t('Performance & Output Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['system']['phpfreechat_container_type'] = array(
'#type' => 'textfield',
'#title' => t('Container Type'),
'#default_value' => variable_get('phpfreechat_container_type', ''),
'#description' => t('Used to specify the chat container (chat database). Accepted containers are : File and Mysql (maybe others in the future). (Default value: 'File')'),
);
$form['system']['phpfreechat_refresh_delay'] = array(
'#type' => 'textfield',
'#title' => t('Refresh Delay'),
'#default_value' => variable_get('phpfreechat_refresh_delay', ''),
'#description' => t('This is the time to wait (in milliseconds) between two refreshes. A refresh is a HTTP request which asks the server if there are new messages to display. If there are no new messages, then a 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)'),
);
$form['system']['phpfreechat_refresh_delay_steps'] = array(
'#type' => 'textfield',
'#title' => t('Refresh Delay Steps'),
'#default_value' => variable_get('phpfreechat_refresh_delay_steps', ''),
'#description' => t('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 ...)'),
);
$form['system']['phpfreechat_timeout'] = array(
'#type' => 'textfield',
'#title' => t('Timeout'),
'#default_value' => variable_get('phpfreechat_timeout', ''),
'#description' => t('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: 20000 - but must be set to 35000 (35 seconds) or higher, higher than highest refresh_delay. Change setting in pfcglobalconfig.class.php. Changing it here doesn't work.)'),
);
$form['system']['phpfreechat_connect_at_startup'] = array(
'#type' => 'select',
'#title' => t('Connect At Startup'),
'#default_value' => variable_get('phpfreechat_connect_at_startup', 'true'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('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)'),
);
$form['system']['phpfreechat_output_encoding'] = array(
'#type' => 'textfield',
'#title' => t('Output Encoding'),
'#default_value' => variable_get('phpfreechat_output_encoding', ''),
'#description' => t('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)'),
);
$form['system']['phpfreechat_frozen_channels'] = array(
'#type' => 'textfield',
'#title' => t('Frozen Channels'),
'#default_value' => variable_get('phpfreechat_frozen_channels', ''),
'#description' => t('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)'),
);
$form['system']['phpfreechat_max_channels'] = array(
'#type' => 'textfield',
'#title' => t('Max Channels'),
'#default_value' => variable_get('phpfreechat_max_channels', ''),
'#description' => t('The maximum number of allowed channels for each user. (Default value: 10)'),
);
$form['system']['phpfreechat_privmsg'] = array(
'#type' => 'textfield',
'#title' => t('Privmsg'),
'#default_value' => variable_get('phpfreechat_privmsg', ''),
'#description' => t('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)'),
);
$form['system']['phpfreechat_max_privmsg'] = array(
'#type' => 'textfield',
'#title' => t('Max Privmsg'),
'#default_value' => variable_get('phpfreechat_max_privmsg', ''),
'#description' => t('This is the maximum number of private message allowed at the same time for one user. (Default value: 5)'),
);
$form['system']['phpfreechat_islocked'] = array(
'#type' => 'select',
'#title' => t('Islocked'),
'#default_value' => variable_get('phpfreechat_islocked', 'false'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('When this parameter is true, all the chatters will be redirected to the url indicated by the lockurl parameter. (Default value: false)'),
);
$form['system']['phpfreechat_lockurl'] = array(
'#type' => 'textfield',
'#title' => t('Lockurl'),
'#default_value' => variable_get('phpfreechat_lockurl', ''),
'#description' => t('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)'),
);
$form['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// Not a phpfreechat setting - a Drupal module debug setting.
$form['advanced']['phpfreechat_params'] = array(
'#type' => 'select',
'#title' => t('Debug Parameters'),
'#default_value' => variable_get('phpfreechat_params', 'false'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('For developers. Setting this to true will list the chat parameters, session and cookies. (Default value: false)'),
);
$form['advanced']['phpfreechat_debug'] = array(
'#type' => 'select',
'#title' => t('Debug Console'),
'#default_value' => variable_get('phpfreechat_debug', 'false'),
'#options' => array('true' => 'true', 'false' => 'false'),
'#description' => t('For developers. When debug is true, some traces will be shown on the chat clients (Default value: false)'),
);
$form['advanced']['phpfreechat_serverid'] = array(
'#type' => 'textfield',
'#title' => t('Serverid'),
'#default_value' => variable_get('phpfreechat_serverid', ''),
'#description' => t('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__); (Default value: set internally)'),
);
$form['advanced']['phpfreechat_server_script_path'] = array(
'#type' => 'textfield',
'#title' => t('Server Script Path'),
'#default_value' => variable_get('phpfreechat_server_script_path', ''),
'#description' => t('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)'),
);
$form['advanced']['phpfreechat_server_script_url'] = array(
'#type' => 'textfield',
'#title' => t('Server Script URL'),
'#default_value' => variable_get('phpfreechat_server_script_url', ''),
'#description' => t('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)'),
);
$form['advanced']['phpfreechat_client_script_path'] = array(
'#type' => 'textfield',
'#title' => t('Client Script Path'),
'#default_value' => variable_get('phpfreechat_client_script_path', ''),
'#description' => t('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)'),
);
// No "client_script_url" in the code, oddly.
$form['advanced']['phpfreechat_cmd_path'] = array(
'#type' => 'textfield',
'#title' => t('Commands Directory'),
'#default_value' => variable_get('phpfreechat_cmd_path', ''),
'#description' => t('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)'),
);
$form['advanced']['phpfreechat_cmd_path_default'] = array(
'#type' => 'textfield',
'#title' => t('Cmd Path Default'),
'#default_value' => variable_get('phpfreechat_cmd_path_default', ''),
'#description' => t('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')'),
);
$form['advanced']['phpfreechat_theme_path'] = array(
'#type' => 'textfield',
'#title' => t('Theme Path'),
'#default_value' => variable_get('phpfreechat_theme_path', ''),
'#description' => t('Indicates where the themes are located. Use this parameter if you want to store your own theme in a special location. (Default value: the same as theme_default_path)'),
);
$form['advanced']['phpfreechat_theme_url'] = array(
'#type' => 'textfield',
'#title' => t('Theme Url'),
'#default_value' => variable_get('phpfreechat_theme_url', ''),
'#description' => t('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: '')'),
);
$form['advanced']['phpfreechat_theme_default_path'] = array(
'#type' => 'textfield',
'#title' => t('Theme Default Path'),
'#default_value' => variable_get('phpfreechat_theme_default_path', ''),
'#description' => t('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)'),
);
$form['advanced']['phpfreechat_theme_default_url'] = array(
'#type' => 'textfield',
'#title' => t('Theme Default Url'),
'#default_value' => variable_get('phpfreechat_them