Index: install.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/install.cgi,v retrieving revision 1.61 retrieving revision 1.59 diff -r1.61 -r1.59 7c7 < # Revision : $Id: install.cgi,v 1.61 2001/02/09 03:42:10 alex Exp $ --- > # Revision : $Id: install.cgi,v 1.59 2001/02/06 04:48:39 alex Exp $ 652,655d651 < unshift @INC, "$path_to_cgi/admin"; < require "$path_to_cgi/admin/Links.pm"; < my $version = $Links::VERSION; < my $data; 656a653,656 > open (CFG, "< $configdata") or die "Unable to open configdata: $configdata ($!)"; > read CFG, my $data, -s CFG; > close CFG; > open (CFG, "> $configdata") or die "Unable to open configdata: $configdata ($!)"; 658c658,661 < $data = GT::Dumper->dump ( data => $inst, var => '' ); --- > my $string = GT::Dumper->dump ( data => $inst, var => '' ); > $data =~ s,{},$string,; > print CFG $data; > close CFG; 660a664,666 > unshift @INC, "$path_to_cgi/admin"; > require "$path_to_cgi/admin/Links.pm"; > my $version = $Links::VERSION; 663a670,673 > $data =~ s,('version'\s*=>\s*')[^']*',$1$version',; > open (CFG, "> $configdata") or die "Unable to open configdata: $configdata ($!)"; > print CFG $data; > close CFG; 665,668d674 < $data =~ s,('version'\s*=>\s*')[^']*',$1$version',; < open (CFG, "> $configdata") or die "Unable to open configdata: $configdata ($!)"; < print CFG $data; < close CFG; Index: cgi/add.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/add.cgi,v retrieving revision 1.33 retrieving revision 1.27 diff -r1.33 -r1.27 7,8c7,9 < # Revision : $Id: add.cgi,v 1.33 2001/02/17 08:02:18 alex Exp $ < # --- > # Revision : $Id: add.cgi,v 1.27 2001/01/25 00:47:30 alex Exp $ > > # 20d20 < local $SIG{__DIE__} = \&Links::fatal; 55,58d54 < if ($USER) { < $IN->param('Contact_Name') or ($IN->param('Contact_Name', $USER->{Name} || $USER->{Username})); < $IN->param('Contact_Email') or ($IN->param('Contact_Email', $USER->{Email})); < } 71c67 < # -------------------------------------------------------- --- > # -------------------------------------------------------- 95c91 < # This will set system fields like Validated to their proper values. --- > # This will set system fields like Validated to their proper values. 100,111d95 < # Setup the language for GT::SQL. < local $GT::SQL::ERRORS->{ILLEGALVAL} = Links::language('ADD_ILLEGALVAL'); < local $GT::SQL::ERRORS->{UNIQUE} = Links::language('ADD_UNIQUE'); < local $GT::SQL::ERRORS->{NOT_NULL} = Links::language('ADD_NOTNULL'); < local $Links::Link::ERRORS->{NOCATEGORY} = Links::language('ADD_NOCATEGORY'); < $Links::Link::ERRORS ||= {}; # silence -w < < # Validate the form input.. < $db = $DB->table ('Links'); < $cdb = $DB->table ('Category'); < $cat_links = $DB->table ('CatLinks'); < 124,129d107 < if ($CFG->{user_valid_email}) { < my $user_cols = $user_db->cols; < $name or $db->error ('NOTNULL', 'WARN', $user_cols->{Name}->{form_display} || 'Contact Name'); < $email or $db->error ('NOTNULL', 'WARN', $user_cols->{Email}->{form_display} || 'Contact Email'); < $email =~ /^.+\@.+\..+$/ or $db->error ('ILLEGALVAL', 'WARN', $user_cols->{Email}->{form_display} || 'Contact Email', $email); < } 131,132c109,110 < my $res = $user_db->insert ( { Username => $email, Name => $name, Email => $email, Status => 'Not Validated', Password => $pass }); < $username = $res ? $username : 'admin'; --- > $user_db->insert ( { Username => $email, Name => $name, Email => $email, Status => 'Not Validated', Password => $pass }); > $username = $email; 151c129 < # Auto validate this link: --- > # Make sure it's not validated. 153,157c131,135 < if ($CFG->{build_auto_validate}) { < if ((($CFG->{build_auto_validate} == 1) and $USER) or ($CFG->{build_auto_validate} == 2)) { < $input->{isValidated} = 'Yes'; < } < } --- > > # Validate the form input.. > $db = $DB->table ('Links'); > $cdb = $DB->table ('Category'); > $cat_links = $DB->table ('CatLinks'); 160,165c138,146 < $cid = $input->{'CatLinks.CategoryID'}; < if ($cid) { < $sth = $cdb->select ( { ID => $cid }, ['Full_Name'] ); < $sth->rows or return { error => Links::language('ADD_INVALIDCAT', $cid), Category => $category }; < ($cname) = $sth->fetchrow_array; < } --- > $cid = $input->{'CatLinks.CategoryID'} or return { error => Links::language('ADD_SELCAT'), Category => $category }; > $sth = $cdb->select ( { ID => $cid }, ['Full_Name'] ); > $sth->rows or return { error => Links::language('ADD_INVALIDCAT', $cid), Category => $category }; > ($cname) = $sth->fetchrow_array; > > # Setup the language for GT::SQL. > $GT::SQL::ERRORS->{ILLEGALVAL} = Links::language('ADD_ILLEGALVAL'); > $GT::SQL::ERRORS->{UNIQUE} = Links::language('ADD_UNIQUE'); > $GT::SQL::ERRORS->{NOTNULL} = Links::language('ADD_NOTNULL'); 167d147 < # Add the record. 176,178c156,175 < my $cfg = Links::Config::load_vars(); < my %tags = ( Host => $host, Referer => $refer, Category => $cname ); < $msg = GT::Template->parse ( $CFG->{admin_root_path} . '/templates/admin/email-val.txt', { %$input, %tags, %$cfg } ); --- > $msg = qq| > The following link is awaiting validation: > > Title: $input->{'Title'} > URL: $input->{'URL'} > Category: $cname > Description: $input->{'Description'} > Contact Name: $input->{'Contact_Name'} > Contact Email: $input->{'Contact_Email'} > > Remote Host: $host > Referer: $refer > > To validate, please go to: > $CFG->{admin_root_url}/admin.cgi > > Sincerely, > > Links Manager. > |; 185c182 < smtp => $CFG->{db_smtp_server}, --- > smtp => $CFG->{db_smtp_server}, 199c196 < $error = ""; --- > $error = ""; 201c198 < } --- > } Index: cgi/browser.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/browser.cgi,v retrieving revision 1.14 retrieving revision 1.12 diff -r1.14 -r1.12 7c7 < # Revision : $Id: browser.cgi,v 1.14 2001/02/14 06:25:02 alex Exp $ --- > # Revision : $Id: browser.cgi,v 1.12 2001/01/16 18:36:53 alex Exp $ 9c9 < # Revision : $Id: browser.cgi,v 1.14 2001/02/14 06:25:02 alex Exp $ --- > # Revision : $Id: browser.cgi,v 1.12 2001/01/16 18:36:53 alex Exp $ 28d27 < local $SIG{__DIE__} = \&Links::fatal; Index: cgi/jump.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/jump.cgi,v retrieving revision 1.19 retrieving revision 1.16 diff -r1.19 -r1.16 7c7 < # Revision : $Id: jump.cgi,v 1.19 2001/02/19 21:05:08 alex Exp $ --- > # Revision : $Id: jump.cgi,v 1.16 2001/01/18 10:10:54 alex Exp $ 20d19 < local $SIG{__DIE__} = \&Links::fatal; 30c29 < $id = $IN->param('ID') || $IN->param('Detailed'); --- > $id = $IN->param('ID'); 49c48 < if (! $rec or ($rec->{isValidated} eq 'No')) { --- > if (! $rec) { 60c59,61 < $db->update ( { Hits => \"Hits + 1" }, { ID => $id }, { GT_SQL_SKIP_INDEX => 1 } ); --- > $db->indexing(0); > $db->update ( { Hits => \"Hits + 1" }, { ID => $id } ); > $db->indexing(1); 74,78d74 < } < < # Redirect to a detailed page if requested. < if ($CFG->{build_detailed} and $IN->param('Detailed')) { < $goto = $CFG->{build_detail_url} . '/' . $id . $CFG->{build_index}; Index: cgi/modify.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/modify.cgi,v retrieving revision 1.24 retrieving revision 1.19 diff -r1.24 -r1.19 7c7 < # Revision : $Id: modify.cgi,v 1.24 2001/02/17 05:21:29 alex Exp $ --- > # Revision : $Id: modify.cgi,v 1.19 2001/01/30 05:09:15 alex Exp $ 20d19 < local $SIG{__DIE__} = \&Links::fatal; 35,37c34,36 < $IN->param('modify') and do { _modify(); last CASE; }; < $IN->param('LinkID') and do { _modify_passed_in(); last CASE; }; < $CFG->{user_required} or $USER and do { _list_owned_links(); last CASE; }; --- > $IN->param('modify') and do { _modify(); last CASE; }; > $IN->param('LinkID') and do { _modify_passed_in(); last CASE; }; > $CFG->{user_required} and do { _list_owned_links(); last CASE; }; 76,78d74 < $link->{Contact_Name} = $USER->{Name} || $USER->{Username}; < $link->{Contact_Email} = $USER->{Email}; < 98c94 < my $sth = $link_db->select ( { LinkOwner => $USER->{Username}, isValidated => 'Yes' }); --- > my $sth = $link_db->select ( { LinkOwner => $USER->{Username} }); 105,108c101,105 < my $toolbar; < my @links; < while (my $hash = $sth->fetchrow_hashref) { < push @links, $hash; --- > my $output = ''; > while (my $link = $sth->fetchrow_hashref) { > $output .= qq~"; 109a107,108 > $output .= "
~; > $output .= Links::SiteHTML::display('link', $link); > $output .= "
"; > my $toolbar; 114c113 < print Links::SiteHTML::display ('modify_select', { link_results => \@links, total => $total, next => $toolbar }); --- > print Links::SiteHTML::display ('modify_select', { link_results => $output, total => $total, next => $toolbar }); 144c143 < my $url = $args->{'Current_URL'} || $args->{'Current URL'}; --- > my $url = $args->{'Current URL'}; 182,186c181,183 < local $GT::SQL::ERRORS->{ILLEGALVAL} = Links::language('ADD_ILLEGALVAL'); < local $GT::SQL::ERRORS->{UNIQUE} = Links::language('ADD_UNIQUE'); < local $GT::SQL::ERRORS->{NOT_NULL} = Links::language('ADD_NOTNULL'); < local $Links::Link::ERRORS->{NOCATEGORY} = Links::language('MODIFY_NOCATEGORY'); < $Links::Link::ERRORS ||= {}; # silence -w --- > $GT::SQL::ERRORS->{ILLEGALVAL} = Links::language('ADD_ILLEGALVAL'); > $GT::SQL::ERRORS->{UNIQUE} = Links::language('ADD_UNIQUE'); > $GT::SQL::ERRORS->{NOT_NULL} = Links::language('ADD_NOTNULL'); 191,194d187 < < # Make sure the category id's are valid. < $IN->param('CatLinks.CategoryID') < or return { error => Links::language('MODIFY_NOCATEGORY'), Category => $category, LinkID => $lid }; 199,202d191 < $new->{'CatLinks.CategoryID'} = $db->clean_category_ids ( $new->{'CatLinks.CategoryID'} ) < or return { error => $GT::SQL::error, Category => $category, LinkID => $lid }; < < # Remove the timestamp. 269a259,266 > if ($CFG->{user_direct_mod}) { > $text = "The following link has been updated."; > } > else { > $text = "The following link was modified and is awaiting validation."; > } > $msg = < $text 271,282c268,290 < my %tags; < foreach my $key (keys %$original) { < $tags{"Original_" . $key} = $original->{$key}; < } < foreach my $key (keys %$new) { < $tags{"New_" . $key} = $new->{$key}; < } < $tags{"Original_Category"} = $c_origname; < $tags{"New_Category"} = $c_newname; < $tags{"Host"} = $host; < $tags{"Referer"} = $refer; < my $cfg = Links::Config::load_vars(); --- > ORIGINAL LINK: > =============================================== > Title: $original->{'Title'} > URL: $original->{'URL'} > Description: $original->{'Description'} > Username: $original->{'LinkOwner'} > Category: $c_origname > > NEW LINK: > =============================================== > Title: $new->{'Title'} > URL: $new->{'URL'} > Description: $new->{'Description'} > Username: $new->{'LinkOwner'} > Category: $c_newname > > Remote Host: $host > Referer: $refer > > To update, please go to: > $CFG->{admin_root_url}/admin.cgi > > Sincerely, 284c292,293 < $msg = GT::Template->parse ( $CFG->{admin_root_path} . '/templates/admin/email-mod.txt', { %tags, %$cfg } ); --- > Links Manager. > END_OF_MSG Index: cgi/page.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/page.cgi,v retrieving revision 1.27 retrieving revision 1.25 diff -r1.27 -r1.25 7c7 < # Revision : $Id: page.cgi,v 1.27 2001/02/14 06:25:02 alex Exp $ --- > # Revision : $Id: page.cgi,v 1.25 2001/02/05 01:10:10 alex Exp $ 21d20 < local $SIG{__DIE__} = \&Links::fatal; Index: cgi/rate.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/rate.cgi,v retrieving revision 1.19 retrieving revision 1.17 diff -r1.19 -r1.17 7c7 < # Revision : $Id: rate.cgi,v 1.19 2001/02/14 06:25:02 alex Exp $ --- > # Revision : $Id: rate.cgi,v 1.17 2001/01/16 18:36:53 alex Exp $ 21d20 < local $SIG{__DIE__} = \&Links::fatal; Index: cgi/search.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/search.cgi,v retrieving revision 1.44 retrieving revision 1.40 diff -r1.44 -r1.40 7c7 < # Revision : $Id: search.cgi,v 1.44 2001/02/15 22:09:45 alex Exp $ --- > # Revision : $Id: search.cgi,v 1.40 2001/02/06 22:09:33 alex Exp $ 21d20 < local $SIG{__DIE__} = \&Links::fatal; 32,46d30 < < # Remove search fields we aren't allowed to search on. < if ($CFG->{search_blocked}) { < foreach my $col (@{$CFG->{search_blocked}}) { < $col =~ s/^\s*|\s*$//g; < if ($args->{$col}) { < delete $args->{$col}; < $IN->delete ($col); < } < $args->{"$col-lt"} and $IN->delete ("$col-lt"); < $args->{"$col-gt"} and $IN->delete ("$col-gt"); < } < } < < # If query is set we know we are searching. 48,50c32 < < # Otherwise, if we pass in a field name, we can search on that too. < foreach (keys %{$db->cols}) { --- > foreach (keys %{$db->cols}) { 51a34 > # Need to make sure isValidated is set to Yes. 93,94d75 < $args->{so} = (defined $args->{so} and $args->{so} =~ /^(asc(?:end)|desc(?:end))$/i ? $1 : ''); < $args->{sb} and ($args->{sb} =~ /^[\w\s,]+$/ or ($args->{sb} = '')); Index: cgi/subscribe.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/subscribe.cgi,v retrieving revision 1.17 retrieving revision 1.15 diff -r1.17 -r1.15 7c7 < # Revision : $Id: subscribe.cgi,v 1.17 2001/02/14 06:25:02 alex Exp $ --- > # Revision : $Id: subscribe.cgi,v 1.15 2001/01/16 18:36:53 alex Exp $ 21d20 < local $SIG{__DIE__} = \&Links::fatal; Index: cgi/user.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/user.cgi,v retrieving revision 1.30 retrieving revision 1.27 diff -r1.30 -r1.27 7c7 < # Revision : $Id: user.cgi,v 1.30 2001/02/17 03:51:33 alex Exp $ --- > # Revision : $Id: user.cgi,v 1.27 2001/01/26 02:06:05 alex Exp $ 22d21 < local $SIG{__DIE__} = \&Links::fatal; 34d32 < $input->{send_validate} and send_validate(), last CASE; 88c86 < print Links::SiteHTML::display ('login', { error => Links::language('USER_NOTVAL', $user->{Email}), Username => $user->{Username} }); --- > print Links::SiteHTML::display ('login', { error => Links::language('USER_NOTVAL'), Username => $user->{Username} }); 152c150 < my $code = (time) . ($$) . (int rand (1000)); --- > $code = (time) . ($$) . (int rand (1000)); 156c154,166 < _send_validate_email($user); --- > > # Prepare the message. > $msg = Links::load_template ('email-validate.txt', $user ); > > # Mail the validation letter. > GT::Mail->send ( { > smtp => $CFG->{db_smtp_server}, > sendmail => $CFG->{db_mail_path}, > from => $CFG->{db_admin_email}, > subject => Links::language('USER_VALEMAILSUB'), > to => $IN->param('Email'), > msg => $msg > } ) or die $GT::Mail::error; 168,187d177 < sub _send_validate_email { < # -------------------------------------------------------- < # Sends a validation email to the user. < # < my $user = shift; < < # Prepare the message. < my $msg = Links::load_template ('email-validate.txt', $user ); < < # Mail the validation letter. < GT::Mail->send ( { < smtp => $CFG->{db_smtp_server}, < sendmail => $CFG->{db_mail_path}, < from => $CFG->{db_admin_email}, < subject => Links::language('USER_VALEMAILSUB'), < to => $IN->param('Email'), < msg => $msg < } ) or die $GT::Mail::error; < } < 234,258d223 < } < else { < print Links::SiteHTML::display ('login_email', { error => Links::language('USER_NOEMAIL') }); < } < } < < sub send_validate { < # ------------------------------------------------------------------- < # Sends the validation email if the user needs another one. < # < my $email = $IN->param('Email'); < my $user_db = $DB->table ('Users'); < my $sth = $user_db->select ( { Email => $email } ); < print $IN->header(); < if ($sth->rows) { < # Prepare the message. < my $user = $sth->fetchrow_hashref; < < # Make sure there is a validation code. < if (! $user->{Validation}) { < $user->{Validation} = (time) . ($$) . (int rand (1000)); < $user_db->modify ($user); < } < _send_validate_email($user); < print Links::SiteHTML::display ('login', { error => Links::language('USER_VALSENT'), Username => '', Password => '' }); Index: cgi/admin/Links.pm =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Links.pm,v retrieving revision 1.104 retrieving revision 1.94 diff -r1.104 -r1.94 6c6 < # Revision : $Id: Links.pm,v 1.104 2001/02/18 19:19:54 alex Exp $ --- > # Revision : $Id: Links.pm,v 1.94 2001/02/05 20:16:25 alex Exp $ 16,18c16,18 < use vars qw/$DEBUG $VERSION $IN $TPL $DB $CFG $USER < $PERSISTANT $DATE_LOADED $GLOBALS $LANGUAGE/; < use GT::Base qw/:all/; # Loads $MOD_PERL and $SPEEDY vars. --- > use vars qw/$DEBUG $VERSION $MOD_PERL > $IN $TPL $DB $CFG $USER > $DATE_LOADED $GLOBALS $LANGUAGE/; 26c26 < $PERSISTANT = $MOD_PERL || $SPEEDY; --- > $MOD_PERL = exists $ENV{GATEWAY_INTERFACE} ? $ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl\// : 0; 36,37c36,37 < # Under persistant environment, import all symbols. < if ($PERSISTANT) { --- > # Under mod_perl, import all symbols. > if ($MOD_PERL) { 58c58 < init_vars(\%symbols) unless ($PERSISTANT); --- > init_vars(\%symbols) unless ($MOD_PERL); 70,73c70,73 < # Set our tmp directory to store files. < $ENV{GT_TMPDIR} = $CFG->{admin_root_path} . '/tmp'; < < $IN ||= GT::CGI->new(); --- > if (! $IN) { > $IN = GT::CGI->new(); > $IN->catch_errors (\&Links::fatal); > } 88,118d87 < sub reset_env { < # ------------------------------------------------------------------- < # This gets run on every request to reset globals under a persistent < # environment. < # < my $opts = shift; < my $load_user = $opts->{load_user}; < < $CFG = new Links::Config; < my $debug = $CFG->{debug_level} || $Links::DEBUG; < < # Set our tmp directory to store files. < $ENV{GT_TMPDIR} = $CFG->{admin_root_path} . '/tmp'; < < # There is mod_perl code to handle this automatically. < GT::SQL->reset_env(); < GT::Plugins->reset_env(); < < # Get a new CGI object. < $IN = GT::CGI->new(); < < # demo 1 < # $TPL = GT::Template->new ({ root => $CFG->{admin_root_path} . '/templates/admin', debug => $debug, strict => 0, compress => 1 }); < $TPL = GT::Template->new ({ root => $CFG->{admin_root_path} . '/templates/admin', debug => $debug, compress => 1 }); < < if (-e "$CFG->{admin_root_path}/defs") { < $DB = GT::SQL->new ({ def_path => "$CFG->{admin_root_path}/defs", cache => 1, debug => $debug }); < } < $USER = $load_user ? Links::init_user() : undef; < } < 180a150,186 > sub reset_env { > # ------------------------------------------------------------------- > # This gets run on every request to reset globals under a persistent > # environment. > # > my $opts = shift; > my $load_user = $opts->{load_user}; > > $CFG = new Links::Config; > my $debug = $CFG->{debug_level} || $Links::DEBUG; > > # There is mod_perl code to handle this automatically. > if (! $MOD_PERL) { > require GT::SQL; > GT::CGI->reset_env(); > GT::SQL->reset_env(); > GT::Plugins->reset_env(); > } > else { > # No persistent connections unless Apache::DBI is loaded. > GT::SQL::Driver->reset_env() unless ($INC{'Apache::DBI'}); > } > $IN = GT::CGI->new(); > > # demo 1 > # $TPL = GT::Template->new ({ root => $CFG->{admin_root_path} . '/templates/admin', debug => $debug, strict => 0, compress => 1 }); > $TPL = GT::Template->new ({ root => $CFG->{admin_root_path} . '/templates/admin', debug => $debug, compress => 1 }); > > # Can only cache if we have Apache::DBI loaded and are using mod_perl, otherwise we have > # problems. > my $cache = $MOD_PERL && $INC{'Apache::DBI'}; > if (-e "$CFG->{admin_root_path}/defs") { > $DB = GT::SQL->new ({ def_path => "$CFG->{admin_root_path}/defs", cache => $cache, debug => $debug }); > } > $USER = $load_user ? Links::init_user() : undef; > } > 187c193 < my $template_set = $IN->param('t') || $CFG->{build_default_tpl} || 'default'; --- > my $template_set = $IN->param('t') || 'default'; 264c270 < my $template_set = $IN->param('t') || $CFG->{build_default_tpl}; --- > my $template_set = GT::CGI->param('t') || 'default'; 266c272 < $template_set = $CFG->{build_default_tpl} || 'default'; --- > $template_set = 'default'; 269c275 < $template_set = $CFG->{build_default_tpl} || 'default'; --- > $template_set = 'default'; 347c353 < $$output_ref =~ s!(]+href\s*=\s*["']*)$CFG->{db_cgi_url}/([^"'>]+\.(cgi|pl)([^"'>]*))! --- > $$output_ref =~ s!(]+href\s*=\s*["']*)$CFG->{db_cgi_url}/([^"'>]+(cgi|pl)([^"'>]*))! 374,382c380 < # Redirects a user to the login screen, through a plugin. < # < my $from = shift; < return GT::Plugins->dispatch ( $CFG->{admin_root_path} . '/Plugins', 'auth_redirect_login', \&_redirect_login_url, $from ); < } < < sub _redirect_login_url { < # -------------------------------------------------------------- < # Redirect the user to the login screen. --- > # Redirects a user to the login screen. 386c384 < $url = $IN->escape ($CFG->{db_cgi_url} . '/' . $url); --- > $url = $IN->escape ($url); 439,440d436 < die @_ if (GT::Base->in_eval()); # Don't do anything if we are in eval. < 466,467c462 < local $SIG{__DIE__}; < die $msg; --- > exit; 479c474 < $info .= GT::Base::stack_trace('Links', 1, 1); --- > $info .= GT::Base::stack_trace('Links', 1); 487d481 < $info .= "Persistant Env: mod_perl ($MOD_PERL) SpeedyCGI ($SPEEDY) Config ($CFG->{persistant_env})\n"; Index: cgi/admin/admin.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/admin.cgi,v retrieving revision 1.50 retrieving revision 1.47 diff -r1.50 -r1.47 7c7 < # Revision : $Id: admin.cgi,v 1.50 2001/02/14 06:25:03 alex Exp $ --- > # Revision : $Id: admin.cgi,v 1.47 2001/01/24 05:01:57 alex Exp $ 20d19 < local $SIG{__DIE__} = \&Links::fatal; 51,52c50 < my $help_path = "$CFG->{admin_root_path}/templates/help"; < my $topic = $IN->param('topic'); --- > my $topic = $IN->param('topic'); 59,70c57,59 < if ( $do eq 'plugin') { < my ($plugin) = $url =~ /plugin=([^&]+)/; < my ($func) = $url =~ /func=([^&]+)/; < if ( $topic = _plugin_help( $plugin, $func ) ) { < $help_path .= "/$plugin"; < } < } < else { < $topic = _parse_topic ($page || ''); < $topic ||= _parse_topic ($do || ''); < $topic ||= _parse_topic ($cgi || ''); < } --- > $topic = _parse_topic ($page || ''); > $topic ||= _parse_topic ($do || ''); > $topic ||= _parse_topic ($cgi || ''); 74c63 < if ($topic =~ /\.(gif|jpg)$/ and -e "$help_path/$topic") { --- > if ($topic =~ /\.(gif|jpg)$/ and -e "$CFG->{admin_root_path}/templates/help/$topic") { 76c65 < open IMG, "< $help_path/$topic" or Links::fatal ("Unable to open image help: $help_path/$topic ($!)"); --- > open IMG, "< $CFG->{admin_root_path}/templates/help/$topic" or Links::fatal ("Unable to open image help: $CFG->{admin_root_path}/templates/help/$topic ($!)"); 86c75 < my $root = $TPL->root($help_path); --- > my $root = $TPL->root("$CFG->{admin_root_path}/templates/help"); 154,172d142 < < sub _plugin_help { < # ------------------------------------------------------------------ < my ( $plugin, $func ) = @_; < my $help_path = "$CFG->{admin_root_path}/templates/help/$plugin"; < < -e $help_path or return; < < if ( -e "$help_path/$func.html" ) { < return "$func.html"; < } < elsif ( -e "$help_path/help.html" ) { < return "help.html"; < } < < return; < } < < Index: cgi/admin/browser.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/browser.cgi,v retrieving revision 1.27 retrieving revision 1.25 diff -r1.27 -r1.25 7c7 < # Revision : $Id: browser.cgi,v 1.27 2001/02/14 06:25:03 alex Exp $ --- > # Revision : $Id: browser.cgi,v 1.25 2001/01/16 18:36:53 alex Exp $ 24d23 < local $SIG{__DIE__} = \&Links::fatal; Index: cgi/admin/db.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/db.cgi,v retrieving revision 1.35 retrieving revision 1.32 diff -r1.35 -r1.32 7c7 < # Revision : $Id: db.cgi,v 1.35 2001/02/17 05:03:33 alex Exp $ --- > # Revision : $Id: db.cgi,v 1.32 2001/01/16 18:36:53 alex Exp $ 21d20 < local $SIG{__DIE__} = \&Links::fatal; 41c40 < $admin->debug_level( $CFG->{debug_level} ); --- > $admin->debug_level($Links::DEBUG) if ($Links::DEBUG); Index: cgi/admin/mailer.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/mailer.cgi,v retrieving revision 1.54 retrieving revision 1.52 diff -r1.54 -r1.52 7c7 < # Revision : $Id: mailer.cgi,v 1.54 2001/02/14 06:25:03 alex Exp $ --- > # Revision : $Id: mailer.cgi,v 1.52 2001/02/05 23:25:17 jagerman Exp $ 39d38 < local $SIG{__DIE__} = \&Links::fatal; Index: cgi/admin/nph-build.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/nph-build.cgi,v retrieving revision 1.46 retrieving revision 1.44 diff -r1.46 -r1.44 7c7 < # Revision : $Id: nph-build.cgi,v 1.46 2001/02/14 06:25:03 alex Exp $ --- > # Revision : $Id: nph-build.cgi,v 1.44 2001/02/05 22:41:54 alex Exp $ 26d25 < local $SIG{__DIE__} = \&Links::fatal; 656c655 < $seen{$name}++ and print "Duplicate Category Name: ($id) $name\n" and next; --- > $seen{$name}++ and warn "Duplicate Category Name: ($id) $name\n" and next; Index: cgi/admin/nph-email.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/nph-email.cgi,v retrieving revision 1.33 retrieving revision 1.31 diff -r1.33 -r1.31 7c7 < # Revision : $Id: nph-email.cgi,v 1.33 2001/02/14 06:25:03 alex Exp $ --- > # Revision : $Id: nph-email.cgi,v 1.31 2001/01/19 22:23:19 alex Exp $ 30d29 < local $SIG{__DIE__} = \&Links::fatal; Index: cgi/admin/nph-import.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/nph-import.cgi,v retrieving revision 1.9 retrieving revision 1.7 diff -r1.9 -r1.7 7c7 < # Revision : $Id: nph-import.cgi,v 1.9 2001/02/14 06:25:03 alex Exp $ --- > # Revision : $Id: nph-import.cgi,v 1.7 2001/01/19 22:23:54 alex Exp $ 22,24c22 < local $SIG{__DIE__} = \&Links::fatal; < main(); < --- > main(); Index: cgi/admin/nph-index.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/nph-index.cgi,v retrieving revision 1.24 retrieving revision 1.22 diff -r1.24 -r1.22 7c7 < # Revision : $Id: nph-index.cgi,v 1.24 2001/02/14 06:25:03 alex Exp $ --- > # Revision : $Id: nph-index.cgi,v 1.22 2001/01/18 05:43:11 aki Exp $ 25d24 < local $SIG{__DIE__} = \&Links::fatal; Index: cgi/admin/nph-verify.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/nph-verify.cgi,v retrieving revision 1.24 retrieving revision 1.22 diff -r1.24 -r1.22 7c7 < # Revision : $Id: nph-verify.cgi,v 1.24 2001/02/14 06:25:03 alex Exp $ --- > # Revision : $Id: nph-verify.cgi,v 1.22 2001/01/25 00:48:16 alex Exp $ 23d22 < local $SIG{__DIE__} = \&Links::fatal; Index: cgi/admin/setup.cgi =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/setup.cgi,v retrieving revision 1.61 retrieving revision 1.58 diff -r1.61 -r1.58 7c7 < # Revision : $Id: setup.cgi,v 1.61 2001/02/14 06:25:03 alex Exp $ --- > # Revision : $Id: setup.cgi,v 1.58 2001/01/26 03:50:11 alex Exp $ 19d18 < local $SIG{__DIE__} = \&Links::fatal; 136d134 < $CFG->{build_images_url} = "$CFG->{build_root_url}/images"; Index: cgi/admin/verify-child.pl =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/verify-child.pl,v retrieving revision 1.14 retrieving revision 1.13 diff -r1.14 -r1.13 7c7 < # Revision : $Id: verify-child.pl,v 1.14 2001/02/14 18:28:22 alex Exp $ --- > # Revision : $Id: verify-child.pl,v 1.13 2001/01/19 22:24:08 alex Exp $ 28d27 < local $SIG{__DIE__} = \&Links::fatal; Index: cgi/admin/Links/Build.pm =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Links/Build.pm,v retrieving revision 1.43 retrieving revision 1.41 diff -r1.43 -r1.41 6c6 < # Revision : $Id: Build.pm,v 1.43 2001/02/19 22:07:18 alex Exp $ --- > # Revision : $Id: Build.pm,v 1.41 2001/02/06 22:08:54 alex Exp $ 488c488 < if ($CFG->{build_category_yahoo}) { --- > if ($CFG->{build_category_sort}) { 595c595 < $link_db->update ( { isNew => 'No' }, $cond, { GT_SQL_SKIP_CHECK => 1 } ); --- > $link_db->update ( { isNew => 'No' }, $cond ); 604c604 < $link_db->update ( { isNew => 'Yes' }, $cond, { GT_SQL_SKIP_CHECK => 1 } ); --- > $link_db->update ( { isNew => 'Yes' }, $cond ); 612c612 < $cat_db->update ( { Has_New_Links => 'No' }, {}, { GT_SQL_SKIP_CHECK => 1 }); --- > $cat_db->update ( { Has_New_Links => 'No' }, {}); 619c619 < $cat_db->update ( { Newest_Link => $date, Has_New_Links => 'Yes' }, GT::SQL::Condition->new ('ID', 'IN', \$str), { GT_SQL_SKIP_CHECK => 1 } ); --- > $cat_db->update ( { Newest_Link => $date, Has_New_Links => 'Yes' }, GT::SQL::Condition->new ('ID', 'IN', \$str) ); 653c653 < $link_db->update ( { isChanged => 'No' }, $cond, { GT_SQL_SKIP_CHECK => 1 } ); --- > $link_db->update ( { isChanged => 'No' }, $cond ); 662c662 < $link_db->update ( { isChanged => 'Yes' }, $cond, { GT_SQL_SKIP_CHECK => 1 } ); --- > $link_db->update ( { isChanged => 'Yes' }, $cond ); 668c668 < $cat_db->update ( { Has_Changed_Links => 'No' }, {}, { GT_SQL_SKIP_CHECK => 1 } ); --- > $cat_db->update ( { Has_Changed_Links => 'No' } ); 674c674 < $cat_db->update ( { Newest_Link => $date, Has_New_Links => 'Yes' }, GT::SQL::Condition->new ('ID', 'IN', \$str), { GT_SQL_SKIP_CHECK => 1 } ); --- > $cat_db->update ( { Newest_Link => $date, Has_New_Links => 'Yes' }, GT::SQL::Condition->new ('ID', 'IN', \$str) ); 706c706 < $link_db->update ( { isPopular => 'Yes' }, { ID => $id }, { GT_SQL_SKIP_CHECK => 1 } ); --- > $link_db->update ( { isPopular => 'Yes' }, { ID => $id } ); 716c716 < $link_db->update ( { isPopular => 'No' }, { ID => $id }, { GT_SQL_SKIP_CHECK => 1 } ); --- > $link_db->update ( { isPopular => 'No' }, { ID => $id } ); Index: cgi/admin/Links/Category.pm =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Links/Category.pm,v retrieving revision 1.51 retrieving revision 1.50 diff -r1.51 -r1.50 6c6 < # Revision : $Id: Category.pm,v 1.51 2001/02/18 19:16:01 alex Exp $ --- > # Revision : $Id: Category.pm,v 1.50 2001/01/19 05:06:20 alex Exp $ 22c22 < $VERSION = substr(q$Revision: 1.51 $,10); --- > $VERSION = substr(q$Revision: 1.50 $,10); 52a53 > $self->SUPER::indexing(1); 57c58 < $self->SUPER::update ( { Timestmp => \"NOW()" }, { ID => $parent }, { GT_SQL_SKIP_CHECK => 1, GT_SQL_SKIP_INDEX => 1 } ); --- > $self->SUPER::update ( { Timestmp => \"NOW()" }, { ID => $parent }, { GT_SQL_SKIP_CHECK => 1 } ); 59a61 > $self->SUPER::indexing(0); 62a65 > $self->SUPER::indexing(0); 77a81 > 136c140,141 < # Remove all the categories. --- > my $index = $self->indexing(); > $self->indexing(1); 144a150 > $self->SUPER::indexing($index); 365a372,373 > my $index = $self->{_index}; > $self->{_index} = 0; 379c387 < $self->SUPER::update ( { Number_of_Links => \"Number_of_Links $change" }, $cond, { GT_SQL_SKIP_CHECK => 1, GT_SQL_SKIP_INDEX => 1 } ); --- > $self->SUPER::update ( { Number_of_Links => \"Number_of_Links $change" }, $cond, { GT_SQL_SKIP_CHECK => 1 } ); 380a389 > $self->{_index} = $index; Index: cgi/admin/Links/Config.pm =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Links/Config.pm,v retrieving revision 1.52 retrieving revision 1.48 diff -r1.52 -r1.48 6c6 < # Revision : $Id: Config.pm,v 1.52 2001/02/17 08:02:18 alex Exp $ --- > # Revision : $Id: Config.pm,v 1.48 2001/02/06 04:49:09 alex Exp $ 183d182 < $self->set('build_default_tpl', 'default', $overwrite); 189d187 < $self->set('build_auto_validate', 0, $overwrite); 222d219 < $self->set('user_valid_email', 1, $overwrite); 274d270 < $self->set('search_blocked', [], $overwrite); Index: cgi/admin/Links/Link.pm =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Links/Link.pm,v retrieving revision 1.39 retrieving revision 1.37 diff -r1.39 -r1.37 6c6 < # Revision : $Id: Link.pm,v 1.39 2001/02/18 19:40:42 alex Exp $ --- > # Revision : $Id: Link.pm,v 1.37 2001/01/31 04:19:37 alex Exp $ 22c22 < $VERSION = substr(q$Revision: 1.39 $,10); --- > $VERSION = substr(q$Revision: 1.37 $,10); 100c100 < $p->{GT_SQL_SKIP_INDEX} = $p->{isValidated} eq 'Yes' ? 0 : 1; --- > ($p->{isValidated} eq 'Yes') ? $self->indexing(1) : $self->indexing(0); 101a102,103 > $self->indexing(1); > 107a110 > $cat_db->indexing(0); 127c130 < { GT_SQL_SKIP_CHECK => 1, GT_SQL_SKIP_INDEX => 1 } --- > { GT_SQL_SKIP_CHECK => 1 } 129a133 > $cat_db->indexing(1); 219c223 < $set->{GT_SQL_SKIP_INDEX} = $set->{isValidated} eq 'Yes' ? 0 : 1; --- > ($set->{isValidated} eq 'Yes') ? $self->indexing(1) : $self->indexing(0); 220a225 > $self->indexing(0); 222a228 > 258a265 > $cat_db->indexing(0); 264c271 < $cat_db->update ( { Number_of_Links => \"Number_of_Links + 1" }, $cond, { GT_SQL_SKIP_CHECK => 1, GT_SQL_SKIP_INDEX => 1 }); --- > $cat_db->update ( { Number_of_Links => \"Number_of_Links + 1" }, $cond, { GT_SQL_SKIP_CHECK => 1 }); 266c273 < $cat_db->update ( { Has_New_Links => 'Yes' }, $cond, { GT_SQL_SKIP_CHECK => 1, GT_SQL_SKIP_INDEX => 1 } ); --- > $cat_db->update ( { Has_New_Links => 'Yes' }, $cond, { GT_SQL_SKIP_CHECK => 1 } ); 268c275 < $cat_db->update ( { Newest_Link => $set->{Add_Date} }, $cond, { GT_SQL_SKIP_CHECK => 1, GT_SQL_SKIP_INDEX => 1 }); --- > $cat_db->update ( { Newest_Link => $set->{Add_Date} }, $cond, { GT_SQL_SKIP_CHECK => 1 }); 282c289 < $cat_db->update ( { Timestmp => \"NOW()" }, GT::SQL::Condition->new ('ID', 'IN', \$str), { GT_SQL_SKIP_CHECK => 1, GT_SQL_SKIP_INDEX => 1 }); --- > $cat_db->update ( { Timestmp => \"NOW()" }, GT::SQL::Condition->new ('ID', 'IN', \$str), { GT_SQL_SKIP_CHECK => 1 }); Index: cgi/admin/Links/SQL.pm =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Links/SQL.pm,v retrieving revision 1.75 retrieving revision 1.72 diff -r1.75 -r1.72 6c6 < # Revision : $Id: SQL.pm,v 1.75 2001/02/17 03:52:33 alex Exp $ --- > # Revision : $Id: SQL.pm,v 1.72 2001/02/06 22:09:13 alex Exp $ 20c20 < @TABLES = qw/Users Links Changes Category CatLinks CatRelations Editors Verify --- > @TABLES = qw/Users Links Changes Category CatLinks CatRelations Sessions Editors Verify 59c59 < URL => { pos => 3, type => 'CHAR', size => 255, not_null => 1, weight => 1, default => 'http://', regex => '^(https?:\/\/|ftp:\/\/|news:\/\/|mailto:)' }, --- > URL => { pos => 3, type => 'CHAR', size => 255, not_null => 1, weight => 1, default => 'http://', regex => '^(https?|ftp|news|mailto):\/\/' }, 159a160,177 > if ($c->create($action)) { $output .= "ok\n"; } > else { > $GT::SQL::errcode eq 'TBLEXISTS' ? ($output .= "failed (table already exists)\n") : ($output .= "failed ($GT::SQL::error)\n"); > $c->set_defaults(); > $c->save_schema(); > } > > # --------- User Sessions Table ---------------- > $output .= "Creating Sessions table .. "; > $c = $DB->creator('Sessions'); > $c->cols ( > ID => { pos => 1, type => 'CHAR', binary => 1, size => 25, not_null => 1 }, > Username => { pos => 2, type => 'CHAR', size => 50, not_null => 1 }, > Created => { pos => 3, type => 'DATETIME', not_null => 1 }, > IP => { pos => 4, type => 'CHAR', size => 25, not_null => 1 } > ); > $c->pk ('ID'); > $c->fk ({ Users => { Username => 'Username' }}); Index: cgi/admin/Links/SiteHTML.pm =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Links/SiteHTML.pm,v retrieving revision 1.33 retrieving revision 1.31 diff -r1.33 -r1.31 6c6 < # Revision : $Id: SiteHTML.pm,v 1.33 2001/02/14 17:49:39 alex Exp $ --- > # Revision : $Id: SiteHTML.pm,v 1.31 2001/01/19 02:52:12 alex Exp $ 128c128 < $cat_r->{Short_Name} = $cat_r->{RelationName}; --- > $cat_r->{Short_Name} = $cat_r->{RelationName} . '@'; 133c133 < $short and ($cat_r->{Short_Name} = $short); --- > $short and ($cat_r->{Short_Name} = $short . '@'); 136c136 < $cat_r->{Short_Name} = $cat_r->{Short_Name}; --- > $cat_r->{Short_Name} = $cat_r->{Short_Name} . '@'; 164c164 < my $template_set = GT::CGI->param('t') || $CFG->{build_default_tpl}; --- > my $template_set = GT::CGI->param('t') || 'default'; 166c166 < $template_set = $CFG->{build_default_tpl} || 'default'; --- > $template_set = 'default'; 169c169 < $template_set = $CFG->{build_default_tpl} || 'default'; --- > $template_set = 'default'; Index: cgi/admin/Links/Tools.pm =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Links/Tools.pm,v retrieving revision 1.47 retrieving revision 1.45 diff -r1.47 -r1.45 6c6 < # Revision : $Id: Tools.pm,v 1.47 2001/02/14 18:29:17 alex Exp $ --- > # Revision : $Id: Tools.pm,v 1.45 2001/02/05 01:10:33 alex Exp $ 467d466 < ref $_[0] and shift; # Can be called from a template where first argument is a hash ref of tags. 469d467 < my $name = shift || 'tpl_dir'; 481c479 < my $d_select_list = ""; 542c540 < so => 'DESC' --- > so => 'ASC' 569c567 < check --- > check 772c770 < $link->{Contact_Name} = $link->{'Contact Name'} = $link->{Name} || $link->{Username} || ''; --- > $link->{Contact_Name} = $link->{'Contact Name'} = $link->{Name} || ''; 809,810c807,808 < $link->{Contact_Email} = $link->{'Contact Email'} = $link->{Email} || ''; < $link->{Contact_Name} = $link->{'Contact Name'} = $link->{Name} || $link->{Username} || ''; --- > $link->{Contact_Email} = $link->{'Contact Email'} = $link->{Email}; > $link->{Contact_Name} = $link->{'Contact Name'} = $link->{Name}; 847c845 < $link->{Contact_Name} = $link->{'Contact Name'} = $link->{Name} || $link->{Username} || ''; --- > $link->{Contact_Name} = $link->{'Contact Name'} = $link->{Name}; Index: cgi/admin/Links/Import/BKS2.pm =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Links/Import/BKS2.pm,v retrieving revision 1.12 retrieving revision 1.11 diff -r1.12 -r1.11 6c6 < # Revision : $Id: BKS2.pm,v 1.12 2001/02/08 02:57:18 alex Exp $ --- > # Revision : $Id: BKS2.pm,v 1.11 2001/02/05 20:33:55 alex Exp $ 77d76 < $e_dbh->{LongReadLen} = 1000000; Index: cgi/admin/Links/Import/L2S2.pm =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Links/Import/L2S2.pm,v retrieving revision 1.27 retrieving revision 1.23 diff -r1.27 -r1.23 6c6 < # Revision : $Id: L2S2.pm,v 1.27 2001/02/19 23:07:50 jagerman Exp $ --- > # Revision : $Id: L2S2.pm,v 1.23 2001/02/05 20:33:55 alex Exp $ 84c84 < open CATS, "<$$opt{source}/data/categories.db" or critical "Unable to open $$opt{source}/data/categories.db: $!"; --- > open CATS, "<$$opt{source}/categories.db" or critical "Unable to open $$opt{source}/categories.db: $!"; 91,92c91,92 < open LINKS, "<$$opt{source}/data/links.db" or critical "Unable to open $$opt{source}/data/links.db: $!"; < if (open VALIDATE, "<$$opt{source}/data/validate.db") { --- > open LINKS, "<$$opt{source}/links.db" or critical "Unable to open $$opt{source}/links.db: $!"; > if (open VALIDATE, "<$$opt{source}/validate.db") { 96c96 < warning "Could not open $$opt{source}/data/validate.db: $!. Non-validated links will not be imported."; --- > warning "Could not open $$opt{source}/validate.db: $!. Non-validated links will not be imported."; 98c98 < if (open EMAIL, "$$opt{source}/data/email.db") { --- > if (open EMAIL, "$$opt{source}/email.db") { 102c102 < warning "Could not open $$opt{source}/data/email.db: $!. No newsletter users will be imported."; --- > warning "Could not open $$opt{source}/email.db: $!. No newsletter users will be imported."; 288d287 < my $ins_pos = @missing_cats; 291c290 < splice @missing_cats, $ins_pos, 0, $father_full_name; --- > unshift @missing_cats, $father_full_name; 300c299 < splice @missing_cats, $ins_pos, 0, $fn; --- > unshift @missing_cats, $fn; 336c335 < elsif (!$cat_map{$full_name}) { --- > else { 346,350d344 < else { < --$Category_counter unless $$opt{straight_import}; < mild_warning("Duplicate category found ($full_name) and skipped"); < next; < } 359,362d352 < if ($cat_map{$_}) { # Already exists < $update_sub_cats->execute($cat_map{$_},"$_/%","$_/%/%") or critical "Unable to execute query `UPDATE ${e_prefix}Category SET FatherID = ? WHERE Full_Name LIKE ? and Full_Name NOT LIKE ?': ".$update_sub_cats->errstr; < next; < } 366,369c356 < if ($father_full and exists $cat_map{$father_full}) { < $father_id = $cat_map{$father_full}; < } < elsif ($father_full) { --- > if ($father_full) { 394c381 < $get_id_sth->execute($_) or critical "Unable to execute query `SELECT ID FROM ${e_prefix}Category WHERE Full_Name = ? <- $_': ".$get_id_sth->errstr; --- > $get_id_sth->execute($_) or critical "Unable to execute query `SELECT ID FROM ${e_prefix}Category WHERE Full_Name = ?': ".$get_id_sth->errstr; 497c484 < for (@category_alternates) { y/_/ / } --- > y/_/ / for @category_alternates; Index: cgi/admin/Links/Import/RDFS2.pm =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Links/Import/RDFS2.pm,v retrieving revision 1.12 retrieving revision 1.11 diff -r1.12 -r1.11 6c6 < # Revision : $Id: RDFS2.pm,v 1.12 2001/02/08 02:57:18 alex Exp $ --- > # Revision : $Id: RDFS2.pm,v 1.11 2001/02/05 20:33:55 alex Exp $ 380,381c380,382 < require GT::Dumper; < critical "STRANGE TAG: " . GT::Dumper::Dumper($parse) . "\n"; --- > require Data::Dumper; > Data::Dumper->import(); > critical "STRANGE TAG: " . Dumper($parse) . "\n"; Index: cgi/admin/Links/Import/S1S2.pm =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Links/Import/S1S2.pm,v retrieving revision 1.20 retrieving revision 1.18 diff -r1.20 -r1.18 6c6 < # Revision : $Id: S1S2.pm,v 1.20 2001/02/17 09:12:09 jagerman Exp $ --- > # Revision : $Id: S1S2.pm,v 1.18 2001/02/06 21:35:01 alex Exp $ 210d209 < $i_dbh{$Links::DBSQL::Links::db_name}->{LongReadLen} = 1000000; 502c501 < my $user_ins_sth = $e_dbh->prepare("INSERT INTO ${e_prefix}Users (Username, Email, Password, Name, ReceiveMail, Newsletter, Status) VALUES (?, ?, ?, ?, ?, ?, 'Registered')") or critical("Unable to prepare query `INSERT INTO ${e_prefix}Users (Username, Email, Name, ReceiveMail, Newsletter) VALUES (?, ?, ?, ?, ?)': ".$e_dbh->errstr); --- > my $user_ins_sth = $e_dbh->prepare("INSERT INTO ${e_prefix}Users (Username, Email, Name, ReceiveMail, Newsletter, Status) VALUES (?, ?, ?, ?, ?, 'Registered')") or critical("Unable to prepare query `INSERT INTO ${e_prefix}Users (Username, Email, Name, ReceiveMail, Newsletter) VALUES (?, ?, ?, ?, ?)': ".$e_dbh->errstr); 535d533 < import_print "\n\tImporting ", scalar @$results, " categories ..\n"; 557d554 < $odbc and $father_sth->finish; 618c615 < $get_links_sth->execute($old_id) or critical "Unable to execute query: ".$get_links_sth->errstr; --- > $get_links_sth->execute($old_id) or critical "Unable to execute query `SELECT $links_get_cols FROM $Links::DBSQL::Links::db_table WHERE CategoryID = ?': ".$get_links_sth->errstr; 620c617 < my $links_results = $get_links_sth->fetchall_arrayref; --- > my $results = $get_links_sth->fetchall_arrayref; 622c619 < $link_sub = sub { return shift @$links_results; } --- > $link_sub = sub { return shift @$results; } 648c645 < $user_ins_sth->execute(($contact_email) x 2, '', (defined $contact_name ? $contact_name : ""), ($receive_mail eq 'Yes' ? 'Yes' : 'No'), 'No') or warning("Unable to execute query `INSERT INTO ${e_prefix}Users (Username, Password, Email, Name, ReceiveMail, Newsletter, Status) VALUES (?, ?, ?, ?, ?, 'Registered')': ".$user_ins_sth->errstr); --- > $user_ins_sth->execute(($contact_email) x 2, (defined $contact_name ? $contact_name : ""), ($receive_mail eq 'Yes' ? 'Yes' : 'No'), 'No') or warning("Unable to execute query `INSERT INTO ${e_prefix}Users (Username, Email, Name, ReceiveMail, Newsletter, Status) VALUES (?, ?, ?, ?, ?, 'Registered')': ".$user_ins_sth->errstr); 668,685c665,667 < { < # Even with a straight import, Validate ID's cannot stay the same because they would conflict with link ID's. < my $sth = $e_dbh->prepare("SELECT MAX(ID) FROM ${e_prefix}Links") or critical "Unable to prepare query `SELECT MAX(ID) FROM ${e_prefix}Links': ".$e_dbh->errstr; < $sth->execute or critical "Unable to execute query `SELECT MAX(ID) FROM ${e_prefix}Links': ".$sth->errstr; < $Links_counter = $sth->fetchrow_array; < $sth->finish(); < } < $get_vlinks_sth->execute($old_id) or critical "Unable to execute query: ".$get_vlinks_sth->errstr; < if ($odbc) { < my $links_results = $get_links_sth->fetchall_arrayref; < $get_links_sth->finish; < $link_sub = sub { return shift @$links_results } < } < else { < $link_sub = sub { $get_links_sth->fetchrow_arrayref } < } < while(my $row = $link_sub->()) { < $row = [@$row]; # Get rid of a peculiar read-only aliasing in DBI --- > $get_vlinks_sth->execute($old_id) or critical "Unable to execute query `SELECT $validate_get_cols FROM $Links::DBSQL::Validate::db_table WHERE CategoryID = ?': ".$get_vlinks_sth->errstr; > while(my $row = $get_vlinks_sth->fetchrow_arrayref) { > $row = [@$row]; 694c676 < $id = ++$Links_counter; --- > $id = ++$Links_counter unless $$opt{straight_import}; 703c685 < $user_ins_sth->execute(($contact_email) x 2, '', (defined $contact_name ? $contact_name : ""), ($receive_mail eq 'Yes' ? 'Yes' : 'No'), 'No') or warning("Unable to execute query `INSERT INTO ${e_prefix}Users (Username, Email, Name, ReceiveMail, Newsletter) VALUES (?, ?, ?, ?, ?)': ".$user_ins_sth->errstr); --- > $user_ins_sth->execute(($contact_email) x 2, (defined $contact_name ? $contact_name : ""), ($receive_mail eq 'Yes' ? 'Yes' : 'No'), 'No') or warning("Unable to execute query `INSERT INTO ${e_prefix}Users (Username, Email, Name, ReceiveMail, Newsletter) VALUES (?, ?, ?, ?, ?)': ".$user_ins_sth->errstr); 718c700 < $Links_counter--; --- > $Links_counter-- unless $$opt{straight_import}; Index: cgi/admin/Plugins/plugin.cfg =================================================================== RCS file: /usr/local/gossamer/lsqldev/cgi/admin/Plugins/plugin.cfg,v retrieving revision 1.14 retrieving revision 1.13 diff -r1.14 -r1.13 1a2,9 > '_post_hooks' => { > > }, > > '_pre_hooks' => { > > }, > Index: GT/Base.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Base.pm,v retrieving revision 1.63 retrieving revision 1.54 diff -r1.63 -r1.54 6c6 < # $Id: Base.pm,v 1.63 2001/02/19 23:43:05 alex Exp $ --- > # $Id: Base.pm,v 1.54 2001/02/05 00:23:01 alex Exp $ 21c21 < use vars qw/$AUTOLOAD $DEBUG $VERSION $ATTRIB_CACHE $MOD_PERL $SPEEDY %ERRORS %COMPILE/; --- > use vars qw/$AUTOLOAD $DEBUG $VERSION $FATAL_MSG $ATTRIB_CACHE $MOD_PERL $MOD_PERL_SET %ERRORS %COMPILE/; 24c24,25 < $VERSION = sprintf "%d.%03d", q$Revision: 1.63 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.54 $ =~ /(\d+)\.(\d+)/; > $FATAL_MSG = undef; 26c27 < $SPEEDY = ($CGI::SpeedyCGI::_i_am_speedy or $CGI::SpeedyCGI::i_am_speedy) ? 1 : 0; --- > $MOD_PERL_SET = 0; 41c42 < if ($MOD_PERL or $SPEEDY) { --- > if ($MOD_PERL) { 44c45 < if ($@) { die "GT::Base: Can't compile '$sub'. Reason: $@"; } --- > if ($@) { die "GT::Base: Can't compiule '$sub'. Reason: $@"; } 48,59d48 < sub import { < # ------------------------------------------------------- < # Only exports the MOD_PERL and SPEEDY tags. < # < my ($pkg, $symbol) = @_; < < return unless ($symbol and ($symbol eq ':all')); < my $callpkg = caller; < *{$callpkg . '::MOD_PERL'} = \$MOD_PERL; < *{$callpkg . '::SPEEDY'} = \$SPEEDY; < } < 101c90 < if (ref $self and (index ($self, 'HASH') != -1) and exists $self->{$attrib} and ! exists $COMPILE{$attrib}) { --- > if (ref $self and exists $self->{$attrib} and ! exists $COMPILE{$attrib}) { 210a200,215 > sub catch_errors { > # ------------------------------------------------------- > # Registers a code ref to trap fatal errors. > # > my $pkg = shift; > my $func = shift; > > defined $func or die "No subroutine passed to catch_errors!"; > (ref $func eq 'CODE') or die "Invalid argument: '$func' passed to catch_errors, must be a code ref"; > > $FATAL_MSG = $func; > $main::SIG{__DIE__} = sub { die(@_) if GT::Base->in_eval(); &$FATAL_MSG(@_); }; > > return 1; > } > 308,309c313,327 < $MOD_PERL and Apache->request->register_cleanup( sub { $self->_cleanup_obj ($msg_pkg, $is_hash); } ); < $SPEEDY and CGI::SpeedyCGI->register_cleanup ( sub { $self->_cleanup_obj ($msg_pkg, $is_hash); } ); --- > if ($MOD_PERL and ! $MOD_PERL_SET) { > Apache->request->register_cleanup( > sub { > ${$msg_pkg . '::errcode'} = undef; > ${$msg_pkg . '::error'} = undef; > ${$msg_pkg . '::errargs'} = undef; > if ($is_hash) { > defined $self and $self->{_errcode} = undef; > defined $self and $self->{_error} = undef; > defined $self and $self->{_errargs} = undef; > } > $MOD_PERL_SET = 0; > }); > $MOD_PERL_SET = 1; > } 325c343 < $msg = @args ? sprintf ($msg, map { defined $_ ? $_ : '[undefined]' } @args) : $msg; --- > $msg = @args ? sprintf ($msg, map { defined $_ ? $_ : '' } @args) : $msg; 340,341c358,359 < if (exists $SIG{__DIE__} and $SIG{__DIE__}) { < die _format_err($err_pkg, $msg); --- > if (ref $FATAL_MSG eq 'CODE') { > &$FATAL_MSG(_format_err($err_pkg, $msg)); 345c363 < die "\n"; --- > die "\n"; # die doesn't print to stderr properly if fileno has changed on some systems. 351,356c369 < my $warning = _format_err($err_pkg, $msg); < $self->{_debug} and $is_hash and ( < $SIG{__WARN__} < ? warn $warning < : print STDERR $warning < ); --- > $self->{_debug} and print STDERR _format_err($err_pkg, $msg) if ($is_hash); 362,380d374 < $COMPILE{_cleanup_obj} = <<'END_OF_FUNC'; < sub _cleanup_obj { < # ------------------------------------------------------- < # Cleans up the self object under a persitant env. < # < my ($self, $msg_pkg, $is_hash) = @_; < < ${$msg_pkg . '::errcode'} = undef; < ${$msg_pkg . '::error'} = undef; < ${$msg_pkg . '::errargs'} = undef; < if ($is_hash) { < defined $self and $self->{_errcode} = undef; < defined $self and $self->{_error} = undef; < defined $self and $self->{_errargs} = undef; < } < return 1; < } < END_OF_FUNC < 423,436d416 < < $COMPILE{clear_errors} = << 'END_OF_FUNC'; < sub clear_errors { < # ------------------------------------------------------- < # Clears the error stack < # < my $self = shift; < $self->{_error} = []; < $self->{_errargs} = []; < $self->{_errcode} = undef; < return 1; < } < END_OF_FUNC < 439d418 < # ------------------------------------------------------- 441d419 < # 461,463c439,441 < if ($] >= 5.005 and !($MOD_PERL or $SPEEDY)) { $ineval = defined ($^S) ? $^S : (stack_trace('GT::Base',1) =~ /(?:[^:]|\b)eval\b/); } < elsif ($MOD_PERL or $SPEEDY) { < my $stack = stack_trace('GT::Base', 1); --- > if ($] >= 5.005 and !$MOD_PERL) { $ineval = defined ($^S) ? $^S : (stack_trace('GT::Base',1) =~ /(?:[^:]|\b)eval\b/); } > elsif ($MOD_PERL) { > my $stack = stack_track('GT::Base', 1); 514d491 < my $rollback = shift || 3; 531c508 < my $i = $rollback; --- > my $i = 1; 595d571 < next unless $self; 712,716d687 < Since errors are kept within an array, too many errors can pose a < memory problem. To clear the error stack simply call: < < $self->clear_errors(); < 783c754 < Revision: $Id: Base.pm,v 1.63 2001/02/19 23:43:05 alex Exp $ --- > Revision: $Id: Base.pm,v 1.54 2001/02/05 00:23:01 alex Exp $ Index: GT/CGI.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/CGI.pm,v retrieving revision 1.50 retrieving revision 1.45 diff -r1.50 -r1.45 6c6 < # $Id: CGI.pm,v 1.50 2001/02/19 21:17:17 sbeck Exp $ --- > # $Id: CGI.pm,v 1.45 2001/02/06 01:40:32 alex Exp $ 18,19c18,19 < use GT::Base (':all'); # Imports $MOD_PERL and $SPEEDY < use vars qw/@ISA $DEBUG $VERSION $ATTRIBS $ERRORS $PRINTED_HEAD --- > use GT::Base (); > use vars qw/@ISA $DEBUG $VERSION $ATTRIBS $ERRORS $MOD_PERL $PRINTED_HEAD 24c24 < $VERSION = sprintf "%d.%03d", q$Revision: 1.50 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.45 $ =~ /(\d+)\.(\d+)/; 33a34 > $MOD_PERL = (exists $ENV{GATEWAY_INTERFACE} and ($ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/)) ? 1 : 0; 90,92c91,94 < $MOD_PERL and require Apache and Apache->request->register_cleanup ( \&reset_env ); < $SPEEDY and require CGI::SpeedyCGI and CGI::SpeedyCGI->new->register_cleanup (\&reset_env ); < --- > if ($MOD_PERL) { > require Apache; > Apache->request->register_cleanup( \&reset_env ); > } 373,384c375,378 < if (ref($toencode) eq 'SCALAR') { < $$toencode =~ s/&/&/g; < $$toencode =~ s//>/g; < $$toencode =~ s/"/"/g; < } < else { < $toencode =~ s/&/&/g; < $toencode =~ s//>/g; < $toencode =~ s/"/"/g; < } --- > $toencode =~ s/&/&/g; > $toencode =~ s/ $toencode =~ s/>/>/g; > $toencode =~ s/"/"/g; 418d411 < my $path_info = exists $opts->{path_info} ? $opts->{path_info} : 0; 440c433 < if ($path_info and $ENV{PATH_INFO}) { --- > if ($ENV{PATH_INFO}) { 476,485c469,470 < for ( split /&/, shift ) { < /([^=]+)=(.*)/ or next; < my ($key, $val) = (unescape($1), unescape($2)); < < # Need to remove cr's on windows. < if ($^O eq 'MSWin32') { < $key =~ s/\r\n/\n/g; < $val =~ s/\r\n/\n/g; < } < push @{$PARAMS{$key}}, $val; --- > for ( split /&/, shift ) { > /([^=]+)=(.*)/ and push @{$PARAMS{unescape($1)}}, unescape($2) 979,982d963 < =item path_info => 1 < < Returns the path info as well: script.cgi/foobar < 1021c1002 < Revision: $Id: CGI.pm,v 1.50 2001/02/19 21:17:17 sbeck Exp $ --- > Revision: $Id: CGI.pm,v 1.45 2001/02/06 01:40:32 alex Exp $ Index: GT/Date.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Date.pm,v retrieving revision 1.33 retrieving revision 1.32 diff -r1.33 -r1.32 6c6 < # $Id: Date.pm,v 1.33 2001/02/09 02:38:11 alex Exp $ --- > # $Id: Date.pm,v 1.32 2001/02/01 00:36:51 jagerman Exp $ 23d22 < # y - two digit year without leading 0 54c53 < $VERSION = sprintf "%d.%03d", q$Revision: 1.33 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.32 $ =~ /(\d+)\.(\d+)/; 296,297c295 < yy => sprintf ("%02d", $year % 100), < y => $year % 100 --- > yy => $year % 100 639d636 < %y% two digit year without leading 0 718c715 < Revision: $Id: Date.pm,v 1.33 2001/02/09 02:38:11 alex Exp $ --- > Revision: $Id: Date.pm,v 1.32 2001/02/01 00:36:51 jagerman Exp $ Index: GT/Dumper.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Dumper.pm,v retrieving revision 1.16 retrieving revision 1.14 diff -r1.16 -r1.14 6c6 < # $Id: Dumper.pm,v 1.16 2001/02/19 21:18:03 sbeck Exp $ --- > # $Id: Dumper.pm,v 1.14 2001/01/03 22:43:36 alex Exp $ 24c24 < $VERSION = sprintf "%d.%03d", q$Revision: 1.16 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.14 $ =~ /(\d+)\.(\d+)/; 71c71 < return $self; --- > return $self; 116c116 < # %opts is optional if you have created an object with the --- > # %opts is optional if you have created an optject with the 152,153c152 < elsif (ref $val eq 'SCALAR' or ref $val eq 'REF' < or ref $val eq 'LVALUE') { $self->_dump_scalar ($level + 1, $val, $code) } --- > elsif (ref $val eq 'SCALAR' or ref $val eq 'REF') { $self->_dump_scalar ($level + 1, $val, $code) } 301c300 < Revision: $Id: Dumper.pm,v 1.16 2001/02/19 21:18:03 sbeck Exp $ --- > Revision: $Id: Dumper.pm,v 1.14 2001/01/03 22:43:36 alex Exp $ Index: GT/HTML.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/HTML.pm,v retrieving revision 1.7 retrieving revision 1.6 diff -r1.7 -r1.6 6c6 < # $Id: HTML.pm,v 1.7 2001/02/11 01:11:24 aki Exp $ --- > # $Id: HTML.pm,v 1.6 2000/11/25 00:22:18 jagerman Exp $ 20a21 > use Data::Dumper; 493a495 > 504c506 < push @deparsed, "http://$host/" . ( join('/', @{__clean_path($new_path) || [] } ) || '' ); --- > push @deparsed, "http://$host/" . join('/',@{__clean_path($new_path)}); 519c521 < return "http://$host/" . ( join('/', grep defined $_, @{ __clean_path( $dirs ) || [] } ) ); --- > return "http://$host/" . join('/',@{__clean_path($dirs)}); 754c756 < Revision: $Id: HTML.pm,v 1.7 2001/02/11 01:11:24 aki Exp $ --- > Revision: $Id: HTML.pm,v 1.6 2000/11/25 00:22:18 jagerman Exp $ Index: GT/Mail.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Mail.pm,v retrieving revision 1.28 retrieving revision 1.23 diff -r1.28 -r1.23 6c6 < # $Id: Mail.pm,v 1.28 2001/02/19 23:43:14 alex Exp $ --- > # $Id: Mail.pm,v 1.23 2001/02/04 23:58:52 sbeck Exp $ 23a24 > use GT::Mail::Decoder; 31c32 < $VERSION = sprintf "%d.%03d", q$Revision: 1.28 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.23 $ =~ /(\d+)\.(\d+)/; 43,44c44 < NOIO => "No input to parse!", < NOEMAIL => "No message head was specified", --- > NOIO => "No input to parse!" 180a181 > $self->{mail_attach} ||= []; 186c187 < # $obj->parse(\*FH); --- > # $obj->parse (\*FH); 188c189 < # $obj->parse('/path/to/file'); --- > # $obj->parse ('/path/to/file'); 190,191d190 < # $obj->parse($SCALAR_REF -or- $SCALAR); < # -------------------------------------- 275c274 < --- > 299c298 < $self->{head}->set( date => $self->date_stamp ) unless ($self->{head}->get('date')); --- > $self->date_stamp; 422,423d420 < < my $attach; 429,434c426 < elsif (ref $_[0] eq 'GT::Mail::Parts') { < $attach = $_[0]; < } < else { < $attach = $self->new_part (@_); < } --- > my $attach = $self->new_part (@_); 478c470 < if (@{$self->{head}->{parts}} > 0) { --- > if ((@{$self->{head}->{parts}} > 0) or (@{$self->{mail_attach}} > 0)) { 499c491 < if ($num_parts == $num) { --- > if (($num_parts == $num) and (@{$self->{mail_attach}} <= 0)) { 509a502,508 > # If we have email objects to attach, attach them. > if (@{$self->{mail_attach}} > 0) { > $self->_build_attach_email ($code); > $self->debug ("Boundary\n\t--$bound--") if ($self->{_debug}); > $code->($CRLF . '--' . $bound . '--' . $CRLF); > } > 511c510 < if (@{$self->{head}->{parts}} > 0) { --- > if ((@{$self->{head}->{parts}} > 0) or (@{$self->{mail_attach}} > 0)) { 518c517 < return $self->{head}; --- > return 1; 535c534 < my ($self, $file) = @_; --- > my $self = shift; 537,542c536,543 < if (ref($file) and (ref($file) eq 'GLOB') and fileno($file)) { < $self->debug ("Filehandle passed to write: fileno (" . fileno ($file) . ").") if ($self->{_debug}); < $io = $file; < } < elsif (open FH, ">$file") { < $io = \*FH; --- > if (ref ($_[0]) and ref ($_[0]) eq 'GLOB') { > $self->debug ("Filehandle passed to write: fileno (" . fileno ($_[0]) . ").") if ($self->{_debug}); > $io = shift; > } > elsif (!-d $_[0]) { > $io = \do { local *FH; *FH }; > my $file; > $_[0] =~ /^\s*(.+)\s*$/ and $file = $1; # Stop the taint monster 543a545 > open $io, ">$file" or return $self->error ("WRITEOPEN", "FATAL", $file, $!); 579,582c581,582 < (ref ($io) eq 'SCALAR') and do { $self->{parser}->in_string($io); last CASE }; < (ref ($io) and ref ($io) =~ /^GLOB|FileHandle$/) and do { $self->{parser}->in_handle($io); last CASE }; < (-e $io and !-d $io) and do { $self->{parser}->in_file($io); last CASE }; < (!ref $io) and do { $self->{parser}->in_string($io); last CASE }; --- > (ref ($io) and ref ($io) =~ /^GLOB|FileHandle$/) and do { $self->{parser}->handle ($io); last CASE }; > (-e $io and !-d $io) and do { $self->{parser}->in_file ($io); last CASE }; 625c625 < return sprintf ("%s, %.2d %s %.4d %.2d:%.2d:%.2d %s", $wday, $date[3], $mon, $date[5], $date[2], $date[1], $date[0], $zone); --- > $self->{head}->set (date => sprintf ("%s, %.2d %s %.4d %.2d:%.2d:%.2d %s", $wday, $date[3], $mon, $date[5], $date[2], $date[1], $date[0], $zone)); 637c637,643 < return $part->body_data; --- > my $tmp = new GT::TempFile; > $io = $tmp->tmpopen or return $self->error ("TMPFILE", "FATAL", $GT::TempFile::error); > (my $data = $part->body_data) =~ s/\015?\012/$CRLF/g; > print $io $data; > seek ($io, 0, 0); > $part->{io} = $io; > $part->{body_in} = 'HANDLE'; 642d647 < binmode($io); 647d651 < binmode($io); 663c667 < if (defined $io) { --- > if ($io) { 669,681c673,678 < my %new = ( < type => $mime, < encoding => $encoding, < disposition => "inline" < ); < < # Body is in a handle < if (ref $io) { $new{body_handle} = $io } < < # Body is in memory < else { $new{body_data} = $io } < < my $new = $self->new_part (%new); --- > my $new = $self->new_part ( > type => $mime, > encoding => $encoding, > body_handle => $io, > disposition => "inline" > ); 686,698c683,686 < < # Set the content boundary unless it has already been set < my $c = $self->{head}->get('Content-Type'); < if ($c) { < $self->debug(qq|Setting content type to ($c; boundary="$bound")|) if $self->{_debug}; < $self->{head}->set('Content-Type' => $c . qq|; boundary="$bound"|); < } < else { < $self->debug ("Setting multipart boundary to ($bound).") if ($self->{_debug}); < $self->{head}->set ('Content-Type' => qq!multipart/mixed; boundary="$bound"!) < } < < --- > $self->debug ("Setting multipart boundary to ($bound).") if ($self->{_debug}); > $self->{head}->set ( > "Content-Type" => qq!multipart/mixed; boundary="$bound"! > ); 716c704,706 < $self->{head}->set ('Content-Transfer-Encoding' => $encoding); --- > $self->{head}->set ( > 'Content-Transfer-Encoding' => $encoding > ); 723c713 < in => $io, --- > in => $io, 728c718 < seek ($io, 0, 0) if (ref $io); --- > seek ($io, 0, 0); 731a722,746 > sub _build_attach_email { > # -------------------------------------------------------------------------- > # Private method that handles attaching the rfc/822 emails. > # > my ($self, $code) = @_; > my $num_attach = $#{$self->{mail_attach}}; > my $bound = $self->{head}->multipart_boundary; > for my $num (0 .. $num_attach) { > next unless $self->{mail_attach}->[$num]; > $self->debug ("Attaching rfc/822 email with name msg.$num") if ($self->{_debug}); > my $new_part = $self->new_part ( > type => 'message/rfc822', > encoding => '7bit', > 'Content-Disposition' => qq!inline; filename="msg.$num"!, > ); > (my $head = $new_part->header_as_string) =~ s/\015?\012/$CRLF/g; > $code->($head . $CRLF); > $self->{mail_attach}->[$num]->build_email ($code) or return; > if ($num != $num_attach) { > $self->debug ("Boundary\n\t--$bound") if ($self->{_debug}); > $code->($CRLF . '--' . $bound . $CRLF); > } > } > } > 752c767 < if (defined $io) { --- > if ($io) { 768,779c783,785 < < # Set the content boundary unless it has already been set < my $c = $part->get('Content-Type'); < if ($c) { < $self->debug(qq|Setting content type to ($c; boundary="$bound")|) if $self->{_debug}; < $part->set('Content-Type' => $c . qq|; boundary="$bound"|); < } < else { < $self->debug ("Setting multipart boundary to ($bound).") if ($self->{_debug}); < $part->set ('Content-Type' => qq!multipart/mixed; boundary="$bound"!) < } < --- > $part->set ( > "Content-Type" => qq!multipart/mixed; boundary="$bound"! > ); 800c806 < in => $io, --- > in => $io, 805c811 < seek ($io, 0, 0) if (ref $io); --- > seek ($io, 0, 0); 835a842 > 1050c1057 < Revision: $Id: Mail.pm,v 1.28 2001/02/19 23:43:14 alex Exp $ --- > Revision: $Id: Mail.pm,v 1.23 2001/02/04 23:58:52 sbeck Exp $ Index: GT/Plugins.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Plugins.pm,v retrieving revision 1.27 retrieving revision 1.25 diff -r1.27 -r1.25 6c6 < # $Id: Plugins.pm,v 1.27 2001/02/12 22:21:36 aki Exp $ --- > # $Id: Plugins.pm,v 1.25 2001/02/01 03:29:46 alex Exp $ 37c37 < $VERSION = sprintf "%d.%03d", q$Revision: 1.27 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.25 $ =~ /(\d+)\.(\d+)/; 133,134d132 < < 172c170 < $config = $self->load_cfg( $directory ); --- > $config = $self->load_cfg(); 264c262 < Revision: $Id: Plugins.pm,v 1.27 2001/02/12 22:21:36 aki Exp $ --- > Revision: $Id: Plugins.pm,v 1.25 2001/02/01 03:29:46 alex Exp $ Index: GT/Robot.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Robot.pm,v retrieving revision 1.11 retrieving revision 1.9 diff -r1.11 -r1.9 6c6 < # $Id: Robot.pm,v 1.11 2001/02/12 17:20:01 aki Exp $ --- > # $Id: Robot.pm,v 1.9 2001/01/02 16:57:46 aki Exp $ 18c18 < use GT::Dumper; --- > use GT::URI; 20d19 < use GT::MD5; 22c21,22 < use GT::URI; --- > use GT::MD5; > use Data::Dumper; 32c32 < 'hits_interval' => 0, --- > 'hits_interval' => 5, 63,67c63 < 'user_rules' => undef, < 'spider_out' => undef, < 'descend_only' => undef, < < 'log_file' => undef --- > 'user_rules' => undef 117,119c113 < rejected => {}, < banned => 0, < descend_only => $self->{descend_only} --- > rejected => {} 128c122,123 < my $host_info = $self->_get_host_info($hostname); --- > my $downloads = $self->{downloads} || {}; > my $host_info = $downloads->{$hostname}; 146c141 < my $host_info = $self->_get_host_info($host); --- > my $host_info = $downloads->{$host}; 168c163 < if ( ref ( $host_info = $self->_get_host_info($hostname) ) and --- > if ( ref ( $host_info = $downloads->{$hostname} ) and 257c252,253 < my $host_info = $self->_get_host_info( $hostname ); --- > my $downloading = $self->{downloads}; > my $host_info = $downloading->{$hostname}; 271c267,268 < my $host_info = $self->_get_host_info($hostname); --- > my $downloading = $self->{downloads}; > my $host_info = $downloading->{$hostname}; 299c296 < my $downloading = $self->{downloads}; --- > my $downloading = $self->{downloads}; 339d335 < 360d355 < $self->_log_message( "Queuing $validated_uri" ) if ( $self->{log_file} ); 367d361 < 373d366 < 386,388c379 < $URIs->do_iteration(); < < while ( $URIs->pending() ) { --- > while ( $URIs->requests() ) { 455,456c446,447 < my $count_downloaded = 0; < my $count_rejected = 0; --- > my $count_downloaded = 0; > my $count_rejected = 0; 458c449 < my $count_pending = 0; --- > my $count_pending = 0; 477c468 < 'count_start_time' => scalar( localtime($self->{count_start_time}) ), --- > 'count_start_time' => $self->{count_start_time}, 515d505 < 521c511 < # ... now, if any of these links don't end with a '/', like www.host.com vs www.host.com/ --- > # ... now, if any of these links don't end with a '/', like www.sfu.ca vs www.sfu.ca/ 526c516 < my $new_parse = ( $self->_validate_rack( "$tmp_uri/" ) ) || {}; --- > my $new_parse = $self->_validate_rack( $tmp_uri . '/' ) || {}; 548a539,541 > # get the host data > my $downloads = $self->{downloads}; > 562c555 < my $host_info = $self->_get_host_info($hostname); --- > my $host_info = $downloads->{$hostname}; 567d559 < $host_info->{downloading} = undef; 577d568 < $self->_log_message( "Rejecting $uri: 404" ) if ( $self->{log_file} ); 584,586c575 < $self->_log_message( "Rejecting $uri: Digest value already exists" ) if ( $self->{log_file} ); < # we can log this but this is probably not necessary < # $self->_add_rejected_uri($hostname, $uri, "DUPLICATE"); --- > $self->_add_rejected_uri($hostname, $uri, "DUPLICATE"); 592d580 < $self->_log_message( "Rejecting $uri: NOINDEX reqwest" ) if ( $self->{log_file} ); 604d591 < $self->_log_message( "Adding $uri to pool" ) if ( $self->{log_file} ); 611d597 < $self->_log_message( "Rejecting $uri because it's not text" ) if ( $self->{log_file} ); 614a601,602 > $host_info->{downloading} = undef; > 617c605 < $self->_spider_links( $hostname, $uri, $resource ); --- > $self->_spider_links( $resource ); 655c643,644 < my $user_rules = $self->{user_rules} or return; --- > my $user_rules = $self->{user_rules}; > $user_rules->debug_level(10); 752a742 > # ... handle robot.txt rules if required 757,760d746 < elsif ( ( my $err = $self->_check_host( $hostname ) ) ne 'OK' ) { < $validated->{$uri} = $err; < } < 763d748 < # ... handle robot.txt rules if required 784d768 < # 791c775 < my $host_info = $self->_get_host_info( $host ); --- > my $host_info = $downloads->{$host}; 795c779 < ( $host_info->{downloading} || () ), --- > $host_info->{downloading}, 808,826c792 < return ''; < } < < sub _check_host { < #------------------------------------------------------------------------------- < # checks to see if we can use this host. sometimes hosts are banned < # < my $self = shift; < my $host = shift or return 'NOHOST'; < < # get the host data < my $downloads = $self->{downloads}; < my $host_info = $downloads->{$host}; < < if ( ( $host_info->{banned} || '' ) eq 'Yes' ) { < return 'BANNED' < }; < < return 'OK'; --- > return undef; 833c799 < my $downloads = ( $self->{downloads} ||= {} ); --- > my $downloads = $self->{downloads}; 844,845c810 < my $host_info = $self->_get_host_info($hostname); < $host_info ||= ( $downloads->{$hostname} ||= {} ); --- > my $host_info = $downloads->{$hostname}; 847c812 < next if ( $host_info->{downloading} ); --- > next if ( $host_info->{downloading}); 855c820,821 < $self->debug( "Completed Queuing" ) if ( $self->{_debug} and @{ $queueable_uris || []} ); --- > $self->debug( "Completed Queuing" ) if ($self->{_debug} and @{ $queueable_uris || []} ); > 861c827 < my ( $hostname, $my_uri, $resource ) = @_; --- > my $resource = shift; 864,893d829 < < my $host_info = $self->_get_host_info($hostname); < my $descend_only = $host_info->{descend_only} || $self->{descend_only}; < my $base_dir = substr( $my_uri, 0, ( rindex( $my_uri, '/' ) + 1 ) ); < < # do a preliminary filter of the links < my $i = 0; < while ( $i < $#uris ) { < my $uri = $uris[$i]; < < # ... are we allowing different hosts < my $uri_host = _parse_host( $uri ); < if ( not $self->{'spider_out'} and ( $uri_host ne $hostname ) ) { < $self->debug( "Ignoring $uri as it moves to another host." ) if ($self->{_debug}); < $self->_log_message( "Ignoring $uri as it moves to another host." ) if ( $self->{log_file} ); < splice @uris, $i, 1; next; < } < < # ... are we only allowed to descend? < if ( $uri_host eq $hostname and $descend_only ) { < if ( substr( $uri, $base_dir ) == 0 ) { < $self->debug( "Not ascending into higher directories for host" ) if ($self->{_debug}); < $self->_log_message( "Not ascending into higher directories for host" ) if ( $self->{log_file} ); < splice @uris, $i, 1; next; < } < } < < $i++; < } < 902,903c838,839 < $self->{uri} ||= do { < new GT::URI( --- > $self->{uri} || do { > new GT::URI( 910,916d845 < sub _get_host_info { < #------------------------------------------------------------------------------- < my $self = shift; < my $hostname = shift or return; < return $self->{downloads}->{$hostname}; < } < 922c851 < $self->{parser} ||= do { --- > $self->{parser} || do { 933c862 < $uri =~ m,\w+://([^/]*)?/?,; --- > $uri =~ m,\w+://([^/]*)?/?,; 940c869 < $uri =~ m,\w+://[^/]*?/(.*),; --- > $uri =~ m,\w+://[^/]*?/(.*),; 944,958d872 < sub _get_dirs { < #------------------------------------------------------------------------------- < my $uri = shift; < my $path = _parse_path( $uri ); < return split /\//, $path; < } < < sub _log_message { < #------------------------------------------------------------------------------- < my $self = shift; < my $message = shift; < my $file = $self->{log_file}; < print $file "$message\n"; < } < 1117c1031 < Revision: $Id: Robot.pm,v 1.11 2001/02/12 17:20:01 aki Exp $ --- > Revision: $Id: Robot.pm,v 1.9 2001/01/02 16:57:46 aki Exp $ Index: GT/SQL.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/SQL.pm,v retrieving revision 1.70 retrieving revision 1.69 diff -r1.70 -r1.69 6c6 < # $Id: SQL.pm,v 1.70 2001/02/13 20:19:40 jagerman Exp $ --- > # $Id: SQL.pm,v 1.69 2001/01/31 03:33:35 alex Exp $ 29c29 < $VERSION = sprintf "%d.%03d", q$Revision: 1.70 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.69 $ =~ /(\d+)\.(\d+)/; 232c232 < return $self->{connect}->{host}; --- > return $self->{connect}->{driver}; 248c248 < return $self->{connect}->{database}; --- > return $self->{connect}->{port}; 256c256 < return $self->{connect}->{login}; --- > return $self->{connect}->{port}; 264c264 < return $self->{connect}->{password}; --- > return $self->{connect}->{port}; 790c790 < Revision: $Id: SQL.pm,v 1.70 2001/02/13 20:19:40 jagerman Exp $ --- > Revision: $Id: SQL.pm,v 1.69 2001/01/31 03:33:35 alex Exp $ Index: GT/TempFile.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/TempFile.pm,v retrieving revision 1.18 retrieving revision 1.17 diff -r1.18 -r1.17 6c6 < # $Id: TempFile.pm,v 1.18 2001/02/09 02:26:17 alex Exp $ --- > # $Id: TempFile.pm,v 1.17 2001/02/02 21:51:05 alex Exp $ 36d35 < unshift (@POSS_TMP_DIRS, $ENV{GT_TMPDIR}) if (exists $ENV{GT_TMPDIR}); 139,146d137 < TempFile picks a temp directory based on the following: < < 1. ENV{GT_TMPDIR} < 2. ~/tmp < 3. ENV{TMPDIR}, ENV{TEMP}, ENV{TMP} < 4. /usr/tmp, /var/tmp, c:/temp, /tmp, /temp, < /WWW_ROOT, c:/windows/temp, c:/winnt/temp < 154c145 < Revision: $Id: TempFile.pm,v 1.18 2001/02/09 02:26:17 alex Exp $ --- > Revision: $Id: TempFile.pm,v 1.17 2001/02/02 21:51:05 alex Exp $ Index: GT/Template.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Template.pm,v retrieving revision 1.64 retrieving revision 1.51 diff -r1.64 -r1.51 6c6 < # $Id: Template.pm,v 1.64 2001/02/20 00:43:27 alex Exp $ --- > # $Id: Template.pm,v 1.51 2001/02/06 04:25:27 alex Exp $ 22c22 < $VERSION = sprintf "%d.%03d", q$Revision: 1.64 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.51 $ =~ /(\d+)\.(\d+)/; 26,37c26,29 < 'NOTEMPLATE' => "No template file was specified.", < 'CANTOPEN' => "Unable to open template file '%s'. Reason: %s", < 'DEEPINC' => "Deep recursion in includes, quiting!", < 'DEEPLOOP' => "Maximum depth of 5 nested loops reached, quiting!", < 'BADINC' => "Error: Can't load included file: '%s'. Reason: %s", < 'UNMATCHENDIF' => "Error: Unmatched endif tag", < 'NOSCALAR' => "Error: Value not scalar", < 'LOOPNOTHASH' => "Error: Value '%s' for loop variable is not a hash reference", < 'NOSUB' => "Error: No subroutine '%s' in '%s'", < 'BADVAR' => "Error: Invalid variable name '\$%s' passed to function: %s\:\:%s", < 'CANTLOAD' => "Error: Unable to load module: %s. Reason:
%s
", < 'UNKNOWNTAG' => "Unknown Tag: '%s'" --- > 'NOTEMPLATE' => "No template file was specified.", > 'CANTOPEN' => "Unable to open template file '%s'. Reason: %s", > 'DEEPINC' => "Deep recursion in includes, quiting!", > 'DEEPLOOP' => "Maximum depth of 5 nested loops reached, quiting!" 77,78c69 < < return $self->_parse($template, $opt, 1); --- > return $self->_parse($template, $opt); 156,164c147,154 < < my $compress = exists $opt->{compress} ? $opt->{compress} : $self->{compress}; < local $self->{opt} = {}; < $self->{opt}->{strict} = exists $opt->{strict} ? $opt->{strict} : $self->{strict}; < $self->{opt}->{print} = exists $opt->{print} ? $opt->{print} : $self->{print}; < $self->{opt}->{escape} = exists $opt->{escape} ? $opt->{escape} : $self->{escape}; < my $root = $self->{root}; < my $copy = $self->{TEMPLATES}{$root}{$template}; < my $temp = \$copy; --- > > my $compress = exists $opt->{compress} ? $opt->{compress} : $self->{compress}; > my $strict = exists $opt->{strict} ? $opt->{strict} : $self->{strict}; > my $print = exists $opt->{print} ? $opt->{print} : $self->{print}; > my $escape = exists $opt->{escape} ? $opt->{escape} : $self->{escape}; > my $root = $self->{root}; > my $copy = $self->{TEMPLATES}{$root}{$template}; > my $temp = \$copy; 167c157 < $self->{opt}->{print} and return $self->_parse_tags($temp); --- > $print and return $self->_parse_tags($temp, { strict => $strict, print => $print, escape => $escape }); 170c160 < $temp = $self->_parse_tags($temp); --- > $temp = $self->_parse_tags($temp, { strict => $strict, print => $print, escape => $escape }); 173c163 < if ($self->{opt}->{compress}) { --- > if ($compress) { 185c175 < my ($self, $txt) = @_; --- > my ($self, $txt, $opt) = @_; 193,195c183,185 < my $strict = $self->{opt}->{strict}; < my $print = $self->{opt}->{print}; < my $escape = $self->{opt}->{escape}; --- > my $strict = $opt->{strict}; > my $print = $opt->{print}; > my $escape = $opt->{escape}; 199,200c189 < my ($loop_var, $loop_var_name, $loop_start); < my $last_pos = 0; --- > my ($loop_var, $loop_var_name, $loop_start, $last_pos); 212,218c201,266 < while ($$txt =~ /($begin\s*(.+?)\s*$end)/gos) { < my $tag = $2; < my $tag_len = length($1); < my $print_start = $last_pos; < $last_pos = pos($$txt); < < --- > while ($$txt =~ / > \G > (.*?) # $1 > ( # $2 > $begin > \s* > (?: > # One argument commands > (?: > ( # $3 > loop | > include | > escapeURL > ) > \s+ > (.+?) # $4 > ) > | > # One or three arguments: > (?: > ( # $5 > if | > ifnot | > unless | > elsif | > elseif > ) > \s+ > (.+?) # $6 > (?: > \s* > ( # $7 > >= | > > | > <= | > < | > == | > = | > != | > \bge\b | > \bgt\b | > \ble\b | > \blt\b | > \beq\b | > \bne\b > ) > \s* > (.+?) # $8 > )? > ) > | > # Zero arguments: > ( # $9 > else | > endif | > endloop > ) > | > # Functions or variables: > (.+?) # $10 > ) > \s* > $end > ) > /gosx) { > $last_pos = pos($$txt) || 0; 223,227c271 < my $print_length = $last_pos - $tag_len - $print_start; < $print ? print substr($$txt, $print_start, $print_length) : ($return .= substr($$txt, $print_start, $print_length)); < < # It has no spaces in it < if ($tag !~ /\s/) { --- > $print ? print $1 : ($return .= $1); 229,231c273,282 < # CASE: TAG = 'else' - switch to print mode (as we were in print). < if ($tag eq 'else') { < $state = SKIP; --- > # CASE: TAG = 'loop' - switch to loop mode. > if (defined $3) { > if ($3 eq 'loop') { > $loop_depth = 1; > $loop_var_name = $4; > $state = > ($loop_var = $self->_get_loop_var($4)) > ? LOOP > : SKIP_LOOP; > $loop_start = pos($$txt) || 0; 233,237c284,291 < < # CASE: TAG = 'endif' - decrement our level. < elsif ($tag eq 'endif') { < if ($i == -1) { < $print ? print $ERRORS->{UNMATCHENDIF} : ($return .= $ERRORS->{UNMATCHENDIF}); --- > # CASE: TAG = 'include' - load the file. > elsif ($3 eq 'include') { > my $include = $4; > my $length = length($2); > if (exists $self->{INCLUDES}{$root}{$include}) { > substr($$txt, pos($$txt) - $length, $length) = $self->{INCLUDES}{$root}{$include}; > pos($$txt) = $last_pos - $length; > ++$include_safety <= 10 or return $self->error("DEEPINC"); 240c294,307 < $i--; --- > my $filename = -e "$root/$include" ? "$root/$include" : (-e $include ? $include : ''); > if ($filename and open (INCL, $filename)) { > read INCL, $self->{INCLUDES}{$root}{$include}, -s INCL; > close INCL; > substr($$txt, pos($$txt) - $length, $length) = $self->{INCLUDES}{$root}{$include}; > $last_pos -= $length; > pos($$txt) = $last_pos; > ++$include_safety <= 10 or return $self->error("DEEPINC"); > } > else { > my $errfile = $filename || "$root/$include"; > my $err = "Error: Can't load included file: '$errfile'. Reason: " . ($! ? $! : 'File does not exist'); > $print ? print $err : ($return .= $err); > } 243,244c310 < < # CASE: Valiable --- > # CASE: TAG = 'escapeURL' - url escape the value. 246,252c312,315 < my $ret = $self->_get_value($tag, $strict); < < # If the function returned a hash ref, we add it to our tags. < if (ref $ret eq 'HASH') { < foreach (keys %$ret) { < $self->{VARS}->{$_} = $ret->{$_}; < } --- > my $val = $self->_get_value($4, 1, $escape) || ''; > if (ref $val) { > my $err = 'Error: Value not scalar'; > $print ? print $err : ($return .= $err) if ref $val; 255,262c318,321 < < # Otherwise just print it out. < if ($escape) { < $ret = ref $ret eq 'SCALAR' ? $$ret : GT::CGI->html_escape($ret); < } < defined($ret) or $ret = ''; < $print ? print $ret : ($return .= $ret); < } --- > $val = GT::CGI->html_unescape($val); > $val = GT::CGI->escape($val); > $print ? print $val : ($return .= $val); > } 264d322 < 266,274c324,325 < elsif ($tag =~ s/^(if)\b\s*// or $tag =~ s/^(ifnot)\b\s*// or $tag =~ s/^(unless)\b\s*//) { < my $op = $1; < $tag =~ s/([\:\w]+)\b\s*//; < my $var = $1; < my ($comp, $val); < if (length($tag)) { < ($comp, $val) = $tag =~ /^(\S+?)\s*(?=(?:[^"']["'])|(?:[^\$]\$v)|\b)\s*(.+)$/; < } < my $full_comp = defined($val); --- > elsif (defined $5) { > my ($op, $var, $comp, $val, $full_comp) = ($5, $6, $7, $8, defined $8); 276,277c327 < my $key = $self->_get_value($var, 0) || ''; # No strict as we are comping. < $key = ref($key) eq 'SCALAR' ? $$key : $key; --- > my $key = $self->_get_value($var, 0, $escape) || ''; # No strict as we are comping. 282c332 < $val = $self->_get_value($val, $strict); --- > $val = $self->_get_value(substr($val,1), $strict, $escape); 286c336 < $val = $self->_check_func($val, 1) || ''; --- > $val = $self->_check_func($val, $strict, $escape, 1) || ''; 318a369 > next; 320,321d370 < } < 323,324c372,375 < elsif ($tag =~ /^elsif\b/ or $tag =~ /^elseif\b/) { < $state = SKIP; --- > elsif ($op eq 'elsif' or $op eq 'elseif') { > $state = SKIP; > next; > } 326,335c377,386 < < # CASE: TAG = 'loop' - switch to loop mode. < elsif ($tag =~ /^loop\b\s*(\S+)/) { < $loop_depth = 1; < $loop_var_name = $1; < $state = < ($loop_var = $self->_get_loop_var($loop_var_name)) < ? LOOP < : SKIP_LOOP; < $loop_start = $last_pos; --- > elsif (defined $9) { > # CASE: TAG = 'else' - switch to print mode (as we were in print). > if ($9 eq 'else') { > $state = SKIP; > } > # CASE: TAG = 'endif' - decrement our level. > elsif ($9 eq 'endif') { > $i--; > } > next; 336a388,390 > else { > # CASE: Regular variable tag found. > my $ret = $self->_check_func($10, $strict, $escape, 0); 338,360c392,395 < # CASE: TAG = 'include' - load the file. < elsif ($tag =~ /^include\b\s*(.+)/) { < my $include = $1; < if (exists $self->{INCLUDES}{$root}{$include}) { < substr($$txt, $last_pos - $tag_len, $tag_len) = $self->{INCLUDES}{$root}{$include}; < $last_pos = $last_pos - $tag_len; < pos($$txt) = $last_pos; < ++$include_safety <= 10 or return $self->error("DEEPINC"); < } < else { < my $filename = -e "$root/$include" ? "$root/$include" : (-e $include ? $include : ''); < if ($filename and open (INCL, $filename)) { < read INCL, $self->{INCLUDES}{$root}{$include}, -s INCL; < close INCL; < substr($$txt, $last_pos - $tag_len, $tag_len) = $self->{INCLUDES}{$root}{$include}; < $last_pos = $last_pos - $tag_len; < pos($$txt) = $last_pos; < ++$include_safety <= 10 or return $self->error("DEEPINC"); < } < else { < my $errfile = $filename || "$root/$include"; < my $err = sprintf ($ERRORS->{BADINC}, $errfile, $! ? $! : 'File does not exist'); < $print ? print $err : ($return .= $err); --- > # If the function returned a hash ref, we add it to our tags. > if (ref $ret eq 'HASH') { > foreach (keys %$ret) { > $self->{VARS}->{$_} = $ret->{$_}; 361a397 > next; 363,371c399,404 < } < # CASE: TAG = 'escapeURL' - url escape the value. < elsif ($tag =~ /^escapeURL\b\s*(\S+)/ or $tag =~ /^escape_url\b\s*(\S+)/) { < my $var = $1; < my $val = $self->_get_value($var, 1) || $var; < $val = ref($val) eq 'SCALAR' ? $$val : $val; < if (ref $val) { < my $err = $ERRORS->{NOSCALAR}; < $print ? print $err : ($return .= $err) if ref $val; --- > # Otherwise, print out what the function returned. > if (defined $ret) { > if ($escape) { > $ret = ref $ret eq 'SCALAR' ? $$ret : GT::CGI->html_escape($ret); > } > $print ? print $ret : ($return .= $ret); 374,377d406 < $val = GT::CGI->html_unescape($val); < $val = GT::CGI->escape($val); < $print ? print $val : ($return .= $val); < } 379d407 < else { 381,383c409 < my $ret = $self->_get_value($tag, $strict); < < # If the function returned a hash ref, we add it to our tags. --- > $ret = $self->_get_value($10, $strict, $escape); 385c411,412 < foreach (keys %$ret) { --- > # If it is a hash ref, add it to our keys. > for (keys %$ret) { 395a423 > next; 402c430 < --- > if (defined $9) { 405,413c433,440 < if ($tag eq 'endif') { < if (defined $if_track[$i]) { < $state = PRINT; < } < if ($i == -1) { < $print ? print $ERRORS->{UNMATCHENDIF} : ($return .= $ERRORS->{UNMATCHENDIF}); < } < else { < $i--; --- > if ($9 eq 'endif') { > if (defined $if_track[$i]) { > $i--; > $state = PRINT; > } > else { > $i--; > } 415d441 < } 418,420c444,447 < elsif ($tag eq 'else') { < if (defined ($if_track[$i]) and $if_track[$i] == 0) { < $state = PRINT; --- > elsif ($9 eq 'else') { > if (defined ($if_track[$i]) and $if_track[$i] == 0) { > $state = PRINT; > } 421a449 > next; 423c451 < --- > if (defined (my $op = $5)) { 426,429c454,458 < elsif ($tag =~ /^if\b/ or $tag =~ /^ifnot\b/ or $tag =~ /^unless\b/) { < $i++; < $if_track[$i] = undef; < } --- > if ($op eq 'if' or $op eq 'ifnot' or $op eq 'unless') { > $i++; > $if_track[$i] = undef; > next; > } 432,447c461,492 < elsif ($tag =~ s/^elsif\b\s*// or $tag =~ s/^elseif\b\s*//) { < unless (defined $if_track[$i]) { next } < $tag =~ s/([\:\w]+)\b\s*//; < my $var = $1; < my ($comp, $val); < if (length($tag)) { < ($comp, $val) = $tag =~ /^(\S+?)\s*(?=(?:[^"']["'])|(?:[^\$]\$v)|\b)\s*(.+)$/; < } < my $full_comp = defined($val); < < my $key = $self->_get_value($var, 0) || ''; # No strict as we are comping. < $key = ref($key) eq 'SCALAR' ? $$key : $key; < if ($full_comp) { < if (index($val, '$') == 0) { < substr($val, 0, 1) = ''; < $val = $self->_get_value($val, $strict); --- > elsif ($op eq 'elsif' or $op eq 'elseif') { > unless (defined $if_track[$i]) { next } > my ($var, $comp, $val, $full_comp) = ($6, $7, $8, defined $8); > my $key = $self->_get_value($var, 0, $escape) || ''; # No strict as we are comping. > if ($full_comp) { > if (substr($val,0,1) eq '$') { > substr($val,0,1) = ''; > $val = $self->_get_value(substr($val,1), $strict, $escape); > } > else { > $val =~ s/^(['"])// and $val =~ s/$1$//; > $val = $self->_check_func($val, $strict, $escape, 1) || ''; > } > my $result; > CASE: { > # Try to silence warnings. This won't work for Perl 5.6's -W switch > local $^W; > ($comp eq 'eq') and $result = ($key eq $val), last CASE; > ($comp eq '=' or $comp eq '==') > and $result = ($key == $val), last CASE; > ($comp eq 'ne') and $result = ($key ne $val), last CASE; > ($comp eq '!=') and $result = ($key != $val), last CASE; > ($comp eq 'lt') and $result = ($key lt $val), last CASE; > ($comp eq '<' ) and $result = ($key < $val), last CASE; > ($comp eq 'le') and $result = ($key le $val), last CASE; > ($comp eq '<=') and $result = ($key <= $val), last CASE; > ($comp eq 'gt') and $result = ($key gt $val), last CASE; > ($comp eq '>' ) and $result = ($key > $val), last CASE; > ($comp eq 'ge') and $result = ($key ge $val), last CASE; > ($comp eq '>=') and $result = ($key >= $val), last CASE; > } > $key = $result; 449,451c494,496 < else { < $val =~ s/^(['"])// and $val =~ s/$1$//; < $val = $self->_check_func($val, 1) || ''; --- > if ($key) { > $if_track[$i] = 1; > $state = PRINT; 453,469c498,499 < my $result; < CASE: { < # Try to silence warnings. This won't work for Perl 5.6's -W switch or use warnings pragma < local $^W; < ($comp eq 'eq') and $result = ($key eq $val), last CASE; < ($comp eq '=' or $comp eq '==') < and $result = ($key == $val), last CASE; < ($comp eq 'ne') and $result = ($key ne $val), last CASE; < ($comp eq '!=') and $result = ($key != $val), last CASE; < ($comp eq 'lt') and $result = ($key lt $val), last CASE; < ($comp eq '<' ) and $result = ($key < $val), last CASE; < ($comp eq 'le') and $result = ($key le $val), last CASE; < ($comp eq '<=') and $result = ($key <= $val), last CASE; < ($comp eq 'gt') and $result = ($key gt $val), last CASE; < ($comp eq '>' ) and $result = ($key > $val), last CASE; < ($comp eq 'ge') and $result = ($key ge $val), last CASE; < ($comp eq '>=') and $result = ($key >= $val), last CASE; --- > else { > $if_track[$i] = 0; 471,478c501 < $key = $result; < } < if ($key) { < $if_track[$i] = 1; < $state = PRINT; < } < else { < $if_track[$i] = 0; --- > next; 486c509 < if ($tag =~ /^loop\b/) { --- > if (defined $3 and $3 eq 'loop') { 489c512 < elsif ($tag eq 'endloop') { --- > elsif (defined $9 and $9 eq 'endloop') { 491c514 < my $loop_length = $last_pos - $tag_len - $loop_start; --- > my $loop_length = pos($$txt) - length($2) - $loop_start; 499c522 < my $loop_tpl = substr($$txt, $loop_start, $loop_length); --- > my $lvref = \substr($$txt, $loop_start, $loop_length); 505c528 < my $err = sprintf ($ERRORS->{LOOPNOTHASH}, $next); --- > my $err = "Value '$next' for loop on variable is not a hash reference"; 517c540 < $print ? $self->_parse_tags($loop_tpl) : ($return .= ${$self->_parse_tags($loop_tpl)}); --- > $print ? $self->_parse_tags($lvref, $opt) : ($return .= ${$self->_parse_tags($lvref, $opt)}); 529c552 < $print ? $self->_parse_tags($loop_tpl) : ($return .= ${$self->_parse_tags($loop_tpl)}); --- > $print ? $self->_parse_tags($lvref, $opt) : ($return .= ${$self->_parse_tags($lvref, $opt)}); 533c556 < my $loop_tpl = substr($$txt, $loop_start, $loop_length); --- > my $lvref = \substr($$txt, $loop_start, $loop_length); 536,537c559,560 < for my $row_num (1 .. @$loop_var) { < my $vars = $loop_var->[$row_num - 1]; --- > for my $row_num (0..$#$loop_var) { > my $vars = $loop_var->[$row_num]; 539c562 < my $err = sprintf ($ERRORS->{LOOPNOTHASH}, $vars); --- > my $err = "Error: Value $row_num of loop array is not a hash"; 552c575 < $print ? $self->_parse_tags(\$loop_tpl) : ($return .= ${$self->_parse_tags(\$loop_tpl)}); --- > $print ? $self->_parse_tags($lvref, $opt) : ($return .= ${$self->_parse_tags($lvref, $opt)}); 562c585 < if ($tag =~ /^loop\b/) { --- > if (defined $3 and $3 eq 'loop') { 563a587 > next; 565c589 < elsif ($tag eq 'endloop') { --- > if (defined $9 and $9 eq 'endloop') { 566a591 > next; 585,586c610,611 < my ($self, $str, $preserve) = @_; < if ((index ($str, '::') != -1) and $str =~ /^ --- > my ($self, $str, $strict, $escape, $preserve) = @_; > if ($str =~ /^ 605,606c630,635 < ( < .+? # Arguments list $3 --- > (?: > ["']? > ( > .+? # Arguments list $3 > ) > ["']? 611a641 > local $SIG{__DIE__}; 619d648 < local ($@, $SIG{__DIE__}); 624c653 < elsif (defined(&{$package . '::' . $func})) { --- > elsif (defined (&{$package . '::' . $func})) { 629c658 < push @err, sprintf($ERRORS->{NOSUB}, $func, $package); --- > push @err, "No subroutine $func in $package."; 637c666 < @args = _parse_args ('\s*,\s*', $args); --- > @args = split(/['"]?\s*,\s*['"]?/, $args); 640,641c669,670 < exists $self->{VARS}->{$1} or return sprintf ($ERRORS->{BADVAR}, $1, $package, $func); < if ($self->{opt}->{escape}) { --- > exists $self->{VARS}->{$1} or return "Invalid variable name '\$$1' passed to function: $package\:\:$func"; > if ($escape) { 653c682 < $ret = $self->{opt}->{strict} ? sprintf ($ERRORS->{CANTLOAD}, $package, join(",
\n" => @err)) : ''; --- > $ret = $strict ? "Unable to load module: $package. Reason:

" . join(",
\n" => @err) : ''; 655d683 < $ret = defined($ret) ? $ret : ''; 660d687 < $ret = defined($ret) ? $ret : ''; 666,705d692 < sub _parse_args { < # -------------------------------------------------------- < # Splits up arguments on commas outside of quotes. < # < my($delimiter, $line) = @_; < my($quote, $quoted, $unquoted, $delim, $word, @pieces); < local $^W; < while (length($line)) { < ($quote, $quoted, undef, $unquoted, $delim, undef) = < $line =~ m/^(["']) # a $quote < ((?:\\.|(?!\1)[^\\])*) # and $quoted text < \1 # followed by the same quote < ([\000-\377]*) # and the rest < | # --OR-- < ^((?:\\.|[^\\"'])*?) # an $unquoted text < (\Z(?!\n)|(?:$delimiter)|(?!^)(?=["'])) < # plus EOL, delimiter, or quote < ([\000-\377]*) # the rest < /x; # extended layout < return() unless( $quote || length($unquoted) || length($delim)); < < $line = $+; < < $unquoted =~ s/\\(.)/$1/g; < if (defined $quote) { < $quoted =~ s/\\(.)/$1/g if ($quote eq '"'); < $quoted =~ s/\\([\\'])/$1/g if ( $quote eq "'"); < } < $word .= defined $quote ? $quoted : $unquoted; < if (length($delim)) { < push(@pieces, $word); < undef $word; < } < if (!length($line)) { < push(@pieces, $word); < } < } < return(@pieces); < } < 759c746 < my ($self, $str, $strict) = @_; --- > my ($self, $str, $strict, $escape) = @_; 761,762c748 < local $self->{opt}->{string} = $strict; < if (ref($str) eq 'HASH') { --- > if (ref $str eq 'HASH') { 765c751 < elsif (defined ($ret = $self->_check_func($str, 0))) { --- > elsif (defined ($ret = $self->_check_func($str, $strict, $escape, 0))) { 772d757 < $ret = defined($ret) ? $ret : ''; 777d761 < $ret = defined($ret) ? $ret : ''; 782c766 < return $strict ? sprintf($ERRORS->{UNKNOWNTAG}, $str) : ''; --- > return $strict ? "Unknown Tag: '$str'" : ''; 1039c1023 < Revision: $Id: Template.pm,v 1.64 2001/02/20 00:43:27 alex Exp $ --- > Revision: $Id: Template.pm,v 1.51 2001/02/06 04:25:27 alex Exp $ 1042,1043d1025 < < Index: GT/URI.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/URI.pm,v retrieving revision 1.17 retrieving revision 1.15 diff -r1.17 -r1.15 6c6 < # $Id: URI.pm,v 1.17 2001/02/12 18:55:40 alex Exp $ --- > # $Id: URI.pm,v 1.15 2001/01/26 03:48:52 alex Exp $ 59c59 < my $requests= scalar(keys %{$self->{downloading}}); # + scalar(@{$self->{racked_uri}}); --- > my $requests= scalar(keys %{$self->{downloading}}) + scalar(@{$self->{racked_uri}}); 165d164 < delete $URI->{request}->{resource_attribs}; 167d165 < 294c292 < $self->debug( "$uri is peculiar because it does not have a request object associated" ) if ($self->{_debug}); --- > $self->debug( "$uri is peculiar because it does no have a request object associated" ) if ($self->{_debug}); 323,327c321,323 < my ( $completed, $tmp ); < while ( < ( %{$tmp = $URI->do_iteration()} ) or < ( $URI->requests( -1 ) ) < ) { --- > my $completed; > while ( $URI->requests( -1 ) ) { > my $tmp = $URI->do_iteration(); 545c541 < Revision: $Id: URI.pm,v 1.17 2001/02/12 18:55:40 alex Exp $ --- > Revision: $Id: URI.pm,v 1.15 2001/01/26 03:48:52 alex Exp $ Index: GT/MD5/Crypt.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/MD5/Crypt.pm,v retrieving revision 1.2 retrieving revision 1.1 diff -r1.2 -r1.1 66,67d65 < local $^W; < Index: GT/Mail/BulkMail.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Mail/BulkMail.pm,v retrieving revision 1.23 retrieving revision 1.22 diff -r1.23 -r1.22 6c6 < # $Id: BulkMail.pm,v 1.23 2001/02/16 10:05:14 jagerman Exp $ --- > # $Id: BulkMail.pm,v 1.22 2001/01/03 17:16:08 jagerman Exp $ 58c58 < $CVS = sprintf "%s", q$Revision: 1.23 $ =~ /(\d+\.\d+)/; --- > $CVS = sprintf "%s", q$Revision: 1.22 $ =~ /(\d+\.\d+)/; 485,486c485 < my ($executable, $tags) = split ' ', $sendmail, 2; < if (-x $executable) { --- > if (-x $sendmail) { 488,496c487,488 < if ($tags) { < $self->{sendmail_with_tags} = $self->{sendmail} = $sendmail; < # Using tags assumes that a method equivelant to -t is being used < $self->{no_sendmail_bs} = 1; < } < else { < $self->{sendmail} = $sendmail; < delete $self->{no_sendmail_bs}; < } --- > $self->{sendmail} = $sendmail; > delete $self->{noSendmailBS}; 503c495 < return $self->{sendmail_with_tags} || $self->{sendmail}; --- > return $self->{sendmail}; 633c625 < if ($noIPCOpen2 || $self->{no_sendmail_bs} and $self->{method} eq 'sendmail') { --- > if ($noIPCOpen2 || $self->{noSendmailBS} and $self->{method} eq 'sendmail') { 863c855 < # sendmail can be run, but apparently it doesn't like the -bs option --- > # sendmail can be run, but apparently it doesn't like bs 868c860 < $self->{no_sendmail_bs}++; --- > $self->{noSendmailBS}++; 910,911c902 < my $to_open = $self->{sendmail_with_tags} || "$self->{sendmail} -t -oi -odq"; < unless (open(SENDMAIL, "| $to_open")) --- > unless (open(SENDMAIL, "| $self->{sendmail} -t -oi -odq")) 913c904 < $self->_cause_error("Can't run sendmail ($to_open): $!"); --- > $self->_cause_error("Can't run sendmail ($self->{sendmail} -t -oi -odq): $!"); Index: GT/Mail/Encoder.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Mail/Encoder.pm,v retrieving revision 1.15 retrieving revision 1.11 diff -r1.15 -r1.11 6c6 < # $Id: Encoder.pm,v 1.15 2001/02/19 21:19:04 sbeck Exp $ --- > # $Id: Encoder.pm,v 1.11 2001/01/17 01:25:13 alex Exp $ 97,103c97,98 < if (not ref $in) { < while (1) { < last unless length $in; < $buf = substr($in, 0, 45); < substr($in, 0, 45) = ''; < < $encoded = encode_base64($buf); --- > while ($nread = read($in, $buf, 4096)) { > $encoded = encode_base64($buf); 106,117c101,103 < $encoded =~ s/\015?\012/$CRLF/g; < $encoded .= $CRLF unless ($encoded =~ /$CRLF\Z/); # ensure newline! < $out->($encoded); < } < } < else { < while ($nread = read($in, $buf, 45)) { < $encoded = encode_base64($buf); < $encoded =~ s/\015?\012/$CRLF/g; < $encoded .= $CRLF unless ($encoded =~ /$CRLF\Z/); # ensure newline! < $out->($encoded); < } --- > $encoded =~ s/\015?\012/$CRLF/g; > $encoded .= $CRLF unless ($encoded =~ /$CRLF\Z/); # ensure newline! > $out->($encoded); 126,136c112,115 < if (not ref $in) { < $in =~ s/\015?\012/$CRLF/g; < $out->($in); < } < else { < my ($buf, $nread) = ('', 0); < while ($nread = read($in, $buf, 4096)) { < $buf =~ s/\015?\012/$CRLF/g; < $out->($buf); < } < defined ($nread) or return; # check for error --- > my ($buf, $nread) = ('', 0); > while ($nread = read($in, $buf, 4096)) { > $buf =~ s/\015?\012/$CRLF/g; > $out->($buf); 137a117 > defined ($nread) or return; # check for error 144d123 < 145a125 > 148,160c128,130 < if (not ref $in) { < while (1) { < last unless length $in; < $buf = substr($in, 0, 45); < substr($in, 0, 45) = ''; < $out->(pack('u', $buf)); < } < } < else { < while (read($in, $buf, 45)) { < $buf =~ s/\015?\012/$CRLF/g; < $out->(pack('u', $buf)) < } --- > while (read($in, $buf, 45)) { > $buf =~ s/\015?\012/$CRLF/g; > $out->(pack('u', $buf)) 169,180c139,142 < < if (not ref $in) { < $in =~ tr[\200-\377][\000-\177]; < $in =~ s/\015?\012/$CRLF/g; < $out->($in); < } < else { < while (<$in>) { < tr[\200-\377][\000-\177]; < s/\015?\012/$CRLF/g; < $out->($_); < } --- > while (<$in>) { > if (/[\200-\377]/) { tr[\200-\377][\000-\177] } > s/\015?\012/$CRLF/g; > $out->($_); 188,201c150,151 < < local $_; < my $ref = ref $in; < unless ($ref) { $in =~ s/\015?\012/\n/g } < while (1) { < if ($ref) { < $_ = <$in>; < defined($_) or last; < } < else { < $in =~ s/^(.*?\r?\n)//m; < $_ = $1; < (defined and length) or last; < } --- > > while (<$in>) { 224d173 < s/\015?\012/$CRLF/g; 226,228d174 < unless ($ref) { < (defined($in) and length($in)) or last; < } 319c265 < Revision: $Id: Encoder.pm,v 1.15 2001/02/19 21:19:04 sbeck Exp $ --- > Revision: $Id: Encoder.pm,v 1.11 2001/01/17 01:25:13 alex Exp $ Index: GT/Mail/POP3.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Mail/POP3.pm,v retrieving revision 1.13 retrieving revision 1.11 diff -r1.13 -r1.11 6c6 < # $Id: POP3.pm,v 1.13 2001/02/13 05:55:07 sbeck Exp $ --- > # $Id: POP3.pm,v 1.11 2001/01/30 09:39:19 sbeck Exp $ 21,23d20 < # Constants < sub BLOCK () { 4096 } < 36c33 < $CRLF = "\r\n"; --- > $CRLF = "\015\012"; 70,72c67,70 < my $io = ''; < $self->top ($num, sub { $io .= $_[0] }) or return; < return GT::Mail::Parse->new(debug => $self->{_debug}, in_string => $io, crlf => $CRLF)->parse_head; --- > my $io = GT::TempFile->tmpopen or return; > $self->top ($num, sub { print $io $_[0] }) or return; > seek ($io, 0, 0); > return GT::Mail::Parse->new (debug => $self->{_debug}, handle => $io)->parse_head; 87c85,86 < my $part = $self->head_part($_) or return; --- > my $part = $self->head_part or return; > 1 while (<$s>); 105,108c104,120 < my $io = $self->retr($num) or return; < my $parser = new GT::Mail::Parse(debug => $self->{_debug}, in_string => $io, crlf => $CRLF); < $parser->parse or return $self->error("PARSE", "WARN", $GT::Mail::Parse::error); < return $parser; --- > my $io = GT::TempFile->tmpopen or return; > $self->retr ($num, sub { print $io $_[0] }) or return; > seek ($io, 0, 0); > $self->{mail} ||= GT::Mail->new(debug => $self->{_debug}); > $self->{mail}->parse($io) or return; > return delete $self->{mail}; > } > > sub naming { > # -------------------------------------------------------- > # $obj->naming($coderef); > # ----------------------- > # This method just wraps to the GT::Mail naming routine. > # > my $self = shift; > $self->{mail} ||= GT::Mail->new(debug => $self->{_debug}); > return $self->{mail}->naming(@_); 183,185c195,196 < port => $self->{port}, < host => $self->{host}, < max_down => 0, --- > port => $self->{port}, > host => $self->{host} 187,188c198 < $self->{sock} = $self->{sock_obj}->fh or return $self->error ("CANTCONNECT", "WARN", $GT::Socket::error); < select((select($self->{sock}) , $| = 1)[0]); --- > $self->{sock} = $self->{sock_obj}->fh or return $self->error ("CANTCONNECT", "WARN", $GT::Socket::error); 260,261c270,272 < my ($self, $num, $code) = @_; < $num or return $self->error ("BADARGS", "FATAL", '$obj->head ($msg_num);. No message number passed to head.'); --- > my $self = shift; > my ($num, $lines, $header, $line, $buflen, $s, $code); > 264,269c275,277 < $_ = $self->send ("TOP $num 0"); /^\+OK/ or return $self->error ("ACTION", "WARN", "TOP $num 0", $_); < my $s = $self->{sock}; < my ($tp, $header); < while (<$s>) { < (index($_, '.') == 0) and last; < $header .= $_; --- > $num = shift || return $self->error ("BADARGS", "FATAL", '$obj->head ($msg_num);. No message number passed to head.'); > unless ($code = shift) { > $code = sub { $header .= $_[0] }; 271,272c279,289 < if (index($header, '>' == 0)) { < substr($header, 0, index($header, "\r\n") + 2) = ''; --- > $lines = 0; > > $_ = $self->send ("TOP $num $lines"); /^\+OK/ or return $self->error ("ACTION", "WARN", "TOP $num $lines", $_); > > $s = $self->{sock}; > my $tp; > while (<$s>) { > $tp = 1 if (/^\r?\n$/); # Out of the header. > next if (!$tp and /^>/); # Qmails nice screwed up header > /^\./ and last; > $code->($_); 273a291 > 275,278c293,294 < if ($code and ref $code eq 'CODE') { < $code->($header); < } < else { --- > > if ($header) { 281d296 < 289,290c304,305 < my ($self, $num, $code) = @_; < defined($num) or return $self->error ("BADARGS", "FATAL", '$obj->retr ($msg_numm, $code);'); --- > my $self = shift; > my $num = shift || return $self->error ("BADARGS", "FATAL", '$obj->message ($msg_numm, $code);'); 294,303c309,312 < # Retrieve the entire email < local ($_) = $self->send ("RETR $num"); /^\+OK (\d+)/ or return $self->error ("ACTION", "WARN", "RETR $num", $_); < my $size = $1; < my $s = $self->{sock}; < read($s, my $body, $size); < my $dot = <$s>; < < # Qmail puts this wierd header as the first line < if (index($body, '>') == 0) { < substr($body, 0, index($body, "\r\n") + 2) = ''; --- > $_ = $self->send ("RETR $num"); /^\+OK/ or return $self->error ("ACTION", "WARN", "RETR $num", $_); > my ($body, $code); > unless ($code = shift) { > $code = sub { $body .= $_[0] }; 305,307c314,322 < $self->debug ("Message $num retrieved.") if ($self->{_debug}); < if ($code and ref $code eq 'CODE') { < $code->($body); --- > my $s = $self->{sock}; > > # Get the entire message body. > my $tp; > while (<$s>) { > $tp = 1 if (/^\r?\n$/); # Out of the header. > next if (!$tp and /^>/); # Qmails nice screwed up header > /^\./ and last; > $code->($_); 309,310c324,327 < else { < return \$body; --- > $self->debug ("Message $num retrieved.") if ($self->{_debug}); > > if ($body) { > return wantarray ? split(/\r?\n/, $body) : $body; 365c382 < my @messages; --- > my ($line, $message, @messages); 369,373c386,388 < my $s = $self->{sock}; < while (<$s>) { < tr/\r\n//d; < (index($_, '.') == 0) and last; < push (@messages, $_); --- > while (defined ($line = $self->read())) { > $line =~ /^\./ and last; > push (@messages, $line); 375c390 < $self->debug ("", (scalar @messages), " messages listed.") if ($self->{_debug}); --- > $self->debug ("", ($#messages+1), " messages listed.") if ($self->{_debug}); 487c502 < my @to = $top->split_field; --- > my @to = $top->emails; 720c735 < Revision: $Id: POP3.pm,v 1.13 2001/02/13 05:55:07 sbeck Exp $ --- > Revision: $Id: POP3.pm,v 1.11 2001/01/30 09:39:19 sbeck Exp $ Index: GT/Mail/Parse.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Mail/Parse.pm,v retrieving revision 1.24 retrieving revision 1.21 diff -r1.24 -r1.21 6c6 < # $Id: Parse.pm,v 1.24 2001/02/13 22:06:29 sbeck Exp $ --- > # $Id: Parse.pm,v 1.21 2001/01/30 09:41:33 sbeck Exp $ 16c16 < use vars qw($VERSION $DEBUG $ERRORS $CRLF $CR_LN @ISA); --- > use vars qw($VERSION $DEBUG $ERRORS $CRLF @ISA); 22a23 > use GT::Mail::Decoder; 33c34 < $VERSION = substr q$Revision: 1.24 $, 10; --- > $VERSION = substr q$Revision: 1.21 $, 10; 36,39c37 < $CRLF = "\n"; < < # The length of a crlf < $CR_LN = 2; --- > $CRLF = "\015\012"; 49d46 < DEEPPARTS => "Deep recursion dected, email appears to have more than 50 parts!", 52,72d48 < my %DecoderFor = ( < # Standard... < '7bit' => 'NBit', < '8bit' => 'NBit', < 'base64' => 'Base64', < 'binary' => 'Binary', < 'none' => 'Binary', < 'quoted-printable' => 'QuotedPrint', < < # Non-standard... < 'x-uu' => 'UU', < 'x-uuencode' => 'UU', < ); < # If MIME::Base64 is installed use it < eval { < local $SIG{__DIE__}; < require MIME::Base64; < import MIME::Base64; < 1; < } or *decode_base64 = \>_old_decode_base64; < 111c87 < for my $m (qw(in_file in_handle in_string crlf)) { --- > for my $m (qw(naming in_file handle)) { 116,123d91 < sub crlf { < $CRLF = pop || return $CRLF; < $CR_LN = length($CRLF); < my $c = $CRLF; < $c =~ s/\r/\\r/g; < $c =~ s/\n/\\n/g; < } < 132c100 < my ($self) = @_; --- > my $self = shift; 135c103 < $self->init(@_) if (@_ > 1); --- > $self->init(@_) if (@_ > 0); 137,138c105,106 < ($self->{string} and ref($self->{string}) eq 'SCALAR') < or return $self->error('BADARGS', 'FATAL', "No input was given to parse before parse() was called"); --- > # Must have an input handle to parse > my $in = $self->{file_handle} or return; 141c109 < $self->_parse_part(undef, $self->{string}); # parse! --- > $self->_parse_part (undef, $in); # parse! 155c123 < my ($self, $in) = @_; --- > my $self = shift; 158c126,129 < # $self->init (@_) if (@_ > 2); --- > $self->init (@_) if (@_ > 0); > > # Must have an input handle to parse > my $in = $self->{file_handle} or return; 169c140 < sub in_handle { --- > sub handle { 171c142 < # $obj->in_handle (\*FH); --- > # $obj->handle (\*FH); 176,183c147,148 < if (@_ > 1 and ref $value and fileno $value) { < my $tmp = ''; < local $_; < while (<$value>) { < ${$self->{string}} .= $_; < } < } < return $self->{string}; --- > (@_ > 1) and $self->{file_handle} = $value; > return $self->{file_handle}; 199,210d163 < sub in_string { < my ($self, $string) = @_; < return $self->{string} unless (@_ > 1); < if (ref($string) eq 'SCALAR') { < $self->{string} = $string; < } < else { < $self->{string} = \$string; < } < return $self->{string}; < } < 237,238c190,213 < sub top_part { < return ${shift()->{parts}}[0]; --- > sub naming { > # -------------------------------------------------------------------------- > # $obj->naming ( sub { do somthing }, @args ); > # ------------------------------------- > # This is the naming scheme for the parts of the email that are > # parsed and added as attachments. > # You should pass in a code ref and a list of arguments. > # Te code ref will be passed in the part object for that part > # and the rest of the arguments you passed in here. > # In addition to the arguments you pass here the first argument > # to your callback will be the part object. > # > my $self = shift; > my $code = shift; > > if (defined ($code) and ref ($code) eq 'CODE') { > $self->{naming} = $code; > if (@_) { > $self->{args} = [@_]; > } > return 1; > } > $self->{naming} or $self->{naming} = \&_naming; > return $self->{naming}; 240a216 > 257c233 < $part->extract($in) or return $self->error ("PARSE", "WARN", "Couldn't parse head!"); --- > $part->extract ($in) or return $self->error ("PARSE", "WARN", "Couldn't parse head!"); 260,265c236,242 < my @header_lines; < while ($$in =~ /^(.*?$CRLF)/g) { < if ($1 eq $CRLF) { < last; < } < push @header_lines, $1; --- > > seek($in, 0, 0); > my @headlines; > while (<$in>) { > s/\r?\n$/\n/; > /^\n/ and last; > push @headlines, $_; 267c244,245 < $part->extract(\@header_lines) or return $self->error($GT::Mail::Parts::error, 'WARN'); --- > $part->extract (\@headlines) or return; > seek ($in, 0, 0); 281,284d258 < if (ref $in eq 'GLOB' or ref $in eq 'FileHandle') { < return $self->_parse_stream($outer_bound, $in, $part); < } < 293,296c267,271 < my $indx = index($$in, $CRLF . $CRLF); < if ($indx == -1) { < $self->debug('Message has no body.'); < $indx = length($$in); --- > my @headlines; > while (<$in>) { > s/\r?\n$/\n/; > /^\n/ and last; > push @headlines, $_; 298,299c273 < $part->extract ([map { $_ . $CRLF } split($CRLF => substr($$in, 0, $indx))]) or return $self->error($GT::Mail::Parts::error, 'WARN'); < substr($$in, 0, $indx + ($CR_LN * 2)) = ''; --- > $part->extract (\@headlines) or return; 302c276 < my ($type, $subtype) = split('/', $part->mime_type); --- > my ($type, $subtype) = split ('/', $part->mime_type); 314,315c288,289 < defined ($inner_bound) or return $self->error ("PARSE", "WARN", "No multipart boundary in multipart message."); < (index($inner_bound, $CRLF) == -1) or return $self->error ("PARSE", "WARN", "CR or LF in multipart boundary."); --- > defined ($inner_bound) or return $self->error ("PARSE", "WARN", "No multipart boundary in multipart message."); > ($inner_bound =~ /[\r\n]/) and return $self->error ("PARSE", "WARN", "CR or LF in multipart boundary."); 318c292 < $self->debug ("Parsing preamble.") if ($self->{_debug}); --- > $self->debug ("Parsing preamble."); 326c300 < ++$partno < 50 or return $self->error('DEEPPARTS', 'WARN'); --- > ++$partno; 329,330c303,304 < ($parts, $state) = $self->_parse_part($inner_bound, $in, new GT::Mail::Parts) or return; < ($state eq 'EOF') and return $self->error('PARSE', 'WARN', 'Unexpected EOF before close.'); --- > ($parts, $state) = $self->_parse_part ($inner_bound, $in, new GT::Mail::Parts) or return; > ($state eq 'EOF') and return $self->error ("PARSE", "WARN", "Unexpected EOF before close."); 332,333c306 < $parts->mime_type($retype) if $retype; < push(@{$part->{parts}}, $parts); --- > $parts->mime_type ($retype) if $retype; 335c308,310 < last if ($state eq 'CLOSE'); --- > push (@{$self->{parts}}, $parts); > push (@{$part->{parts}}, $parts); > last if ($state eq 'CLOSE'); 340c315 < ($state = $self->_parse_epilogue($outer_bound, $in, $part)) or return; --- > ($state = $self->_parse_epilogue ($outer_bound, $in, $part)) or return; 351c326 < if (!exists($DecoderFor{lc($encoding)})) { --- > if (!GT::Mail::Decoder->supported ($encoding)) { 359a335 > my $rawlength = undef; 364a341,342 > $ENCODED = GT::TempFile->tmpopen or return; > binmode ($ENCODED); 365a344,347 > > select ((select ($ENCODED), $| = 1)[0]); > $rawlength = tell ($ENCODED); > seek ($ENCODED, 0, 0); 374a357 > 379,383c362,376 < $part->{body_in} = 'MEMORY'; < < my $decoder = $DecoderFor{lc($encoding)}; < $self->debug("Decoding " . lc($encoding)) if $self->{_debug}; < $self->$decoder($ENCODED, \$part->{data}) or return; --- > > my $body = $self->_new_body_for ($part) or return $self->error ("PARSE", "WARN", "Message has no body."); > $part->binmode (1) unless $part->mime_type =~ m{^(text|message)(/|\Z)}i; #/ > > (my $out = $part->open ("w")) or return; > > $self->debug ("Decoding $encoding.") if ($self->{_debug}); > GT::Mail::Decoder->gt_decode ( > debug => $self->{_debug}, > encoding => $encoding, > in => $ENCODED, > out => sub { print $out $_[0] } > ) or return $self->error ("DECODE", "WARN", $GT::Mail::Decoder::error); > close ($out); > 385c378 < else { --- > else { 388,389c381,395 < $self->debug("Reparsing enclosed message.") if ($self->{_debug}); < my $out = ''; --- > $self->debug ("Reparsing enclosed message.") if ($self->{_debug}); > > my $out = GT::TempFile->tmpopen or return; > > $self->debug ("Decoding $encoding.") if ($self->{_debug}); > GT::Mail::Decoder->gt_decode ( > debug => $self->{_debug}, > encoding => $encoding, > in => $ENCODED, > out => sub { print $out $_[0] } > ) or return $self->error ("DECODE", "WARN", $GT::Mail::Decoder::error); > seek ($out, 0,0); > > my $top = new GT::Mail::Parts; > push (@{$part->{parts}}, $top); 391,394c397 < my $decoder = $DecoderFor{lc($encoding)}; < $self->debug("Decoding " . lc($encoding)) if $self->{_debug}; < $self->$decoder($ENCODED, \$out) or return; < $self->_parse_part(undef, \$out, new GT::Mail::Parts) or return; --- > $self->_parse_part (undef, $out, $top) or return; 406,407c409 < my ($self, $bound, $in) = @_; < my $loc; --- > my ($self, $bound, $in, $out) = @_; 410c412 < my ($delim, $close) = ("$CRLF--$bound$CRLF", "$CRLF--$bound--$CRLF"); --- > my ($delim, $close) = ("--$bound", "--$bound--"); 412,425c414,426 < < $loc = index($$in, $delim); < if ($loc != -1) { < $_[3] = \do{substr($$in, 0, $loc)}; < substr($$in, 0, $loc + length($delim)) = ''; < $self->debug("Found delim($delim)") if $self->{_debug}; < return 'DELIM' < } < $loc = index($$in, $close); < if ($loc != -1) { < $_[3] = \do{substr($$in, 0, $loc)}; < substr($$in, 0, $loc + length($close)) = ''; < $self->debug("Found close($close)") if $self->{_debug}; < return 'CLOSE' --- > > # Read: > my $eol; > my $held_eol = ''; > while (<$in>) { > > ($_, $eol) = m/^(.*?)($CRLF|\n)?\Z/o; > > # Now, look at what we've got: > ($_ eq $delim) and return 'DELIM'; > ($_ eq $close) and return 'CLOSE'; > print $out $held_eol, $_; > $held_eol = $eol; 428c429 < return $self->error ("PARSE", "FATAL", "Unexpected EOF.\n". --- > return $self->error ("PARSE", "WARN", "Unexpected EOF.\n". 442,443c443 < my $loc; < my ($delim, $close) = ("$CRLF--$inner_bound$CRLF", "$CRLF--$inner_bound--$CRLF"); --- > my ($delim, $close) = ("--$inner_bound", "--$inner_bound--"); 448,456c448,453 < $loc = index($$in, $delim); < if ($loc != -1) { < push(@saved, split($CRLF => substr($$in, 0, $loc))); < substr($$in, 0, $loc + length($delim)) = ''; < return 'DELIM' < } < $loc = index($$in, $close); < if ($loc != -1) { < return $self->error ("Found ($close) before finding the start of the boundary. Message malformed"); --- > while (<$in>) { > s/\r?\n$//o; > ($_ eq $delim) and return 'DELIM'; > ($_ eq $close) and return $self->error ("Found ($close) before finding the start of the boundary. Message malformed"); > > push @saved, "$_\n"; 471d467 < my $loc; 473c469 < my ($delim, $close) = ("$CRLF--$outer_bound$CRLF", "$CRLF--$outer_bound--$CRLF") --- > my ($delim, $close) = ("--$outer_bound", "--$outer_bound--") 479,498c475,476 < if (defined $outer_bound) { < $loc = index($$in, $delim); < if ($loc != -1) { < push(@saved, split($CRLF => substr($$in, 0, $loc))); < substr($$in, 0, $loc + length($delim)) = ''; < return 'DELIM' < } < $loc = index($$in, $close); < if ($loc != -1) { < push(@saved, split($CRLF => substr($$in, 0, $loc))); < substr($$in, 0, $loc + length($close)) = ''; < return 'CLOSE' < } < } < push(@saved, split($CRLF => $$in)); < $$in = ''; < $self->debug ("EOF: epilogue is ", length(join '', @saved), " bytes") if ($self->{_debug}); < return 'EOF'; < } < --- > while (<$in>) { > s/\r?\n$//o; 500,518c478,481 < sub Base64 { < # -------------------------------------------------------------------------- < my ($self, $in, $out) = @_; < < ### Extract substring with highest multiple of 4 bytes: < ### 0 means not enough to work with... get more data! < my $len_4xN = length($$in) & ~3; < < ### Partition into largest-multiple-of-4 (which we decode), < ### and the remainder (which gets handled next time around): < $$out .= decode_base64(substr($$in, 0, $len_4xN)); < my $buffer = substr($$in, $len_4xN); < < ### No more input remains. Dispose of anything left in buffer: < if (length($buffer)) { < < ### Pad to 4-byte multiple, and decode: < $buffer .= "==="; ### need no more than 3 pad chars < $len_4xN = length($buffer) & ~3; --- > if (defined($outer_bound)) { > ($_ eq $delim) and return 'DELIM'; > ($_ eq $close) and return 'CLOSE'; > } 520,521c483 < ### Decode it! < $$out .= decode_base64(substr($buffer, 0, $len_4xN)); --- > push @saved, "$_\n"; 523,548c485,486 < < return 1; < } < < sub Binary { < # -------------------------------------------------------------------------- < my ($self, $in, $out) = @_; < $$out = $$in; < return 1; < } < < sub NBit { < # -------------------------------------------------------------------------- < my ($self, $in, $out) = @_; < $$out = $$in; < return 1; < } < < sub QuotedPrint { < # -------------------------------------------------------------------------- < my ($self, $in, $out) = @_; < $$out = $$in; < $$out =~ s/[ \t]+?\n/\n/g; # rule #3 (trailing space must be deleted) < $$out =~ s/=\n//g; # rule #5 (soft line breaks) < $$out =~ s/=([\da-fA-F]{2})/pack("C", hex($1))/ge; < return 1; --- > $self->debug ("EOF: epilogue is ", length(join '', @saved), " bytes"); > return 'EOF'; 551c489 < sub UU { --- > sub _naming { 553,571c491,499 < my ($self, $in, $out) = @_; < my ($mode, $file); < < # Find beginning... < while ($$in =~ s/^(.+$CRLF)//o) { < local $_ = $1; < last if ($mode, $file) = /^begin\s*(\d*)\s*(\S*)/; < } < return GT::Mail::Decoder->error("uu decoding: no begin found", 'WARN') if (!defined($_)); < < # Decode: < while ($$in =~ s/^(.+$CRLF)//o) { < local $_ = $1; < last if /^end/; < next if /[a-z]/; < next unless int((((ord() - 32) & 077) + 2) / 3) == int(length() / 4); < $$out .= unpack('u', $_); < } < return 1; --- > # Private naming function that is used if you do not specify the > # naming code ref. > # > my ($self, $part) = @_; > my $name = $part->recommended_filename; > $self->debug ('Recommended name is ('.$name.')') if ($self->{_debug} and $name); > $self->{Ext} ||= 'txt'; > my $file = $name ? $name : $self->{name}++ . '.' . $self->{Ext}; > return './' . $file; 574c502 < sub gt_old_decode_base64 ($) { --- > sub _new_body_for { 576,591c504,514 < local($^W) = 0; < < my $str = shift; < my $res = ""; < < $str =~ tr|A-Za-z0-9+=/||cd; < if (length($str) % 4) { < carp ("Length of base64 data not a multiple of 4"); < } < $str =~ s/=+$//; < $str =~ tr|A-Za-z0-9+/| -_|; < while ($str =~ /(.{1,60})/gs) { < my $len = chr(32 + length($1)*3/4); < $res .= unpack("u", $len . $1 ); < } < return $res; --- > # Internal Method > # --------------- > # Sets the path to the body and returns it. > # Uses the naming scheme defined. > # > my ($self, $part) = @_; > my @args = exists $self->{args} ? @{$self->{args}} : (); > unshift(@args, $self, $part); > my $path = ($self->{naming} and ref ($self->{naming}) eq 'CODE') ? $self->{naming}->(@args) : $self->_naming ($part); > $self->debug("Setting Path to: ($path) for ($part)") if ($self->{_debug}); > return $part->body_path ($path); 704c627 < Revision: $Id: Parse.pm,v 1.24 2001/02/13 22:06:29 sbeck Exp $ --- > Revision: $Id: Parse.pm,v 1.21 2001/01/30 09:41:33 sbeck Exp $ Index: GT/Mail/Parts.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Mail/Parts.pm,v retrieving revision 1.29 retrieving revision 1.25 diff -r1.29 -r1.25 2c2,3 < # Gossamer Threads Module Library - http://gossamer-threads.com/ # --- > # Gossamer Threads Module Library - http://gossamer-threads.com/ > # 5c6 < # $Id: Parts.pm,v 1.29 2001/02/19 21:19:57 sbeck Exp $ --- > # $Id: Parts.pm,v 1.25 2001/01/30 09:43:01 sbeck Exp $ 16a18 > use GT::Mail::Decoder; 21c23 < $CRLF = "\015\012"; --- > $CRLF = "\r\n"; 41c43,44 < # token = 1* # --- > # token = 1* > # 76d78 < 83c85,86 < ($tag, $lines) = $self->_fmt_line ($tag, $lines) or return; --- > ($tag, $lines) = $self->_fmt_line ($tag, $lines); > 103c106 < $raw =~ tr/\n//d; --- > $raw =~ s/\n//g; 153c156 < $tag = lc($tag); --- > $tag = $self->_tag_case($tag); 171c174 < $tag = lc($tag); --- > $tag = $self->_tag_case ($tag); 200c203 < my $tag = lc($_[0]); --- > my $tag = $self->_tag_case($_[0]); 311c314 < $self->multipart_boundary ("---------=_" . scalar (time) . "-$$-" . int(rand(time)/2)); --- > $self->multipart_boundary ("---------=_" . scalar (time) . "-$$-" . scalar (@{$self->{parts}})); 365c368 < $tag = lc($tag); --- > $tag = $self->_tag_case($tag); 444,445d446 < my $key = lc $tag; < $tag = $self->_tag_case($tag); 448c449 < $ret .= $tag . ': ' . $self->get ($key) . $CRLF; --- > $ret .= $tag . ': ' . $self->get ($tag) . $CRLF; 456c457 < delete $head{$key}; --- > delete $head{$tag}; 459,460c460,461 < next unless exists $self->{header_lines}->{$key}; < foreach (@{$self->{header_lines}->{$key}}) { --- > next unless exists $self->{header_lines}->{$tag}; > foreach (@{$self->{header_lines}->{$tag}}) { 465c466 < delete $head{$key}; --- > delete $head{$tag}; 469c470 < foreach (@{$self->{header_lines}->{lc($tag)}}) { --- > foreach (@{$self->{header_lines}->{$tag}}) { 472d472 < $tag = $self->_tag_case($tag); 490c490 < $tag = lc($tag); --- > $tag = $self->_tag_case ($tag); 563d562 < $self->{body_in} ||= ''; 759a759,762 > if (defined $tag) { > $tag = $self->_tag_case($tag); > $tag =~ s/\A([^ :]+)/$1/o; > } 761,763c764 < (defined ($tag) && $tag =~ /\A($FIELD_NAME|From )/oi) or return $self->error ("BADTAG", "WARN", $tag); < $tag =~ s/^([^ :]+):/$1/; < $tag = lc($tag); --- > (defined ($tag) && $tag =~ /\A($FIELD_NAME|From )/oi) and return $self->error ("BADTAG", "WARN", $tag); 767c768 < $line =~ s/\n*\Z//; --- > $line =~ s/\n*\Z//s; 774c775,776 < my ($self, $tag) = @_; --- > my $self = shift; > my $tag = shift; 777,780c779,780 < $tag =~ s/:\Z//; < $tag =~ s/\A\s*//; < $tag =~ s/\s*\Z//; < $tag = lc $tag; --- > $tag =~ s/:\Z//o; > $tag =~ s/\A\s*|\s*\Z//g; 784,785c784,785 < $tag =~ s/\b([a-z]+)/\L\u$1/g; < $tag =~ s/\b([b-df-hj-np-tv-z]+)\b/\U$1/g if (index($tag, '-') != -1); --- > $tag =~ s/\b([a-z]+)/\L\u$1/gio; > $tag =~ s/\b([b-df-hj-np-tv-z]+)\b/\U$1/gio if $tag =~ /-/; 793,795c793 < my $out = ''; < GT::Mail::Parse->decode_base64 (\$str, \$out); < return $out; --- > >::Mail::Decoder::decode_base64 ($str); 846,847c844,845 < my @to = $top_part->split_field ('to'); < my @from = $top_part->split_field ('from'); --- > my @to = $top_part->emails ('to'); > my @from = $top_part->emails ('from'); 1088c1086,1089 < http://www.gossamer-threads.com/ =head1 VERSION --- > http://www.gossamer-threads.com/ > > =head1 VERSION > Index: GT/Mail/Send.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Mail/Send.pm,v retrieving revision 1.9 retrieving revision 1.8 diff -r1.9 -r1.8 6c6 < # $Id: Send.pm,v 1.9 2001/02/07 03:29:30 alex Exp $ --- > # $Id: Send.pm,v 1.8 2000/12/15 18:13:44 alex Exp $ 22c22 < $VERSION = sprintf "%d.%03d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/; 99c99 < foreach ($self->{mail}->{head}->split_field ('to')) { --- > foreach ($self->{mail}->{head}->emails ('to')) { 218c218 < Revision: $Id: Send.pm,v 1.9 2001/02/07 03:29:30 alex Exp $ --- > Revision: $Id: Send.pm,v 1.8 2000/12/15 18:13:44 alex Exp $ Index: GT/SQL/Admin.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/SQL/Admin.pm,v retrieving revision 1.63 retrieving revision 1.60 diff -r1.63 -r1.60 6c6 < # $Id: Admin.pm,v 1.63 2001/02/18 19:41:32 alex Exp $ --- > # $Id: Admin.pm,v 1.60 2001/02/06 04:47:55 alex Exp $ 28d27 < $ROW_COLOR1 $ROW_COLOR2 48c47 < $VERSION = sprintf "%d.%03d", q$Revision: 1.63 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.60 $ =~ /(\d+)\.(\d+)/; 57,58d55 < $ROW_COLOR1 = 'bgcolor="#dddddd"'; < $ROW_COLOR2 = 'bgcolor="#eeeeee"'; 117a115 > 255,269c253,254 < < if ( $self->{in}->param('dr') eq 'rows' ) { < print qq!

!; < print "", $self->{html}->display_row_cols({ mode => 'search_results' }), ""; < my $i = 0; < while (my $result = $sth->fetchrow_hashref) { < print "", $self->{html}->display_row ( { mode => 'search_results', values => $result }), ""; < } < print "
"; < } < < else { < while (my $result = $sth->fetchrow_hashref) { < print "

", $self->{html}->display ( { mode => 'search_results', values => $result }); < } --- > while (my $result = $sth->fetchrow_hashref) { > print "

", $self->{html}->display ( { mode => 'search_results', values => $result }); 271d255 < 448,487c432,437 < < if ( $self->{in}->param('dr') eq 'rows' ) { < < print qq!

!; < print "", $self->{html}->display_row_cols({ mode => 'search_results' }), ""; < < while (my $result = $sth->fetchrow_hashref) { < foreach my $key (@pk) { < if ($self->{db}->can ('_complete_name')) { < my $new = {}; < for (keys %{$result}) { < $new->{$self->{db}->_complete_name ($_)} = $result->{$_}; < } < $result = $new; < } < my $val = $result->{$key}; < $self->{html}->escape(\$val); < print qq~~; < } < print ""; < print qq~~; < print $self->{html}->display_row ( { mode => 'search_results', values => $result }), ""; < print qq~~; < $i++; < } < < print "
Delete
\n"; < < } < < else { < < while (my $result = $sth->fetchrow_hashref) { < foreach my $key (@pk) { < if ($self->{db}->can ('_complete_name')) { < my $new = {}; < for (keys %{$result}) { < $new->{$self->{db}->_complete_name ($_)} = $result->{$_}; < } < $result = $new; --- > while (my $result = $sth->fetchrow_hashref) { > foreach my $key (@pk) { > if ($self->{db}->can ('_complete_name')) { > my $new = {}; > for (keys %{$result}) { > $new->{$self->{db}->_complete_name ($_)} = $result->{$_}; 489,491c439 < my $val = $result->{$key}; < $self->{html}->escape(\$val); < print qq~~; --- > $result = $new; 493,496c441,443 < print qq~

~; < print $self->{html}->display ( { mode => 'delete_search_results', values => $result } ); < print "
\n"; < $i++; --- > my $val = $result->{$key}; > $self->{html}->escape(\$val); > print qq~~; 498c445,448 < --- > print qq~

~; > print $self->{html}->display ( { mode => 'delete_search_results', values => $result } ); > print "
\n"; > $i++; 500,501d449 < < 658,671c606,611 < < if ( $self->{in}->param('dr') eq 'rows' ) { < < print qq!

!; < print "", $self->{html}->display_row_cols({ mode => 'search_results' }), ""; < < while (my $result = $sth->fetchrow_hashref) { < foreach my $key (@pk) { < if ($self->{db}->can ('_complete_name')) { < my $new = {}; < for (keys %{$result}) { < $new->{$self->{db}->_complete_name ($_)} = $result->{$_}; < } < $result = $new; --- > while (my $result = $sth->fetchrow_hashref) { > foreach my $key (@pk) { > if ($self->{db}->can ('_complete_name')) { > my $new = {}; > for (keys %{$result}) { > $new->{$self->{db}->_complete_name ($_)} = $result->{$_}; 673,675c613 < my $val = $result->{$key}; < $self->{html}->escape(\$val); < print qq~~; --- > $result = $new; 677,681c615,617 < print ""; < print qq~~; < print $self->{html}->display_row ( { mode => 'modify_search_results', values => $result } ); < print "\n"; < $i++; --- > my $val = $result->{$key}; > $self->{html}->escape(\$val); > print qq~~; 683,686c619,622 < < print "
Modify
\n"; < < --- > print qq~

~; > print $self->{html}->display ( { mode => 'modify_search_results', values => $result } ); > print "
\n"; > $i++; 688,712d623 < < else { < < while (my $result = $sth->fetchrow_hashref) { < foreach my $key (@pk) { < if ($self->{db}->can ('_complete_name')) { < my $new = {}; < for (keys %{$result}) { < $new->{$self->{db}->_complete_name ($_)} = $result->{$_}; < } < $result = $new; < } < my $val = $result->{$key}; < $self->{html}->escape(\$val); < print qq~~; < } < print qq~

~; < print $self->{html}->display ( { mode => 'modify_search_results', values => $result } ); < print "
\n"; < $i++; < } < < }; < < 1183c1094 < print "(" . join (", " => @{$attribs{values}}) . ")" if ($attribs{values} and (ref $attribs{values})); --- > print "(" . join (", " => @{$attribs{values}}) . ")" if ($attribs{values} and ($attribs{values} !~ /^\s*$/sm)); 1228c1139 < $attribs{form_size} ||= $attribs{form_type} eq 'SELECT' ? 0 : 20; --- > $attribs{form_size} ||= 20; 1242,1244d1152 < < my $values = join (", " => @{$attribs{values}}) if ($attribs{values}); < $values = GT::CGI->html_escape($values); 1250,1254c1158,1160 < Column Type$attribs{type} < Column Value < ~; < my @pk = $self->{db}->pk; < if (! grep { $column eq $_ } @pk) { --- > Column Type$attribs{type}\n~; > print " Column Value" . join (", " => @{$attribs{values}}) . "\n" if ($attribs{values}); > unless ($self->{db}->pk ($column)) { 1261,1271c1167 < < ~; < } < else { < print qq~ < < Not Null < < Yes (Can't change primary key) < < ~; --- > ~; 1287,1288c1183,1184 < Form Names
(Stored in Database)
Only for checkbox, multi-select or radio forms. < Form Values
(Displayed on Form)
Only for checkbox, multi-select or radio forms. --- > Form Names
(Stored in Database) > Form Values
(Displayed on Form) 1609c1505 < $attribs{form_size} = $self->{cgi}->{form_size} || ($attribs{form_type} eq 'SELECT') ? 0 : 20; --- > $attribs{form_size} = $self->{cgi}->{form_size} || 20; 1650,1651c1546,1547 < Form Names
(Stored in Database)
Only for checkbox, multi-select or radio forms. < Form Values
(Displayed on Form)
Only for checkbox, multi-select or radio forms. --- > Form Names
(Stored in Database) > Form Values
(Displayed on Form) 1888a1785 > 1892a1790,1795 > if (not $attribs{form_names}) { > $errors .= "

  • You must specify the names for the enum in the 'Form Names' text area. One per line.
  • \n"; > } > if (not $attribs{form_values}) { > $errors .= "
  • You must specify the values for the enum field in the 'Form Values' text area. One per line.
  • \n"; > } 1894,1895c1797,1798 < else { < delete $attribs{values}; --- > elsif (@{$attribs{values}}) { > $errors .= "
  • You should not enter anything in the 'Column Value' unless you are creating an enum field: '@{$attribs{values}}'
  • \n"; 1902,1906d1804 < else { < delete $attribs{form_names}; < delete $attribs{form_values}; < } < 1907a1806 > 1958d1856 < $attribs{values} = [split /\s*,\s*/, $self->{cgi}->{values}]; 1966,1967c1864,1865 < if (not @{$attribs{values}}) { < $errors .= "
  • You must specify the values for the enum field in the Values text area.
  • \n"; --- > if (not @{$attribs{form_names}}) { > $errors .= "
  • You must specify the names for the enum in the 'Form Names' text area. One per line.
  • \n"; 1969,1975c1867,1868 < } < else { < delete $attribs{values}; < } < if ($attribs{form_type} =~ /^CHECKBOX|MULTIPLE|RADIO$/) { < if (! (@{$attribs{form_names}} or @{$attribs{form_values}}) ) { < $errors .= "
  • For checkbox and select fields, you must specify in form names and form values what you want displayed, one entry per line."; --- > if (not @{$attribs{form_values}}) { > $errors .= "
  • You must specify the values for the enum field in the 'Form Values' text area. One per line.
  • \n"; 1979,1980c1872,1876 < delete $attribs{form_names}; < delete $attribs{form_values}; --- > if ($attribs{form_type} =~ /^CHECKBOX|SELECT|RADIO$/) { > if (! (@{$attribs{form_names}} or @{$attribs{form_values}}) ) { > $errors .= "
  • For checkbox and select fields, you must specify in form names and form values what you want displayed, one entry per line."; > } > } 2185d2080 < 2198,2209d2092 < my $dr = $self->{html}->select ( < { < name => "dr", < values => { < '' => 'As Elements', < 'rows' => 'As Rows' < }, < default => $self->{cgi}->{dr}, < blank => 1 < } < ); < 2235c2118 < $sb --- > $sb 2237,2244c2120 < $so < ~; < < if ( ( () = $self->{in}->param('db') ) == 1 ) { < $out .= qq~ < < Display Records: < $dr --- > $so 2246,2248c2122 < ~; < } < --- > ~; 2559c2433 < Revision: $Id: Admin.pm,v 1.63 2001/02/18 19:41:32 alex Exp $ --- > Revision: $Id: Admin.pm,v 1.60 2001/02/06 04:47:55 alex Exp $ Index: GT/SQL/Base.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/SQL/Base.pm,v retrieving revision 1.7 retrieving revision 1.4 diff -r1.7 -r1.4 6c6 < # $Id: Base.pm,v 1.7 2001/02/17 08:01:21 alex Exp $ --- > # $Id: Base.pm,v 1.4 2001/02/06 04:25:44 alex Exp $ 28c28 < $VERSION = sprintf "%d.%03d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/; 311a312 > next if (defined $opts->{$field} and ($opts->{$field} eq '*')); 325c326 < if (exists $opts->{"$field-gt"} and ($opts->{"$field-gt"} ne "")) { --- > if (exists $opts->{"$field-gt"}) { 328c329 < elsif (exists $opts->{"$field-lt"} and ($opts->{"$field-gt"} ne "")) { --- > elsif (exists $opts->{"$field-lt"}) { 331,357c332,333 < else { < if (exists $opts->{$field} and ($opts->{$field} ne "")) { < if ($opts->{$field} =~ /^(>|<)(.*)/) { < push @ins, ($field, $1, $2); < } < elsif ($opts->{$field} eq '+') { < push @ins, ($field, "<>", ''); < } < elsif ($opts->{$field} eq '-') { < push @ins, ($field, "=", ''); < } < elsif ($opts->{$field} eq '*') { < if ($opts->{"$field-opt"} and ($opts->{"$field-opt"} eq '<>')) { < push @ins, ($field, '=', ''); < } < else { < next; < } < } < else { < (index ($opts->{$field}, "\\") == 0) and (substr ($opts->{$field}, 0, 1) = ""); < push @ins, ($field, $comp, "$s$opts->{$field}$s"); < } < } < else { < next; < } --- > elsif (exists $opts->{$field} and $opts->{$field} =~ /^(>|<)/) { > push @ins, ($field, $1, $opts->{$field}); 358a335,338 > elsif (exists $opts->{$field}) { > push @ins, ($field, $comp, "$s$opts->{$field}$s"); > } > next if (!defined $ins[2] or ($ins[2] =~ /^\s*$/)); 378c358,360 < return 1 if (UNIVERSAL::can($class, 'new')); --- > return 1 if (defined %{$class . '::'}); > > local ($@, $SIG{__DIE__}); 384d365 < local ($@, $SIG{__DIE__}); 387,389c368 < push @err, $@; < # In case the module had compile errors, %class:: will be defined, but not complete. < undef %{$class . '::'} if defined %{$class . '::'}; --- > push @err, $@; 398,399c377,378 < if (! $ok or ! UNIVERSAL::can($class, 'new')) { < return $self->error ('BADSUBCLASS', 'FATAL', $class, join(", ", @err)); --- > if (! $ok or ! defined %{$class . '::'}) { > return $self->error ('BADSUBCLASS', 'FATAL', $class, join ", ", @err); 404a384 > Index: GT/SQL/Condition.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/SQL/Condition.pm,v retrieving revision 1.16 retrieving revision 1.15 diff -r1.16 -r1.15 6c6 < # $Id: Condition.pm,v 1.16 2001/02/07 01:35:15 alex Exp $ --- > # $Id: Condition.pm,v 1.15 2001/02/05 00:44:29 alex Exp $ 23c23 < $VERSION = sprintf "%d.%03d", q$Revision: 1.16 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.15 $ =~ /(\d+)\.(\d+)/; 31c31,32 < # that object ("AND" is the default), the conditions for this object. --- > # that object ("AND" is the default), the conditions for this object, > # and the values. 37a39 > $self->{values} = []; 160a163,213 > # $obj->prepare_sql; > # ------------------ > # Does the same thing as $obj->sql except that > # it replaces the values by question marks which > # make caching prepare statements a lot easier. > # > # The values corresponding to the question marks > # are stored into $self->{values}. > ## > sub prepare_sql { > my $self = shift; > my @cond = @{$self->{cond}}; > my $bool = $self->boolean; > my @vals = (); > my (@tmp, $sql_str); > > # for each sub-condition of our GT::SQL::Condition object > foreach my $cond (@cond) > { > # if the sub-condition is an array, then we construct > # out prepared statement > if (ref $cond eq 'ARRAY') > { > my ($col, $op, $val) = @{$cond}; > if (ref $val eq 'SCALAR') { > $sql_str = "$col $op " . $$val; > } > elsif (ref $val) { > return $self->error ('BADARGS', 'FATAL', "Invalid value '@$val', must be scalar or scalar ref."); > } > else { > defined $val or $val = 'NULL'; > push @vals, $val; > $sql_str = "$col $op ?"; > } > } > # if it is a condition, then we prepare it's statement > # and include it in our current statement. > elsif (ref $cond eq ref $self) > { > $sql_str = "(" . $cond->prepare_sql . ")"; > push @vals, $cond->store_values; > } > push (@tmp, $sql_str); > } > $self->store_values (@vals); > return join " $bool ", @tmp; > } > > > ## 176a230,250 > > ## > # $obj->store_values; > # ------------------- > # Returns the values which have been stored for replacement > # in a prepared statement. > # > # $obj->store_values (LIST); > # -------------------------- > # Store LIST into the current GT::SQL::Condition object for > # further retrieval. > # > # Scott: do we want to push onto here? why not set it '=' > ## > sub store_values { > my ($self, @args) = @_; > map {quote($_)} @args; > @{$self->{values}} = @args if (@args); > return wantarray ? @{$self->{values}} : $self->{values} > } > 281c355 < Revision: $Id: Condition.pm,v 1.16 2001/02/07 01:35:15 alex Exp $ --- > Revision: $Id: Condition.pm,v 1.15 2001/02/05 00:44:29 alex Exp $ Index: GT/SQL/Driver.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/SQL/Driver.pm,v retrieving revision 1.47 retrieving revision 1.45 diff -r1.47 -r1.45 6c6 < # $Id: Driver.pm,v 1.47 2001/02/14 18:49:31 alex Exp $ --- > # $Id: Driver.pm,v 1.45 2001/02/05 00:03:50 sbeck Exp $ 30c30 < $VERSION = sprintf "%d.%03d", q$Revision: 1.47 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.45 $ =~ /(\d+)\.(\d+)/; 170,173d169 < @GT::SQL::Driver::debug::QUERY_STACK = (); < return if ($INC{'Apache::DBI'}); # Apache::DBI is loaded and handling persistant connections. < < # Otherwise remove connections that aren't valid. 175d170 < next if ($CONN{$dsn} and $CONN{$dsn}->ping); 177,178c172,174 < delete $CONN{$dsn}; < } --- > } > %CONN = (); > @GT::SQL::Driver::debug::QUERY_STACK = (); 581c577 < require GT::Dumper; --- > require Data::Dumper; 590c586 < my $dump = >::Dumper::Dumper($arg); --- > my $dump = &Data::Dumper::Dumper($arg); Index: GT/SQL/Editor.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/SQL/Editor.pm,v retrieving revision 1.20 retrieving revision 1.18 diff -r1.20 -r1.18 6c6 < # $Id: Editor.pm,v 1.20 2001/02/18 19:15:10 alex Exp $ --- > # $Id: Editor.pm,v 1.18 2001/01/30 23:00:10 alex Exp $ 22c22 < $VERSION = sprintf "%d.%03d", q$Revision: 1.20 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.18 $ =~ /(\d+)\.(\d+)/; 39c39 < $self->{table} = $opts->{table}; --- > $self->{schema} = $opts->{table}; 44c44 < $self->{table}->connect; --- > $self->{schema}->connect; 70c70 < my $c = $self->{table}->cols; --- > my $c = $self->{schema}->cols; 73,74c73,74 < my $defs = $self->{table}->{driver}->_column_sql ($col); < my $table = $self->{table}->name; --- > my $defs = $self->{schema}->{driver}->_column_sql ($col); > my $table = $self->{schema}->name; 76,77c76,79 < # Auto add a new position number. < $col->{pos} = keys (%$c) + 1; --- > # Auto add a new position number if not specified. > if (! exists $col->{pos}) { > $col->{pos} = keys (%$c) + 1; > } 81,84c83,86 < unless ($self->{table}->check_schema) { < my $name = $self->{table}->name; < $self->{table}->load_state ("$GT::SQL::DEF_PATH/$name.def"); < return; --- > unless ($self->{schema}->check_schema) { > my $name = $self->{schema}->name; > $self->{schema}->load_state ("$GT::SQL::DEF_PATH/$name.def"); > return undef; 90c92 < $self->{table}->{driver}->do ($query) or return undef; --- > $self->{schema}->{driver}->do ($query) or return undef; 111c113 < my $table = $self->{table}->name; --- > my $table = $self->{schema}->name; 124c126 < delete $self->{table}->cols->{$name}; --- > delete $self->{schema}->cols->{$name}; 127c129 < @{$self->{table}->pk} = grep !/^\Q$name\E$/, @{$self->{table}->pk}; --- > @{$self->{schema}->pk} = grep !/^\Q$name\E$/, @{$self->{schema}->pk}; 130,132c132,134 < for (keys %{$self->{table}->fk}) { < for my $col (keys %{$self->{table}->fk->{$_}}) { < if ($col eq $name) { delete $self->{table}->fk->{$_}->{$col} } --- > for (keys %{$self->{schema}->fk}) { > for my $col (keys %{$self->{schema}->fk->{$_}}) { > if ($col eq $name) { delete $self->{schema}->fk->{$_}->{$col} } 138,140c140,142 < for (keys %{$self->{table}->$index()}) { < @{$self->{table}->$index()->{$_}} = grep !/^\Q$name\E$/, @{$self->{table}->$index()->{$_}}; < if (not @{$self->{table}->$index()->{$_}}) { delete $self->{table}->$index()->{$_} } --- > for (keys %{$self->{schema}->$index()}) { > @{$self->{schema}->$index()->{$_}} = grep !/^\Q$name\E$/, @{$self->{schema}->$index()->{$_}}; > if (not @{$self->{schema}->$index()->{$_}}) { delete $self->{schema}->$index()->{$_} } 145,146c147,148 < unless ($self->{table}->check_schema) { < $self->{table}->load_state ("$GT::SQL::DEF_PATH/$self->{table}->{name}.def"); --- > unless ($self->{schema}->check_schema) { > $self->{schema}->load_state ("$GT::SQL::DEF_PATH/$self->{schema}->{name}.def"); 153c155 < $self->{table}->{driver}->do ($query) or return undef; --- > $self->{schema}->{driver}->do ($query) or return undef; 167c169 < exists $self->{table}->{schema}->{cols}->{$col} or return $self->error ("NOCOL", "WARN", $col); --- > exists $self->{schema}->cols->{$col} or return $self->error ("NOCOL", "WARN", $col); 170,173c172 < my $orig = $self->{table}->{schema}->{cols}->{$col}; < < # Set the position, can't be changed. < $defs->{pos} = $orig->{pos}; --- > $defs->{pos} = $self->{schema}->{cols}->{$col}->{pos}; 176,179c175,178 < my $table = $self->{table}->name; < if (exists $defs->{type} and ($defs->{type} ne $orig->{type}) or < exists $defs->{size} and ($defs->{size} ne $orig->{size}) or < exists $defs->{not_null} and ($defs->{not_null} ne $orig->{not_null})) --- > my $table = $self->{schema}->name; > if ($defs->{type} ne $self->{schema}->cols->{$col}->{type} or > $defs->{size} ne $self->{schema}->cols->{$col}->{size} > ) 182,190d180 < } < if (ref $defs->{values} and ref $orig->{values}) { < my $orig_list = join ("", @{$defs->{values}}); < my $new_list = join ("", @{$orig->{values}}); < if ($new_list ne $orig_list) { < $change = 1; < } < } < if ($change) { 194c184 < if (exists $self->{table}->fk->{$col}) { --- > if (exists $self->{schema}->fk->{$col}) { 200,203c190,193 < $self->{table}->{schema}->{cols}->{$col} = $defs; < unless ($self->{table}->check_schema) { < $self->{table}->load_state ("$GT::SQL::DEF_PATH/$self->{table}->{name}.def"); < return; --- > $self->{schema}->cols->{$col} = $defs; > unless ($self->{schema}->check_schema) { > $self->{schema}->load_state ("$GT::SQL::DEF_PATH/$self->{schema}->{name}.def"); > return undef; 207c197 < my $def = $self->{table}->{driver}->_column_sql ($defs); --- > my $def = $self->{schema}->{driver}->_column_sql ($defs); 211c201 < $self->{table}->do ($query) or return; --- > $self->{schema}->{driver}->do ($query) or return; 214,215c204 < $self->save_state or return; < --- > $self->save_state or return undef; 232,233c221,222 < map { exists $self->{table}->cols->{$_} or return $self->error ("NOCOL", "WARN", $_) } @{$indexes}; < exists $self->{table}->unique->{$index_name} and return $self->error ("INDXEXISTS", "WARN", $index_name); --- > map { exists $self->{schema}->cols->{$_} or return $self->error ("NOCOL", "WARN", $_) } @{$indexes}; > exists $self->{schema}->unique->{$index_name} and return $self->error ("INDXEXISTS", "WARN", $index_name); 235c224 < $table = $self->{table}->name; --- > $table = $self->{schema}->name; 241c230 < my $sth = $self->{table}->{driver}->do ($query) or return undef; --- > my $sth = $self->{schema}->{driver}->do ($query) or return undef; 245,247c234,236 < $self->{table}->unique->{$index_name} = $indexes; < unless ($self->{table}->check_schema) { < $self->{table}->load_state ("$GT::SQL::DEF_PATH/$self->{table}->{name}.def") or return undef; --- > $self->{schema}->unique->{$index_name} = $indexes; > unless ($self->{schema}->check_schema) { > $self->{schema}->load_state ("$GT::SQL::DEF_PATH/$self->{schema}->{name}.def") or return undef; 254c243 < $self->{table}->{driver}->do ($query) or return undef; --- > $self->{schema}->{driver}->do ($query) or return undef; 270c259 < exists $self->{table}->unique->{$index_name} or return $self->error ("NOUNIQUE", "WARN", $index_name); --- > exists $self->{schema}->unique->{$index_name} or return $self->error ("NOUNIQUE", "WARN", $index_name); 272c261 < $table = $self->{table}->name; --- > $table = $self->{schema}->name; 275,277c264,266 < delete $self->{table}->unique->{$index_name}; < unless ($self->{table}->check_schema) { < $self->{table}->load_state ("$GT::SQL::DEF_PATH/$self->{table}->{name}.def"); --- > delete $self->{schema}->unique->{$index_name}; > unless ($self->{schema}->check_schema) { > $self->{schema}->load_state ("$GT::SQL::DEF_PATH/$self->{schema}->{name}.def"); 284c273 < $self->{table}->{driver}->do ($query) or return undef; --- > $self->{schema}->{driver}->do ($query) or return undef; 302,304c291,293 < map { exists $self->{table}->cols->{$_} or return $self->error ("NOCOL", "WARN", $_) } @{$indexes}; < exists $self->{table}->index->{$index_name} and return $self->error ("INDXEXISTS", "WARN", $index_name); < my $table = $self->{table}->name; --- > map { exists $self->{schema}->cols->{$_} or return $self->error ("NOCOL", "WARN", $_) } @{$indexes}; > exists $self->{schema}->index->{$index_name} and return $self->error ("INDXEXISTS", "WARN", $index_name); > my $table = $self->{schema}->name; 307,309c296,298 < $self->{table}->index->{$index_name} = $indexes; < unless ($self->{table}->check_schema) { < $self->{table}->load_state ("$GT::SQL::DEF_PATH/$self->{table}->{name}.def"); --- > $self->{schema}->index->{$index_name} = $indexes; > unless ($self->{schema}->check_schema) { > $self->{schema}->load_state ("$GT::SQL::DEF_PATH/$self->{schema}->{name}.def"); 318c307 < $self->{table}->{driver}->do ($query) or return undef; --- > $self->{schema}->{driver}->do ($query) or return undef; 333c322 < exists $self->{table}->index->{$index_name} or return $self->error ("NOINDEX", "WARN", $index_name); --- > exists $self->{schema}->index->{$index_name} or return $self->error ("NOINDEX", "WARN", $index_name); 336,338c325,327 < delete $self->{table}->index->{$index_name}; < unless ($self->{table}->check_schema) { < $self->{table}->load_state ("$GT::SQL::DEF_PATH/$self->{table}->{name}.def"); --- > delete $self->{schema}->index->{$index_name}; > unless ($self->{schema}->check_schema) { > $self->{schema}->load_state ("$GT::SQL::DEF_PATH/$self->{schema}->{name}.def"); 343c332 < my $table = $self->{table}->name; --- > my $table = $self->{schema}->name; 346c335 < $self->{table}->{driver}->do ($query) or return undef; --- > $self->{schema}->{driver}->do ($query) or return undef; 365c354 < map { exists $self->{table}->cols->{$_} or return $self->error ("NOCOL", "WARN", $_) } @fields; --- > map { exists $self->{schema}->cols->{$_} or return $self->error ("NOCOL", "WARN", $_) } @fields; 367,368c356,357 < my ($table, %add) = ($self->{table}->name); < if ($self->{table}->pk) { --- > my ($table, %add) = ($self->{schema}->name); > if ($self->{schema}->pk) { 371,372c360,361 < $self->{table}->{driver}->do ($query) or return undef; < %add = map { $_ => 1 } @{delete $self->{table}->{schema}->{pk}}; --- > $self->{schema}->{driver}->do ($query) or return undef; > %add = map { $_ => 1 } @{delete $self->{schema}->{pk}}; 377,379c366,368 < $self->{table}->{schema}->{pk} = [keys %add]; < unless ($self->{table}->check_schema) { < $self->{table}->load_state ("$GT::SQL::DEF_PATH/$self->{table}->{name}.def"); --- > $self->{schema}->{pk} = [keys %add]; > unless ($self->{schema}->check_schema) { > $self->{schema}->load_state ("$GT::SQL::DEF_PATH/$self->{schema}->{name}.def"); 387c376 < $self->{table}->{driver}->do ($query) or return undef; --- > $self->{schema}->{driver}->do ($query) or return undef; 400c389 < $self->{table}->pk || return $self->error ("NOPK", "WARN"); --- > $self->{schema}->pk || return $self->error ("NOPK", "WARN"); 403,405c392,394 < $self->{table}->{schema}->{pk} = []; < unless ($self->{table}->check_schema) { < $self->{table}->load_state ("$GT::SQL::DEF_PATH/$self->{table}->{name}.def"); --- > $self->{schema}->{pk} = []; > unless ($self->{schema}->check_schema) { > $self->{schema}->load_state ("$GT::SQL::DEF_PATH/$self->{schema}->{name}.def"); 410c399 < my $table = $self->{table}->name; --- > my $table = $self->{schema}->name; 413c402 < $self->{table}->{driver}->do ($query) or return undef; --- > $self->{schema}->{driver}->do ($query) or return undef; 428c417 < $self->{table}->fk (@_) or return undef; --- > $self->{schema}->fk (@_) or return undef; 435c424 < delete $self->{table}->{schema}->{fk}->{$table} or return $self->error ("FKNOEXISTS", "WARN", $table); --- > delete $self->{schema}->{fk}->{$table} or return $self->error ("FKNOEXISTS", "WARN", $table); 540c529 < my $table = $self->{table}->name; --- > my $table = $self->{schema}->name; 542c531 < my $tmp = $self->{table}->fk_tables() || []; --- > my $tmp = $self->{schema}->fk_tables() || []; 546c535 < $self->{table}->{driver}->do (qq!DROP TABLE $table!) or return; --- > $self->{schema}->{driver}->do (qq!DROP TABLE $table!) or return; 560c549 < if ( keys %{$self->{table}->weight()} ) { --- > if ( keys %{$self->{schema}->weight()} ) { 566c555 < 'schema' => $self->{table}, --- > 'schema' => $self->{schema}, 581,582c570,571 < my $fk = $self->{table}->fk() or return; < my $prefix = $DB->prefix(); --- > > my $fk = $self->{schema}->fk() or return; 584d572 < $related_name =~ s/^$prefix//g; # not 'o' because it may cause mod_perl problems 612c600 < schema => $self->{table}, --- > schema => $self->{schema}, 625c613 < foreach my $table (@{$self->{table}->fk_tables}) { --- > foreach my $table (@{$self->{schema}->fk_tables}) { 640c628 < foreach my $table (@{$self->{table}->fk_tables}) { --- > foreach my $table (@{$self->{schema}->fk_tables}) { 660c648 < foreach my $table (keys %{$self->{table}->fk}) { --- > foreach my $table (keys %{$self->{schema}->fk}) { 662,663c650,651 < if ($fc = $self->{table}->fk->{$table}->{$mycol}) { < delete $self->{table}->fk->{$table}->{$mycol}; --- > if ($fc = $self->{schema}->fk->{$table}->{$mycol}) { > delete $self->{schema}->fk->{$table}->{$mycol}; 665c653 < next if keys %{$self->{table}->fk->{$table}}; --- > next if keys %{$self->{schema}->fk->{$table}}; 893c881 < Revision: $Id: Editor.pm,v 1.20 2001/02/18 19:15:10 alex Exp $ --- > Revision: $Id: Editor.pm,v 1.18 2001/01/30 23:00:10 alex Exp $ Index: GT/SQL/Relation.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/SQL/Relation.pm,v retrieving revision 1.42 retrieving revision 1.39 diff -r1.42 -r1.39 6c6 < # $Id: Relation.pm,v 1.42 2001/02/12 01:01:01 alex Exp $ --- > # $Id: Relation.pm,v 1.39 2001/01/31 04:10:48 alex Exp $ 29c29 < $VERSION = sprintf "%d.%03d", q$Revision: 1.42 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.39 $ =~ /(\d+)\.(\d+)/; 577c577 < return sort { my $ret = $self->_col_cmp($a, $b); $ret } keys %cols; --- > return sort { my $ret = $self->_col_cmp ($a, $b); $ret } keys %cols; 669c669 < return sort { my $ret = $self->_col_cmp($a, $b); $ret; } @result; --- > return sort { my $ret = $self->_col_cmp ($a, $b); $ret } @result; 929c929 < return 0; --- > return; 1615c1615 < Revision: $Id: Relation.pm,v 1.42 2001/02/12 01:01:01 alex Exp $ --- > Revision: $Id: Relation.pm,v 1.39 2001/01/31 04:10:48 alex Exp $ Index: GT/SQL/Table.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/SQL/Table.pm,v retrieving revision 1.104 retrieving revision 1.100 diff -r1.104 -r1.100 6c6 < # $Id: Table.pm,v 1.104 2001/02/19 22:07:58 alex Exp $ --- > # $Id: Table.pm,v 1.100 2001/02/05 00:18:15 alex Exp $ 28c28 < $VERSION = sprintf "%d.%03d", q$Revision: 1.104 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.100 $ =~ /(\d+)\.(\d+)/; 62d61 < $self->{_index} = 1; 235c234 < $self->_index_record($self->{last_insert}, $sth) unless ($opts->{GT_SQL_SKIP_INDEX}); --- > $self->_index_record($self->{last_insert}, $sth); 285c284 < # $obj->update ($hash_ref, $condition, $opts); --- > # $obj->update ($hash_ref, $condition); 290c289 < # $obj->update ($hash_ref_1, $hash_ref_2, $opts); --- > # $obj->update ($hash_ref_1, $hash_ref_2); 305,306d303 < $opts ||= {}; < $where ||= {}; # Update all. 350c347 < $self->_update_index ($sth) unless ($opts->{GT_SQL_SKIP_INDEX}); --- > $self->_update_index ($sth); 2319,2321d2315 < Passing in GT_SQL_SKIP_INDEX => 1 will not index the fields. You can < also use the C method to do this. < 2398,2399c2392,2393 < C returns undef on failure and the a L statement < handle on success. The error message will be available in $GT::SQL::error. --- > C returns undef on failure, 1 on success. The error message > will be available in $GT::SQL::error. 2404,2406d2397 < Passing in GT_SQL_SKIP_INDEX => 1 will not index the fields. You can < also use the C method to do this. < 2552c2543 < Revision: $Id: Table.pm,v 1.104 2001/02/19 22:07:58 alex Exp $ --- > Revision: $Id: Table.pm,v 1.100 2001/02/05 00:18:15 alex Exp $ Index: GT/SQL/Display/HTML.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/SQL/Display/HTML.pm,v retrieving revision 1.48 retrieving revision 1.44 diff -r1.48 -r1.44 6c6 < # $Id: HTML.pm,v 1.48 2001/02/18 19:41:15 alex Exp $ --- > # $Id: HTML.pm,v 1.44 2001/01/29 14:46:43 sbeck Exp $ 24c24 < $VERSION = sprintf "%d.%03d", q$Revision: 1.48 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.44 $ =~ /(\d+)\.(\d+)/; 218,224c218 < # sort => coderef called to sort the list. Keep in mind that you < # will need to do this (this example is a reverse numerical sort): < # sub { no strict "refs"; ${${caller() . "::"}{b}} <=> ${${caller() . "::"}{a}} } < # because $a and $b are package globals and are not the < # same '$a' and '$b' that are available in your function. < # sort_order => takes a list of the fields in the order they should be displayed. < --- > # 240c234 < my $sort_f = exists $opts->{sort} ? $opts->{sort} : ''; --- > my $sort_f = exists $opts->{sort} ? $opts->{sort} : sub { lc $hash{$a} cmp lc $hash{$b} }; 265,266c259,260 < elsif ($sort_f and ref $sort_f) { @keys = sort { $sort_f->($a, $b) } keys %hash; } < else { @keys = @$names; } --- > elsif ($sort_f and ref $sort_f) { @keys = sort { $sort_f->() } keys %hash; } > else { @keys = keys %hash; } 451c445 < my $def = exists $opts->{def} ? $opts->{def} : return $self->error ("BADARGS", "FATAL", "No type hash passed to view creator display_text (" . (caller())[2] . ")" ); --- > my $def = exists $opts->{def} ? $self->{def} : return $self->error ("BADARGS", "FATAL", "No type hash passed to view creator display_text (" . (caller())[2] . ")" ); 453a448 > $val =~ s/\Q$INPUT_SEPARATOR\E|\n/
    \n/g; 455,468d449 < < # If they are using checkbox/radio/selects then we map form_names => form_values. < if (ref $def->{form_names} and ref $def->{form_values}) { < if (@{$def->{form_names}} and @{$def->{form_values}}) { < my %map = map { $def->{form_names}->[$_] => $def->{form_values}->[$_] } (0 .. $#{$def->{form_names}}); < my @keys = split /\Q$INPUT_SEPARATOR\E|\n/, $val; < $val = ''; < < foreach (@keys) { < $val .= $map{$_} ? $map{$_} : $_; < $val .= "
    "; < } < } < } 547,548c528,529 < and $hash = { 'LIKE' => 'Like', '=' => 'Exact Match', '<>' => 'Not Equal', '>' => 'Greater Than', '<' => 'Less Than'}, < $so = [ 'LIKE', '=', '<>', '>', '<' ], last CASE; --- > and $hash = { 'LIKE' => 'Like', '=' => 'Exact Match', '>' => 'Greater Than', '<' => 'Less Than'}, > $so = [ 'LIKE', '=', '>', '<' ], last CASE; 550,551c531,532 < and $hash = { 'LIKE' => 'Like', '=' => 'Exact Match', '<>' => 'Not Equal', }, < $so = [ 'LIKE', '=', '<>' ], last CASE; --- > and $hash = { 'LIKE' => 'Like', '=' => 'Exact Match' }, > $so = [ 'LIKE', '=' ], last CASE; 553,554c534,535 < and $hash = { '=' => 'Exact Match', '<>' => 'Not Equal', '>' => 'Greater Than', '<' => 'Less Than'}, < $so = [ '=', '>', '<', '<>' ], last CASE; --- > and $hash = { '=' => 'Exact Match', '>' => 'Greater Than', '<' => 'Less Than'}, > $so = [ '=', '>', '<' ], last CASE; Index: GT/SQL/Display/HTML/Relation.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/SQL/Display/HTML/Relation.pm,v retrieving revision 1.12 retrieving revision 1.11 diff -r1.12 -r1.11 6c6 < # $Id: Relation.pm,v 1.12 2001/02/09 06:52:05 sbeck Exp $ --- > # $Id: Relation.pm,v 1.11 2001/01/25 00:47:08 alex Exp $ 24c24 < $VERSION = sprintf "%d.%03d", q$Revision: 1.12 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.11 $ =~ /(\d+)\.(\d+)/; 239c239 < (defined $c->{$col}->{default} and $c->{$col}->{default} =~ /0000/) ? --- > ($c->{$col}->{default} =~ /0000/) ? Index: GT/SQL/Display/HTML/Table.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/SQL/Display/HTML/Table.pm,v retrieving revision 1.11 retrieving revision 1.9 diff -r1.11 -r1.9 6c6 < # $Id: Table.pm,v 1.11 2001/02/10 23:05:32 aki Exp $ --- > # $Id: Table.pm,v 1.9 2001/01/25 00:47:08 alex Exp $ 24c24 < $VERSION = sprintf "%d.%03d", q$Revision: 1.11 $ =~ /(\d+)\.(\d+)/; --- > $VERSION = sprintf "%d.%03d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/; 54,158d53 < sub display_row { < # --------------------------------------------------------------- < # Display a record row as html. < # < my ($self, $opts) = @_; < $opts->{disp_form} = 0; < $opts->{disp_html} = 1; < return $self->_display_row ($opts || ()); < } < < sub display_row_cols { < # --------------------------------------------------------------- < # returns the for each of the title names for columns < # < my $self = shift; < < # Initiate if we are passed in any arguments as options. < if (@_) { $self->init (@_); } < < # Get the column hash and primary key < $self->{cols} = $self->{db}->cols unless exists $self->{cols}; < $self->{pk} = $self->{db}->pk unless exists $self->{pk}; < < # Output < my $out = ''; < < # Hide the primary keys. < $self->{view_key} and push (@{$self->{view}}, @{$self->{pk}}); < < # Calculate the form values. < my $values = $self->_get_defaults; < < # Now go through each column and print out a column row. < my @cols = $self->{db}->ordered_columns; < my $script = GT::CGI->url(); < $script =~ s/\&?sb=([^&]*)//g; < my $sb = $1; < $script =~ s/\&?so=(ASC|DESC)//g; < my $so = $1; < foreach my $col (@cols) { < < $out .= qq!\n\t{col_font}>!; < $out .= qq!!; < $out .= $col; < $out .= ( ( $col eq $sb ) ? ( ($so eq 'ASC') ? " ^" : " v" ) : '' ) . ""; < $out .= qq!\n!; < < } < < return $out; < } < < sub _display_row { < # --------------------------------------------------------------- < # Handles displaying of a form or a record. < # < my $self = shift; < < # Initiate if we are passed in any arguments as options. < if (@_) { $self->init (@_); } < < # Get the column hash and primary key < $self->{cols} = $self->{db}->cols unless exists $self->{cols}; < $self->{pk} = $self->{db}->pk unless exists $self->{pk}; < < # Output < my $out = ''; < < # Hide the primary keys. < $self->{view_key} and push (@{$self->{view}}, @{$self->{pk}}); < < # Calculate the form values. < my $values = $self->_get_defaults; < < # Now go through each column and print out a column row. < my @cols = $self->{db}->ordered_columns; < foreach my $col (@cols) { < < # Run any code refs that have been setup. < if (exists $self->{code}->{$col} and (ref $self->{code}->{$col} eq 'CODE')) { < $out .= $self->{code}->{$col}->($self, $self->{cols}->{$col}, $values); < next; < } < next if $self->_skip ($col); < < # Set the form name (using increment for multiple if requested) and also the display name. < my $field_name = $self->{multiple} ? "$self->{multiple}-$col" : $col; < my $display_name = exists $self->{cols}->{$col}->{form_display} ? $self->{cols}->{$col}->{form_display} : $col; < my $value = $values->{$col}; < my $disp = $self->{disp_form} ? $self->_get_form_display ($col) : $self->_get_html_display ($col); < < $disp eq 'hidden' and push (@{$self->{hide}}, $col) and next; < < $out .= qq!\n\t{col_font}>!; < < # Get the column display subroutine < $out .= $self->$disp( { name => $field_name, def => $self->{cols}->{$col}, value => $value }); < < $out .= qq!\n!; < < } < < return $out; < } < 195c90 < else { $cwidth = "30%"; $vwidth = "70%" } --- > else { $cwidth = "30%"; $vwidth = "70%" } Index: GT/Session/TempTable.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/Session/TempTable.pm,v retrieving revision 1.2 retrieving revision 1.1 diff -r1.2 -r1.1 8a9 > use GT::Session::SQL; 13c14 < @ISA = qw| GT::Base |; --- > @ISA = qw| GT::Session::SQL GT::Base |; 16,17c17,22 < id => undef, < tb => undef, --- > info => { > session_date => undef, > session_data => undef, > session_id => undef, > }, > tb => undef, 24d28 < seconds => 60*60, 33,36c37,40 < 'BADDATA' => "Invalid data in session: '%s'. Reason: '%s'", < 'CLASSFUNC' => "This is a class function only.", < 'INVALIDSESSION'=> "Invalid session id: '%s'.", < 'BADARGS' => "Invalid arguments: %s", --- > BADDATA => "Invalid data in session: '%s'. Reason: '%s'", > CLASSFUNC => "This is a class function only.", > INVALIDSESSION => "Invalid session id: '%s'.", > BADARGS => "Invalid arguments: %s", 40,42c44,48 < sub install { < #------------------------------------------------------------------------------- < # creates the controller table --- > sub new { > # --------------------------------------------------------------- > # Initilizes a session. Expects to find a session id to lookup, some > # data to save, or nothing. If no session is defined, then one will > # be generated. If an invalid session is specified, nothing is returned. 44,45c50,57 < my $self = shift; < my $DB = $self->_db(); --- > my $this = shift; > my $class = ref $this || $this; > my $self = bless {}, $class; > > # Set defaults. > foreach (keys %$ATTRIBS) { > $self->{$_} = $ATTRIBS->{$_}; > } 47c59,65 < my $c = $DB->creator( $self->{set_name} ); --- > # We got passed in a single session id. > if (@_ == 2) { > $self->{tb} = $_[1]; > $self->load ($_[0]) or return $self->error ('INVALIDSESSION', 'WARN', $_[0]); > $self->{save} = 0; > return $self; > } 49,60c67,88 < $c->cols( < ID => { pos => 1, type => 'INT', not_null => 1, unsigned => 1, regex => '^d+$' }, < SessID => { pos => 2, type => 'CHAR', size => 100, not_null => 1 }, < SessTable => { pos => 3, type => 'CHAR', size => 100, not_null => 1 }, < Timestmp => { pos => 4, type => 'TIMESTAMP', time_check => 1 } < ); < < $c->pk('ID'); < $c->ai('ID'); < $c->create('force'); < $c->set_defaults(); < $c->save_schema(); --- > # We got passed some options, possibly a session id. > if (@_ == 1 and ref $_[0] eq 'HASH') { > my $opts = $_[0]; > foreach (keys %{$opts}) { > if (exists $self->{$_}) { $self->{$_} = $opts->{$_}; next } > if (exists $self->{info}->{$_}) { $self->{info}->{$_} = $opts->{$_}; next } > } > } > > exists ($self->{tb}) or return $self->error ("BADARGS", "FATAL", "Must pass in a table object"); > > # If we have an id, load it or return. > if ($self->{info}->{session_id}) { > $self->load ($self->{info}->{session_id}) or return $self->error ('INVALIDSESSION', 'WARN', $self->{id}); > $self->{save} = 0; > } > else { > $self->{info}->{session_id} = generate_session_id(); > $self->{save} = 1; > } > > return $self; 63c91 < sub uninstall { --- > sub initial_create { 65c93 < # drops the controller table along with all the --- > # creates the controller table 67,83c95,96 < my $self = shift; < my $DB = $self->_db() or return; < my $err = 1; < < # drop all the associated temp tables..., < eval { < my $tb = $DB->table( $self->{set_name} ); < my $sth = $tb->select( [ 'SessTable' ] ); < while ( my $aref = $sth->fetchrow_arrayref() ) { < my $table_name = $aref->[0]; < eval { < my $e = $DB->editor( $table_name ); < $e->drop_table("remove") or die "Can't drop table"; < }; < $@ and $err = undef; < < } --- > my $self = shift; > my $DB = $self->_db(); 85,88c98 < # now drop the master control table < my $e = $DB->editor( $self->{set_name}); < $e->drop_table("remove") or die "Can't drop table"; < }; --- > my $c = $DB->creator( $self->{set_name} ); 90c100,111 < return $@ ? undef : 1; --- > $c->cols( > ID => { pos => 1, type => 'INT', not_null => 1, unsigned => 1, regex => '^d+$' }, > SessID => { pos => 2, type => 'CHAR', size => 100, not_null => 1 }, > SessTable => { pos => 3, type => 'CHAR', size => 100, not_null => 1 }, > Timestmp => { pos => 4, type => 'TIMESTAMP', time_check => 1 } > ); > > $c->pk('ID'); > $c->ai('ID'); > $c->create('force'); > $c->set_defaults(); > $c->save_schema(); 98c119,120 < my $create_session = ( ref $_[0] eq 'CODE' ? shift : $self->{create_session} ) or return $self->error( 'NOCS', 'WARN' ); --- > my $create_session = shift || $self->{create_session} or return $self->error( 'NOCS', 'WARN' ); > ref $create_session eq 'CODE' or return $self->error( 'CSNOTCODE', 'WARN' ); 100c122 < my $sid = $self->{id} or return $self->error( 'NOSID', 'WARN' ); --- > my $sid = $self->{info}->{session_id} or return $self->error( 'NOSID', 'WARN' ); 106c128 < my $newid = $Session->add({ SessTable => $table_name, SessID => $sid }) or return; --- > my $newid = $Session->add({ SessTable => $table_name, SessID => $sid, }) or return; 108,109c130,131 < # create the new table, extra parameters are passed into the create_session sub procedure < if ( my $result = &{$create_session}( $DB, $table_name, $newid, @_ ) ) { --- > # create the new table > if ( my $result = &{$create_session}( $DB, $table_name, $newid ) ) { 114c136 < $Session->delete($newid); --- > $Session->drop($newid); 126c148 < my $sid = $self->{id} or return $self->error( 'NOSID', 'WARN' ); --- > my $sid = $self->{info}->{session_id} or return $self->error( 'NOSID', 'WARN' ); 128,133c150,153 < my $DB = $self->_db(); < my $Session = $DB->table( $self->{set_name} ) or return; < my $sth = $Session->select({ ID => $set_id, SessID => $sid }) or return undef; < my $href = $sth->fetchrow_hashref() or return undef; < $href->{Timestmp} = \'NOW()'; < $Session->update( $href ); --- > my $DB = $self->_db(); > my $Session = $DB->table( $self->{set_name} ) or return; > my $sth = $Session->select({ ID => $set_id, SessID => $sid }, ['SessTable']) or return undef; > my $aref = $sth->fetchrow_arrayref() or return undef; 135c155 < if ( my $table_name = $href->{'SessTable'} ) { --- > if ( my $table_name = $aref->[0] ) { 151c171 < my $sid = $self->{id} or return $self->error( 'NOSID', 'WARN' ); --- > my $sid = $self->{info}->{session_id} or return $self->error( 'NOSID', 'WARN' ); 172c192 < my $sid = ( shift || $self->{id} ) or return $self->error( 'NOSID', 'WARN' ); --- > my $sid = ( shift || $self->{info}->{session_id} ) or return $self->error( 'NOSID', 'WARN' ); 175d194 < # delete all created temp tables 178,181c197,198 < eval { < my $e = $DB->editor($tbl_name); < $e->drop_table( "remove" ); < } --- > my $e = $DB->editor($tbl_name); > $e->drop_table( "remove" ); 199c216 < my $sid = $self->{id} or return $self->error( 'NOSID', 'WARN' ); --- > my $sid = $self->{info}->{session_id} or return $self->error( 'NOSID', 'WARN' ); 205c222 < $e->drop_table(); --- > $e->drop_table( "remove" ); 212,213c229 < my $self = shift; < my $seconds = shift || $self->{seconds}; --- > my ($self, $seconds) = @_; 220,222d235 < my $DB = $self->_db() or return; < my $tb = $DB->table( $self->{set_name} ); < 225c238 < my @time = localtime ($new_sec); --- > my @time = localtime ($new_sec); 230c243 < my $sth = $tb->select( GT::SQL::Condition->new('Timestmp', '<', $date_str), [ 'SessID' ] ) or return $self->error ($GT::SQL::error); --- > my $sth = $self->{tb}->select( GT::SQL::Condition->new('session_data', '<', $date_str), [ 'session_id' ] ) or return $self->error ($GT::SQL::error); 234c247 < $tb->delete (GT::SQL::Condition->new ('Timestmp', '<', $date_str)) or return $self->error ($GT::SQL::error); --- > $self->{tb}->delete (GT::SQL::Condition->new ('session_data', '<', $date_str)) or return $self->error ($GT::SQL::error); 249c262 < $db = GT::SQL->new( $def_path ); --- > my $db = GT::SQL->new( $def_path ); 262c275 < return md5_hex( time . $$ . rand (16000) ); --- > return md5_hex ( time . $$ . rand (16000) ); Index: GT/URI/HTTP.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/URI/HTTP.pm,v retrieving revision 1.21 retrieving revision 1.20 diff -r1.21 -r1.20 6c6 < # $Id: HTTP.pm,v 1.21 2001/02/11 01:11:24 aki Exp $ --- > # $Id: HTTP.pm,v 1.20 2000/12/11 18:28:47 aki Exp $ 168,169c168 < if ( $sock ) { < $fh = $sock->fh(); --- > if ( $fh = $sock->fh() ) { 880c879 < Revision: $Id: HTTP.pm,v 1.21 2001/02/11 01:11:24 aki Exp $ --- > Revision: $Id: HTTP.pm,v 1.20 2000/12/11 18:28:47 aki Exp $ Index: GT/URI/HTTPS.pm =================================================================== RCS file: /usr/local/gossamer/library/GT/URI/HTTPS.pm,v retrieving revision 1.5 retrieving revision 1.4 diff -r1.5 -r1.4 6c6 < # $Id: HTTPS.pm,v 1.5 2001/02/11 01:11:24 aki Exp $ --- > # $Id: HTTPS.pm,v 1.4 2001/01/02 16:57:49 aki Exp $ 169,170c169 < if ( $sock ) { < $fh = $sock->fh(); --- > if ( $fh = $sock->fh() ) { 614c613 < Revision: $Id: HTTPS.pm,v 1.5 2001/02/11 01:11:24 aki Exp $ --- > Revision: $Id: HTTPS.pm,v 1.4 2001/01/02 16:57:49 aki Exp $