-VERSION=0.15
+VERSION=0.15_01
DISTNAME=bse-$(VERSION)
DISTBUILD=$(DISTNAME)
DISTTAR=../$(DISTNAME).tar
shipping_cost integer not null default 0,
+ delivMobile varchar(80) not null default '',
+ billMobile varchar(80) not null default '',
+
primary key (id),
index order_cchash(ccNumberHash),
index order_userId(userId, orderDate)
affiliate_name varchar(40) not null default '',
+ delivMobile varchar(80) not null default '',
+ billMobile varchar(80) not null default '',
+
primary key (id),
unique (userId),
index (affiliate_name)
$r = $req->url('siteusers', { list => 1,
'm' => "User $user->{userId} added" });
}
- $r .= "&m=".escape_url($msg) if $msg;
+ $r .= "&m=".escape_uri($msg) if $msg;
return BSE::Template->get_refresh($r, $cfg);
}
else {
Orders => 'select * from orders',
getOrderByPkey => 'select * from orders where id = ?',
getOrderItemByOrderId => 'select * from order_item where orderId = ?',
- addOrder => 'insert orders values(null,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
- replaceOrder => 'replace orders values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
+ addOrder => 'insert orders values(null,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
+ replaceOrder => 'replace orders values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
addOrderItem => 'insert order_item values(null,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
getOrderByUserId => 'select * from orders where userId = ?',
'select * from site_users where id = ?',
getSiteUserByAffiliate_name =>
'select * from site_users where affiliate_name = ?',
- addSiteUser => 'insert site_users values(null,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
- replaceSiteUser => 'replace site_users values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
+ addSiteUser => 'insert site_users values(null,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
+ replaceSiteUser => 'replace site_users values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
'SiteUsers.removeSubscriptions'=>
'delete from subscribed_users where userId = ?',
'SiteUsers.removeSub'=>
customInt1 customInt2 customInt3 customInt4 customInt5
customStr1 customStr2 customStr3 customStr4 customStr5
instructions billTelephone billFacsimile billEmail
- siteuser_id affiliate_code shipping_cost/;
+ siteuser_id affiliate_code shipping_cost
+ delivMobile billMobile/;
}
=item siteuser
return $user;
}
},
- user => sub { $user && CGI::escapeHTML($user->{$_[0]}) },
+ user => $user ? [ \&tag_hash, $user ] : '',
);
}
},
adminbase => [ \&tag_adminbase, $cfg ],
help => [ \&tag_help, $cfg, 'user' ],
+ $it->make_iterator(\&DevHelp::Tags::iter_get_repeat, 'strepeat', 'strepeats'),
_format =>
sub {
elsif ($prefix eq 'r') {
$result = sprintf("%.0f", $result);
}
+ elsif ($prefix =~ /^d(\d+)$/) {
+ $result = sprintf("%.*f", $1, $result);
+ }
return escape_html($result);
}
return "$ol<li>".join("</li><li>", @points)."</li></ol>";
}
+sub _format_lists {
+ my ($text) = @_;
+
+ my $out = '';
+
+ while (length $text) {
+ if ($text =~ s!^((?: *\#\#[^\n]+(?:\n|$)\n?[^\S\n]*)+)\n?!!) {
+ $out .= _format_ol($1);
+ }
+ elsif ($text =~ s#^((?: *\*\*[^\n]+(?:\n|$)\n?[^\S\n]*)+)\n?##) {
+ $out .= _format_bullets($1);
+ }
+ elsif ($text =~ s!^((?: *%%[^\n]+(?:\n|$)\n?[^\S\n]*)+)\n?!!) {
+ $out .= _format_ol($1, 'a', '%%');
+ }
+ else {
+ $out .= $text;
+ $text = '';
+ }
+ }
+
+ return $out;
+}
+
# raw html - this has some limitations
# the input text has already been escaped, so we need to unescape it
# too bad if you want [] in your html (but you can use entities)
and next TRY;
$part =~ s#table\[([^\]\[]+)\|([^\]\[|]+)\]#_make_table($1, "|$2")#ieg
and next TRY;
- $part =~ s#(?:^|\n{1,2})((?: *\*\*[^\n]+(?:\n|$)\n?[^\S\n]*)+)\n?#_format_bullets($1)#eg
- and next TRY;
- $part =~ s!(?:^|\n{1,2})((?: *##[^\n]+(?:\n|$)\n?[^\S\n]*)+)\n?!_format_ol($1)!eg
- and next TRY;
- $part =~ s!(?:^|\n{1,2})((?: *%%[^\n]+(?:\n|$)\n?[^\S\n]*)+)\n?!_format_ol($1, 'a', '%%')!eg
+ $part =~ s#(?:^|\n{1,2})((?: *(?:\*\*|\#\#|\%\%)[^\n]+(?:\n|$)\n?[^\S\n]*)+)\n?#_format_lists($1)#eg
and next TRY;
$part =~ s#indent\[([^\]\[]+)\]#<ul>$1</ul>#ig
and next TRY;
my $out = '';
for my $part (split /((?:html\[(?:[^\[\]]*(?:(?:\[[^\[\]]*\])[^\[\]]*)*)\])
- |embed\[(?:[^,\[\]]*)(?:,(?:[^,\[\]]*)){0,2}\])/ix, $body) {
+ |embed\[(?:[^,\[\]]*)(?:,(?:[^,\[\]]*)){0,2}\]
+ |pre\[(?:[^\[\]]*(?:(?:\[[^\[\]]*\])[^\[\]]*)*)\])/ix, $body) {
#print STDERR "Part is $part\n";
if ($part =~ /^html\[([^\[\]]*(?:(?:\[[^\[\]]*\])[^\[\]]*)*)\]$/i) {
$out .= _strip_html($1);
elsif ($part =~ /^embed\[([^,\[\]]*)\]$/i) {
$out .= "";
}
+ elsif ($part =~ /^pre\[([^\[\]]*(?:(?:\[[^\[\]]*\])[^\[\]]*)*)\]$/i) {
+ my $work = $1;
+ $out .= $self->remove_format($work);
+ }
else {
TRY: while (1) {
$self->remove(\$part)
and next TRY;
$part =~ s#link\[([^|\]\[]+)\]#$1#ig
and next TRY;
- $part =~ s#([bi])\[([^\]\[]+)\]#$2#ig
+ $part =~ s#[bi]\[([^\]\[]+)\]#$1#ig
+ and next TRY;
+ $part =~ s#tt\[([^\]\[]+)\]#$1#ig
and next TRY;
$part =~ s#align\[([^|\]\[]+)\|([^\]\[]+)\]#$2#ig
and next TRY;
$self->remove_block('Articles', [], \$body);
1 while $body =~ s/[bi]\[([^\]\[]+)\]/$1/g;
+ $body = escape_html($body);
+
my @found = find_terms(\$body, $case_sensitive, @terms);
my @reterms = @terms;
.'" width="'.$acts->{$which}->('thumbWidth')
.'" height="'.$acts->{$which}->('thumbHeight').'"';
$result .= qq! class="$class"! if $class;
- $result .= ' border="0" />';
+ $result .= ' border="0" alt="" />';
return $result;
}
else {
billEmail adminNotes disabled flags
customText1 customText2 customText3
customStr1 customStr2 customStr3
- affiliate_name/;
+ affiliate_name delivMobile billMobile/;
}
sub valid_fields {
title => { description=>'Title', rules=>"dh_one_line", maxlen=>127 },
organization => { description=>'Organization', rules=>"dh_one_line",
maxlen=>127 },
+ delivMobile => { description => "Mobile", rules=>"phone",
+ maxlen => 80 },
textOnlyEmail => { description => "Text Only Email", type=>"boolean" },
referral => { description=>'Referral', rules=>"natural" },
otherReferral => { description=>'Other Referral', rules=>"dh_one_line",
maxlen=>80 },
billEmail => { description => "Billing Email", rules=>"email",
maxlen=>255 },
+ billMobile => { description => "Billing Mobile", rules=>"phone",
+ maxlen => 80 },
customText1 => { description => "Custom Text 1" },
customText2 => { description => "Custom Text 2" },
customText3 => { description => "Custom Text 3" },
=head1 CHANGES
+=head2 0.15_01
+
+=over
+
+=item *
+
+formatted lists where there was no other text between the lists would
+produce mis-formatted lists.
+
+=item *
+
+the tt[] and pre[] tags were not removed from search result except
+text. (#460)
+
+=item *
+
+creating a new user with subscriptions enabled could sometimes cause a
+500 server error. This was due to calling escape_url() instead of
+escape_uri(). Thanks to Piers Johnson from Might Media for reporting
+and patching this.
+
+=item *
+
+added the billMobile and delivMobile fields to the orders and site
+users tables
+
+=item *
+
+the user tag in user.pl could sometimes produce undefined value
+warnings in the error log.
+
+=item *
+
+search excerpt text is now correctly HTML escaped
+
+=item *
+
+added the strepeats iterator for use on all pages (resolved on the
+first build when pre-building templates for dynamic pages)
+
+=item *
+
+added the dI<digits> prefix to the arithmetic tag, which rounds the
+result, so for example:
+
+ <:arithmetic d2:1.234:>
+
+results in:
+
+ 1.23
+
+=item *
+
+C<img> elements produced by the thumbnail tag now include an empty alt
+parameter.
+
+=item *
+
+the tt[...] tag is now removed from body text in those cases where
+we're removing other tags
+
+=back
+
=head2 0.15
No changes since 0.14_37, no issues reported with 0.14_37.
<td> </td>
<td align="left"><b>Phone:</b></td>
<td><:order telephone:></td>
- <!--<td rowspan=3> </td>-->
</tr>
<tr>
<td align="left"><b>Date:</b></td>
<td><:date order orderDate:></td>
+ <td> </td>
+ <td align="left"><b>Mobile:</b></td>
+ <td><:order delivMobile:></td>
</tr>
<tr>
<td align="left"><b>Delivery:</b></td>
</td>
<td bgcolor="#FFFFFF"><:help editsiteuser telephone:> <:error_img telephone:></td>
</tr>
+ <tr>
+ <th bgcolor="#FFFFFF" align="left">mobile: </th>
+ <td bgcolor="#FFFFFF">
+ <input type="text" name="delivMobile" value="<:old delivMobile:>" /><:ifRequired delivMobile:>*<:or:><:eif:>
+ </td>
+ <td bgcolor="#FFFFFF"><:help editsiteuser delivMobile:> <:error_img delivMobile:></td>
+ </tr>
<tr>
<th bgcolor="#FFFFFF" align="left">facsimile: </th>
<td bgcolor="#FFFFFF">
</td>
<td bgcolor="#FFFFFF"><:help editsiteuser billTelephone:> <:error_img billTelephone:></td>
</tr>
+ <tr>
+ <th bgcolor="#FFFFFF" align="left">billMobile: </th>
+ <td bgcolor="#FFFFFF">
+ <input type="text" name="billMobile" value="<:old billMobile:>" /><:ifRequired billMobile:>*<:or:><:eif:>
+ </td>
+ <td bgcolor="#FFFFFF"><:help editsiteuser billMobile:> <:error_img billMobile:></td>
+ </tr>
<tr>
<th bgcolor="#FFFFFF" align="left">billFacsimile: </th>
<td bgcolor="#FFFFFF">
</td>
<td bgcolor="#FFFFFF"><:help editsiteuser telephone:> <:error_img telephone:></td>
</tr>
+ <tr>
+ <th bgcolor="#FFFFFF" align="left">mobile: </th>
+ <td bgcolor="#FFFFFF">
+ <input type="text" name="delivMobile" value="<:old delivMobile siteuser delivMobile:>" /><:ifRequired delivMobile:>*<:or:><:eif:>
+ </td>
+ <td bgcolor="#FFFFFF"><:help editsiteuser delivMobile:> <:error_img delivMobile:></td>
+ </tr>
<tr>
<th bgcolor="#FFFFFF" align="left">facsimile: </th>
<td bgcolor="#FFFFFF">
</td>
<td bgcolor="#FFFFFF"><:help editsiteuser billTelephone:> <:error_img billTelephone:></td>
</tr>
+ <tr>
+ <th bgcolor="#FFFFFF" align="left">billMobile: </th>
+ <td bgcolor="#FFFFFF">
+ <input type="text" name="billMobile" value="<:old billMobile siteuser billMobile:>" /><:ifRequired billMobile:>*<:or:><:eif:>
+ </td>
+ <td bgcolor="#FFFFFF"><:help editsiteuser billMobile:> <:error_img billMobile:></td>
+ </tr>
<tr>
<th bgcolor="#FFFFFF" align="left">billFacsimile: </th>
<td bgcolor="#FFFFFF">
<input type="Text" name="telephone" size=20 value="<:old telephone:>">
*</font></td>
</tr>
+ <tr>
+ <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Mobile:</font></td>
+ <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
+ <input type="Text" name="delivMobile" size=20 value="<:old delivMobile:>">
+ </font></td>
+ </tr>
<tr>
<td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Facsimile:</font></td>
<td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<input type="Text" name="billTelephone" size=20 value="<:old billTelephone:>">
*</font></td>
</tr>
+ <tr>
+ <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Mobile:</font></td>
+ <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
+ <input type="Text" name="billMobile" size=20 value="<:old billMobile:>">
+ </font></td>
+ </tr>
<tr>
<td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Facsimile:</font></td>
<td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<:order delivCountry:>
Phone : <:order telephone:>
-Fax : <:order facsimile:>
+<:ifOrder delivMobile:>Mobile : <:order delivMobile:>
+<:or:><:eif:>Fax : <:order facsimile:>
Email : <:order emailAddress:>
Product Units Price Extended
<:order delivCountry:>
Phone : <:order telephone:>
-Fax : <:order facsimile:>
+<:ifOrder delivMobile:>Mobile : <:order delivMobile:>
+<:or:><:eif:>Fax : <:order facsimile:>
Email : <:order emailAddress:>
Product Units Price Extended
<input type="text" name="telephone" value="<:last telephone:>" size="32" maxlength="80" /><:error_img telephone:>
</td>
</tr>
+ <tr>
+ <th nowrap="nowrap" align="left"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="-2">Mobile:</font></b></th>
+ <td width="100%" nowrap="nowrap">
+ <input type="text" name="delivMobile" value="<:last delivMobile:>" size="32" maxlength="80" /><:error_img delivMobile:>
+ </td>
+ </tr>
<tr>
<th nowrap="nowrap" align="left"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="-2">Facsimile:</font></b></th>
<td width="100%" nowrap="nowrap">
<input type="text" name="billTelephone" value="<:last billTelephone:>" size="40" maxlength="127" /><:error_img billTelephone:>
</td>
</tr>
+ <tr>
+ <th>Mobile:</th>
+ <td width="100%" nowrap="nowrap">
+ <input type="text" name="billMobile" value="<:last billMobile:>" size="40" maxlength="80" /><:error_img billMobile:>
+ </td>
+ </tr>
<tr>
<th>Facsimile:</th>
<td width="100%" nowrap="nowrap">
<input type="text" name="billTelephone" value="<:last billTelephone:>" size="40" maxlength="127" /><:error_img billTelephone:>
</td>
</tr>
+ <tr>
+ <th>Mobile:</th>
+ <td width="100%" nowrap="nowrap">
+ <input type="text" name="billMobile" value="<:last billMobile:>" size="40" maxlength="127" /><:error_img billMobile:>
+ </td>
+ </tr>
<tr>
<th>Facsimile:</th>
<td width="100%" nowrap="nowrap">
<input type="text" name="telephone" value="<:old telephone:>" size="32" maxlength="80" /> <:error_img telephone:><:ifRequired telephone:><font face="Verdana, Arial, Helvetica, sans-serif" size="-2">*</font><:or:><:eif:>
</td>
</tr>
+ <tr>
+ <th nowrap align="left"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="-2">Mobile:</font></b></th>
+ <td width="100%" nowrap="nowrap">
+ <input type="text" name="delivMobile" value="<:old delivMobile:>" size="32" maxlength="80" /> <:error_img delivMobile:><:ifRequired delivMobile:><font face="Verdana, Arial, Helvetica, sans-serif" size="-2">*</font><:or:><:eif:>
+ </td>
+ </tr>
<tr>
<th nowrap align="left"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="-2">Facsimile:</font></b></th>
<td width="100%" nowrap="nowrap">
#!perl -w
use strict;
-use Test::More tests => 42;
+use Test::More tests => 43;
sub format_test($$$;$);
** so should this
IN
this shouldn't be a bullet ** some text<ul><li>this should be a bullet</li><li>so should this</li></ul>
+OUT
+
+ format_test <<IN, <<OUT, 'mixed', 'both';
+** joe
+** bob
+## one
+## two
+IN
+<ul><li>joe</li><li>bob</li></ul><ol><li>one</li><li>two</li></ol>
OUT
format_test 'indent[text]', '<ul>text</ul>', 'indent';
DevHelp::HTML->import('escape_xml');
- is(escape_xml("<&\xE9"), '<&é', "don't escape like html");
+ is(escape_xml("<&\xE9"), "<&\xE9", "don't escape like html");
}
#!perl -w
use strict;
use BSE::Test ();
-use Test::More tests=>58;
+use Test::More tests=>64;
use File::Spec;
use FindBin;
my $cgidir = File::Spec->catdir(BSE::Test::base_dir, 'cgi-bin');
template_test "arithmetic", $top, <<'TEMPLATE', <<EXPECTED;
<:arithmetic 2+2:>
<:arithmetic 2+[add 1 1]:>
+<:arithmetic d2:1.234+1.542:>
<:arithmetic 2+[add 1 2]+[undefinedtag x]+[add 1 1]+[undefinedtag2]:>
TEMPLATE
4
4
+2.78
<:arithmetic 2+3+[undefinedtag x]+2+[undefinedtag2]:>
EXPECTED
Thu 23/09/2004
EXPECTED
+template_test "strepeats", $parent, <<'TEMPLATE', <<EXPECTED;
+<:iterator begin strepeats [arithmetic 1+1]:><:strepeat index:> <:strepeat value:>
+<:iterator end strepeats:>
+TEMPLATE
+0 1
+1 2
+
+EXPECTED
+
+template_test "strepeats2", $parent, <<'TEMPLATE', <<EXPECTED;
+<:iterator begin strepeats [arithmetic 1+1] 5:><:strepeat index:> <:strepeat value:>
+<:iterator end strepeats:>
+TEMPLATE
+0 2
+1 3
+2 4
+3 5
+
+EXPECTED
+
BSE::Admin::StepParents->del($parent, $parent);
for my $kid (reverse @kids) {
my $name = $kid->{title};