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