a5407d1efef8aa7ca9c094465c91ad3c934b692c
[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                                         my %newsettings = %defsettings;
229                                         $newsettings{'model'} = $e->{'model'};
230                                         $newsettings{'lens'} = defined($e->{'lens'}) ? $e->{'lens'} : '';
231                                         my $url = "/$event/" . Sesse::pr0n::Common::get_query_string(\%newsettings, \%defsettings);
232
233                                         # This isn't correct for all languages. Fix if we ever need to care. :-)
234                                         if ($e->{'num'} == 1) {
235                                                 Sesse::pr0n::Templates::print_template($r, "equipment-item-singular", { eqspec => $eqspec, filterurl => $url });
236                                         } else {
237                                                 Sesse::pr0n::Templates::print_template($r, "equipment-item", { eqspec => $eqspec, num => $e->{'num'}, filterurl => $url });
238                                         }
239                                 }
240                                 Sesse::pr0n::Templates::print_template($r, "equipment-end");
241                         }
242                 }
243
244                 my $toclose = 0;
245                 my $lastupl = "";
246                 my $img_num = (defined($start) && defined($num)) ? $start : 1;
247                 
248                 # Print out all thumbnails
249                 if ($rot == 1) {
250                         $r->print("    <form method=\"post\" action=\"/rotate\">\n");
251                         $r->print("      <input type=\"hidden\" name=\"event\" value=\"$event\" />\n");
252         
253                         while (my $ref = $q->fetchrow_hashref()) {
254                                 my $imgsz = "";
255                                 my $takenby = $ref->{'takenby'};
256                                 if (defined($ref->{'day'})) {
257                                          $takenby .= ", " . $ref->{'day'};
258                                 }
259
260                                 if ($takenby ne $lastupl) {
261                                         $lastupl = $takenby;
262                                         $r->print("    <h2>");
263                                         Sesse::pr0n::Templates::print_template($r, "submittedby", { author => $lastupl });
264                                         print_fullscreen_fromhere($r, $event, \%settings, \%defsettings, $img_num);
265                                         $r->print("</h2>\n");
266                                 }
267                                 if ($ref->{'width'} != -1 && $ref->{'height'} != -1) {
268                                         my $width = $ref->{'width'};
269                                         my $height = $ref->{'height'};
270                                                 
271                                         ($width, $height) = Sesse::pr0n::Common::scale_aspect($width, $height, $thumbxres, $thumbyres);
272                                         $imgsz = " width=\"$width\" height=\"$height\"";
273                                 }
274
275                                 my $filename = $ref->{'filename'};
276                                 my $uri = $infobox . $filename;
277                                 if (defined($xres) && defined($yres) && $xres != -1) {
278                                         $uri = "${xres}x$yres/$infobox$filename";
279                                 } elsif (defined($xres) && $xres == -1) {
280                                         $uri = "original/$infobox$filename";
281                                 }
282
283                                 my $prefix = "";
284                                 if ($abspath) {
285                                         $prefix = "/" . $ref->{'event'} . "/";
286                                 }
287
288                                 $r->print("    <p><a href=\"$prefix$uri\"><img src=\"$prefix${thumbxres}x${thumbyres}/$filename\" alt=\"\"$imgsz /></a>\n");
289                                 $r->print("      90 <input type=\"checkbox\" name=\"rot-" .
290                                         $ref->{'id'} . "-90\" />\n");
291                                 $r->print("      180 <input type=\"checkbox\" name=\"rot-" .
292                                         $ref->{'id'} . "-180\" />\n");
293                                 $r->print("      270 <input type=\"checkbox\" name=\"rot-" .
294                                         $ref->{'id'} . "-270\" />\n");
295                                 $r->print("      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" .
296                                         "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Del <input type=\"checkbox\" name=\"del-" . $ref->{'id'} . "\" /></p>\n");
297                         
298                                 ++$img_num;
299                         }
300                         $r->print("      <input type=\"submit\" value=\"Rotate\" />\n");
301                         $r->print("    </form>\n");
302                 } else {
303                         while (my $ref = $q->fetchrow_hashref()) {
304                                 my $imgsz = "";
305                                 my $takenby = $ref->{'takenby'};
306                                 if (defined($ref->{'day'})) {
307                                          $takenby .= ", " . $ref->{'day'};
308                                 }
309
310                                 if ($takenby ne $lastupl) {
311                                         $r->print("    </p>\n\n") if ($lastupl ne "");
312                                         $lastupl = $takenby;
313                                         $r->print("    <h2>");
314                                         Sesse::pr0n::Templates::print_template($r, "submittedby", { author => $lastupl });
315                                         print_fullscreen_fromhere($r, $event, \%settings, \%defsettings, $img_num);
316                                         $r->print("</h2>\n");
317                                         $r->print("    <p class=\"photos\">\n");
318                                 }
319                                 if ($ref->{'width'} != -1 && $ref->{'height'} != -1) {
320                                         my $width = $ref->{'width'};
321                                         my $height = $ref->{'height'};
322                                                 
323                                         ($width, $height) = Sesse::pr0n::Common::scale_aspect($width, $height, $thumbxres, $thumbyres);
324                                         $imgsz = " width=\"$width\" height=\"$height\"";
325                                 }
326
327                                 my $filename = $ref->{'filename'};
328                                 my $uri = $infobox . $filename;
329                                 if (defined($xres) && defined($yres) && $xres != -1) {
330                                         $uri = "${xres}x$yres/$infobox$filename";
331                                 } elsif (defined($xres) && $xres == -1) {
332                                         $uri = "original/$infobox$filename";
333                                 }
334                                 
335                                 my $prefix = "";
336                                 if ($abspath) {
337                                         $prefix = "/" . $ref->{'event'} . "/";
338                                 }
339                                 
340                                 $r->print("      <a href=\"$prefix$uri\"><img src=\"$prefix${thumbxres}x${thumbyres}/$filename\" alt=\"\"$imgsz /></a>\n");
341                                 
342                                 ++$img_num;
343                         }
344                         $r->print("    </p>\n");
345                 }
346
347                 print_nextprev($r, $event, $where, \%settings, \%defsettings);
348                 Sesse::pr0n::Common::footer($r);
349         }
350
351         return Apache2::Const::OK;
352 }
353
354 sub eq_with_undef {
355         my ($a, $b) = @_;
356         
357         return 1 if (!defined($a) && !defined($b));
358         return 0 unless (defined($a) && defined($b));
359         return ($a eq $b);
360 }
361
362 sub print_changes {
363         my ($r, $event, $template, $settings, $defsettings, $var1, $var2, $alternatives) = @_;
364
365         my $title = Sesse::pr0n::Templates::fetch_template($r, $template);
366         chomp $title;
367         $r->print("    <p>$title:\n");
368
369         for my $a (@$alternatives) {
370                 my $text;
371                 my %newsettings = %$settings;
372
373                 if (ref $a) {
374                         my ($v1, $v2);
375                         ($text, $v1, $v2) = @$a;
376                         
377                         $newsettings{$var1} = $v1;
378                         $newsettings{$var2} = $v2;
379                 } else {
380                         $text = $a;
381
382                         # Parse the current alternative
383                         my ($v1, $v2) = split /x/, $a;
384
385                         $newsettings{$var1} = $v1;
386                         $newsettings{$var2} = $v2;
387                 }
388
389                 $r->print("      ");
390
391                 # Check if these settings are current (print only label)
392                 if (eq_with_undef($settings->{$var1}, $newsettings{$var1}) &&
393                     eq_with_undef($settings->{$var2}, $newsettings{$var2})) {
394                         $r->print($text);
395                 } else {
396                         Sesse::pr0n::Common::print_link($r, $text, "/$event/", \%newsettings, $defsettings);
397                 }
398                 $r->print("\n");
399         }
400         $r->print("    </p>\n");
401 }
402
403 sub print_thumbsize {
404         my ($r, $event, $settings, $defsettings) = @_;
405         my @alternatives = qw(80x64 120x96 160x128 240x192 320x256);
406
407         print_changes($r, $event, 'thumbsize', $settings, $defsettings,
408                       'thumbxres', 'thumbyres', \@alternatives);
409 }
410 sub print_viewres {
411         my ($r, $event, $settings, $defsettings) = @_;
412         my @alternatives = qw(320x256 512x384 640x480 800x600 1024x768 1280x960);
413         chomp (my $unlimited = Sesse::pr0n::Templates::fetch_template($r, 'viewres-unlimited'));
414         chomp (my $original = Sesse::pr0n::Templates::fetch_template($r, 'viewres-original'));
415         push @alternatives, [ $unlimited, undef, undef ];
416         push @alternatives, [ $original, -1, -1 ];
417
418         print_changes($r, $event, 'viewres', $settings, $defsettings,
419                       'xres', 'yres', \@alternatives);
420 }
421
422 sub print_pagelimit {
423         my ($r, $event, $settings, $defsettings) = @_;
424         
425         my $title = Sesse::pr0n::Templates::fetch_template($r, 'imgsperpage');
426         chomp $title;
427         $r->print("    <p>$title:\n");
428         
429         # Get choices
430         chomp (my $unlimited = Sesse::pr0n::Templates::fetch_template($r, 'imgsperpage-unlimited'));
431         my @alternatives = qw(10 50 100 500);
432         push @alternatives, $unlimited;
433         
434         for my $num (@alternatives) {
435                 my %newsettings = %$settings;
436
437                 if ($num !~ /^\d+$/) { # unlimited
438                         $newsettings{'num'} = -1;
439                 } else {
440                         $newsettings{'num'} = $num;
441                 }
442
443                 $r->print("      ");
444                 if (eq_with_undef($settings->{'num'}, $newsettings{'num'})) {
445                         $r->print($num);
446                 } else {
447                         Sesse::pr0n::Common::print_link($r, $num, "/$event/", \%newsettings, $defsettings);
448                 }
449                 $r->print("\n");
450         }
451         $r->print("    </p>\n");
452 }
453
454 sub print_infobox {
455         my ($r, $event, $settings, $defsettings) = @_;
456
457         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'infobox'));
458         chomp (my $on = Sesse::pr0n::Templates::fetch_template($r, 'infobox-on'));
459         chomp (my $off = Sesse::pr0n::Templates::fetch_template($r, 'infobox-off'));
460
461         $r->print("    <p>$title:\n");
462
463         my %newsettings = %$settings;
464
465         if ($settings->{'infobox'} == 1) {
466                 $r->print($on);
467         } else {
468                 $newsettings{'infobox'} = 1;
469                 Sesse::pr0n::Common::print_link($r, $on, "/$event/", \%newsettings, $defsettings);
470         }
471
472         $r->print(' ');
473
474         if ($settings->{'infobox'} == 0) {
475                 $r->print($off);
476         } else {
477                 $newsettings{'infobox'} = 0;
478                 Sesse::pr0n::Common::print_link($r, $off, "/$event/", \%newsettings, $defsettings);
479         }
480         
481         $r->print('</p>');
482 }
483
484 sub print_nextprev {
485         my ($r, $event, $where, $settings, $defsettings) = @_;
486         my $start = $settings->{'start'};
487         my $num = $settings->{'num'};
488         my $dbh = Sesse::pr0n::Common::get_dbh();
489
490         $num = undef if (defined($num) && $num == -1);
491         return unless (defined($start) && defined($num));
492
493         # determine total number
494         my $ref = $dbh->selectrow_hashref("SELECT count(*) AS num_images FROM images WHERE vhost=? $where",
495                 undef, $r->get_server_name)
496                 or dberror($r, "image enumeration");
497         my $num_images = $ref->{'num_images'};
498
499         return if ($start == 1 && $start + $num >= $num_images);
500
501         my $end = $start + $num - 1;
502         if ($end > $num_images) {
503                 $end = $num_images;
504         }
505
506         $r->print("    <p class=\"nextprev\">\n");
507
508         # Previous
509         if ($start > 1) {
510                 my $newstart = $start - $num;
511                 if ($newstart < 1) {
512                         $newstart = 1;
513                 }
514                 my $newend = $newstart + $num - 1;
515                 if ($newend > $num_images) {
516                         $newend = $num_images;
517                 }
518
519                 my %newsettings = %$settings;
520                 $newsettings{'start'} = $newstart;
521                 chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'prevpage'));
522                 chomp (my $accesskey = Sesse::pr0n::Templates::fetch_template($r, 'prevaccesskey'));
523                 Sesse::pr0n::Common::print_link($r, "$title ($newstart-$newend)\n", "/$event/", \%newsettings, $defsettings, $accesskey);
524         }
525
526         # This
527         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'thispage'));
528         $r->print("    $title ($start-$end)\n");
529
530         # Next
531         if ($end < $num_images) {
532                 my $newstart = $start + $num;
533                 my $newend = $newstart + $num - 1;
534                 if ($newend > $num_images) {
535                         $newend = $num_images;
536                 }
537                 
538                 my %newsettings = %$settings;
539                 $newsettings{'start'} = $newstart;
540                 chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'nextpage'));
541                 chomp (my $accesskey = Sesse::pr0n::Templates::fetch_template($r, 'nextaccesskey'));
542                 Sesse::pr0n::Common::print_link($r, "$title ($newstart-$newend)", "/$event/", \%newsettings, $defsettings, $accesskey);
543         }
544
545         $r->print("    </p>\n");
546 }
547
548 sub print_selected {
549         my ($r, $event, $settings, $defsettings) = @_;
550
551         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'show'));
552         chomp (my $all = Sesse::pr0n::Templates::fetch_template($r, 'show-all'));
553         chomp (my $sel = Sesse::pr0n::Templates::fetch_template($r, 'show-selected'));
554
555         $r->print("    <p>$title:\n");
556
557         my %newsettings = %$settings;
558
559         if ($settings->{'all'} == 0) {
560                 $r->print($sel);
561         } else {
562                 $newsettings{'all'} = 0;
563                 Sesse::pr0n::Common::print_link($r, $sel, "/$event/", \%newsettings, $defsettings);
564         }
565
566         $r->print(' ');
567
568         if ($settings->{'all'} == 1) {
569                 $r->print($all);
570         } else {
571                 $newsettings{'all'} = 1;
572                 Sesse::pr0n::Common::print_link($r, $all, "/$event/", \%newsettings, $defsettings);
573         }
574         
575         $r->print('</p>');
576 }
577
578 sub print_fullscreen {
579         my ($r, $event, $settings, $defsettings) = @_;
580
581         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'fullscreen'));
582
583         my %newsettings = %$settings;
584         $newsettings{'fullscreen'} = 1;
585
586         $r->print("    <p>");
587         Sesse::pr0n::Common::print_link($r, $title, "/$event/", \%newsettings, $defsettings);
588         $r->print("</p>\n");
589 }
590
591 sub print_fullscreen_fromhere {
592         my ($r, $event, $settings, $defsettings, $start) = @_;
593
594         chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'fullscreen-fromhere'));
595
596         my %newsettings = %$settings;
597         $newsettings{'fullscreen'} = 1;
598         $newsettings{'start'} = $start;
599
600         $r->print("    <p class=\"fsfromhere\">");
601         Sesse::pr0n::Common::print_link($r, $title, "/$event/", \%newsettings, $defsettings);
602         $r->print("</p>\n");
603 }
604         
605 1;
606
607