Re: ChatBox (Multi)
Is it possible that the answers in the chat will appera without refreshing the window?
Is there posiibility to make this chat to work like that: whem a person enters the chat he does not see what was written before?
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → ChatBox (Multi)
Is it possible that the answers in the chat will appera without refreshing the window?
Is there posiibility to make this chat to work like that: whem a person enters the chat he does not see what was written before?
Is it possible that the answers in the chat will appera without refreshing the window?
It can be done by using auto refresh on the page, but I don't like it so I don't write it. It should be easy maybe someone has already written that.
Is there posiibility to make this chat to work like that: whem a person enters the chat he does not see what was written before?
If you mean in here that user can have chat likes on instant messaging, if using this code I'm affraid it can't be done but I think ConnorHd is working on other Chatmod too which is using java.
why is the width so big both in IE and FF
http://www.strictlyleft.co.uk/forum/chatbox.php
how can i make it smaller
look for
<label><textarea name="req_message" rows="7" cols="100" tabindex="1"></textarea></label>
I edited mine too so it might be hard to find but I know its at the bottom. the Rows and Cols can change the size of the text box
miowpro the width is follow the width of your forum, but I have made a new one which is only modified the look of it. The idea is put all the box inside table(at left is the room and the right is where users write a messages) plus added whos online at the bottom. But now it can't restrict guest for only looking at the room.
Replace all inside chatbox.php with this
<?php
$pun_root = './';
if (!defined('PUN_ROOT')) define('PUN_ROOT','./');
require $pun_root.'include/common.php';
if ($pun_user['g_read_board'] == '0')
message($lang_common['No view']);
//Hide ChatBox from Guest
if ($pun_user['is_guest'])
message($lang_common['No permission']);
$page_title=pun_htmlspecialchars($pun_config['o_board_title']).' / ChatBox';
require $pun_root.'lang/'.$pun_user['language'].'/'.'chatbox.php';
require $pun_root.'lang/'.$pun_user['language'].'/'.'index.php';
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
###################### Configuration of ChatBox ########################
$hide_smilies = 0; // 1 = hide smilies, 0 = show smilies
$msg_max = 50; // max. messages in chatbox
$file_name = 'chatbox.txt'; // file where there are all messages
$box_height = '217px'; // height of chatbox
########################################################################
require PUN_ROOT.'include/parser.php';
$tpl_room = file_get_contents(PUN_ROOT.$file_name);
$messages = explode("</MESSAGE>", $tpl_room);
$nb_messages = count($messages);
$room = '';
$room_txt = '';
$anti_flood = 0;
if (isset($_GET['action']) && isset($_POST['req_message']))
$room_tmp_flood = '<MESSAGE><ID>'.$pun_user['id'].'</ID><TEXT>'.$_POST['req_message'].'</TEXT>';
else
$room_tmp_flood = '<no_post>';
for($i=0;$i<$nb_messages - 1;$i++)
{
$grab = ereg("<ID>(.*)</ID>", $messages[$i], $mess_id);
$grab = ereg("<PSEUDO>(.*)</PSEUDO>", $messages[$i], $mess_pseudo);
$grab = ereg("<DATE>(.*)</DATE>", $messages[$i], $mess_date);
$grab = ereg("<TEXT>(.*)</TEXT>", $messages[$i], $mess_text);
$room .= '[<a href="profile.php?id='.$mess_id[1].'"><strong>'.pun_htmlspecialchars($mess_pseudo[1]).'</strong></a> - '.format_time($mess_date[1])."]".parse_message($mess_text[1], $hide_smilies)."\n".'<br />'."\n";
if ($i+1 < $msg_max)
{
$room_txt_flood = '<MESSAGE><ID>'.$mess_id[1].'</ID><TEXT>'.$mess_text[1].'</TEXT>';
if ($room_tmp_flood == $room_txt_flood)
$anti_flood = 1;
$room_txt .= '<MESSAGE>'."\r".' <ID>'.$mess_id[1].'</ID>'."\r".' <PSEUDO>'.$mess_pseudo[1].'</PSEUDO>'."\r".' <DATE>'.$mess_date[1].'</DATE>'."\r".' <TEXT>'.$mess_text[1].'</TEXT>'."\r".'</MESSAGE>'."\n\n";
}
}
if (isset($_GET['action']) && isset($_POST['req_message']))
{
if ($anti_flood == 0 && $_POST['req_message'] != '')
{
$fp = fopen(PUN_ROOT.$file_name, "w");
if ($fp)
{
$room_txt = '<MESSAGE>'."\r".' <ID>'.$pun_user['id'].'</ID>'."\r".' <PSEUDO>'.$pun_user['username'].'</PSEUDO>'."\r".' <DATE>'.time().'</DATE>'."\r".' <TEXT>'.$_POST['req_message'].'</TEXT>'."\r".'</MESSAGE>'."\n\n".$room_txt;
$r = fwrite($fp, $room_txt);
}
fclose($fp);
$room = '[<a href="profile.php?id='.$pun_user['id'].'"><strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></a> - '.format_time(time())."]".parse_message($_POST['req_message'], $hide_smilies)."\n".'<br />'."\n".$room;
}
elseif ($anti_flood == 1)
{
$room = '<strong><font color=red>'.$lang_chatbox['Anti flood'].'</font></strong>'."\n".'<br />'."\n".'<br />'."\n".$room;
}
else
{
$room = '<strong><font color=red>'.$lang_chatbox['Anti blank'].'</font></strong>'."\n".'<br />'."\n".'<br />'."\n".$room;
}
}
?>
<h2><span><?php echo $lang_chatbox['Chatbox']; ?></span></h2>
<div class="box">
<table cellspacing="0">
<thead>
<tr>
<th><?php echo $lang_chatbox['Room']; ?></th>
<th><?php echo $lang_chatbox['Messages']; ?></th>
</tr>
</thead>
<tbody>
<tr>
<td valign="top" style="padding:0; margin:0">
<div style="padding:5px;margin:0;overflow:auto;height:<?php echo $box_height; ?>;">
<?php echo $room; ?>
</div>
</td>
<script type="text/javascript">
<!--
function refreshRoom()
{
window.location="<?php echo $pun_root.'chatbox.php' ?>";
}
// -->
</script>
<td valign="top" style="border:none; padding:0; margin:0">
<div class="inbox">
<fieldset>
<form id="post" method="post" name="form_room" action="?action=send" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">
<?php require PUN_ROOT.'mod_easy_bbcode.php'; ?>
<label><textarea name="req_message" rows="7" cols="75" tabindex="1"></textarea></label>
<ul class="bblinks">
<li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
<li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
<li><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a>: <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
</ul>
<p align="right"><input type="submit" name="send" tabindex="2" value=" <?php echo $lang_chatbox['Btn Send']; ?> " /> <input type="button" name="refresh" tabindex="3" value=" <?php echo $lang_chatbox['Btn Refresh']; ?> " onClick="refreshRoom()"></p>
</fieldset>
</form>
</div>
</td>
</tr></table></div>
<div class="box">
<div class="inbox">
<?php
if ($pun_config['o_users_online'] == '1')
{
// Fetch users online info and generate strings for output
$users = array();
$result = $db->query('SELECT user_id, ident, color FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
while ($pun_user_online = $db->fetch_assoc($result))
{
if ($pun_user_online['user_id'] > 1)
$users[] = "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_user_online['user_id'].'"><span style="color: '.$pun_user_online['color'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</span></a>';
}
$num_users = count($users);
if ($num_users > 0)
echo "\t\t\t".'<dl id="onlinelist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].': </strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";
else
echo "\t\t\t".'<div class="clearer"></div>'."\n";
}
else
echo "\t\t".'</dl>'."\n\t\t\t".'<div class="clearer"></div>'."\n";
?>
</div>
</div>
<br />
<?php
require PUN_ROOT.'footer.php';
and then add at lang/LANGUAGE/chatbox.php
'Room' => 'Room',
Enjoy
here is a french mod
add at lang/LANGUAGE/chatbox.php
'Room' => 'pièce',
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → ChatBox (Multi)
Powered by PunBB, supported by Informer Technologies, Inc.