1 # Copyright 2002-2007 Interchange Development Group and others
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version. See the LICENSE file for details.
8 # $Id: history_scan.tag,v 1.20 2007-03-30 23:40:57 pajamian Exp $
10 UserTag history-scan Order find exclude default
11 UserTag history-scan addAttr
12 UserTag history-scan Version $Revision: 1.20 $
13 UserTag history-scan Routine <<EOR
14 my %var_exclude = ( qw/
15 mv_credit_card_number 1
25 my ($find, $exclude, $default, $opt) = @_;
26 $default ||= $Vend::Cfg->{SpecialPage}{catalog};
27 my $ref = $Vend::Session->{History};
29 use vars qw/$CGI $Tag/;
31 $opt->{size_limit} ||= '1024';
33 return $default if $opt->{pageonly};
34 return $Tag->area($default);
36 my ($hist, $href, $cgi);
37 $exclude = qr/$exclude/ if $exclude;
39 $include = qr/$opt->{include}/ if $opt->{include};
40 for (my $i = $#$ref - abs($opt->{count}); $i >= 0; $i--) {
41 next if $ref->[$i][0] eq 'expired';
42 if ($exclude and $ref->[$i][0] =~ $exclude) {
45 if ($include and $ref->[$i][0] !~ $include) {
49 next unless $ref->[$i][0] =~ /$find/;
51 ($href, $cgi) = @{$ref->[$i]};
55 return $default if $opt->{pageonly};
56 return $Tag->area($default);
60 if ($opt->{pageonly}) {
64 if($opt->{var_exclude}) {
65 for(split /[\s,\0]+/, $opt->{var_exclude}) {
69 for(grep !$var_exclude{$_}, keys %$cgi) {
71 $form .= join("\n$_=", split /\0/, $cgi->{$_});
73 $form .= "\n$opt->{form}" if $opt->{form};
74 my $string = $Tag->area( {
77 no_session => $opt->{no_session},
79 my $len = length($string);
80 if($len > $opt->{size_limit}) {
81 $len = $Tag->filter('commify.0', $len);
83 'Huge URL (%s bytes) exceeds %s byte limit, returning blank.',
87 $Tag->error({ name => 'history-scan', set => $m })