• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Contributions (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

MediaWiki integration

Post a bug fix, a new feature, a theme ...

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
18 posts • Page 1 of 2 • 1, 2

Postby ccs » Tue Sep 26, 2006 1:58 am

My setup:
MediaWiki in /www/wiki2/ directory
Apache config file: "Alias /wiki /var/www/wiki2/index.php"
phpFreeChat in /www/chat/ directory

New file: wiki2/extensions/SpecialChat.php
New file: wiki2/includes/SpecialChat.php
Add to file: wiki2/LocalSettings.php
require_once("extensions/SpecialChat.php");

That should be all. You can access now the new chat with [[Special:Chat]]
Also shows up in "Special pages"

Csaba Csoma



wiki2/extensions/SpecialChat.php
Code: Select all
<?php
$wgExtensionFunctions[] = "wfExtensionSpecialChat";
function wfExtensionSpecialChat()
{
  global $wgMessageCache;

  $wgMessageCache->addMessages(array('chat' => 'My Chat'));
  require_once('includes/SpecialPage.php');
  SpecialPage::addPage(new SpecialPage('Chat'));
}

?>

wiki2/includes/SpecialChat.php
Code: Select all
<?php

function wfSpecialChat()
{global $wgOut,$wgUser;

$wgCachePages=false;
$wgOut->setHTMLTitle('My Chat');
$wgOut->setPageTitle('My Chat');

if ($wgUser->mId<1) {
  $wgOut->addHTML('You must <a href="/wiki2/index.php?title=Special:Userlogin&returnto=Special:Chat">log in</a> first<br>');
} else {
  require_once "/www/chat/src/phpfreechat.class.php"; // adjust to your own path
  $params =  array("title"          => "",
                 "max_msg"        => 21,
                 "nick"         => $wgUser->mRealName,
                  "openlinknewwindow"         => true,
                 "showsmileys"    => false,
                 "channels"      => array("Public room"),
                 "nickmarker"     => true,
                 "serverid"       => md5(__FILE__),
                 "btn_sh_smileys" => true,
                 'server_script_path' => '/www/chat/ajax.php',
                 'server_script_url' => '/www/chat/ajax.php',
                 );
  $chat = new phpFreeChat($params);
  $wgOut->addScript( $chat->printJavascript(true) );
  $wgOut->addScript( $chat->printStyle(true) );
  $wgOut->addHTML( $chat->printChat(true) );
}

}
?>

chat/ajax.ph
Code: Select all
<?php
 if (!$_GET['q'])
        $params = $_GET; // Only need to fetch query string after initial request

 // Explode channels into an array of strings
 $params['channels'] = explode(',', $params['channels']);
 $params['serverid'] =  md5(__FILE__);
 require_once("src/phpfreechat.class.php");
 $chat = new phpFreeChat($params);
?>
Last edited by ccs on Thu Oct 12, 2006 9:12 pm, edited 1 time in total.
ccs
New member
 
Posts: 3
Joined: Tue Sep 26, 2006 1:42 am
Location: USA
Top

Postby phpfreechat » Tue Sep 26, 2006 9:07 am

Thanks ccs for sharing this great contribution.
I'm sure a lot of MediaWiki users will like it :)
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby kostets » Fri Oct 20, 2006 7:16 am

I had tried to integrate php Free Chat to MediaWIKI. As standalone application php Free Chat works fine. Buit when php Free Chat has been started under MediaWIKI error occured. My Platform: Chat version phpfreechat-1.0-beta6 / win server 2003 / IIS 6.0 / php-5.1.4-Win32 / mysql-5.0.22-win32.

Error: GetScriptFilename function returns a wrong path. Please contact the pfc team (contact@phpfreechat.net) and copy/paste this array to help debugging.

Array
(
[ALL_HTTP] => HTTP_CONNECTION:Keep-Alive
HTTP_ACCEPT:*/*
HTTP_ACCEPT_ENCODING:gzip, deflate
HTTP_ACCEPT_LANGUAGE:ru
HTTP_COOKIE:wikiUserName=Konstantin.andrienko; wikiUserID=2; wiki_session=28393f7fb1ac64a264bd0119967dc16f; phpfreechat=a5074312d3bfa52fc2367944ce398666
HTTP_HOST:rufp-wiki.cneu.cnwk
HTTP_REFERER:http://rufp-wiki.cneu.cnwk/wiki/index.php?title=Special:Specialpages
HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

[HTTPS] => off
[SCRIPT_NAME] => /wiki/index.php
[HTTP_COOKIE] => wikiUserName=Konstantin.andrienko; wikiUserID=2; wiki_session=28393f7fb1ac64a264bd0119967dc16f; phpfreechat=a5074312d3bfa52fc2367944ce398666
[AUTH_PASSWORD] =>
[AUTH_TYPE] =>
[AUTH_USER] =>
[CONTENT_LENGTH] => 0
[CONTENT_TYPE] =>
[PATH_TRANSLATED] => C:Inetpubwwwroot
[QUERY_STRING] => title=Special:Chat
[REMOTE_ADDR] => 213.33.139.60
[REMOTE_HOST] => 213.33.139.60
[REMOTE_USER] =>
[REQUEST_METHOD] => GET
[SERVER_NAME] => rufp-wiki.cneu.cnwk
[SERVER_PORT] => 80
[SERVER_PROTOCOL] => HTTP/1.1
[SERVER_SOFTWARE] => Microsoft-IIS/6.0
[APPL_MD_PATH] => /LM/W3SVC/1/Root
[APPL_PHYSICAL_PATH] => C:Inetpubwwwroot
[INSTANCE_ID] => 1
[INSTANCE_META_PATH] => /LM/W3SVC/1
[LOGON_USER] =>
[REQUEST_URI] => /wiki/index.php?title=Special:Chat
[url]=> /wiki/index.php?title=Special:Chat
[SCRIPT_FILENAME] => C:Inetpubwwwrootwikiindex.php
[ORIG_PATH_INFO] => /wiki/index.php
[PATH_INFO] =>
[ORIG_PATH_TRANSLATED] => C:Inetpubwwwrootwikiindex.php
[DOCUMENT_ROOT] => C:Inetpubwwwroot
[PHP_SELF] => /wiki/index.php
[HTTP_CONNECTION] => Keep-Alive
[HTTP_ACCEPT] => */*
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTP_ACCEPT_LANGUAGE] => ru
[HTTP_HOST] => rufp-wiki.cneu.cnwk
[HTTP_REFERER] => http://rufp-wiki.cneu.cnwk/wiki/index.p ... ecialpages
[HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
[REQUEST_TIME] => 1161323476
[argv] => Array
(
[0] => title=Special:Chat
)

[argc] => 1
)
kostets
New member
 
Posts: 2
Joined: Tue Oct 17, 2006 7:25 am
Top

Postby ccs » Fri Oct 20, 2006 3:02 pm

I saw 2 threads about this:

http://www.phpfreechat.net/forum/viewtopic.php?id=6

and

http://www.phpfreechat.net/forum/viewtopic.php?pid=1488
ccs
New member
 
Posts: 3
Joined: Tue Sep 26, 2006 1:42 am
Location: USA
Top

Postby KlinT » Sun Oct 22, 2006 1:09 pm

Hi All,

Well, I've just discovered your contribution to add PHPFreeChat support to MediaWiki ...

Good job, but I encounter some problems ...

As described in previous posts, I cannot use the latest beta6 release ... Does not work with MediaWiki 1.7.1 ... I've read all posts and modified PATHS in your 3 files ( SpecialChat.php ans Ajax.php ) ...

Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights

So, I've tried to use the Stable Release ( 0.9.3 ) of PHPFreeChat ... It looks better, but I encounter another problem :

Error: the ajax Javascript file could not be included. Perhaps the URL is incorrect ?
URL: chat/data/public/xajax_js/xajax.js

I've verified, directory contents ... The URL is ok ... May be a / at the beginning is missing in my case.

Any idea / direction to follow to make this woring ?

Here is the detail of my configuration :

NetBSD / Apache 2.0.58 / PHP 5.1.6 ( as module ) ...
my DocumentRoot is : /usr/pkg/share/httpd/htdocs
The PHPFreeChat components are in : /usr/pkg/share/httpd/htdocs/chat/
MediaWiki is installed in DocumentRoot, not in a subdirectory ... No aliases in my apache configuration file.

Many thanks for your help.

KlinT
KlinT
New member
 
Posts: 1
Joined: Sun Oct 22, 2006 12:58 pm
Top

Postby garoffano » Mon Nov 06, 2006 9:51 pm

Hi css, thx for nice workout. I got problems with it, for that the question:do you really mean both time refer
'server_script_path' => '/www/chat/ajax.php',
'server_script_url' => '/www/chat/ajax.php',
should really both items refer (with corrected path's) the ajax.php? Should'nt the server_script_url refer to something else, i.e. some .js ? the definition to the script url is even an internal path, should'nt it be the external (http://myhost/mydir/...)
Away from that i got the "Error: the chat cannot be loaded! two possibilities: your browser doesn't support javascript or you didn't setup correctly the server directories rights - don't hesitate to ask some help on the forum www.phpfreechat.net/forum".
To check it out, i opened my wiki/includes for everybody even writing access. I made the wiki/includes to root for phpfreechat. so the index.php from freechat even lays there and the directory structure of phpfreechat lays below. if i call localhost/wiki/includes/index.php it comes up really fine. if i call it from the wiki, i get the msg before. what could be the problem please ???
garoffano
New member
 
Posts: 1
Joined: Mon Nov 06, 2006 9:26 pm
Top

Postby Gible » Thu Dec 07, 2006 11:45 am

I'm getting this error:
Warning: require_once(/chat/src/phpfreechat.class.php) [function.require-once]: failed to open stream: No such file or directory in D:wwwrootwww.gible.netwikiincludesSpecialChat.php on line 13

Fatal error: require_once() [function.require]: Failed opening required '/chat/src/phpfreechat.class.php' (include_path='D:wwwrootwww.gible.netwiki;D:wwwrootwww.gible.netwiki/includes;D:wwwrootwww.gible.netwiki/languages;D:wwwrootwww.gible.netwiki/chat/src') in D:wwwrootwww.gible.netwikiincludesSpecialChat.php on line 13

I've verified that the paths are correct and the file does exist.
Also tried changing
$path = array( $IP, "$IP/includes", "$IP/languages" );
to
$path = array( $IP, "$IP/includes", "$IP/languages", "$IP/chat/src" );
in the LocalSettings.php of Media Wiki.

The chat works fines when used stand alone.

Using:
phpFreeChat version 1.0-beta7
Mediawiki version 1.6.3
Gible
New member
 
Posts: 3
Joined: Thu Dec 07, 2006 11:35 am
Top

Postby ccs » Thu Dec 07, 2006 3:29 pm

My solution works in Linux, never tested on Windows. Hope somebody have time to do that...

Gible, are you sure that the file D:chatsrcphpfreechat.class.php exists in your server?
If you have the path where your store phpfreechat.class.php added to include paths, then you need just this:
require_once('phpfreechat.class.php');
ccs
New member
 
Posts: 3
Joined: Tue Sep 26, 2006 1:42 am
Location: USA
Top

Postby Gible » Sat Dec 16, 2006 2:29 am

ccs, you were right, D:chatsrcphpfreechat.class.php didn't exist, silly me assumed that it would append to the root directory of the website. Removing the '/chat/src/' did fix it due to being in the path. Thanx :)

Then I encountered the GetScriptFilename error above and my solution was in the first link given. However its worth feeding forward that the file phpfreechattools.php is now pfctools.php

Next problem was this error:
Please correct these errors:

* /chat/ajax.php doesn't exist
* doesn't exist
The first of which is essentially the same path problem I had the first time. I managed to fix the first error by replacing
'server_script_path' => '/chat/ajax.php',
'server_script_url' => '/chat/ajax.php',
in SpecialChat.php with:
'server_script_path' => $_SERVER['DOCUMENT_ROOT'] . '/chat/ajax.php',
'server_script_url' => $_SERVER['DOCUMENT_ROOT'] . '/chat/ajax.php',

Now I'm down to:
Please correct these errors:

* doesn't exist
And I'm really sitting here thinking "Well, Duh!", but a solution would be better :)
Gible
New member
 
Posts: 3
Joined: Thu Dec 07, 2006 11:35 am
Top

Postby pawandeep » Tue Jan 02, 2007 2:00 pm

how to select string in php
pawandeep
New member
 
Posts: 3
Joined: Tue Jan 02, 2007 1:57 pm
Top

Postby pawandeep » Tue Jan 02, 2007 2:03 pm

i am programmer and i need for function thats is selecting string in php from specific position to specific position???????????/
pawandeep
New member
 
Posts: 3
Joined: Tue Jan 02, 2007 1:57 pm
Top

Postby pawandeep » Tue Jan 02, 2007 2:09 pm

pawandeep wrote:i am programmer and i need for function thats is selecting string in php from specific position to specific position???????????/

try my code
pawandeep
New member
 
Posts: 3
Joined: Tue Jan 02, 2007 1:57 pm
Top

Postby Ryan Lane » Sun Mar 04, 2007 9:01 pm

I've rewritten this extension, and would like to post the code to MediaWiki's svn. I don't want to outright hijack your extension though. If you would like me to start a new wiki page, and fork your code, I will. Give me a shout. I'm on meta and mediawiki as user Ryan lane.
Ryan Lane
New member
 
Posts: 1
Joined: Sun Mar 04, 2007 8:55 pm
Top

Postby austin » Wed Mar 07, 2007 5:48 pm

I've also simplified the extension (it's just one file) and got it running on the http://openwetware.org/ wiki (currently requires login and enabling via a preference as I'm testing). Other than adding a Special:Chat page, I added a chat tab to every page that puts people into a chat room of the same name as the page. The code is at http://austinche.name/mediawiki/WikiChat.php.txt and Ryan you are free to take whatever you want to merge with what you have.
austin
New member
 
Posts: 6
Joined: Fri Feb 16, 2007 10:40 pm
Top

Postby Xenith » Fri Jul 06, 2007 4:42 pm

ccs wrote:My setup:
MediaWiki in /www/wiki2/ directory
Apache config file: "Alias /wiki /var/www/wiki2/index.php"
phpFreeChat in /www/chat/ directory

New file: wiki2/extensions/SpecialChat.php
New file: wiki2/includes/SpecialChat.php
Add to file: wiki2/LocalSettings.php
require_once("extensions/SpecialChat.php");

That should be all. You can access now the new chat with [[Special:Chat]]
Also shows up in "Special pages"

Csaba Csoma



wiki2/extensions/SpecialChat.php
Code: Select all
<?php
$wgExtensionFunctions[] = "wfExtensionSpecialChat";
function wfExtensionSpecialChat()
{
  global $wgMessageCache;

  $wgMessageCache->addMessages(array('chat' => 'My Chat'));
  require_once('includes/SpecialPage.php');
  SpecialPage::addPage(new SpecialPage('Chat'));
}

?>

wiki2/includes/SpecialChat.php
Code: Select all
<?php

function wfSpecialChat()
{global $wgOut,$wgUser;

$wgCachePages=false;
$wgOut->setHTMLTitle('My Chat');
$wgOut->setPageTitle('My Chat');

if ($wgUser->mId<1) {
  $wgOut->addHTML('You must <a href="/wiki2/index.php?title=Special:Userlogin&returnto=Special:Chat">log in</a> first<br>');
} else {
  require_once "/www/chat/src/phpfreechat.class.php"; // adjust to your own path
  $params =  array("title"          => "",
                 "max_msg"        => 21,
                 "nick"         => $wgUser->mRealName,
                  "openlinknewwindow"         => true,
                 "showsmileys"    => false,
                 "channels"      => array("Public room"),
                 "nickmarker"     => true,
                 "serverid"       => md5(__FILE__),
                 "btn_sh_smileys" => true,
                 'server_script_path' => '/www/chat/ajax.php',
                 'server_script_url' => '/www/chat/ajax.php',
                 );
  $chat = new phpFreeChat($params);
  $wgOut->addScript( $chat->printJavascript(true) );
  $wgOut->addScript( $chat->printStyle(true) );
  $wgOut->addHTML( $chat->printChat(true) );
}

}
?>

chat/ajax.ph
Code: Select all
<?php
 if (!$_GET['q'])
        $params = $_GET; // Only need to fetch query string after initial request

 // Explode channels into an array of strings
 $params['channels'] = explode(',', $params['channels']);
 $params['serverid'] =  md5(__FILE__);
 require_once("src/phpfreechat.class.php");
 $chat = new phpFreeChat($params);
?>


I was wondering if this final part of the code should be "code/ajax.PHP"
If so I have gone ahead and made the change but im still having trouble with the line
require_once("src/phpfreechat.class.php");
im on a windows machine and when I offer the direct path from "C:"
then the chat attempts to load... but remains on the loading page forever??
Any Suggestions??
Xenith
New member
 
Posts: 1
Joined: Fri Jul 06, 2007 4:33 pm
Top

Next

Post a reply
18 posts • Page 1 of 2 • 1, 2

Return to Contributions (v1.x)

Who is online

Users browsing this forum: No registered users and 16 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub