Description:
This is the cabal instant messenger, so that editors can talk amongst themselves. It requires a quick edit to your database...
(bugfix to original version)
Box Code:
# - A quick way to talk with other editors
# - you need to add a permission called
# "cabal_member" to the "perms" site control. Once
# that is done, you can go into the groups tool
# and give access to your editors, admins, and
# superusers
#
# - add this table to your database
# CREATE TABLE instant_msg (
# msg_id int not null primary key auto_increment,
# uid int not null,
# time datetime not null,
# message varchar(255)
# );
return '' unless ($S->have_perm('cabal_member'));
if($S->{CGI}->param('message')) {
my $s_mesg = $S->{DBH}->quote($S->{CGI}->param('message'));
my $uid = $S->{UID};
my $cols = qq{msg_id, uid, message,time};
my $vals = qq{0, $uid,$s_mesg,NOW()};
my ($rv, $sth) = $S->db_insert({
DEBUG=>0,
INTO=>'instant_msg',
COLS=>$cols,
VALUES=>$vals
});
}
my $date_format = $S->date_format('time', 'short');
# edit the LIMIT line if you'd like more then
# three comments shown at once
my ($rv, $sth) = $S->db_select({
WHAT=>"*,$date_format AS ftime",
FROM=>'instant_msg',
ORDER_BY=>'time desc',
LIMIT=>3
});
my $content = qq{<TABLE>};
while(my $row = $sth->fetchrow_hashref()) {
my $nick = $S->get_nick_from_uid($row->{'uid'});
my $url_nick = $S->urlify($nick);
my $msg = $row->{'message'};
my $ftime = $row->{'ftime'};
$content .= qq{
<tr>
<td width=200 valign=top align=left><a href="/user/$url_nick">$nick</a> - $ftime</td>
<td>$msg</td>
</tr>
<tr>
<td colspan="2" background="/images/dot_line.gif"></td>
</tr>
};
}
$content .= qq{
<tr>
<td colspan=2>
<form method="post">
<input type="text" name="message" size=45 maxlength=255>
<input type="submit" name="submit" value="Post">
- <a href="/im_popup" target="_blank">Show History...</a>
</form>
</td>
</tr>
</table>};
return $content;
|