From 630af0ed6c0af69c7df2e45aef7a87722a3c00c0 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Apr 2013 13:14:47 +0200 Subject: tagging ychat-perl-legacy --- 0.4.7a2/htdocs.pl | 241 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 0.4.7a2/htdocs.pl (limited to '0.4.7a2/htdocs.pl') diff --git a/0.4.7a2/htdocs.pl b/0.4.7a2/htdocs.pl new file mode 100644 index 0000000..61fcd77 --- /dev/null +++ b/0.4.7a2/htdocs.pl @@ -0,0 +1,241 @@ +#!/usr/bin/perl -w + +# yChat - Copyright by Paul C. Bütow + +use CGI; +$q = new CGI; +require config; +print + $q->header; + +##################################### +##WELCHE SUB MUß AUSGEFÜHRT WERDEN?## +##################################### +$var = $q->param("var"); +if ($var eq "help_html") { + &printfile("help.sno","Alle Chatbefehle"); +} elsif ($var eq "logo_html") { + &start_html("Logo"); +print<
+ + + + + + + + + + +
+END +print $q->end_html; +} elsif ($var eq "menu_html") { + $alias = $q->param("alias"); + $tmpid = $q->param("tmpid"); + $room = $q->param("room"); + $col = $q->param("col"); + $secol = $q->param("secol"); + $tmp = $q->param("tmp"); + &menu_html; +} elsif ($var eq "werda_html") { + $alias = $q->param("alias"); + $tmpid = $q->param("tmpid"); + &werda_html; +} elsif ($var eq "logs_html") { + $alias = $q->param("alias"); + $tmpid = $q->param("tmpid"); + &secure_checkid($alias); + &logs_html; +} elsif ($var eq "view_logs_html") { + $alias = $q->param("alias"); + $tmpid = $q->param("tmpid"); + $tmp = $q->param("tmp"); + &secure_checkid($alias); + &hierachie($alias); + if ($hierachie eq "ow" || $hierachie eq "wa") { + &printfile($tmp,"Logdatei","blank"); + } +} elsif ($var eq "superuser_html") { + $alias = $q->param("alias"); + $tmpid = $q->param("tmpid"); + &secure_checkid($alias); + &superuser_html; +} else { + print + $q->start_html(-bgcolor=>"000000"), + $q->end_html; +} + +sub menu_html { +if ($tmp eq "quit") { + &start_html("Quit","blank",""); + print $q->end_html; + &zeit; + &post($room,"($hours:$min:$sec) $alias verläßt den Chat ... "); + sleep 2; + &rm_alias($alias,$room); + exit; +} +ENDJS + &start_html("Menü","blank"); +print < +function fenster(fenster,target) { + open(fenster,target,"width=500,height=500,screenX=100,screenY=100,scrollbars"); +} + +

+ Wer ist da? + Profil ändern + Chatoptionen + Benutzerliste + Chatbefehle
+ Benutzerboard + Superuser + Logs + Top 20 + Home + Credits + Verlassen +

+ + +END +} + +sub werda_html { # Anzeige, wer eingelogt ist. + &start_html("Wer ist da?"); + print < + $alias, schön daß Du hier bist :-) + +
+
+ Folgende Personen befinden sich im Chat: +
+
+
+END + opendir(ROOMDIRS,"data/online/rooms"); + local @roomdirs = readdir(ROOMDIRS); + close(ROOMDIRS); + foreach(@roomdirs) { + if (-e "data/online/rooms/$_" && $_ ne ".." && $_ ne ".") { + my $room = $_; + open(RSTAT,"; + close RSTAT; + my $door = "[Abgesperrt!]" if ($rstat[0] eq "1\n"); + opendir(ROOMDIR,"data/online/rooms/$room"); + my @roomdir = readdir(ROOMDIR); + close(ROOMDIR); + local $nr = $#roomdir-1; + print $q->b( $_ ), + " $door ($nr) Raumthema: $rstat[1]", + $q->br; + foreach(@roomdir) { + if ($_ ne ".." && $_ ne ".") { + print + $q->a( { -href=>"main2.pl?var=alias_html&alias=$alias&tmp=$_&tmpid=$tmpid" }, "$_"), " "; + } + } + print $q->br, $q->br; + } + } + print + "
", + $q->end_html; +} + +sub logs_html { + &start_html("Logdateien"); + print < + Hier befinden sich alle Logdateien + +
+END + &hierachie($alias); + if ($hierachie eq "ow") { + print $q->div( "Folgende Logdateien des Raumes \"Cyberbar\" können nur von Oberwächtern gelesen werden (Sortiert nach A-Z, a-z):" ), + $q->br; + opendir(LOGS,"data/logs"); + local @logs = readdir(LOGS); + closedir(LOGS); + local @sortedir = sort(@logs); + foreach(@sortedir) { + if (-f "data/logs/$_") { + print $q->a( { -href=>"htdocs.pl?alias=$alias&var=view_logs_html&tmp=data/logs/$_&tmpid=$tmpid", + -target=>"_new" }, + "$_" ), + " "; + } + } + } else { + print $q->div( "Logdateien können nur von Oberwächtern (OW) gelesen werden. Du bist jedoch ein Wächter (WÄ) oder ein", + "\"Normaler Chatter\". Oberwächter können alles nachlesen, was öffentlich im Raum \"Cyberbar\" gechattet wurde." ), + $q->hr; + &printfile("data/htdocs/logs_html"); + } + print + $q->end_html; +} + +sub superuser_html { # Zeigt an, wer Superuser ist + &start_html("Superuser"); + print "
Hallo $alias. Du bist als "; + &hierachie($alias); + if ($hierachie eq "ow") { + print + $q->b( "Oberwächter" ), + " (OW) eingetragen.
", + $q->hr; + } elsif ( $hierachie eq "wa") { + print + $q->b( "Wächter" ), + " (WÄ) eingetragen.", + $q->hr; + } else { + print + $q->b( "normaler Chatter" ), + " (NC) eingetragen.", + $q->hr; + } + + my $nrow = $#ows+1; + print + "
", + $q->b( "OW" ), + "s ($nrow Stück)"; + foreach(@ows) { + print + $q->font( { -color=>"FFA500" }, + " ".$_); + } + my $nrwa = $#was+1; + print + "
", + $q->hr, + "
", + $q->b( "WÄ" ), + "s ($nrwa Stück)"; + foreach(@was) { + print + $q->font( { -color=>"FFA500" }, + " ".$_); + } +print < + Die jeweiligen Fähigkeiten der Oberwächter (OW) und der Wächter (WÄ) sind unter + "Chat-Befehle" + dokumentiert. +
+ + +END +} \ No newline at end of file -- cgit v1.2.3