X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=opac%2Fopac-showreviews.pl;h=24ac312768e334d74e406fa83e594df55f03a1b2;hb=f029e9aba7d6c03b3c8e19697af31071b595dcc9;hp=19693b0c46643baade831e0c0f7861eb8385ffd8;hpb=f36747f5e8ab8c02034b165be31dcc478153cbee;p=koha_gimpoz diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl index 19693b0c46..24ac312768 100755 --- a/opac/opac-showreviews.pl +++ b/opac/opac-showreviews.pl @@ -14,9 +14,9 @@ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; use warnings; @@ -52,7 +52,7 @@ my ( $template, $borrowernumber, $cookie ) = &get_template_and_user( template_name => $template_name, query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), } ); @@ -65,6 +65,17 @@ if($format eq "rss"){ ); } +my $libravatar_enabled = 0; +if ( C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) { + eval { + require Libravatar::URL; + Libravatar::URL->import(); + }; + if ( !$@ ) { + $libravatar_enabled = 1; + } +} + my $reviews = getallreviews(1,$offset,$results_per_page); my $marcflavour = C4::Context->preference("marcflavour"); my $hits = numberofreviews(); @@ -92,6 +103,10 @@ for my $result (@$reviews){ $result->{timestamp} = $bib->{'timestamp'}; $result->{firstname} = $borr->{'firstname'}; $result->{surname} = $borr->{'surname'}; + if ($libravatar_enabled and $borr->{'email'}) { + $result->{avatarurl} = libravatar_url(email => $borr->{'email'}, size => 40, https => $ENV{HTTPS}); + } + if ($result->{borrowernumber} eq $borrowernumber) { $result->{your_comment} = 1; }