#!/usr/bin/perl # MimerDesk # Web based groupware and eLearning environment # www.mimerdesk.org # # Copyright (C) 2001 Ionstream Ltd. # www.ionstream.fi # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # This program is distributed with a hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # $Id: chat_userlist.html,v 1.4 2002/06/07 19:19:36 inf Exp $ ############################################ # # # MimerDesk: I-Chat # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # (c) Ionstream OY 1999 - 2001 # # # # Programmed by: Teemu Vainio # # # ############################################ use strict; use vars qw ($APPLICATION $ACTIVEGRP $ARTICLE $MONTH $USER $IP $LAST_ACT $FORWARDED $TIME_USED $IDLE $form $ref $sth $trans); use lib::MimerDesk; use CGI::Carp "fatalsToBrowser"; sub tulosta_tiedosto; sub print_template; $APPLICATION='Communication - Chat'; ########### # Ohjelma # ########### read_config('../config/mimerdesk.cfg'); initialize(); $form = decode_multipart(); $form->{'ID'} =~ tr/0-9//cd; $form->{'auth'} =~ tr/0-9a-z//cd; ($USER, $IP, $LAST_ACT, $FORWARDED, $TIME_USED, $IDLE, $ACTIVEGRP) = authenticate($form->{'ID'}, $form->{'auth'}, $form->{'changeGroup'}); $trans = lib::MimerDesk->new_gettext(program => 'chat_userlist',language => $config{'language'}); $APPLICATION = $trans->gettext('Communication - Chat'); tulosta_tiedosto(); ###################### # Tulostaa tiedoston # ###################### sub tulosta_tiedosto { my ($access, @kayttajat); lock_tables('READ', 'chat_users'); db_list("SELECT * FROM chat_users where USER like '$form->{'kanava'}&%' group by NICK"); while (my $ref = $sth->fetchrow_hashref()) { (undef, $ref->{'USER'}) = split "&", $ref->{'USER'}; if ($ref->{'USER'} eq $USER) {$access = 1;} push @kayttajat, "$ref->{'NICK'}
\n"; } db_end(); unlock_tables(); if (!$access) { # ANNETAAN MONOA vakoojalle } print_template('chat_userlist_ie', \@kayttajat); } ################## # Modulea varten # ################## sub print_template { print_header('pragma'); my ($template, $kayttajat) = @_; $kayttajat = join "", @$kayttajat; $ref = get_template($template); my $fulltemplate = $ref->{$template}; $fulltemplate =~ s/<>/minea/gm; $fulltemplate =~ s/<>/MimerDesk\: $APPLICATION/ms; $fulltemplate = replace_tags($fulltemplate, $USER, $form->{'auth'}, $form->{'ID'}, $TIME_USED); $fulltemplate = add_popups($fulltemplate, $USER, $form->{'auth'}, $form->{'ID'}); lock_tables('READ', "chat_users"); db_list("select count(*) from chat_users where USER like '$form->{'kanava'}%'"); my @maara = $sth->fetchrow_array(); db_end(); unlock_tables(); my $maara = join "", @maara; my $s = 'S' if $maara > 1; $fulltemplate =~ s/<>/$maara/mg; $fulltemplate =~ s/<>/$s/mg; $fulltemplate =~ s/<>/$form->{'kanava'}/mg; $fulltemplate =~ s/<>/$kayttajat/mg; print $fulltemplate; db_end('disconnect'); exit; }