-VERSION=0.14_33
+VERSION=0.14_34
DISTNAME=bse-$(VERSION)
DISTBUILD=$(DISTNAME)
DISTTAR=../$(DISTNAME).tar
#my $articles = Articles->new;
my $articles = 'Articles';
- my $article = $articles->getByPkey($id)
- or die "Cannot find article ",$id;
-
- eval "use $article->{generator}";
- die $@ if $@;
- my $generator = $article->{generator}
- ->new(admin=>$admin, articles=>$articles, cfg=>$cfg, request=>$req,
- top=>$article);
-
- print "Content-Type: text/html\n\n";
- print $generator->generate($article, $articles);
+ my $article;
+ $article = $articles->getByPkey($id) if $id =~ /^\d+$/;
+
+ if ($article) {
+ eval "use $article->{generator}";
+ die $@ if $@;
+ my $generator = $article->{generator}
+ ->new(admin=>$admin, articles=>$articles, cfg=>$cfg, request=>$req,
+ top=>$article);
+
+ print "Content-Type: text/html\n\n";
+ print $generator->generate($article, $articles);
+ }
+ else {
+ # display a message on the admin menu
+ refresh_to_admin($req->cfg,
+ $req->url(menu =>{ 'm' => "No such article '${id}'"} ));
+ }
}
else {
refresh_to_admin($cfg, "/cgi-bin/admin/logon.pl");
sub tag_thumbimage {
my ($cfg, $thumbs_obj, $current_image, $args) = @_;
+ $thumbs_obj or return '';
+
$$current_image or return '** no current image **';
my $imagedir = cfg_image_dir($cfg);
my $im_id = $cgi->param('im');
my $image;
if (defined $im_id && $im_id =~ /^\d+$/) {
- ($image) = grep $_->{id} == $im_id, $article->images;
+ ($image) = grep $_->{id} == $im_id, $self->get_images($article);
}
my $thumb_obj = $self->_get_thumbs_class();
my ($data, $type);
my %types =
(
qw(
- pdf application/pdf
- txt text/plain
+ bash text/plain
+ css text/css
+ csv text/plain
+ diff text/plain
htm text/html
html text/html
+ ics text/calendar
+ patch text/plain
+ pl text/plain
+ pm text/plain
+ pod text/plain
+ py text/plain
sgm text/sgml
sgml text/sgml
- xml text/xml
+ sh text/plain
+ tcsh text/plain
+ text text/plain
tsv text/tab-separated-values
- csv text/plain
+ txt text/plain
+ vcf text/x-vcard
+ vcs text/x-vcalendar
+ xml text/xml
+ zsh text/x-script.zsh
+ bmp image/bmp
gif image/gif
- jpg image/jpeg
- jpeg image/jpeg
jp2 image/jpeg2000
+ jpeg image/jpeg
+ jpg image/jpeg
+ pct image/pict
+ pict image/pict
png image/png
- bmp image/bmp
tif image/tiff
tiff image/tiff
- pct image/pict
- pict image/pict
+ Z application/x-compress
+ dcr application/x-director
+ dir application/x-director
+ doc application/msword
+ dxr application/x-director
eps application/postscript
+ fla application/x-shockwave-flash
+ gz application/gzip
+ hqx application/mac-binhex40
+ js application/x-javascript
+ lzh application/x-lzh
+ pdf application/pdf
+ pps application/ms-powerpoint
+ ppt application/ms-powerpoint
ps application/postscript
- doc application/msword
rtf application/rtf
- zip application/zip
- gz application/gzip
+ sit application/x-stuffit
+ swf application/x-shockwave-flash
tar application/x-tar
tgz application/gzip
- hqx application/mac-binhex40
- bin application/macbinary
- sit application/x-stuffit
- Z application/x-compress
xls application/ms-excel
- ppt application/ms-powerpoint
- swf application/x-shockwave-flash
- fla application/x-shockwave-flash
- dxr application/x-director
- dcr application/x-director
- dir application/x-director
- mov video/quicktime
+ zip application/zip
+ asf video/x-ms-asf
+ avi video/avi
+ flc video/flc
moov video/quicktime
- mpg video/mpeg
+ mov video/quicktime
mp4 video/mp4
mpeg video/mpeg
- avi video/avi
- flc video/flc
+ mpg video/mpeg
wmv video/x-ms-wmv
- asf video/x-ms-asf
- mp2 audio/x-mpeg
- mp3 audio/x-mpeg
- m4a audio/m4a
- 3gp audio/3gpp
+ aa audio/audible
aif audio/aiff
aiff audio/aiff
- aa audio/audible
+ m4a audio/m4a
+ mid audio/midi
+ mp2 audio/x-mpeg
+ mp3 audio/x-mpeg
ra audio/x-realaudio
ram audio/x-pn-realaudio
rm audio/vnd.rm-realmedia
+ swa audio/mp3
wav audio/wav
wma audio/x-ms-wma
- mid audio/midi
- swa audio/mp3
- diff text/plain
- patch text/plain
- css text/css
+ 3gp audio/3gpp
)
);
}
my @site_actions =
- qw(edit artimg process addimg removeimg moveimgup moveimgdown);
+ qw(edit artimg process addimg removeimg moveimgup moveimgdown a_thumb);
sub article_actions {
my ($self) = @_;
my $prefix;
- if ($arg =~ s/^\s*([^:\s]+)://) {
+ if ($arg =~ s/^\s*([^:\s]*)://) {
$prefix = $1;
}
else {
$prefix = '';
}
-
- $arg =~ s/\[\s*(\w+)(\s+\S[^\[\]]*)?\s*\]/
- $templater->perform($acts, $1, $2)/ge;
+
+ my $not_found;
+ $arg =~ s/(\[\s*(\w+)(\s+\S[^\[\]]*)?\s*\])/
+ exists $acts->{$2} ? $templater->perform($acts, $2, $3)
+ : (++$not_found, $1)/ge;
+
+ if ($not_found) {
+ if ($prefix eq '') {
+ return "<:arithmetic $arg:>";
+ }
+ else {
+ return "<:arithmetic $prefix: $arg:>";
+ }
+ }
# this may be made more restrictive
my $result = eval $arg;
$msg = $msg->[$num];
}
my $images_uri = $cfg->entry('uri', 'images', '/images');
+ my $image = $cfg->entry('error_img', 'image', "$images_uri/admin/error.gif");
+ my $width = $cfg->entry('error_img', 'width', 16);
+ my $height = $cfg->entry('error_img', 'height', 16);
my $encoded = escape_html($msg);
- return qq!<img src="$images_uri/admin/error.gif" alt="$encoded" title="$encoded" border="0" align="top" />!;
+ return qq!<img src="$image" alt="$encoded" title="$encoded" width="$width" height="$height" border="0" align="top" />!;
}
sub tag_replace {
# older versions of uri_escape() acted differently without the
# second argument, so supply one to make sure we escape what
# needs escaping
- URI::Escape::uri_escape(shift, "^A-Za-z0-9\-_.!~*'()");
+ URI::Escape::uri_escape(shift, "^A-Za-z0-9\-_.!~*()");
}
sub unescape_uri {
sub send_conf_request {
my ($user, $cgi, $cfg, $rcode, $rmsg) = @_;
+
+ if ($user->is_disabled) {
+ $$rmsg = "User is disabled";
+ return;
+ }
my $nopassword = $cfg->entryBool('site users', 'nopassword', 0);
BSE::DB->query(siteuserSubscriptions => $self->{id});
}
+sub is_disabled {
+ my ($self) = @_;
+
+ return $self->{disabled};
+}
+
1;
." and expire <= $now";
last SWITCH;
};
+ /^m(\d+)$/ # modified in last N days
+ && do {
+ $sql .= " and lastModified > " . _sql_date(time - $oneday * $1);
+ last SWITCH;
+ };
$_ eq 'ae'
&& do {
$sql .= " and expire < $now";
# used to refresh if a logon is needed
my $r = $securlbase . $ENV{SCRIPT_NAME} . "?add=1&id=$addid";
for my $opt_index (0..$#opt_names) {
- $r .= "&$opt_names[$opt_index]=".ecape_uri($options[$opt_index]);
+ $r .= "&$opt_names[$opt_index]=".escape_uri($options[$opt_index]);
}
my $user = get_siteuser(\%session, $cfg, $CGI::Q);
=head1 CHANGES
+=head2 0.14_34
+
+=over
+
+=item *
+
+thumbnails weren't implemented for the site view/global image manager,
+they are now available there
+
+=item *
+
+you can now supply a new date selection code to the search engine,
+'mI<number>' will now only list articles that have been modified
+within the last I<number> days. The supplied search_base.tmpl has
+been modified to include this. (#136)
+
+=item *
+
+updated internal file extension to MIME types based on a list from
+Adrian, types which are basicly text files (like
+C<text/x-script.bash>) have been changed to C<text/plain> so browsers
+don't need to know about obscure aliases for text file types.
+
+=item *
+
+doing a refresh due to failure in adding a product to the cart (due to
+subscription restrictions for example) when the product had options
+would cause a 500 error (#438)
+
+=item *
+
+the arithmetic tag should handle double generated pages where tags
+needed on the second generation are used in the expression.
+
+=item *
+
+we now URI escape apostrophe C<'> when we're URI escaping in general,
+since a trailing unescaped C<'> could confuse some browsers in a
+Refresh header.
+
+=item *
+
+cgi-bin/admin/admin.pl now refreshes to the menu with an error message
+rather than causing a 500 error if it cannot find the article
+specified by C<id>. (#424)
+
+=item *
+
+saving a disabled user from the member admin page will no longer send
+the user a confirmation message if they are unconfirmed and have
+subscriptions selected. (#393)
+
+=item *
+
+a change not listed for 0.14_05 - the delivery instructions entered
+during checkout are now included on the encrypted order emailed to the
+site admin. (#354)
+
+=item *
+
+the validation error icon image can now be configured, see [error_img]
+in config.pod. (#230)
+
+=back
+
=head2 0.14_33
=over
=item *
-affiliate.pl will no longer display pages for disabled users
+affiliate.pl will no longer display pages for disabled users (#437)
=item *
=back
+=head2 [error_img]
+
+This is used to configure the error icon displayed next to fields that
+fail validation.
+
+=over
+
+=item image
+
+URI to the image file.
+
+=item width
+
+=item height
+
+The width and height of the error icon image.
+
+=back
+
=head1 AUTHOR
Tony Cook <tony@develop-help.com>
<b>Date: </b></font>
<select name="d">
<option value="ar" <:dateSelected ar:>>All Current</option>
+ <option value="m7" <:dateSelected m7:>>Modified within last 7 days</option>
+ <option value="m30" <:dateSelected m30:>>Modified within last 30 days</option>
<option value="r1" <:dateSelected r1:>>Released Today</option>
<option value="r7" <:dateSelected r7:>>Released within last 7 days</option>
<option value="e7" <:dateSelected e7:>>Archived within last 7 days</option>
#!perl -w
use strict;
use BSE::Test ();
-use Test::More tests=>49;
+use Test::More tests=>52;
use File::Spec;
use FindBin;
my $cgidir = File::Spec->catdir(BSE::Test::base_dir, 'cgi-bin');
Alpha Beta Gamma
EXPECTED
+template_test "arithmetic", $top, <<'TEMPLATE', <<EXPECTED;
+<:arithmetic 2+2:>
+<:arithmetic 2+[add 1 1]:>
+<:arithmetic 2+[add 1 2]+[undefinedtag x]+[add 1 1]+[undefinedtag2]:>
+TEMPLATE
+4
+4
+<:arithmetic 2+3+[undefinedtag x]+2+[undefinedtag2]:>
+EXPECTED
+
BSE::Admin::StepParents->del($parent, $parent);
for my $kid (reverse @kids) {
my $name = $kid->{title};
--- /dev/null
+# where to install the site
+base_url = http://imager.perl.org
+securl = http://imager.perl.org
+# where to install the site
+base_dir = /var/www/httpd/imager.perl.org
+# the database user/password/dsn
+dbuser = bseimager
+dbpass = bseimager
+dsn = dbi:mysql:bseimager
+dbclass = BSE::DB::Mysql
+sessionclass = Apache::Session::MySQL
+# the location of mysql
+mysql = mysql
+basic.access_control=1
+#basic.htusers = /home/httpd/bsetest/htdocs/images/.htusers
+#paths.libraries=/home/tony/dev/bse/tryandbyte/modules
+#paths.local_templates=/home/tony/dev/bse/tryandbyte/templates
+#tryandbyte.aufreight=500
+shop.to_email=tony@develop-help.com
+site.name=Imager
editor.allow_thumb=1
editor.thumbs_class=BSE::Thumb::Imager
+