Wizard.pm 0000666 0000000 0000000 00000002463 07446331276 012627 0 ustar unknown unknown # ==================================================================
# Auto Generated Plugin Configuration - Needed for Web Based Creator.
#
# Plugins::GForum::User_Notification
# Author : Paul Wilson
# Version : 1.0
# Updated : Wed Mar 20 12:50:01 2002
#
# ==================================================================
#
package Plugins::GForum::User_Notification;
# ==================================================================
use strict;
use vars qw/$WIZARD/;
$WIZARD = {
'install' => 'Please install the plugin.',
'meta' => {
'prog_ver' => '1.1.4',
'description' => 'This plugin will email the administrator when a new user signs up to the forum.',
'license' => 'Freeware',
'url' => 'http://www.wiredon.net/',
'author' => 'Paul Wilson',
'version' => '1.0'
},
'menu' => [],
'hooks' => [
[
'do_user_signup',
'POST',
'Plugins::GForum::User_Notification::signup_email',
'LAST'
]
],
'files' => [
[
'new_user.eml',
'user_cgi'
]
],
'uninstall' => 'Don\'t uninstall me. That\'s not a request, it\'s an order.',
'install_code' => '',
'user' => [],
'name' => 'User_Notification',
'uninstall_code' => ''
};
1;
new_user.eml 0000666 0000000 0000000 00000000611 07446331674 013352 0 ustar unknown unknown To: <%admin_email%>
Subject: New User Signup!
From: <%site_title%> <<%admin_email%>>
Hello Admin,
Someone has signed up to <%site_title%>. Their user information follows:
Username: <%user_username%>
Email: <%user_email%>
This user is not yet validated but you can validate them by visiting the following URL:
<%admin_root_url%>/admin.cgi?do=page;page=users_admin_validate.html
Thanks. Install.pm 0000666 0000000 0000000 00000007576 07446331740 013003 0 ustar unknown unknown # ==================================================================
# Plugins::GForum::User_Notification - Auto Generated Install Module
#
# Plugins::GForum::User_Notification
# Author : Paul Wilson
# Version : 1.0
# Updated : Thu Mar 21 10:20:16 2002
#
# ==================================================================
#
package Plugins::GForum::User_Notification;
# ==================================================================
use strict;
use vars qw/$VERSION $DEBUG $NAME $META/;
use GT::Base;
use GT::Plugins qw/STOP CONTINUE/;
use GForum qw/$IN $DB $CFG/;
$VERSION = '1.0';
$DEBUG = 0;
$NAME = 'User_Notification';
# Inhert from base class for debug and error methods
@Plugins::GForum::User_Notification::ISA = qw(GT::Base);
$META = {
'prog_ver' => '1.1.4',
'url' => 'http://www.wiredon.net/',
'license' => 'Freeware',
'description' => 'This plugin will email the administrator when a new user signs up to the forum.',
'author' => 'Paul Wilson',
'version' => '1.0'
};
sub pre_install {
# -------------------------------------------------------------------
# This function displays an HTML formatted message that will display
# to the user any instructions/information before they install
# the plugin.
#
my $inst_msg = 'Please install the plugin.';
my $inst = '
Should the installer overwrite any existing templates for this plugin?
Yes No';
return $inst_msg . $inst;
}
sub pre_uninstall {
# -------------------------------------------------------------------
# This function displays an HTML formatted message that will display
# to the user any instructions/information before they remove the
# plugin.
#
my $uninst_msg = 'Don\'t uninstall me. That\'s not a request, it\'s an order.';
return $uninst_msg;
}
sub install {
# -------------------------------------------------------------------
# This function does the actual installation. It's first argument is
# a plugin manager which you can use to register hooks, install files,
# add menu options, etc. The second argument is a GT::Tar object which
# you can use to access any files in your plugin module.
#
# You should return an HTML formatted string that will be displayed
# to the user.
#
# If there is an error, return undef, and set the error message in
# $Plugins::GForum::User_Notification::error
#
my ($mgr, $tar) = @_;
$mgr->install_hooks ( 'User_Notification', [ ['do_user_signup_submit', 'POST', 'Plugins::GForum::User_Notification::signup_email', 'FIRST'] ]);
# Silence warnings
$GT::Tar::error ||= '';
# The following section will unarchive attached files into the
# proper location.
my $file;
# Copying new_user.eml to the template directory unless it exists.
if ($IN->param('ow')) {
$file = $tar->get_file ('new_user.eml');
$file->name("$CFG->{admin_root_path}/templates/$CFG->{default_template_set}/new_user.eml");
$file->write or return User_Notification->error("Unable to extract file: '$CFG->{admin_root_path}/templates/$CFG->{default_template_set}/new_user.eml' ($GT::Tar::error)", 'WARN');
}
return "The plugin has been successfully installed!";
}
sub uninstall {
# -------------------------------------------------------------------
# This function removes the plugin. It's first argument is
# also a plugin manager which you can use to register hooks, install files,
# add menu options, etc. You should return an HTML formatted string
# that will be displayed to the user.
#
# If there is an error, return undef, and set the error message in
# $Plugins::GForum::User_Notification::error
#
my $mgr = shift;
$mgr->uninstall_hooks ( 'User_Notification', [ ['do_user_signup_submit', 'POST', 'Plugins::GForum::User_Notification::signup_email', 'FIRST'] ]);
;
return "The plugin has been successfully removed!";
}
1;
User_Notification.pm 0000666 0000000 0000000 00000004267 07446331740 015013 0 ustar unknown unknown # ==================================================================
# Plugins::GForum::User_Notification - Auto Generated Program Module
#
# Plugins::GForum::User_Notification
# Author : Paul Wilson
# Version : 1.0
# Updated : Thu Mar 21 10:20:16 2002
#
# ==================================================================
#
package Plugins::GForum::User_Notification;
# ==================================================================
use strict;
use GT::Base;
use GT::Plugins qw/STOP CONTINUE/;
use GForum qw/$IN $DB $CFG/;
# Inherit from base class for debug and error methods
@Plugins::GForum::User_Notification::ISA = qw(GT::Base);
# PLUGIN HOOKS
# ===================================================================
sub signup_email {
# -------------------------------------------------------------------
# Send an email to the administrator when a new user signs up.
# If there was a registration error there are no args.
return unless @_;
send_email('new_user.eml', $_[1]);
return @_;
}
sub send_email {
#--------------------------------------------------------------------
# Send the actual email using the user_signup.eml template.
my ($template, $vars) = @_;
require GT::Mail::Editor;
require GT::Mail;
my $email = GT::Mail::Editor->new(dir => "$CFG->{admin_root_path}/templates", template => ($vars->{user_template} || $CFG->{default_template_set}));
$email->load($template);
my $headers = $email->headers;
my %head;
while (my ($k, $v) = each %$headers) {
my $val = $v; # Copy it
$val = GForum::Template->parse("string", $vars, { string => $val });
$head{$k} = $val;
}
$head{To} ||= $CFG->{admin_email};
$head{From} ||= $CFG->{admin_email};
my $body = $email->body;
$body = GForum::Template->parse("string", $vars, { string => $body });
$CFG->{smtp_server} or $CFG->{mail_path} or die 'No mail path or SMTP server set!';
my $mailer = GT::Mail->new(
%head,
msg => $body,
($CFG->{smtp_server} ? (smtp => $CFG->{smtp_server}) : (sendmail => $CFG->{mail_path}))
);
$mailer->send or return "Unable to send mail: " . $mailer->error;
0;
}
# Always end with a 1.
1;