/weblogs/lon-web-1/httpd-error.log:Column 'connection' in Jonbaglo::Database::Clan_Applications clashes with built-in method at /home/lsrfm/webs/www.lsrfm.com/perllib/Jonbaglo/Application/Clan_Application.pm line 11
####
package Jonbaglo::Application::Clan_Application;
use strict;
use warnings;
use base qw(LSRfm::Base);
use Apache::Reload;
use CGI;
use Class::Date;
use Jonbaglo::Database::Clan_Applications;
use Jonbaglo::Database::Clan_Shows;
use Jonbaglo::Database::Clan_Scripts;
sub setup {
my $self = shift;
$self->start_mode('index');
$self->run_modes([qw/index
form add_process dsp_single single_process dsp_all dsp_single_detailed public_clan
script add_show_process add_script_process/]);
#clan_app
#script_app
#script? edit delete
}
sub index {
my $self = shift;
my $html_template = $self->param('jonbaglo_template');
my $output;
$html_template->process('jonbaglo/form',
{
process => "index",
},
\$output) || die $html_template->error;
return $output;
}
sub form {
my $self = shift;
my $errs = shift;
my $html_template = $self->param('jonbaglo_template');
my $output;
$html_template->process('jonbaglo/form',
{
process => "form",
errors => $errs,
},
\$output) || die $html_template->error;
return $output;
}
sub add_process {
my $self = shift;
my $html_template = $self->param('jonbaglo_template');
my $mail_template = $self->param('mail_template');
my $q = $self->query;
my $script = $q->script_name;
#restraints
my ($results, $err_page) = $self->check_rm('form',
{
required => [qw/lastname
gamertag
forumuser
email
location
clan
agree/],
optional => [qw/firstname
connection
exp
good
online/],
constraints => {email => 'email'},
# dependencies => {
# a => {
# other => [qw/ /]
# }
# },
filters => ['trim'],
msgs => {
missing => 'required',
invalid => 'invalid'
}
});
return $err_page if $err_page;
#initial non form supplied values
my $accepted = "no";
my $rank = "n/a";
#run sql
Jonbaglo::Database::Clan_Applications->create({'firstname' => $q->param('firstname'),
'lastname' => $q->param('lastname'),
'gamertag' => $q->param('gamertag'),
'forumuser' => $q->param('forumuser'),
'email'=> $q->param('email'),
'location' => $q->param('location'),
'connection' => $q->param('connection'),
'exp' => $q->param('exp'),
'good' => $q->param('good'),
'online' => $q->param('online'),
'clan' => $q->param('clan
'),
'agree' => $q->param('agree'),
'datetime' => Class::Date->now(),
'accepted' => $accepted,
'rank' => $rank,
# acc datetime left blank
});
#email
##fetch just added id number for use in email and thus for 'activation'
my $id = Jonbaglo::Database::Clan_Applications->search(gamertag => $q->param('gamertag'));
# set vars
my $vars = {
id => $id,
firstname => $q->param('firstname'),
lastname => $q->param('lastname'),
gamertag => $q->param('gamertag'),
forumuser => $q->param('forumuser'),
email => $q->param('email'),
location => $q->param('location'),
};
#send an email with the details
$mail_template->process('jonbaglo/email',
$vars,
'jonbaglo@hotmail.com',#to
# 'barrycarlyon@hotmail.co.uk',#to
"$vars->{'firstname'} $vars->{'lastname'} <$vars->{'email'}>",#from
"$vars->{'gamertag'} wants to join the clan!");#subject
#output
my $output;
$html_template->process('jonbaglo/form',
{
process => "thanks",
},
\$output) || die $html_template->error;
return $output;
}
sub dsp_single {
my $self = shift;
my $html_template = $self->param('jonbaglo_template');
my $cgi = CGI->new;
my $userid = $cgi->param('userid');
my @user = Jonbaglo::Database::Clan_Applications->search(id => $userid);
my $output;
$html_template->process('jonbaglo/form',
{
process => "single",
user => \@user,
},
\$output) || die $html_template->error;
return $output;
}
sub single_process {
my $self = shift;
my $html_template = $self->param('jonbaglo_template');
my $mail_template = $self->param('mail_template');
my $q = $self->query;
my $script = $q->script_name;
#no restraints
#determin process, choice: yes no_change no proc: email and update yn, no_ sned email standby
#set initial vars
my $yes = 'yes';
my $no = 'no';
my $id = $q->param('id');
my $vars;
my $choice;
my $text;
#if options
if ($q->param('activate') eq "no")
{
# set vars for no email
$choice = "Unsuccessful, you are welcome to try again!";
$vars = {
email => $q->param('email'),
gamertag => $q->param('gamertag'),
choice => $q->param('choice'),
comments => $q->param('comments'),
};
}
elsif ($q->param('activate') eq "yes")
{
#set vars
$choice = "Successful";
$text = "You Entry Role is:";
$vars = {
email => $q->param('email'),
gamertag => $q->param('gamertag'),
choice => $choice,
roletext => $text,
role => $q->param('role'),
comments => $q->param('comments'),
};
}
else #nc
{
# set vars for consideration email
$choice = "entered into consideration!";
$vars = {
email => $q->param('email'),
gamertag => $q->param('gamertag'),
choice => $q->param('choice'),
comments => $q->param('comments'),
};
}
#run sql del, and add
Jonbaglo::Database::Clan_Applications->search(id => $id)->delete_all();
Jonbaglo::Database::Clan_Applications->create({'id' => $q->param('id'),
'firstname' => $q->param('firstname'),
'lastname' => $q->param('lastname'),
'gamertag' => $q->param('gamertag'),
'forumuser' => $q->param('forumuser'),
'email'=> $q->param('email'),
'location' => $q->param('location'),
'connection' => $q->param('connection'),
'exp' => $q->param('exp'),
'good' => $q->param('good'),
'online' => $q->param('online'),
'clan' => $yes,
'agree' => $yes,
'datetime' => $q->param('datetime'),
'accepted' => $q->param('activate'),
'rank' => $q->param('role'),
'acc_date' => Class::Date->now(),
});
# always send an email but var. dependant
my $returnemail = 'jonbaglo@hotmail.com';
# # send an email with the details
$mail_template->process('jonbaglo/email_user',
$vars,
"$vars->{'email'}",#to
# 'barrycarlyon@hotmail.co.uk',#to
"Apollo Studios <$returnemail>",#from
"$vars->{'gamertag'} -> Apollo Studios Status Update");#subject
#output should go to full list
$self->header_props( -url => "/jonbaglo/?rm=dsp_all" );
$self->header_type('redirect');
}
sub dsp_all {
my $self = shift;
my $html_template = $self->param('jonbaglo_template');
my @user = Jonbaglo::Database::Clan_Applications->retrieve_all;
my $output;
$html_template->process('jonbaglo/form',
{
process => "all",
user => \@user,
},
\$output) || die $html_template->error;
return $output;
}
sub dsp_single_detailed {
my $self = shift;
my $html_template = $self->param('jonbaglo_template');
my $cgi = CGI->new;
my $userid = $cgi->param('userid');
my @user = Jonbaglo::Database::Clan_Applications->search(id => $userid);
my $output;
$html_template->process('jonbaglo/form',
{
process => "single_detail",
user => \@user,
},
\$output) || die $html_template->error;
return $output;
}
sub public_clan {
my $self = shift;
my $html_template = $self->param('jonbaglo_template');
my @overlord = Jonbaglo::Database::Clan_Applications->search(rank => "overlord");
my @staff = Jonbaglo::Database::Clan_Applications->search(rank => "staff");
my @member = Jonbaglo::Database::Clan_Applications->search(rank => "member");
my @peon = Jonbaglo::Database::Clan_Applications->search(rank => "peon");
my $output;
$html_template->process('jonbaglo/form',
{
process => "public_clan",
overlord => \@overlord,
staff => \@staff,
member => \@member,
peon => \@peon,
},
\$output) || die $html_template->error;
return $output;
}
######################################################################
#need perl script for dsp of scripts on the forum
sub script {
my $self = shift;
my $errs = shift;
my $html_template = $self->param('jonbaglo_template');
my $output;
$html_template->process('jonbaglo/form',
{
process => "script",
errors => $errs,
},
\$output) || die $html_template->error;
return $output;
}
sub add_show_process {
my $self = shift;
my $html_template = $self->param('jonbaglo_template');
my $mail_template = $self->param('mail_template');
my $q = $self->query;
my $script = $q->script_name;
my ($results, $err_page) = $self->check_rm('script',
{
required => [qw/gamertag
title
locations
desc
password
/],
optional => [qw/episodes
characters
/],
# constraints => {email => '
email'},
# dependencies => {
# a => {
# other => [qw/ /]
# }
# },
filters => ['trim'],
msgs => {
missing => 'required',
invalid => 'invalid'
}
});
return $err_page if $err_page;
Jonbaglo::Database::Clan_Shows->create({'show' => $q->param('title'),
'password' => $q->param('password'),
'gamertag' => $q->param('gamertag'),
'locations' => $q->param('locations'),
'episodes' => $q->param('episodes'),
'character' => $q->param('characters'),
'description' => $q->param('desc'),
'datetime' => Class::Date->now(),
});
my $output;
$html_template->process('jonbaglo/form',
{
process => "script_ok",
text => "Your Show Suggestion Has Been Added Succesfully",
},
\$output) || die $html_template->error;
return $output;
}
sub add_script_process {
my $self = shift;
my $html_template = $self->param('jonbaglo_template');
my $mail_template = $self->param('mail_template');
my $q = $self->query;
my $script = $q->script_name;
#check password first
my $show = $q->param('show');
#obtain show password
my @password = Jonbaglo::Database::Clan_Shows->search(show => $show);
my $pass = shift(@password);
my $output;
$html_template->process('jonbaglo/form',
{
process => "script_ok",
text => $pass,
},
\$output) || die $html_template->error;
return $output;
}
sub script_index {
my $self = shift;
my $html_template = $self->param('jonbaglo_template');
my $output;
$html_template->process('jonbaglo/form',
{
process => "script",
},
\$output) || die $html_template->error;
return $output;
}
sub script_display {
my $self = shift;
my $html_template = $self->param('jonbaglo_template');
my $output;
$html_template->process('jonbaglo/form',
{
process => "script",
},
\$output) || die $html_template->error;
return $output;
}
1;
####
package Jonbaglo::Database::Clan_Applications;
use strict;
use base qw(LSRfm::DBI);
use Apache::Reload;
__PACKAGE__->table('Clan_App');
__PACKAGE__->columns(All => qw/id firstname lastname gamertag forumuser email location connection exp good online clan agree datetime accepted rank acc_date/);
__PACKAGE__->set_sql(all => 'SELECT __ESSENTIAL__
FROM __TABLE__');
1;
####
package LSRfm::DBI;
use strict;
use warnings;
use base qw(Class::DBI);
use Apache::Reload;
use LSRfm::Config;
my $config = $LSRfm::Config::DATABASE;
LSRfm::DBI->connection("dbi:mysql:host=$config->{host};database=$config->{name}", $config->{dbuser}, $config->{dbpasswd});
1;
####
package LSRfm::Config;
use strict;
use warnings;
use Apache::Reload;
our $DATABASE = {
host => 'foo.foo.net',
name => 'foo',
dbuser => 'foo',
dbpasswd => 'foo'
};
our $MORNING = 6 * 60;
our $INCLUDE_PATH = '/home/lsrfm/webs/www.lsrfm.com/templates';
our $MAIL_HOST = 'localhost';
our $MAIL_PORT = 25;
1;