sub divcom {
if ($var eq 'list_alias_html') {
&list_alias_html;
}
elsif ($var eq 'alias_html') {
&alias_html;
}
elsif ($var eq 'edit_profile_html') {
&secure_checkid($alias, $tmpid);
&edit_html('edit_profile_html');
}
elsif ($var eq 'edit_options_html') {
&secure_checkid($alias, $tmpid);
&edit_html('edit_options_html');
}
elsif ($var eq 'gb_html') {
&gb_html;
}
elsif ($var eq 'post_gb') {
&secure_checkid($alias, $tmpid);
&post_gb;
}
elsif ($var eq 'edit_profile') {
&secure_checkid($alias, $tmpid);
&edit('edit_profile');
}
elsif ($var eq 'edit_options') {
&secure_checkid($alias, $tmpid);
&edit('edit_options');
}
elsif ($var eq 'rm_gb_alias') {
&secure_checkid($alias, $tmpid);
&rm_gb;
}
else {
&error('Parameter fehlt');
}
}
sub gb_html {
my ($message,$method) = @_;
unless ($method eq 'loggedin') {
&start_html('Benutzerboard');
&menu();
}
if ($message eq 'post_empty') {
print "
\n ACHTUNG!\n
\n \n Du wolltest soeben einen leeren Eintrag posten. Bitte schreib\n \n zuerst\n \n einen Text und poste\n dann\n !\n
\n
\n";
}
elsif ($message eq 'post_less') {
print " \n ACHTUNG!\n
\n \n Ein Eintrag muss mindestens aus 30 Zeichen bestehen ...\n
\n
\n";
}
elsif ($message eq 'post_ok') {
print " \n Meldung:\n
\n \n Vielen Dank f\374r Deinen Beitrag. Wenn Du willst, kannst Du jetzt gleich noch einen Eintrag posten ...\n
\n
\n";
}
else {
print " \n Falls Du Anregungen oder Verbesserungsvorschl\344ge f\374r die Community hast, dann poste doch einen kleinen Eintrag :-)\n
\n
\n";
}
print qq[ \n
\n];
if (-e 'data/guestbook') {
&error("Konnte dat/guestbook nicht \366ffnen") unless open DATEI, ';
close DATEI;
print $q->div(@datei);
}
print $q->end_html;
}
sub post_gb {
my($secs, $mins, $hours, $days, $months, $years) = &timearray;
if ($msg eq '') {
if ($id eq 'y') {
if ($method eq 'loggedin') {
&loggedin('post_empty');
} else {
&gb_html('post_empty');
}
}
else {
&alias_html('post_empty');
}
$client->shutdown(2);
exit 0;
}
if (length($msg) < 30) {
if ($id eq 'y') {
if ($method eq 'loggedin') {
&loggedin('post_less');
} else {
&gb_html('post_less');
}
}
else {
&alias_html('post_less');
}
$client->shutdown(2);
exit 0;
}
$msg =~ s/</g;
$msg =~ s/\n/
/g;
my $tmpath = '';
if ($id eq 'y') {
$tmpath = 'data/guestbook';
}
else {
$tmpath = "data/user/gbooks/$tmp";
}
open GB, "$tmpath";
my(@gb) = ;
close GB;
pop @gb if $#gb > 99;
my(@newdatei) = "
$alias schrieb am $days.$months.$years um $hours:$mins:$secs ...
$msg
\n";
push @newdatei, @gb;
open GB, ">$tmpath";
print GB @newdatei;
close GB;
if ($id eq 'y') {
if ($method eq 'loggedin') {
&loggedin('post_ok');
} else {
&gb_html('post_ok');
}
$client->shutdown(2);
exit 0;
}
&post_prv ($tmp, "$alias hat soeben einen Pin in Dein Profil geh\344ngt ... ");
&alias_html;
$client->shutdown(2);
exit 0;
}
sub rm_gb {
open GB, ";
close GB;
my(@newgbfile) = ();
for ($i = 0; $i <= $#gbfile; ++$i) {
push @newgbfile, $gbfile[$i] if $i != $id;
}
open GB, ">data/user/gbooks/$alias";
print GB @newgbfile;
close GB;
&alias_html('rm_ok');
}
sub list_alias_html {
&start_html('Alle Benutzer');
opendir REGISTERED, 'data/user/options';
my(@users) = readdir REGISTERED;
closedir REGISTERED;
my(@liste) = sort(@users);
my $nr = $#users - 1;
&menu();
print " \n Es sind z.Z. genau $nr Benutzernamen in der Datenbank vorhanden! (Sortiert nach #, A-Z, a-z)\n
\n
\n \n";
foreach $_ (@liste) {
if (-f "data/user/options/$_") {
print $q->a({-'href', "chat?request=divcom&var=alias_html&alias=$alias&tmp=$_&tmpid=$tmpid"}, "$_"), ' ';
}
}
print "
\n