phpFreechat related discussions.
You are not logged in.
Hi,
I recently started using Mantis to track issues, it doesn't come with a Chat program, so after research of the available option I found phpFreeChat best to suits our requirements.
For Info about Mantis : http://www.mantisbt.org
Review of different AJAX based chat applications : here
Features:
Access PFC from Mantis Menu,
Access level integration with Mantis ( Mantis Admin = PFC Admin) ,
Can set Minimum Access Level required to See the Chat Page,
Mantis Projects and Sub-Projects as Channels for PFC (only the projects to which user has access to)
I started with one of the Mantis Recipes titled: Integrate phpFreeChat into Mantis - Author: Victor Boctor
I would highly recommend you have a look at that.
Mantis Version used 1.0.8
PFC Version used 1.0-beta11
Add the "Chat" option to the main menu by adding the following code to Mantis config_inc.php
$g_main_menu_custom_options = array (array( "Chat", REPORTER, 'chat_page.php' )); // the access level here must match the one in chat_page.php
Directory Structure of code sample:
MANTIS ROOT: C:\mantis
PFC ROOT: C:\mantis\chat
Save this code in a file named chat_page.php in Mantis root folder ( C:\mantis ).
<?php
require_once( 'core.php' ); // mantis core file needed for the functions called in this page.
access_ensure_project_level( REPORTER ); // change minimum access level if required.
$t_chat_path = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'mantis' . DIRECTORY_SEPARATOR. 'chat' . DIRECTORY_SEPARATOR; // adjust to your own path
require_once ( $t_chat_path . 'src' . DIRECTORY_SEPARATOR . 'phpfreechat.class.php' ); // pfc core file
// Functions I wrote to integrate Mantis Projects as Channels for pfc
# --------------------
# a list of projects to which the user has access
function get_project_list() {
$t_project_ids = current_user_get_accessible_projects();
$t_project_list = array();
foreach ( $t_project_ids as $t_id ) {
$t_project_list[] = project_get_field( $t_id, 'name' );
// code to get sub projects, if you don't want sub-projects comment these line
$t_temp_list = array();
$t_temp_list = get_subproject_list( $t_id );
foreach ( $t_temp_list as $t_list_item ) {
$t_project_list[] = $t_list_item;
}
}
return $t_project_list;
}
# --------------------
# a list of subprojects to which the user has access
function get_subproject_list( $p_project_id ) {
$t_subprojects_ids = current_user_get_accessible_subprojects( $p_project_id );
$t_subproject_list = array();
foreach ( $t_subprojects_ids as $t_id ) {
$t_subproject_list[] = project_get_field( $t_id, 'name' );
//get the sub projects of a sub-project, if you don't want these sub-projects comment these line
$t_temp_list = array();
$t_temp_list = get_subproject_list( $t_id );
foreach ( $t_temp_list as $t_list_item ) {
$t_subproject_list[] = $t_list_item;
}
}
return $t_subproject_list;
}
$t_nick = user_get_name( auth_get_current_user_id() );
$t_channel_list = array();
$t_channel_list = get_project_list(); //get the project list
$params = array();
$params['isadmin'] = user_is_administrator( auth_get_current_user_id() ); // check if the user is admin
$params["serverid"] = md5( __FILE__ );
$params["title"] = "Your Chat Title";
$params["nick"] = $t_nick;
$params["frozen_nick"] = true;
$params["refresh_delay"] = 5000;
$params["clock"] = true;
$params["channels"] = $t_channel_list;
#$params["frozen_channels"] = $t_channel_list; // uncomment this if you want to freeze the channels
// I have to also set the following config values to make the pfc work as I was having issues.
$params["data_public_path"] = "C:\mantis\chat\data\public";
$params["data_public_url"] = "/chat/data/public";
$params["server_script_path"] = "C:\mantis";
$params["server_script_url"] = "./chat_page.php";
$params["theme_path"] = "C:\mantis\chat\themes";
$params["theme_default_path"] = "C:\mantis\chat\themes";
$params["theme_default_url"] = "/chat/themes";
$params["theme_url"] = "/chat/themes";
$params["theme"] = "default";
$chat = new phpFreeChat( $params );
html_page_top1(); //part of mantis header
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
$chat->printJavascript();
$chat->printStyle();
html_page_top2(); //part of mantis header
echo '<br />';
$chat->printChat(); // display chat
echo '<br />';
/* Uncomment this code to debug the pfc config
echo "<h2>Debug</h2>";
echo "<pre>";
$c =& pfcGlobalConfig::Instance();
print_r($c);
print_r($_SERVER);
echo "</pre>";
*/
html_page_bottom1( __FILE__ ); // Mantis page footer
?>I am only a week old with PHP and Mantis, and few days old with PFC.
I certainly think this could be done in a better way, like putting functions in a separate file.
Any comments will sure be appreciated.
Further updates/implementations will be posted.
Cheers!!!
~nsj
Offline
I have been trying to integrate phpFreeChat 1.0-beta11 with Mantis 1.0.8 on Windows 2003/IIS 6.0 all night and have not been able to get it to work for the life of me. I have used the above and updated the necessary paths, but FireFox just keeps trying to load the chat and IE7 gives the following errors.
Any help would be VERY much appreciated! Thanks!
Line: 131 Char: 1 Error: Object expected Code: 0 URL: http://www.americandutch.com/mantis/chat_page.php
Line: 99 Char: 3 Error: 'pfcClient' is undefined Code: 0 URL: http://www.americandutch.com/mantis/chat_page.php
Debug
pfcGlobalConfig Object
(
[serverid] => 4681ddd6cac2318aaca21aa4995c1ef0
[nick] => shigadeyo
[nickmeta] => Array
(
)
[nickmeta_private] => Array
(
[0] => ip
)
[isadmin] =>
[admins] => Array
(
[admin] =>
)
[firstisadmin] =>
[islocked] =>
[lockurl] => http://www.phpfreechat.net
[skip_proxies] => Array
(
)
[post_proxies] => Array
(
)
[pre_proxies] => Array
(
)
[proxies] => Array
(
[0] => lock
[1] => checktimeout
[2] => checknickchange
[3] => auth
[4] => noflood
[5] => censor
[6] => log
)
[proxies_cfg] => Array
(
[auth] => Array
(
)
[noflood] => Array
(
[charlimit] => 450
[msglimit] => 10
[delay] => 5
)
[censor] => Array
(
[words] => Array
(
[0] => fuck
[1] => sex
[2] => bitch
)
[replaceby] => *
[regex] =>
)
[log] => Array
(
[path] =>
)
)
[proxies_path] => D:\InetPub\RatingSite\htdocs\mantis\chat\src/proxies
[proxies_path_default] => D:\InetPub\RatingSite\htdocs\mantis\chat\src/proxies
[cmd_path] => D:\InetPub\RatingSite\htdocs\mantis\chat\src/commands
[cmd_path_default] => D:\InetPub\RatingSite\htdocs\mantis\chat\src/commands
[title] => Your Chat Title
[channels] => Array
(
)
[frozen_channels] => Array
(
)
[max_channels] => 10
[privmsg] => Array
(
)
[max_privmsg] => 5
[frozen_nick] => 1
[max_nick_len] => 15
[max_text_len] => 400
[refresh_delay] => 5000
[max_refresh_delay] => 60000
[timeout] => 20000
[max_msg] => 20
[max_displayed_lines] => 150
[quit_on_closedwindow] => 1
[focus_on_connect] => 1
[connect_at_startup] => 1
[start_minimized] =>
[height] => 440px
[width] =>
[shownotice] => 3
[nickmarker] => 1
[clock] => 1
[startwithsound] => 1
[openlinknewwindow] => 1
[notify_window] => 1
[display_pfc_logo] => 1
[displaytabimage] => 1
[displaytabclosebutton] => 1
[showwhosonline] => 1
[showsmileys] => 1
[btn_sh_whosonline] => 1
[btn_sh_smileys] => 1
[bbcode_colorlist] => Array
(
[0] => #FFFFFF
[1] => #000000
[2] => #000055
[3] => #008000
[4] => #FF0000
[5] => #800000
[6] => #800080
[7] => #FF5500
[8] => #FFFF00
[9] => #00FF00
[10] => #008080
[11] => #00FFFF
[12] => #0000FF
[13] => #FF00FF
[14] => #7F7F7F
[15] => #D2D2D2
)
[nickname_colorlist] => Array
(
[0] => #CCCCCC
[1] => #000000
[2] => #3636B2
[3] => #2A8C2A
[4] => #C33B3B
[5] => #C73232
[6] => #80267F
[7] => #66361F
[8] => #D9A641
[9] => #3DCC3D
[10] => #1A5555
[11] => #2F8C74
[12] => #4545E6
[13] => #B037B0
[14] => #4C4C4C
[15] => #959595
)
[theme] => default
[theme_path] => D:\InetPub\RatingSite\htdocs\mantis\chat\src/../themes
[theme_default_path] => D:\InetPub\RatingSite\htdocs\mantis\chat\src/../themes
[theme_url] => /chat/themes
[theme_default_url] => /chat/themes
[language] =>
[output_encoding] => UTF-8
[container_type] => File
[client_script_path] => D:\InetPub\RatingSite\htdocs
[server_script_path] => D:\InetPub\RatingSite\htdocs\mantis
[server_script_url] => ./chat_page.php
[data_private_path] => D:\InetPub\RatingSite\htdocs\mantis\chat\src/../data/private
[data_public_path] => D:\InetPub\RatingSite\htdocs\mantis\chat\data\public
[data_public_url] => /chat/data/public
[prototypejs_url] => /chat/data/public/js/prototype.js
[smileys] => Array
(
[smileys/emoticon_smile.png] => Array
(
[0] => :-)
[1] => ^_^
[2] => :)
)
[smileys/emoticon_evilgrin.png] => Array
(
[0] => >(
)
[smileys/emoticon_surprised.png] => Array
(
[0] => :S
[1] => :s
[2] => :-S
[3] => :-s
[4] => :-/
)
[smileys/emoticon_grin.png] => Array
(
[0] => :-D
[1] => :D
)
[smileys/emoticon_unhappy.png] => Array
(
[0] => :\'(
[1] => :-(
[2] => :o(
[3] => :-<
[4] => :(
)
[smileys/emoticon_happy.png] => Array
(
[0] => :lol:
)
[smileys/emoticon_waii.png] => Array
(
[0] => :{}
[1] => :-{}
[2] => :razz:
[3] => :}
[4] => :-}
)
[smileys/emoticon_wink.png] => Array
(
[0] => ;-)
[1] => ;o)
[2] => ;)
)
[smileys/emoticon_tongue.png] => Array
(
[0] => :P
[1] => :-P
[2] => :-p
[3] => :p
)
[smileys/weather_rain.png] => Array
(
[0] => ///
[1] => \\\\\\
[2] => |||
[3] => :rain:
[4] => :drizzle:
)
[smileys/weather_snow.png] => Array
(
[0] => :***:
)
[smileys/weather_sun.png] => Array
(
[0] => >O<
)
[smileys/weather_clouds.png] => Array
(
[0] => :\"\"\":
[1] => :cloud:
[2] => :clouds:
)
[smileys/weather_cloudy.png] => Array
(
[0] => :\"O\":
[1] => :cloudly:
)
[smileys/weather_lightning.png] => Array
(
[0] => :$:
)
[smileys/arrow_right.png] => Array
(
[0] => =>
[1] => ->
[2] => -->
[3] => ==>
[4] => >>>
)
[smileys/arrow_left.png] => Array
(
[0] => <=
[1] => <-
[2] => <--
[3] => <==
[4] => <<<
)
[smileys/exclamation.png] => Array
(
[0] => :!:
)
[smileys/lightbulb.png] => Array
(
[0] => *)
[1] => 0=
)
)
[errors] => Array
(
)
[is_init] => 1
[version] => 1.0-beta11
[debugurl] => mantis\chat\debug
[debug] =>
[time_offset] => 0
[date_format] => d/m/Y
[time_format] => H:i:s
[get_ip_from_xforwardedfor] =>
[_sys_proxies] => Array
(
[0] => lock
[1] => checktimeout
[2] => checknickchange
[3] => auth
[4] => noflood
[5] => censor
[6] => log
)
[_dyn_params] => Array
(
[0] => nick
[1] => isadmin
[2] => islocked
[3] => admins
[4] => frozen_channels
[5] => channels
[6] => privmsg
[7] => nickmeta
[8] => time_offset
[9] => date_format
[10] => time_format
)
[_params_type] => Array
(
)
[_query_string] =>
[container_cfg_chat_dir] => D:\InetPub\RatingSite\htdocs\mantis\chat\src/../data/private/chat
[container_cfg_server_dir] => D:\InetPub\RatingSite\htdocs\mantis\chat\src/../data/private/chat/s_4681ddd6cac2318aaca21aa4995c1ef0
)
Array
(
[ALL_HTTP] => HTTP_CONNECTION:Keep-Alive
HTTP_ACCEPT:*/*
HTTP_ACCEPT_ENCODING:gzip, deflate
HTTP_ACCEPT_LANGUAGE:en-us
HTTP_COOKIE:MANTIS_STRING_COOKIE=6cc644f9d24f2b61663a3b132959c3908d6d7ccb5286a7b8be93069cedab6f96
HTTP_HOST:www.americandutch.com
HTTP_REFERER:http://www.americandutch.com/mantis/my_view_page.php
HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1)
HTTP_UA_CPU:x86
[HTTPS] => off
[SCRIPT_NAME] => /mantis/chat_page.php
[HTTP_COOKIE] => MANTIS_STRING_COOKIE=6cc644f9d24f2b61663a3b132959c3908d6d7ccb5286a7b8be93069cedab6f96
[AUTH_PASSWORD] =>
[AUTH_TYPE] =>
[AUTH_USER] =>
[CONTENT_LENGTH] => 0
[CONTENT_TYPE] =>
[PATH_TRANSLATED] => D:\InetPub\RatingSite\htdocs
[QUERY_STRING] =>
[REMOTE_ADDR] => 72.49.239.73
[REMOTE_HOST] => 72.49.239.73
[REMOTE_USER] =>
[REQUEST_METHOD] => GET
[SERVER_NAME] => www.americandutch.com
[SERVER_PORT] => 80
[SERVER_PROTOCOL] => HTTP/1.1
[SERVER_SOFTWARE] => Microsoft-IIS/6.0
[APPL_MD_PATH] => /LM/W3SVC/461973746/Root
[APPL_PHYSICAL_PATH] => D:\InetPub\RatingSite\htdocs\
[INSTANCE_ID] => 461973746
[INSTANCE_META_PATH] => /LM/W3SVC/461973746
[LOGON_USER] =>
[REQUEST_URI] => /mantis/chat_page.php
[url]=> /mantis/chat_page.php
[SCRIPT_FILENAME] => D:\InetPub\RatingSite\htdocs\mantis\chat_page.php
[ORIG_PATH_INFO] => /mantis/chat_page.php
[PATH_INFO] =>
[ORIG_PATH_TRANSLATED] => D:\InetPub\RatingSite\htdocs\mantis\chat_page.php
[DOCUMENT_ROOT] => D:\InetPub\RatingSite\htdocs
[PHP_SELF] => /mantis/chat_page.php
[HTTP_CONNECTION] => Keep-Alive
[HTTP_ACCEPT] => */*
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTP_ACCEPT_LANGUAGE] => en-us
[HTTP_HOST] => www.americandutch.com
[HTTP_REFERER] => http://www.americandutch.com/mantis/my_view_page.php
[HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1)
[HTTP_UA_CPU] => x86
[REQUEST_TIME] => 1190086652
)Last edited by shigadeyo (2007-09-18 05:41:03)
Offline
shigadeyo are you able to have a working chat without mantis integration ? (does the demo works?)
Offline
shigadeyo Your Javascript reference in the output page is not correct. You need to set the param: [client_script_path] & [client_script_url] with your other params.
You can look the current javascript source file path by right click and view source, and copy paste that path into a new IE window and see if it opens up any file.
Cheers!!!
~nsj
Offline