Add the equipment list back into +all for now.
[pr0n] / perl / Sesse / pr0n / Index.pm
1 package Sesse::pr0n::Index;
2 use strict;
3 use warnings;
4
5 use Sesse::pr0n::Common qw(error dberror);
6 use Apache2::Request;
7 use POSIX;
8
9 sub handler {
10         my $r = shift;
11         my $apr = Apache2::Request->new($r);
12         my $dbh = Sesse::pr0n::Common::get_dbh();
13
14         my ($event, $abspath, $datesort);
15         if ($r->uri =~ /^\/\+all\/?/) {
16                 $event = '+all';
17                 $abspath = 1;
18
19                 # augh, this needs 8.3, so we'll have to fiddle around a bit instead
20                 # $datesort = 'DESC NULLS LAST';
21                 $datesort = 'DESC';
22         } else {
23                 # Find the event
24                 $r->uri =~ /^\/([a-zA-Z0-9-]+)\/?$/
25                         or error($r, "Could not extract event");
26                 $event = $1;
27                 $abspath = 0;
28                 $datesort = 'ASC';
29         }
30
31         # Fix common error: pr0n.sesse.net/event -> pr0n.sesse.net/event/
32         if ($r->uri !~ m#/$#) {
33                 $r->headers_out->{'location'} = "/$event/";
34                 return Apache2::Const::REDIRECT;
35         }
36
37         # Internal? (Ugly?) 
38         if ($r->get_server_name =~ /internal/ || $r->get_server_name =~ /skoyen\.bilder\.knatten\.com/ || $r->get_server_name =~ /lia\.heimdal\.org/) {
39                 my $user = Sesse::pr0n::Common::check_access($r);
40                 if (!defined($user)) {
41                         return Apache2::Const::OK;
42                 }
43         }
44
45         # Read the appropriate settings from the query string into the settings hash
46         my %defsettings = (
47                 thumbxres => 80,
48                 thumbyres => 64,
49                 xres => -1,
50                 yres => -1,
51                 start => 1,
52                 num => 100,
53                 all => 1,
54                 infobox => 1,
55                 rot => 0,
56                 sel => 0,
57                 fullscreen => 0,
58         );
59         
60         # Construct SQL for this filter
61         my $where;
62         if ($event eq '+all') {
63                 $where = '';
64         } else {
65                 $where = ' AND event=' . $dbh->quote($event);
66         }
67         
68         # Any NEF files => default to processing
69         my $ref = $dbh->selectrow_hashref("SELECT * FROM images WHERE vhost=? $where AND LOWER(filename) LIKE '%.nef' LIMIT 1",
70                 undef, $r->get_server_name)
71                 and $defsettings{'xres'} = $defsettings{'yres'} = undef;
72         
73         # Reduce the front page load when in overload mode.
74         if (Sesse::pr0n::Overload::is_in_overload($r)) {
75                 $defsettings{'num'} = 100;
76         }
77                 
78         my %settings = %defsettings;
79
80         for my $s qw(thumbxres thumbyres xres yres start num all infobox rot sel fullscreen) {
81                 my $val = $apr->param($s);
82                 if (defined($val) && $val =~ /^(\d+)$/) {
83                         $settings{$s} = $val;
84                 }
85                 if (($s eq "num" || $s eq "xres" || $s eq "yres") && defined($val) && $val == -1) {
86                         $settings{$s} = $val;
87                 }
88         }
89
90         my $thumbxres = $settings{'thumbxres'};
91         my $thumbyres = $settings{'thumbyres'};
92         my $xres = $settings{'xres'};
93         my $yres = $settings{'yres'};
94         my $start = $settings{'start'};
95         my $num = $settings{'num'};
96         my $all = $settings{'all'};
97         my $infobox = $settings{'infobox'} ? '' : 'nobox/';
98         my $rot = $settings{'rot'};
99         my $sel = $settings{'sel'};
100         
101         if ($all == 0) {
102                 $where .= ' AND selected=\'t\'';        
103         }
104
105         if (defined($num) && $num == -1) {
106                 $num = undef;
107         }
108
109         my ($date, $name);
110
111         if ($event eq '+all') {
112                 $ref = $dbh->selectrow_hashref("SELECT EXTRACT(EPOCH FROM MAX(last_update)) AS last_update FROM events WHERE vhost=?",
113                         undef, $r->get_server_name)
114                         or error($r, "Could not list events", 404, "File not found");
115                 $date = undef;
116                 $name = Sesse::pr0n::Templates::fetch_template($r, 'all-event-title');
117                 $r->set_last_modified($ref->{'last_update'});
118         } else {
119                 $ref = $dbh->selectrow_hashref("SELECT name,date,EXTRACT(EPOCH FROM last_update) AS last_update FROM events WHERE vhost=? $where",
120                         undef, $r->get_server_name)
121                         or error($r, "Could not find event $event", 404, "File not found");
122
123                 $date = HTML::Entities::encode_entities(Encode::decode_utf8($ref->{'date'}));
124                 $name = HTML::Entities::encode_entities(Encode::decode_utf8($ref->{'name'}));
125                 $r->set_last_modified($ref->{'last_update'});
126         }
127                                 
128         # If the client can use cache, do so
129         if ((my $rc = $r->meets_conditions) != Apache2::Const::OK) {
130                 return $rc;
131         }
132         
133         # Count the number of selected images.
134         $ref = $dbh->selectrow_hashref("SELECT COUNT(*) AS num_selected FROM images WHERE vhost=? $where AND selected=\'t\'", undef, $r->get_server_name);
135         my $num_selected = $ref->{'num_selected'};
136
137         # Find all images related to this event.
138         my $limit = (defined($start) && defined($num) && !$settings{'fullscreen'}) ? (" LIMIT $num OFFSET " . ($start-1)) : "";
139
140         my $q = $dbh->prepare("SELECT *, (date - INTERVAL '6 hours')::date AS day FROM images WHERE vhost=? $where ORDER BY COALESCE((date - INTERVAL '6 hours')::date, '1970-01-01') $datesort,takenby,date,filename $limit")
141                 or dberror($r, "prepare()");
142         $q->execute($r->get_server_name)
143                 or dberror($r, "image enumeration");
144
145         # Print the page itself
146         if ($settings{'fullscreen'}) {
147                 $r->content_type("text/html; charset=utf-8");
148                 Sesse::pr0n::Templates::print_template($r, "fullscreen-header", { title => "$name [$event]" });
149                 while (my $ref = $q->fetchrow_hashref()) {
150                         $r->print("        [ \"" . $ref->{'event'} . "\", \"" . $ref->{'filename'} . "\" ],\n");
151                 }
152
153                 my %settings_no_fullscreen = %settings;
154                 $settings_no_fullscreen{'fullscreen'} = 0;
155
156                 my $returnurl = "http://" . $r->get_server_name . "/" . $event . "/" .
157                         Sesse::pr0n::Common::get_query_string(\%settings_no_fullscreen, \%defsettings);
158
159                 # *whistle*
160                 $returnurl =~ s/&/&/g;
161
162                 Sesse::pr0n::Templates::print_template($r, "fullscreen-footer", {
163                         vhost => $r->get_server_name,
164                         start => $settings{'start'} - 1,
165                         returnurl => $returnurl,
166                         sel => $settings{'sel'},
167                         infobox => $infobox
168                 });
169         } else {
170                 Sesse::pr0n::Common::header($r, "$name [$event]");
171                 if (defined($date)) {
172                         Sesse::pr0n::Templates::print_template($r, "date", { date => $date });
173                 }
174
175                 if (Sesse::pr0n::Overload::is_in_overload($r)) {
176                         Sesse::pr0n::Templates::print_template($r, "overloadmode");
177                 }
178
179                 print_thumbsize($r, $event, \%settings, \%defsettings);
180                 print_viewres($r, $event, \%settings, \%defsettings);
181                 print_pagelimit($r, $event, \%settings, \%defsettings);
182                 print_infobox($r, $event, \%settings, \%defsettings);
183                 print_selected($r, $event, \%settings, \%defsettings) if ($num_selected > 0);
184                 print_fullscreen($r, $event, \%settings, \%defsettings);
185                 print_nextprev($r, $event, $where, \%settings, \%defsettings);
186         
187                 if (1 || $event ne '+all') {
188                         # Find the equipment used
189                         my $eq = $dbh->prepare("
190                                 SELECT 
191                                         TRIM(model.value) AS model,
192                                         coalesce(TRIM(lens_spec.value), TRIM(lens.value)) AS lens,
193                                         COUNT(*) AS num
194                                 FROM ( SELECT * FROM images WHERE vhost=? $where ) i
195                                         LEFT JOIN exif_info model ON i.id=model.image
196                                         LEFT JOIN ( SELECT * FROM exif_info WHERE tag='Lens' ) lens ON i.id=lens.image
197                                         LEFT JOIN ( SELECT * FROM exif_info WHERE tag='LensSpec') lens_spec ON i.id=lens_spec.image
198                                 WHERE model.tag='Model'
199                                 GROUP BY 1,2
200                                 ORDER BY 1,2")
201                                 or die "Couldn't prepare to find equipment: $!";
202                         $eq->execute($r->get_server_name)
203                                 or die "Couldn't find equipment: $!";
204
205                         my @equipment = ();
206                         my %cameras_seen = ();
207                         while (my $ref = $eq->fetchrow_hashref) {
208                                 if (!defined($ref->{'lens'}) && exists($cameras_seen{$ref->{'model'}})) {
209                                         #
210                                         # Some compact cameras seem to add lens info sometimes and not at other
211                                         # times; if we have seen a camera with at least one specific lens earlier,
212                                         # just combine entries without a lens with the previous one.
213                                         #
214                                         $equipment[$#equipment]->{'num'} += $ref->{'num'};
215                                         next;
216                                 }
217                                 push @equipment, $ref;
218                                 $cameras_seen{$ref->{'model'}} = 1;
219                         }
220                         $eq->finish;
221
222                         if (scalar @equipment > 0) {
223                                 Sesse::pr0n::Templates::print_template($r, "equipment-start");
224                                 for my $e (@equipment) {
225                                         my $eqspec = $e->{'model'};
226                                         $eqspec .= ', ' . $e->{'lens'} if (defined($e->{'lens'}));
227
228                                         # This isn't correct for all languages. Fix if we ever need to care. :-)
229                                         if ($e->{'num'} == 1) {
230                                                 Sesse::pr0n::Templates::print_template($r, "equipment-item-singular", { eqspec => $eqspec });
231                                         } else {
232                                                 Sesse::pr0n::Templates::print_template($r, "equipment-item", { eqspec => $eqspec, num => $e->{'num'} });
233                                         }
234                                 }
235                                 Sesse::pr0n::Templates::print_template($r, "equipment-end");
236                         }
237                 }
238
239                 my $toclose = 0;
240                 my $lastupl = "";
241                 my $img_num = (defined($start) && defined($num)) ? $start : 1;
242                 
243                 # Print out all thumbnails
244                 if ($rot == 1) {
245                         $r->print("    <form method=\"post\" action=\"/rotate\">\n");
246                         $r->print("      <input type=\"hidden\" name=\"event\" value=\"$event\" />\n");
247         
248                         while (my $ref = $q->fetchrow_hashref()) {
249                                 my $imgsz = "";
250                                 my $takenby = $ref->{'takenby'};
251                                 if (defined($ref->{'day'})) {
252                                          $takenby .= ", " . $ref->{'day'};
253                                 }
254
255                                 if ($takenby ne $lastupl) {
256                                         $lastupl = $takenby;
257                                         $r->print("    <h2>");
258                                         Sesse::pr0n::Templates::print_template($r, "submittedby", { author => $lastupl });
259                                         print_fullscreen_fromhere($r, $event, \%settings, \%defsettings, $img_num);
260                                         $r->print("</h2>\n");
261                                 }
262                                 if ($ref->{'width'} != -1 && $ref->{'height'} != -1) {
263                                         my $width = $ref->{'width'};
264                                         my $height = $ref->{'height'};
265                                                 
266                                         ($width, $height) = Sesse::pr0n::Common::scale_aspect($width, $height, $thumbxres, $thumbyres);
267                                         $imgsz = " width=\"$width\" height=\"$height\"";
268                                 }
269
270                                 my $filename = $ref->{'filename'};
271                                 my $uri = $infobox . $filename;
272                                 if (defined($xres) && defined($yres) && $xres != -1) {
273                                         $uri = "${xres}x$yres/$infobox$filename";
274                                 } elsif (defined($xres) && $xres == -1) {
275                                         $uri = "original/$infobox$filename";
276                                 }
277
278                                 my $prefix = "";
279                                 if ($abspath) {
280                                         $prefix = "/" . $ref->{'event'} . "/";
281                                 }
282
283                                 $r->print("    <p><a href=\"$prefix$uri\"><img src=\"$prefix${thumbxres}x${thumbyres}/$filename\" alt=\"\"$imgsz /></a>\n");
284                                 $r->print("      90 <input type=\"checkbox\" name=\"rot-" .
285                                         $ref->{'id'} . "-90\" />\n");
286                                 $r->print("      180 <input type=\"checkbox\" name=\"rot-" .
287                                         $ref->{'id'} . "-180\" />\n");
288                                 $r->print("      270 <input type=\"checkbox\" name=\"rot-" .
289                                         $ref->{'id'} . "-270\" />\n");
290                                 $r->print("      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" .
291                                         "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Del <input type=\"checkbox\" name=\"del-" . $ref->{'id'} . "\" /></p>\n");
292                         
293                                 ++$img_num;
294                         }
295                         $r->print("      <input type=\"submit\" value=\"Rotate\" />\n");
296                         $r->print("    </form>\n");
297                 } else {
298                         while (my $ref = $q->fetchrow_hashref()) {
299                                 my $imgsz = "";
300                                 my $takenby = $ref->{'takenby'};
301                                 if (defined($ref->{'day'})) {
302                                          $takenby .= ", " . $ref->{'day'};
303                                 }
304
305                                 if ($takenby ne $lastupl) {
306                                         $r->print("    </p>\n\n") if ($lastupl ne "");
307                                         $lastupl = $takenby;
308                                         $r->print("    <h2>");
309                                         Sesse::pr0n::Templates::print_template($r, "submittedby", { author => $lastupl });
310                                         print_fullscreen_fromhere($r, $event, \%settings, \%defsettings, $img_num);
311                                         $r->print("</h2>\n");
312                                         $r->print("    <p class=\"photos\">\n");
313                                 }
314                                 if ($ref->{'width'} != -1 && $ref->{'height'} != -1) {
315                                         my $width = $ref->{'width'};
316                                         my $height = $ref->{'height'};
317                                                 
318                                         ($width, $height) = Sesse::pr0n::Common::scale_aspect($width, $height, $thumbxres, $thumbyres);
319                                         $imgsz = " width=\"$width\" height=\"$height\"";
320                                 }
321
322                                 my $filename = $ref->{'filename'};
323                                 my $uri = $infobox . $filename;
324                                 if (defined($xres) && defined($yres) && $xres != -1) {
325                                         $uri = "${xres}x$yres/$infobox$filename";
326                                 } elsif (defined($xres) && $xres == -1) {
327                                         $uri = "original/$infobox$filename";
328                                 }
329                                 
330                                 my $prefix = "";
331                                 if ($abspath) {
332                                         $prefix = "/" . $ref->{'event'} . "/";
333                                 }
334                                 
335                                 $r->print("      <a href=\"$prefix$uri\"><img src=\"$prefix${thumbxres}x${thumbyres}/$filename\" alt=\"\"$imgsz /></a>\n");
336                                 
337                                 ++$img_num;
338                         }
339                         $r->print("    </p>\n");
340                 }
341
342                 print_nextprev($r, $event, $where, \%settings, \%defsettings);
343                 Sesse::pr0n::Common::footer($r);
344         }
345
346         return Apache2::Const::OK;
347 }
348
349 sub eq_with_undef {
350         my ($a, $b) = @_;
351         
352         return 1 if (!defined($a) && !defined($b));
353         return 0 unless (defined($a) && defined($b));
354         return ($a eq $b);
355 }
356
357 sub print_changes {
358         my ($r, $event, $template, $settings, $defsettings, $var1, $var2, $alternatives) = @_;
359
360         my $title = Sesse::pr0n::Templates::fetch_template($r, $template);
361         chomp $title;
362         $r->print("    <p>$title:\n");
363
364         for my $a (@$alternatives) {
365                 my $text;
366                 my %newsettings = %$settings;
367
368                 if (ref $a) {
369                         my ($v1, $v2);
370                         ($text, $v1, $v2) = @$a;
371                         
372                         $newsettings{$var1} = $v1;
373                         $newsettings{$var2} = $v2;
374                 } else {
375                         $text = $a;
376
377                         # Parse the current alternative
378                         my ($v1, $v2) = split /x/, $a;
379
380                         $newsettings{$var1} = $v1;
381                         $newsettings{$var2} = $v2;
382                 }
383
384                 $r->print("      ");
385
386                 # Check if these settings are current (print only label)
387                 if (eq_with_undef($settings->{$var1}, $newsettings{$var1}) &&
388                     eq_with_undef($settings->{$var2}, $newsettings{$var2})) {
389                         $r->print($text);
390                 } else {
391                         Sesse::pr0n::Common::print_link($r, $text, "/$event/", \%newsettings, $defsettings);
392                 }
393                 $r->print("\n");
394         }
395         $r->print("    </p>\n");
396 }
397
398 sub print_thumbsize {
399         my ($r, $event, $settings, $defsettings) = @_;
400         my @alternatives = qw(80x64 120x96 160x128 240x192 320x256);
401
402         print_changes($r, $event, 'thumbsize', $settings, $defsettings,
403                       'thumbxres', 'thumbyres', \@alternatives);
404 }
405 sub print_viewres {
406         my ($r, $event, $settings, $defsettings) = @_;
407         my @alternatives = qw(320x256 512x384 640x480 800x600 1024x768 1280x960);
408         chomp (my $unlimited = Sesse::pr0n::Templates::fetch_template($r, 'viewres-unlimited'));
409         chomp (my $original = Sesse::pr0n::Templates::fetch_template($r, 'viewres-original'));
410         push @alternatives, [ $unlimited, undef, undef ];
411         push @alternatives, [ $original, -1, -1 ];
412
413         print_changes($r, $event, 'viewres', $settings, $defsettings,
414                       'xres', 'yres', \@alternatives);
415 }
416
417 sub print_pagelimit {
418         my ($r, $event, $settings, $defsettings) = @_;
419         
420         my $title = Sesse::pr0n::Templates::fetch_template($r, 'imgsperpage');
421         chomp $title;
422         $r->print("    <p>$title:\n");
423         
424         # Get choices
425         chomp (my $unlimited = Sesse::pr0n::Templates::fetch_template($r, 'imgsperpage-unlimited'));
426         my @alternatives = qw(10 50 100 500);
427         push @alternatives, $unlimited;
428         
429         for my $num (@alternatives) {
430                 my %newsettings = %$settings;
431
432                 if ($num !~ /^\d+$/) { # unlimited
433                         $newsettings{'num'} = -1;
434                 } else {
435                         $newsettings{'num'} = $num;
436                 }
437
438                 $r->print("      ");
439                 if (eq_with_undef($settings->{'num'}, $newsettings{'num'})) {
440                         $r->print($num);
441                 } else {
442                         Sesse::pr0n::Common::print_link($r, $num, "/$event/", \%newsettings, $defsettings);
443                 }
444                 $r->print("\n");
445         }
446         $r->print("    </p>\n");
447 }
448
449 sub print_infobox {
450         my ($r, $event, $settings, $defsettings) = @_;
451
452         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'infobox'));
453         chomp (my $on = Sesse::pr0n::Templates::fetch_template($r, 'infobox-on'));
454         chomp (my $off = Sesse::pr0n::Templates::fetch_template($r, 'infobox-off'));
455
456         $r->print("    <p>$title:\n");
457
458         my %newsettings = %$settings;
459
460         if ($settings->{'infobox'} == 1) {
461                 $r->print($on);
462         } else {
463                 $newsettings{'infobox'} = 1;
464                 Sesse::pr0n::Common::print_link($r, $on, "/$event/", \%newsettings, $defsettings);
465         }
466
467         $r->print(' ');
468
469         if ($settings->{'infobox'} == 0) {
470                 $r->print($off);
471         } else {
472                 $newsettings{'infobox'} = 0;
473                 Sesse::pr0n::Common::print_link($r, $off, "/$event/", \%newsettings, $defsettings);
474         }
475         
476         $r->print('</p>');
477 }
478
479 sub print_nextprev {
480         my ($r, $event, $where, $settings, $defsettings) = @_;
481         my $start = $settings->{'start'};
482         my $num = $settings->{'num'};
483         my $dbh = Sesse::pr0n::Common::get_dbh();
484
485         $num = undef if (defined($num) && $num == -1);
486         return unless (defined($start) && defined($num));
487
488         # determine total number
489         my $ref = $dbh->selectrow_hashref("SELECT count(*) AS num_images FROM images WHERE vhost=? $where",
490                 undef, $r->get_server_name)
491                 or dberror($r, "image enumeration");
492         my $num_images = $ref->{'num_images'};
493
494         return if ($start == 1 && $start + $num >= $num_images);
495
496         my $end = $start + $num - 1;
497         if ($end > $num_images) {
498                 $end = $num_images;
499         }
500
501         $r->print("    <p class=\"nextprev\">\n");
502
503         # Previous
504         if ($start > 1) {
505                 my $newstart = $start - $num;
506                 if ($newstart < 1) {
507                         $newstart = 1;
508                 }
509                 my $newend = $newstart + $num - 1;
510                 if ($newend > $num_images) {
511                         $newend = $num_images;
512                 }
513
514                 my %newsettings = %$settings;
515                 $newsettings{'start'} = $newstart;
516                 chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'prevpage'));
517                 chomp (my $accesskey = Sesse::pr0n::Templates::fetch_template($r, 'prevaccesskey'));
518                 Sesse::pr0n::Common::print_link($r, "$title ($newstart-$newend)\n", "/$event/", \%newsettings, $defsettings, $accesskey);
519         }
520
521         # This
522         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'thispage'));
523         $r->print("    $title ($start-$end)\n");
524
525         # Next
526         if ($end < $num_images) {
527                 my $newstart = $start + $num;
528                 my $newend = $newstart + $num - 1;
529                 if ($newend > $num_images) {
530                         $newend = $num_images;
531                 }
532                 
533                 my %newsettings = %$settings;
534                 $newsettings{'start'} = $newstart;
535                 chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'nextpage'));
536                 chomp (my $accesskey = Sesse::pr0n::Templates::fetch_template($r, 'nextaccesskey'));
537                 Sesse::pr0n::Common::print_link($r, "$title ($newstart-$newend)", "/$event/", \%newsettings, $defsettings, $accesskey);
538         }
539
540         $r->print("    </p>\n");
541 }
542
543 sub print_selected {
544         my ($r, $event, $settings, $defsettings) = @_;
545
546         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'show'));
547         chomp (my $all = Sesse::pr0n::Templates::fetch_template($r, 'show-all'));
548         chomp (my $sel = Sesse::pr0n::Templates::fetch_template($r, 'show-selected'));
549
550         $r->print("    <p>$title:\n");
551
552         my %newsettings = %$settings;
553
554         if ($settings->{'all'} == 0) {
555                 $r->print($sel);
556         } else {
557                 $newsettings{'all'} = 0;
558                 Sesse::pr0n::Common::print_link($r, $sel, "/$event/", \%newsettings, $defsettings);
559         }
560
561         $r->print(' ');
562
563         if ($settings->{'all'} == 1) {
564                 $r->print($all);
565         } else {
566                 $newsettings{'all'} = 1;
567                 Sesse::pr0n::Common::print_link($r, $all, "/$event/", \%newsettings, $defsettings);
568         }
569         
570         $r->print('</p>');
571 }
572
573 sub print_fullscreen {
574         my ($r, $event, $settings, $defsettings) = @_;
575
576         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'fullscreen'));
577
578         my %newsettings = %$settings;
579         $newsettings{'fullscreen'} = 1;
580
581         $r->print("    <p>");
582         Sesse::pr0n::Common::print_link($r, $title, "/$event/", \%newsettings, $defsettings);
583         $r->print("</p>\n");
584 }
585
586 sub print_fullscreen_fromhere {
587         my ($r, $event, $settings, $defsettings, $start) = @_;
588
589         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'fullscreen-fromhere'));
590
591         my %newsettings = %$settings;
592         $newsettings{'fullscreen'} = 1;
593         $newsettings{'start'} = $start;
594
595         $r->print("    <p class=\"fsfromhere\">");
596         Sesse::pr0n::Common::print_link($r, $title, "/$event/", \%newsettings, $defsettings);
597         $r->print("</p>\n");
598 }
599         
600 1;
601
602