#!/usr/bin/perl #!/usr/local/bin/perl # ------------- # Links # ------------- # Links Manager # # File: aendern.cgi # Beschreibung: Adds a record marked unvalidated to the database and # optionally emails someone. # Author: Alex Krohn # Email: alex@gossamer-threads.com # Web: http://www.gossamer-threads.com/ # Version: 2.01 # # (c) 1998 Gossamer Threads Inc. # # This script is not freeware! Please read the README for full details # on registration and terms of use. # ===================================================================== # # Setup Notes: # Make sure the require statement below points to the config file. # # # German Translation by Nicky # http://www.nicky.net # Deutsches Forum http://forum.nicky.net # Required Librariers # -------------------------------------------------------- eval { ($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX / ($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \ require "admin/links.cfg"; # Ändern Sie dieses zum vollen Pfad zu links.cfg, wenn Sie Probleme haben sollten. require "$db_lib_path/db_utils.pl"; require "$db_lib_path/links.def"; $build_use_templates ? require "$db_lib_path/site_html_templates.pl" : require "$db_lib_path/site_html.pl"; }; if ($@) { print "Content-type: text/plain\n\n"; print "Fehler beim einlesen von dazugehörigen Bibliothek Dateien: $@\n"; print "Überprüfen Sie ob diese existieren, Pfade richtig eingestellt sind, und ob die Dateien richtig CHMOD-ed sind."; exit; } eval { &main; }; if ($@) { &cgierr("Allgemeiner Fehler: $@"); } exit; sub main { # -------------------------------------------------------- local (%in) = &parse_form; if (keys %in != 0) { &process_form; } else { &site_html_modify_form; } } sub process_form { # -------------------------------------------------------- my ($key, $status, @values, $found); # ----------------------------------------------- # Banner-MOD by Martin Bujara # www.linkdb.de # ----------------------------------------------- if ($in{'Width'} > "$bannerw") { &site_html_add_failure ("Bannerbreite zu gross, max. $bannerw Pix."); return; } if ($in{'Height'} > "$bannerh") { &site_html_add_failure ("Bannerhöhe zu gross, max. $bannerh Pix."); return; } local (%original); !$in{'Current URL'} and &site_html_modify_failure ("Sie haben keine URL eingetragen !") and return; open (DB, "<$db_file_name") or &cgierr("Fehler. Kann die Datei bzw. Verzeichnis nicht öffnen: $db_file_name. Grund: $!"); $found = 0; LINE: while () { (/^#/) and next LINE; (/^\s*$/) and next LINE; chomp; @data = &split_decode($_); if ($data[$db_url] eq $in{'Current URL'}) { $in{$db_key} = $data[0]; $found = 1; %original = &array_to_hash (0, @data); last LINE; } } close DB; !$found and &site_html_modify_failure ("Diese URL wurde in der Datenbank nicht gefunden.") and return; foreach $key (keys %add_system_fields) { $in{$key} = $original{$key}; } $in{$db_cols[$db_modified]} = &get_date; $status = &validate_record(%in); if ($status eq "ok") { open (MOD, "<$db_modified_name") or &cgierr ("Fehler. Kann die Datei bzw. Verzeichnis nicht öffnen: $db_modified_name. Grund: $!"); while () { chomp; @values = split /\|/; if ($values[0] eq $in{$db_key}) { close MOD; &site_html_modify_failure("Ihr Antrag auf die Linkänderung wurde bereits abgeschickt."); return; } } close MOD; open (MOD, ">>$db_modified_name") or &cgierr("Fehler. Kann die Datei bzw. Verzeichnis nicht öffnen: $db_modified_name. Grund: $!"); flock(MOD, $LOCK_EX) unless (!$db_use_flock); print MOD &join_encode(%in); close MOD; &send_email; &site_html_modify_success; } else { &site_html_modify_failure($status); } } sub send_email { # -------------------------------------------------------- $db_admin_email or &cgierr("Admin Emailadresse in der links.cfg wurde nicht angegeben!"); my $to = $db_admin_email; my $from = $in{$db_cols[$db_contact_email]}; my $subject = "Linkänderung: $in{'Titel'}"; my $msg = qq| Folgender Link soll geändert werden: ORIGINAL LINK: =============================================== Titel: $original{'Titel'} URL: $original{'URL'} Beschreibung: $original{'Beschreibung'} Name: $original{'Name'} Email: $original{'Email'} Kategorie: $original{'Kategorie'} NEUER LINK: =============================================== Titel: $in{'Titel'} URL: $in{'URL'} Beschreibung: $in{'Beschreibung'} Name: $in{'Name'} Email: $in{'Email'} Kategorie: $in{'Kategorie'} Remote Host: $ENV{'REMOTE_HOST'} Referer: $ENV{'HTTP_REFERER'} Zum updaten klicken Sie hier: $db_script_url Grüsse, Links Manager. |; require "$db_lib_path/Mailer.pm"; my $mailer = new Mailer ( { smtp => $db_smtp_server, sendmail => $db_mail_path, from => $from, subject => $subject, to => $to, msg => $msg, log => $db_mailer_log } ) or return undef; $mailer->send or return undef; }