Hilfe bei Flashchat Modul (fehlerhaft) gesucht
am 29.07.2010 - 17:51 Uhr in
Hallo Leute, wenn ich mit Drupal 6.17 das Flashchat Modul für den Flashchat 6.0.8 verwende und den Block Flashchat aktiviere, bekomme ich die Fehlermeldung
Call to a member function next() on a non-object in...
next ist aber keine member function, sondern gehört zu php dazu. Was könnte da falsch laufen?
Nachdem ich 2 Zeilen auskommentiert hatte, die die Funktion next() aufrufen, wurde zumindest der Block dann angezeigt und die Seite war wieder nutzbar. Allerdings werden so keine Räume und keine Chatter angezeigt.
Wer könnte mir bei der Lösung des Problems helfen? Ich habe jetzt alternativ ein unbeliebts iframe eingebunden, welches die info-embedded.php des Chats aufruft.
Eine Frage nebenbei: Besteht die Möglichkeit, die Chatteranzeige mittels ajax wie bei der Shoutbox zu aktualisieren? Es wäre sehr von Vorteil, wenn es dazu im Konfigurationsmenü eine Möglichkeit geben würde. Leider sind meine Kenntnisse bezgl Drupal noch annähernd bei Null, um es selbst zu verwirklichen.
Der Quelltext des Moduls sieht folgendermaßen aus:
<?php
// $Id: flashchat.module,v 1.2 2009/01/21 16:45:00 Veronica Exp $
/**
* Valid permissions for this module
* @return array An array of valid permissions for the flashchat_block module
*/
function flashchat_menu() {
$items['admin/settings/flashchat'] = array(
'title' => 'FlashChat Parameters',
'description' => 'Configure and translate parameters for the FlashChat block',
'page callback' => 'drupal_get_form',
'page arguments' => array('flashchat_admin_settings'),
'access arguments' => array('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
'file' => 'flashchat.admin.inc',
);
$items['flashchat/%/%/%'] = array(
'title' => '',
'page callback' => 'page_embed_flashchat',
'page arguments' => array(1, 2, 3),
'access arguments' => array('access flashchat'),
'type' => MENU_CALLBACK,
'access' => TRUE,
'access callback' => TRUE,
);
return $items;
}
function flashchat_help($path, $arg=null) {
switch ($path) {
case 'admin/help#flashchat':
return '';
case 'admin/settings/flashchat':
return '<p>'. t('Modify all the Texts and Links in the FlashChat "Who\'s in chat" block.
<br>Include/Exclude Chat and Admin Panel Links
<br>How to open FlashChat: Embedded or Standalone
<br>Heading line may be modified in the FlashChat SiteBuilding->Blocks configuration menu') . '</p>';
}
}
function page_embed_flashchat($width, $height, $chat) {
$list = t('<p><iframe width="' . $width . '" height="' . $height . '" src="' . base_path() . $chat . '/flashchat.php"></iframe></p>');
return $list;
}
/**
* Generate HTML for the flashchat block
* @param op the operation from the URL
* @param delta offset
* @returns block HTML
*/
function flashchat_block($op = 'list', $delta = 0) {
$block = array();
if($op == 'list') {
$block[0]["info"] = t('FlashChat: Who\'s in chat');
return $block;
} else if ($op == 'view') {
ob_start();
$block['subject'] = 'Who\'s in chat';
$chat = variable_get('flashchat_chatdir_default', 'chat') . '/';
$fc_admin = variable_get('flashchat_fcAdmin_default', '(A)');
$fc_moderator = variable_get('flashchat_fcModerator_default', '(M)');
$fc_user = variable_get('flashchat_fcUser_default', '');
$noUser = variable_get('flashchat_noUser_default', '[USERNUMBER] users');
$singleUser = variable_get('flashchat_singleUser_default', '[USERNUMBER] user');
$multipleUsers = variable_get('flashchat_multipleUsers_default', '[USERNUMBER] users');
$singleRoom = variable_get('flashchat_singleRoom_default', '[ROOMNUMBER] room');
$multipleRooms = variable_get('flashchat_multipleRooms_default', '[ROOMNUMBER] rooms');
$fullTextLine = variable_get('flashchat_fullTextLine_default', '[USERTEXT] in [ROOMTEXT]');
$roomSuffix = variable_get('flashchat_roomSuffix_default', '([USERSINROOM])');
$chatLinkText = trim(variable_get('flashchat_chatLink_default', 'Goto the Chat'));
$chatLinkTitle = variable_get('flashchat_chatLinkTitle_default', 'Open chat in new browser window');
$chatEmbedSwitch = variable_get('flashchat_chatEmbedSwitch_default', 'yes');
$chatEmbedPageHeight = variable_get('flashchat_chatEmbedHeight_default', '600px');
$chatEmbedPageWidth = variable_get('flashchat_chatEmbedWidth_default', '100%');
$chatNewPage = 'target="' . variable_get('flashchat_chatNewPage_default', 'flashchat') . '"';
$adminPanel = trim(variable_get('flashchat_adminPanel_default', 'FlashChat Admin Panel'));
$moderatorPanel = trim(variable_get('flashchat_moderatorPanel_default', 'FlashChat Moderator Panel'));
if(file_exists($chat . 'inc/common.php')) {
if($chatLinkText) {
if($chatEmbedSwitch == 'no') $chatLink = '<a href="' . base_path() . $chat . 'flashchat.php" ' . $chatNewPage . ' title="' . $chatLinkTitle . '" alt="' . $chatLinkTitle . '">' . $chatLinkText . '</a><br>
<iframe width="100%" frameborder="0" border="0" src="'.base_path().$chat.'info_embedded.php"></iframe>';
else $chatLink = '<a href="' . base_path() . '?q=flashchat/' . $chatEmbedPageWidth . '/' . $chatEmbedPageHeight . '/' . variable_get('flashchat_chatdir_default', 'chat') . '" ' . $chatNewPage . ' title="' . $chatLinkTitle . '" alt="' . $chatLinkTitle . '">' . $chatLinkText . '</a><br>';
} else $chatLink = '';
require_once($chat . 'inc/common.php');
if(substr($GLOBALS['fc_config']['version'], 0, 1) > '4') $temp = 'temp/'; else $temp = '';
$GLOBALS['fc_config']['appdata_path'] = $chat . $temp . 'appdata/appTime.txt';
$GLOBALS['fc_config']['botsdata_path'] = $chat . $temp . 'appdata/bots.txt';
ChatServer::purgeExpired();
/**
Retrieves the number of users who are chatting in any room.
Leave the $room parameter empty to return the number of users in all room.
*/
function numusers($room = "") {
if($room) {
$stmt = new Statement("SELECT COUNT(*) AS numb FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND userid <> ? AND roomid=?");
$rs = $stmt->process(SPY_USERID, $room);
} else {
$stmt = new Statement("SELECT COUNT(*) AS numb FROM {$GLOBALS['fc_config']['db']['pref']}connections,{$GLOBALS['fc_config']['db']['pref']}rooms
WHERE userid IS NOT NULL AND userid <> ? AND ispublic IS NOT NULL
AND {$GLOBALS['fc_config']['db']['pref']}connections.roomid = {$GLOBALS['fc_config']['db']['pref']}rooms.id");
$rs = $stmt->process(SPY_USERID);
}
//$rec = $rs->next(); <<<<<< diese Zeile habe ich vorläufig auskommentiert >>>>>>>>>>>>>>>>>>>>>
return $rec?$rec['numb']:0;
}
/**
Retrieves a list of the users (by login ID) who are in $room.
Leave the $room parameter empty to return a list of all users in all rooms.
*/
function usersinroom($room = "") {
$list = array();
if($room) {
$stmt = new Statement("SELECT userid, state, color, lang, roomid FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND userid <> ? AND roomid=?");
$rs = $stmt->process(SPY_USERID, $room);
} else {
$stmt = new Statement("SELECT userid, state, color, lang, roomid FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND userid <> ?");
$rs = $stmt->process(SPY_USERID);
}
while($rec = $rs->next()) {
$usr = ChatServer::getUser($rec['userid']);
$usr['profileLink'] = str_replace('../', '', ChatServer::getUserProfile($rec['userid']));
if($usr == null && $GLOBALS['fc_config']['enableBots']) $usr = $GLOBALS['fc_config']['bot']->getUser($rec['userid']);
$list[] = array_merge($usr, $rec);
}
return $list;
}
/**
Retrieves a list of all available rooms, as an array.
*/
function roomlist() {
$list = array();
// populate $list with the names of all available rooms
$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE ispublic IS NOT NULL order by ispermanent");
$rs = $stmt->process();
//while($rec = $rs->next()) $list[] = $rec; <<<<<<<<<<<<<<<<<< Diese Zeile habe ich vorerst auskommentiert >>>>>>>>>>>>>>>>>>>>>>>>
//result will be an array of arrays like ('id' => <room id>, 'updated' = <timestamp>, 'created' => <timestamp>, 'name' => <room name>, 'ispublic' => <public flag>, 'ispermanent' => <autoclose flag>)
return $list;
}
$rooms = roomlist();
$roomnumb = sizeof($rooms);
$usernumb = numusers();
if($chatLink) echo '
' . $chatLink;
$currentUserId = chatServer::isLoggedIn();
if($adminPanel && chatServer::userInRole($currentUserId, ROLE_ADMIN)) echo '
<a href=' . base_path() . $chat . 'admin.php target=flashchatadmin>'. $adminPanel . '</a><br>';
if($moderatorPanel && chatServer::userInRole($currentUserId, ROLE_MODERATOR)) echo '
<a href=' . base_path() . $chat . 'admin.php target=flashchatmoderator>' . $moderatorPanel . '</a><br>';
if($usernumb == 0) $userText = str_replace('[USERNUMBER]', $usernumb, $noUser);
elseif($usernumb == 1) $userText = str_replace('[USERNUMBER]', $usernumb, $singleUser);
else $userText = str_replace('[USERNUMBER]', $usernumb, $multipleUsers);
if($roomnumb == 1) $roomText = str_replace('[ROOMNUMBER]', $roomnumb, $singleRoom);
else $roomText = str_replace('[ROOMNUMBER]', $roomnumb, $multipleRooms);
if($roomnumb) {
foreach($rooms as $room) {
echo '<li class="leaf first">' . $room['name'];
if(numusers($room['id']) > 0 && $roomSuffix) echo ' ' . str_replace('[USERSINROOM]', numusers($room['id']), $roomSuffix);
$users = usersinroom($room['id']);
if($users) {
echo "<ul class=\"menu\">";
foreach($users as $user) {
if($user['roles'] == ROLE_ADMIN) $r = $fc_admin;
elseif($user['roles'] == ROLE_MODERATOR) $r = $fc_moderator;
else $r = $fc_user;
echo "<li class=\"leaf first\">
<a href=" . $user['profileLink'] . " target=_blank>" . $user['login'] . "</a> " . $r . "
</li>";
}
echo "</ul>";
}
echo "</li>";
}
}
echo '</ul>';
} else {
echo '<b>Error:</b><br>Your "' . variable_get('flashchat_chatdir_default', 'chat') . '" directory was not found
<br><b>Solutions:</b><br>Update the FlashChat Module parameter "FlashChat installation directory" with the directory name where you have FlashChat installed
<br>in <a href=' . base_path() . '/admin/settings/flashchat>FlashChat Settings</a> or
<a href=' . base_path() . '/admin/build/modules>deactivate</a> the FlashChat Module';
}
$block['content'] = ob_get_clean();
return $block;
}
}
- Anmelden oder Registrieren um Kommentare zu schreiben
Sowas kommt in die issue
am 30.07.2010 - 00:31 Uhr
Sowas kommt in die issue queue des Projekts.
Danke! Das muss man ja auch
am 30.07.2010 - 05:40 Uhr
Danke!
Das muss man ja auch erstmal wissen. ;-)
Für mich ist ein Forum immer der erste Anlaufpunkt gewesen. Aber nicht schlecht, wenn es für solche Fälle bei Drupal direkt einen Bereich gibt. Dann werde ich mich später mal drum kümmern, das dort einzustellen.