#!/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: vision.html,v 1.5 2002/06/06 14:58:02 inf Exp $ ########################################### # # # MimerDesk: I-vision # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # (c) Ionstream Oy 1999 - 2001 # # # # Programmed by: Teemu Arina # # # ########################################### # Asetukset ################################## use strict; use vars qw ($APPLICATION $ACTIVEGRP $ARTICLE $MONTH $USER $IP $LAST_ACT $FORWARDED $TIME_USED $IDLE $form $ref $sth %colors $mode); use lib::MimerDesk; use CGI::Carp "fatalsToBrowser"; $APPLICATION = 'Tools - TV broadcaster'; $mode = 'news'; %colors = ( blue => '#484F62', green => '#4D5E53', yellow => '#5F5B38', red => '#643334', lila => '#583F57', brown => '#634129', navy => '#2D4847', grey => '#4D4A4D' ); sub print_template; sub wrapper; # Ohjelma ################################## my ($admin_status, $all_count); $config{'theme'} = 'default'; read_config('../config/mimerdesk.cfg'); lock_tables('READ', 'configuration'); db_list("SELECT * FROM configuration"); while (my $ref = $sth->fetchrow_arrayref()) {$config{$ref->[0]} = $ref->[1] if !$config{$ref->[0]};} db_end(); unlock_tables(); initialize(); $form = decode_multipart(); $form->{'ID'} =~ tr/0-9//cd; $form->{'auth'} =~ tr/0-9a-z//cd; if (get_ipaddress() ne $config{'broadcast_ip'}) { ($USER, $IP, $LAST_ACT, $FORWARDED, $TIME_USED, $IDLE, $ACTIVEGRP) = authenticate($form->{'ID'}, $form->{'auth'}, $form->{'changeGroup'}); lock_tables('READ', "users"); db_list("SELECT flags FROM users where nimi = '$USER'"); while (my $ref = $sth->fetchrow_hashref()) {$admin_status = $ref->{'flags'};} db_end(); unlock_tables(); print_template("$config{'theme'}_accfailure") if $admin_status !~ /T0/; } $all_count = row_count('visionnews'); $config{'article_count'} = $all_count if 0 > ($all_count - $config{'article_count'}); $form->{'count'} = 1 if !($form->{'count'}); if ($form->{'go'} eq 'wrapper') {wrapper('vision_wrapper');} else {print_template('vision_news');} exit; # Aliohjelmat ################################## ############################### # Lue template ja tulosta se # ############################### sub print_template { my($num, $sqlput, $headline, $date, $sender, $article, $background, $fontsize, $fulltemplate, $form_count_new); my $template = shift; print_header('pragma'); ($form->{'count'}) = prepare_fordb($form->{'count'}); lock_tables('READ', "visionnews"); db_list("SELECT background, headline,date,sender,news,fontsize FROM visionnews order by number DESC LIMIT $form->{'count'}"); while (my $ref = $sth->fetchrow_hashref()) { $headline = $ref->{'headline'}; $date = $ref->{'date'}; $sender = $ref->{'sender'}; $article = $ref->{'news'}; $background = $ref->{'background'}; $fontsize = $ref->{'fontsize'}; } db_end(); unlock_tables(); ($article, $date, $sender, $headline) = html_escape($article, $date, $sender, $headline); $article = itag_replacer($article); $article =~ s/\r?\n/
/mg; if ($form->{'count'} <= $config{'article_count'}) {$form_count_new = $form->{'count'} + 1;} if ($form_count_new > $config{'article_count'}) {$form_count_new = 1;} $ref = get_template($template); $fulltemplate = $ref->{$template}; my (undef,$min,$hour,$mday,$mon,$year) = utc_epoch2date(time()); $fulltemplate =~ s/<>/$mday.$mon.$year $hour:$min/m; $fulltemplate =~ s/<>/$date/m; $fulltemplate =~ s/<>/$form->{'count'} \/ $config{'article_count'}/m; $fulltemplate =~ s/<>/$colors{$background}/gm; $fulltemplate =~ s/<>/${background}grid.gif/mg; $fulltemplate =~ s/<>/- $sender/m; $fulltemplate =~ s/<>/$article/m; $fulltemplate =~ s/<>/$fontsize/gm; $fulltemplate =~ s/<>/$headline/mg; $fulltemplate =~ s/<>/$config{'vision_delay'}/m; $fulltemplate =~ s/<>/$form_count_new/m; $fulltemplate =~ s/<>/$mode/m; $fulltemplate = replace_tags($fulltemplate, $USER, $form->{'auth'}, $form->{'ID'}, $TIME_USED); print $fulltemplate; db_end('disconnect'); exit; } ############################## # Lue wrapper ja tulosta se # ############################## sub wrapper { my($num, $sqlput, $fulltemplate); my $template = shift; print_header('pragma'); $ref = get_template($template); $fulltemplate = $ref->{$template}; $fulltemplate = replace_tags($fulltemplate, $USER, $form->{'auth'}, $form->{'ID'}, $TIME_USED); print $fulltemplate; db_end('disconnect'); exit; }