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

Parse error

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

Post a reply
2 posts • Page 1 of 1

Postby x66x66 » Sun Aug 07, 2011 3:23 am

I keep getting "Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /srv/disk5/x66x66/www/x66x66.awardspace.com/extensions/WikiChat.php on line 45" whenever I load my wiki.

heres my php. What's wrong??

<?php
/**
* MediaWiki WikiChat extension
* See: http://www.mediawiki.org/wiki/Extension:Chat for installation
* Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
* Author: http://www.wikichat.org/User:Firebreather
*/

#set to the directory phpfreechat is installed in
define('WC_PFC_DIRECTORY', 'phpfreechat');

# set to false to deny access to anonymous users
define('WC_ALLOW_ANONYMOUS_USERS', true);

# message shown when denying anonymous users. Change if you want a different message. WikiText ok..
define('WC_DENY_ACCESS_MESSAGE', 'You must [[Special:Userlogin|login]] to be allowed into this chatroom');

# when true there will be a chat room per article. Set to false to have a single site-wide chat room.
define('WC_ROOM_PER_ARTICLE', true);

if (!defined('MEDIAWIKI')) die ('Not an entry point');

$wgPFC_Directory = "$IP/phpfreechat";

require_once "$IP/$wgPFC_Directory/src/phpfreechat.class.php";
require_once "$IP/includes/DatabaseFunctions.php";

$wgRoomPerArticle = true;
$wgAllowAnonUsers = 'You must [[Special:Userlogin|login]] to be allowed into this chatroom';
$wgDenyAccessMessage = true;

/* Extension variables */
$wgExtensionFunctions[] = 'wfSetupWikiChat';
$wgExtensionCredits['other'][] = array(
'name' => 'WikiChat',
'version' => '0.3.8, 2010-09-03',
'author' => '[http://www.wikichat.org/User:Firebreather User:Firebreather]',
'url' => 'http://www.wikichat.org/',
'description' => 'Adds a tab to each article that switches to a chatroom',
);

class WikiChat {

// Constructor
public function WikiChat() {
global $wgHooks;

# Add all our needed hooks
$wgHooks['UnknownAction'][] = $this;
$wgHooks['SkinTemplateTabs'][] = $this;
}

// main entry point
public function onUnknownAction($action, $article) {
global $wgOut, $wgCachePages, $wgTitle, $wgDBprefix, $wgDenyAccessMessage;

$wgCachePages = false;

if($action == 'chat') {
$wgOut->setPageTitle(str_replace('_', ' ', $wgTitle->getDBKey()));

if($this->isAnonDenied()) {
$wgOut->addWikiText($wgDenyAccessMessage);
return false;
}

$params = $this->configurePFC_Params();

$tblname = $wgDBprefix."chathistory";

$this->createChatHistoryDBTable($tblname);

$this->configurePFC_DB_Params($tblname, $params);

$this->configureNick($params);

$this->showChat($params);

return false;
}
else {
return true;
}
}

private function isAnonDenied() {
global $wgUser, $wgAllowAnonUsers;

return !$wgAllowAnonUsers && $wgUser->isAnon();
}

private function configureNick(&$params) {
global $wgUser, $wgOut, $wgAllowAnonUsers, $wgDenyAccessMessage, $wgTitle;

$nick = "";

if($wgUser->isAnon()) {
}
else {
$nick = $wgUser->getName();
}

$params["nick"] = $nick; // setup the initial nickname

return $nick;
}

private function configurePFC_Params() {
global $wgTitle, $wgRoomPerArticle, $wgPFC_Directory;
global $wgOut;

$params["title"] = "WikiChat";

// apply room per page or site-wide room configuration option
if($wgRoomPerArticle) {
$params["serverid"] = $wgTitle->getDBKey();
}
else {
$params["serverid"] = md5(__FILE__);
}

$params["data_public_url"] = "$IP/phpfreechat/data/public";
$params["data_public_path"] = "$IP/phpfreechat/data/public";

$params["server_script_url"] = $_SERVER['REQUEST_URI'];
$params["openlinknewwindow"] = true;
$params["channels"] = array(str_replace('_', ' ', $wgTitle->getDBKey()));
$params["frozen_nick"] = true; // do not allow to change the nickname
$params["shownotice"] = 0; // 0 = nothing, 1 = just nickname changes, 2 = connect/quit, 3 = nick + connect
$params["max_nick_len"] = 30; // nickname length could not be longer than 10 caracteres
$params["max_text_len"] = 300; // a message cannot be longer than 50 caracteres
$params["max_channels"] = 3; // limit the number of joined channels tab to 3
$params["max_privmsg"] = 1; // limit the number of private message tab to 1
$params["refresh_delay"] = 2000; // chat refresh speed is 2 secondes (2000ms)
$params["max_msg"] = 30; // max message in the history is 15 (message seen when reloading the chat)
$params["height"] = "230px"; // height of chat area is 230px
$params["debug"] = false; // activate debug console
$params["timeout"] = 600000; // msecs until user is disconnected

return $params;
}

private function createChatHistoryDBTable($tblname) {
$dbr =& wfGetDB( DB_SLAVE );

$sql = "show tables like '$tblname'";
$res = $dbr->query ( $sql ) ;
$num_rows = $dbr->numRows($res) + 0;
$dbr->freeResult( $res );

//create the chathistory table if it doesn't exist
if($num_rows == 0) {
$sql =
"CREATE TABLE IF NOT EXISTS `$tblname` (
`server` varchar(32) NOT NULL default '',
`group` varchar(64) NOT NULL default '',
`subgroup` varchar(64) NOT NULL default '',
`leaf` varchar(64) NOT NULL default '',
`leafvalue` text NOT NULL,
`timestamp` int(11) NOT NULL default 0,
PRIMARY KEY (`server`,`group`,`subgroup`,`leaf`),
INDEX (`server`,`group`,`subgroup`,`timestamp`)
) ENGINE=InnoDB;";
$ret = wfQuery($sql, DB_WRITE, "");
}
}

private function configurePFC_DB_Params($tblname, &$params) {
global $wgDBserver, $wgDBname, $wgDBprefix, $wgDBuser, $wgDBpassword;

$params["container_type"] = "mysql";
$params["container_cfg_mysql_host"] = $wgDBserver;
$params["container_cfg_mysql_database"] = $wgDBname;
$params["container_cfg_mysql_port"] = 3306;
$params["container_cfg_mysql_table"] = $tblname;
$params["container_cfg_mysql_username"] = $wgDBuser;
$params["container_cfg_mysql_password"] = $wgDBpassword;
}

private function showChat($params) {
global $wgOut;

$pfc = new phpFreeChat($params);
$wgOut->addHTML($pfc->printChat(true));
$wgOut->addHTML('<br><br><p>Type /help for a list of all commands</p>');
$wgOut->addWikiText("[http://www.wikichat.org/index.php/WikiChat_help More help on WikiChat.org]");
}

public function onSkinTemplateTabs( &$skin, &$content_actions ) {
global $wgRequest;

$action = $wgRequest->getText( 'action' );

$content_actions['chat'] = array(
'class' => ($action == 'chat') ? 'selected' : false,
'text' => "chat",
'href' => $skin->mTitle->getLocalURL( 'action=chat' )
);

return true;
}

# Needed in some versions to prevent Special:Version from breaking
public function __toString() { return 'WikiChat'; }
} /* class WikiChat */

/* Global function */
# Called from $wgExtensionFunctions array when initialising extensions
function wfSetupWikiChat() {
global $wgWikiChat;
$wgWikiChat = new WikiChat();
}

?>
x66x66
New member
 
Posts: 2
Joined: Sun Aug 07, 2011 3:21 am
Top

Postby re*s.t.a.r.s.*2 » Sun Aug 07, 2011 4:01 am

hi,

Just looking at it, I dont see any problem but you didnt use the code tag to insert the code.. so please use code tags so we can really see whats up with the code...

regards.
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top


Post a reply
2 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 17 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