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.7.2/modules/divcom.pm | 260 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100644 0.7.2/modules/divcom.pm (limited to '0.7.2/modules/divcom.pm') diff --git a/0.7.2/modules/divcom.pm b/0.7.2/modules/divcom.pm new file mode 100644 index 0000000..38685bf --- /dev/null +++ b/0.7.2/modules/divcom.pm @@ -0,0 +1,260 @@ +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_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\n\n\n\n \n \n \n \n \n \n \n \n \n \n
\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; + } + $msg =~ s//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 ... "); + &gb_html('post_ok');### + $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\n\n"; +} +sub alias_html { + my $message = $_[0]; + open COUNTS, "; + close COUNTS; + ++$counter; + open COUNTS, ">data/user/counts/$tmp"; + print COUNTS $counter; + close COUNTS; + &start_html($tmp); + &menu(); + print ""; + if ($message eq 'rm_ok') { + print "
\n Meldung:\n
\n
\n Der von Dir gew\344hlte Eintrag wurde erfolgreich gel\366scht.\n
\n
\n"; + } + elsif ($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"; + } + open PROFILE, "; + close PROFILE; + print qq[
\n Dieses Profil wurde insgesamt schon $counter mal aufgerufen !\n

Alias: $tmp\n

Nachname: $data[0]\n

Vorname: $data[1]\n

Alter: $data[2]\n

Wohnort: $data[3]\n

E-Mail:\n $data[4]\n

ICQ-Nummer: $data[5]\n

Homepage: $data[6]\n

Weiteres:
$data[7]\n
\n Hier kannst Du $tmp eine Nachricht hinterlassen!\n
\n \n \n \n \n \n \n \n \n \n
\n
\n]; + if (-e "data/user/gbooks/$tmp") { + &error("Konnte data/user/gbooks/$tmp nicht \366ffnen") unless open DATEI, "; + close DATEI; + my $nr = 1; + if ($alias ne $tmp) { + foreach $_ (@datei) { + print "
Eintrag # $nr: $_"; + ++$nr; + } + } + else { + print qq[ \n \n \n \n \n \n \n]; + for ($i = 0; $i <= $#datei; ++$i) { + print qq[ \n \n \n \n]; + ++$nr; + } + print qq[
\n \n \n
\n
\n Eintrag # $nr:\n $datei[$i]\n
\n
\n \n \n \n \n \n
\n \n \n \n \n \n \n \n
\n \n]; + } + } + print $q->end_html; +} +sub edit_html { + my($method, $message) = @_; + &start_html("Benutzerprofil \344ndern"); + if ($method eq 'edit_options_html') { + open DATEI, "; + close DATEI; + foreach $_ (@data) { + chomp $_; + } + &menu(); + if ($method eq 'edit_options_html') { + if ($message eq 'edit_options_ok') { + print "
\n Hinweis:\n
\n
\n Du hast soeben Deine Chat-Optionen erfolgreich editiert. Hier kannst Du Dein Profil erneuert editieren. Um\n weiterzuchatten einfach Fenster schliessen!\n
\n
\n"; + } + elsif ($message eq 'edit_pw_wrong') { + print "
\n ACHTUNG!\n
\n
\n Du hast soeben versucht, dein Passwort zu \344ndern. Jedoch stimmte die Erste Eingabe nicht mit der Zweiten \374berein.\n Bitte versuch es erneuert ...\n
\n
\n"; + } + else { + print $q->div('Hier kannst Du Deine Chat-Optionen editieren!'), $q->hr; + } + print qq[\n\n
\n \n \n \n \n \n \n \n
\n
\n Dein Passwort\n \n (Gut merken !!)\n \n
\n \n
\n
\n \n
\n Geb hier das Passwort erneuert ein:\n
\n \n
\n
\n
\n
Einstellungen f\374r den Nachrichten-Verlauf
\n \n \n \n \n \n \n \n
\n
\n
Anzahl der Nachrichten im Verlauf (Standart = 10)
\n \n \n \n
\n
\n
Wie sollen die Nachrichten im Verlauf angeordnet sein?
\n \n \n \n
\n
\n
PS: Einstellungen des Nachrichten-Verlaufs werden erst nach einem Neueinloggen aktualisiert.
\n
\n \n \n \n \n \n \n
\n
\n \n Auswahl von Farbe 1\n
\n (Farbe Deines Nicks):\n
\n \n
\n
\n \n
\n \n Auswahl von Farbe 2\n
\n (Farbe Deiner Nachrichten):\n
\n \n
\n
\n
\n
\n Beliebige Auswahl markieren und Farbe w\344hlen. Um Deine Optionen abzuspeichern,\n auf "Daten \344ndern" klicken!\n
\n
\n]; + open COLORS, '; + close COLORS; + print @colors; + } + elsif ($method eq 'edit_profile_html') { + if ($message eq 'edit_profile_ok') { + print "
\n Hinweis:\n
\n
\n Du hast soeben Dein Profil erfolgreich editiert. Hier kannst Du Dein Profil erneuert editieren:\n
\n"; + } + else { + print $q->div('Hier kannst Du Dein Profil editieren!'), $q->hr; + } + print qq[ \n \n
\n Dein Nachname:\n
\n \n
\n
\n
\n Dein Vorname:\n
\n \n
\n
\n
\n Dein Alter:\n
\n \n
\n
\n
\n Dein Wohnort:\n
\n \n
\n
\n
\n Deine E-Mail Adresse:\n
\n \n
\n
\n
\n Deine ICQ-Nummer:\n
\n \n
\n
\n
\n Deine Homepage:\n
\n \n
\n
\n
\n Weiteres:\n
\n \n
\n]; + } + print qq[
\n \n \n \n \n \n \n \n \n\n\n]; +} +sub edit { + my $method = $_[0]; + if ($method eq 'edit_profile') { + my $url = $homepage; + $url =~ s[^http://*][]; + open PROFILE, ">data/user/profiles/$alias"; + my $profile = "$nachname\n$vorname\n$alter\n$wohnort\n$email\n$icq\nhttp://$url\n$weiteres"; + $profile =~ s/shutdown(2); + exit 0; + } + open OPTIONS, ">data/user/options/$alias"; + my $options = "$id\n$col\n$secol\n$maxVerlauf\n$verlaufOrder"; + $options =~ s/' . ×tring . " $alias hat seine Chat-Einstellungen geändert ...
", $alias); + &post_strmsg($alias, $room, 'col', "$col;$secol"); + &edit_html('edit_options_html', 'edit_options_ok'); + } +} +1; -- cgit v1.2.3