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