Remove two header => 1 settings that were overridden by later header => 0
[ikiwiki.git] / IkiWiki / CGI.pm
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5 use IkiWiki;
6 use IkiWiki::UserInfo;
7 use open qw{:utf8 :std};
8 use Encode;
9
10 package IkiWiki;
11
12 sub printheader ($) { #{{{
13         my $session=shift;
14         
15         if ($config{sslcookie}) {
16                 print $session->header(-charset => 'utf-8',
17                         -cookie => $session->cookie(-secure => 1));
18         } else {
19                 print $session->header(-charset => 'utf-8');
20         }
21
22 } #}}}
23
24 sub redirect ($$) { #{{{
25         my $q=shift;
26         my $url=shift;
27         if (! $config{w3mmode}) {
28                 print $q->redirect($url);
29         }
30         else {
31                 print "Content-type: text/plain\n";
32                 print "W3m-control: GOTO $url\n\n";
33         }
34 } #}}}
35
36 sub check_canedit ($$$;$) { #{{{
37         my $page=shift;
38         my $q=shift;
39         my $session=shift;
40         my $nonfatal=shift;
41         
42         my $canedit;
43         run_hooks(canedit => sub {
44                 return if defined $canedit;
45                 my $ret=shift->($page, $q, $session);
46                 if (defined $ret && $ret eq "") {
47                         $canedit=1;
48                 }
49                 elsif (defined $ret) {
50                         $canedit=0;
51                         error($ret) unless $nonfatal;
52                 }
53         });
54         return $canedit;
55 } #}}}
56
57 sub decode_form_utf8 ($) { #{{{
58         my $form = shift;
59         foreach my $f ($form->field) {
60                 next if Encode::is_utf8(scalar $form->field($f));
61                 $form->field(name  => $f,
62                              value => decode_utf8($form->field($f)),
63                              force => 1,
64                             );
65         }
66 } #}}}
67
68 sub cgi_recentchanges ($) { #{{{
69         my $q=shift;
70         
71         # Optimisation: building recentchanges means calculating lots of
72         # links. Memoizing htmllink speeds it up a lot (can't be memoized
73         # during page builds as the return values may change, but they
74         # won't here.)
75         eval q{use Memoize};
76         error($@) if $@;
77         memoize("htmllink");
78
79         eval q{use Time::Duration};
80         error($@) if $@;
81
82         my $changelog=[rcs_recentchanges(100)];
83         foreach my $change (@$changelog) {
84                 $change->{when} = concise(ago($change->{when}));
85
86                 $change->{user} = userlink($change->{user});
87
88                 my $is_excess = exists $change->{pages}[10]; # limit pages to first 10
89                 delete @{$change->{pages}}[10 .. @{$change->{pages}}] if $is_excess;
90                 $change->{pages} = [
91                         map {
92                                 $_->{link} = htmllink("", "", $_->{page},
93                                         noimageinline => 1,
94                                         linktext => pagetitle($_->{page}));
95                                 $_;
96                         } @{$change->{pages}}
97                 ];
98                 push @{$change->{pages}}, { link => '...' } if $is_excess;
99         }
100
101         my $template=template("recentchanges.tmpl"); 
102         $template->param(
103                 title => "RecentChanges",
104                 indexlink => indexlink(),
105                 wikiname => $config{wikiname},
106                 changelog => $changelog,
107                 baseurl => baseurl(),
108         );
109         run_hooks(pagetemplate => sub {
110                 shift->(page => "", destpage => "", template => $template);
111         });
112         print $q->header(-charset => 'utf-8'), $template->output;
113 } #}}}
114
115 # Check if the user is signed in. If not, redirect to the signin form and
116 # save their place to return to later.
117 sub needsignin ($$) { #{{{
118         my $q=shift;
119         my $session=shift;
120
121         if (! defined $session->param("name") ||
122             ! userinfo_get($session->param("name"), "regdate")) {
123                 if (! defined $session->param("postsignin")) {
124                         $session->param(postsignin => $ENV{QUERY_STRING});
125                 }
126                 cgi_signin($q, $session);
127                 cgi_savesession($session);
128                 exit;
129         }
130 } #}}}  
131
132 sub cgi_signin ($$) { #{{{
133         my $q=shift;
134         my $session=shift;
135
136         eval q{use CGI::FormBuilder};
137         error($@) if $@;
138         my $form = CGI::FormBuilder->new(
139                 title => "signin",
140                 name => "signin",
141                 charset => "utf-8",
142                 method => 'POST',
143                 required => 'NONE',
144                 javascript => 0,
145                 params => $q,
146                 action => $config{cgiurl},
147                 header => 0,
148                 template => {type => 'div'},
149                 stylesheet => baseurl()."style.css",
150         );
151         my $buttons=["Login"];
152         
153         if ($q->param("do") ne "signin" && !$form->submitted) {
154                 $form->text(gettext("You need to log in first."));
155         }
156         $form->field(name => "do", type => "hidden", value => "signin",
157                 force => 1);
158         
159         run_hooks(formbuilder_setup => sub {
160                 shift->(form => $form, cgi => $q, session => $session);
161         });
162         
163         decode_form_utf8($form);
164
165         if (exists $hooks{formbuilder}) {
166                 run_hooks(formbuilder => sub {
167                         shift->(form => $form, cgi => $q, session => $session,
168                                 buttons => $buttons);
169                 });
170         }
171         else {
172                 if ($form->submitted) {
173                         $form->validate;
174                 }
175                 printheader($session);
176                 print misctemplate($form->title, $form->render(submit => $buttons));
177         }
178 } #}}}
179
180 sub cgi_postsignin ($$) { #{{{
181         my $q=shift;
182         my $session=shift;
183         
184         # Continue with whatever was being done before the signin process.
185         if (defined $session->param("postsignin")) {
186                 my $postsignin=CGI->new($session->param("postsignin"));
187                 $session->clear("postsignin");
188                 cgi($postsignin, $session);
189                 cgi_savesession($session);
190                 exit;
191         }
192         else {
193                 # This can occur, for example, if a user went to the signin
194                 # url via a bookmark.
195                 redirect($q, $config{url});
196         }
197 } #}}}
198
199 sub cgi_prefs ($$) { #{{{
200         my $q=shift;
201         my $session=shift;
202
203         needsignin($q, $session);
204
205         eval q{use CGI::FormBuilder};
206         error($@) if $@;
207         my $form = CGI::FormBuilder->new(
208                 title => "preferences",
209                 name => "preferences",
210                 header => 0,
211                 charset => "utf-8",
212                 method => 'POST',
213                 validate => {
214                         email => 'EMAIL',
215                 },
216                 required => 'NONE',
217                 javascript => 0,
218                 params => $q,
219                 action => $config{cgiurl},
220                 template => {type => 'div'},
221                 stylesheet => baseurl()."style.css",
222                 fieldsets => [
223                         [login => gettext("Login")],
224                         [preferences => gettext("Preferences")],
225                         [admin => gettext("Admin")]
226                 ],
227         );
228         my $buttons=["Save Preferences", "Logout", "Cancel"];
229
230         run_hooks(formbuilder_setup => sub {
231                 shift->(form => $form, cgi => $q, session => $session);
232         });
233         
234         $form->field(name => "do", type => "hidden");
235         $form->field(name => "email", size => 50, fieldset => "preferences");
236         $form->field(name => "subscriptions", size => 50,
237                 fieldset => "preferences",
238                 comment => "(".htmllink("", "", "PageSpec", noimageinline => 1).")");
239         $form->field(name => "banned_users", size => 50,
240                 fieldset => "admin");
241         
242         my $user_name=$session->param("name");
243         if (! is_admin($user_name)) {
244                 $form->field(name => "banned_users", type => "hidden");
245         }
246
247         if (! $form->submitted) {
248                 $form->field(name => "email", force => 1,
249                         value => userinfo_get($user_name, "email"));
250                 $form->field(name => "subscriptions", force => 1,
251                         value => userinfo_get($user_name, "subscriptions"));
252                 if (is_admin($user_name)) {
253                         $form->field(name => "banned_users", force => 1,
254                                 value => join(" ", get_banned_users()));
255                 }
256         }
257         
258         decode_form_utf8($form);
259         
260         if ($form->submitted eq 'Logout') {
261                 $session->delete();
262                 redirect($q, $config{url});
263                 return;
264         }
265         elsif ($form->submitted eq 'Cancel') {
266                 redirect($q, $config{url});
267                 return;
268         }
269         elsif ($form->submitted eq 'Save Preferences' && $form->validate) {
270                 foreach my $field (qw(email subscriptions)) {
271                         if (defined $form->field($field) && length $form->field($field)) {
272                                 userinfo_set($user_name, $field, $form->field($field)) ||
273                                         error("failed to set $field");
274                         }
275                 }
276                 if (is_admin($user_name)) {
277                         set_banned_users(grep { ! is_admin($_) }
278                                         split(' ',
279                                                 $form->field("banned_users"))) ||
280                                 error("failed saving changes");
281                 }
282                 $form->text(gettext("Preferences saved."));
283         }
284         
285         if (exists $hooks{formbuilder}) {
286                 run_hooks(formbuilder => sub {
287                         shift->(form => $form, cgi => $q, session => $session,
288                                 buttons => $buttons);
289                 });
290         }
291         else {
292                 printheader($session);
293                 print misctemplate($form->title, $form->render(submit => $buttons));
294         }
295 } #}}}
296
297 sub cgi_editpage ($$) { #{{{
298         my $q=shift;
299         my $session=shift;
300
301         my @fields=qw(do rcsinfo subpage from page type editcontent comments);
302         my @buttons=("Save Page", "Preview", "Cancel");
303         
304         eval q{use CGI::FormBuilder};
305         error($@) if $@;
306         my $form = CGI::FormBuilder->new(
307                 fields => \@fields,
308                 charset => "utf-8",
309                 method => 'POST',
310                 validate => {
311                         editcontent => '/.+/',
312                 },
313                 required => [qw{editcontent}],
314                 javascript => 0,
315                 params => $q,
316                 action => $config{cgiurl},
317                 header => 0,
318                 table => 0,
319                 template => scalar template_params("editpage.tmpl"),
320                 wikiname => $config{wikiname},
321         );
322         
323         run_hooks(formbuilder_setup => sub {
324                 shift->(form => $form, cgi => $q, session => $session);
325         });
326         
327         decode_form_utf8($form);
328         
329         # This untaint is safe because titlepage removes any problematic
330         # characters.
331         my ($page)=$form->field('page');
332         $page=titlepage(possibly_foolish_untaint($page));
333         if (! defined $page || ! length $page || file_pruned($page, $config{srcdir}) || $page=~/^\//) {
334                 error("bad page name");
335         }
336         
337         my $from;
338         if (defined $form->field('from')) {
339                 ($from)=$form->field('from')=~/$config{wiki_file_regexp}/;
340         }
341         
342         my $file;
343         my $type;
344         if (exists $pagesources{$page} && $form->field("do") ne "create") {
345                 $file=$pagesources{$page};
346                 $type=pagetype($file);
347                 if (! defined $type) {
348                         error(sprintf(gettext("%s is not an editable page"), $page));
349                 }
350                 if (! $form->submitted) {
351                         $form->field(name => "rcsinfo",
352                                 value => rcs_prepedit($file), force => 1);
353                 }
354         }
355         else {
356                 $type=$form->param('type');
357                 if (defined $type && length $type && $hooks{htmlize}{$type}) {
358                         $type=possibly_foolish_untaint($type);
359                 }
360                 elsif (defined $from) {
361                         # favor the type of linking page
362                         $type=pagetype($pagesources{$from});
363                 }
364                 $type=$config{default_pageext} unless defined $type;
365                 $file=$page.".".$type;
366                 if (! $form->submitted) {
367                         $form->field(name => "rcsinfo", value => "", force => 1);
368                 }
369         }
370
371         $form->field(name => "do", type => 'hidden');
372         $form->field(name => "from", type => 'hidden');
373         $form->field(name => "rcsinfo", type => 'hidden');
374         $form->field(name => "subpage", type => 'hidden');
375         $form->field(name => "page", value => pagetitle($page, 1), force => 1);
376         $form->field(name => "type", value => $type, force => 1);
377         $form->field(name => "comments", type => "text", size => 80);
378         $form->field(name => "editcontent", type => "textarea", rows => 20,
379                 cols => 80);
380         $form->tmpl_param("can_commit", $config{rcs});
381         $form->tmpl_param("indexlink", indexlink());
382         $form->tmpl_param("helponformattinglink",
383                 htmllink("", "", "HelpOnFormatting", noimageinline => 1));
384         $form->tmpl_param("baseurl", baseurl());
385         
386         if ($form->submitted eq "Cancel") {
387                 if ($form->field("do") eq "create" && defined $from) {
388                         redirect($q, "$config{url}/".htmlpage($from));
389                 }
390                 elsif ($form->field("do") eq "create") {
391                         redirect($q, $config{url});
392                 }
393                 else {
394                         redirect($q, "$config{url}/".htmlpage($page));
395                 }
396                 return;
397         }
398         elsif ($form->submitted eq "Preview") {
399                 $form->tmpl_param("page_preview",
400                         htmlize($page, $type,
401                         linkify($page, "",
402                         preprocess($page, $page,
403                         filter($page, $page, $form->field('editcontent')), 0, 1))));
404         }
405         else {
406                 $form->tmpl_param("page_preview", "");
407         }
408         $form->tmpl_param("page_conflict", "");
409         
410         if (! $form->submitted || $form->submitted eq "Preview" || 
411             ! $form->validate) {
412                 if ($form->field("do") eq "create") {
413                         my @page_locs;
414                         my $best_loc;
415                         if (! defined $from || ! length $from ||
416                             $from ne $form->field('from') ||
417                             file_pruned($from, $config{srcdir}) ||
418                             $from=~/^\// ||
419                             $form->submitted eq "Preview") {
420                                 @page_locs=$best_loc=$page;
421                         }
422                         else {
423                                 my $dir=$from."/";
424                                 $dir=~s![^/]+/+$!!;
425                                 
426                                 if ((defined $form->field('subpage') && length $form->field('subpage')) ||
427                                     $page eq gettext('discussion')) {
428                                         $best_loc="$from/$page";
429                                 }
430                                 else {
431                                         $best_loc=$dir.$page;
432                                 }
433                                 
434                                 push @page_locs, $dir.$page;
435                                 push @page_locs, "$from/$page";
436                                 while (length $dir) {
437                                         $dir=~s![^/]+/+$!!;
438                                         push @page_locs, $dir.$page;
439                                 }
440                         }
441                         push @page_locs, "$config{userdir}/$page"
442                                 if length $config{userdir};
443
444                         @page_locs = grep {
445                                 ! exists $pagecase{lc $_}
446                         } @page_locs;
447                         if (! @page_locs) {
448                                 # hmm, someone else made the page in the
449                                 # meantime?
450                                 redirect($q, "$config{url}/".htmlpage($page));
451                                 return;
452                         }
453
454                         my @editable_locs = grep {
455                                 check_canedit($_, $q, $session, 1)
456                         } @page_locs;
457                         if (! @editable_locs) {
458                                 # let it throw an error this time
459                                 map { check_canedit($_, $q, $session) } @page_locs;
460                         }
461                         
462                         my @page_types;
463                         if (exists $hooks{htmlize}) {
464                                 @page_types=keys %{$hooks{htmlize}};
465                         }
466                         
467                         $form->tmpl_param("page_select", 1);
468                         $form->field(name => "page", type => 'select',
469                                 options => [ map { pagetitle($_, 1) } @editable_locs ],
470                                 value => pagetitle($best_loc, 1));
471                         $form->field(name => "type", type => 'select',
472                                 options => \@page_types);
473                         $form->title(sprintf(gettext("creating %s"), pagetitle($page)));
474                         
475                 }
476                 elsif ($form->field("do") eq "edit") {
477                         check_canedit($page, $q, $session);
478                         if (! defined $form->field('editcontent') || 
479                             ! length $form->field('editcontent')) {
480                                 my $content="";
481                                 if (exists $pagesources{$page}) {
482                                         $content=readfile(srcfile($pagesources{$page}));
483                                         $content=~s/\n/\r\n/g;
484                                 }
485                                 $form->field(name => "editcontent", value => $content,
486                                         force => 1);
487                         }
488                         $form->tmpl_param("page_select", 0);
489                         $form->field(name => "page", type => 'hidden');
490                         $form->field(name => "type", type => 'hidden');
491                         $form->title(sprintf(gettext("editing %s"), pagetitle($page)));
492                 }
493                 
494                 printheader($session);
495                 print misctemplate($form->title, $form->render(submit => \@buttons));
496         }
497         else {
498                 # save page
499                 check_canedit($page, $q, $session);
500                 if (! -e "$config{srcdir}/$file" &&
501                     $form->field("do") ne "create") {
502                         $form->tmpl_param("page_gone", 1);
503                         $form->field(name => "do", value => "create", force => 1);
504                         $form->tmpl_param("page_select", 0);
505                         $form->field(name => "page", type => 'hidden');
506                         $form->field(name => "type", type => 'hidden');
507                         $form->title(sprintf(gettext("editing %s"), $page));
508                         printheader($session);
509                         print misctemplate($form->title, $form->render(submit => \@buttons));
510                         return;
511                 }
512                 elsif (-e "$config{srcdir}/$file" &&
513                        $form->field("do") eq "create") {
514                         $form->tmpl_param("creation_conflict", 1);
515                         $form->field(name => "do", value => "edit", force => 1);
516                         $form->tmpl_param("page_select", 0);
517                         $form->field(name => "page", type => 'hidden');
518                         $form->field(name => "type", type => 'hidden');
519                         $form->title(sprintf(gettext("editing %s"), $page));
520                         $form->field("editcontent", 
521                                 value => readfile("$config{srcdir}/$file").
522                                          "\n\n\n".$form->field("editcontent"),
523                                 force => 1);
524                         printheader($session);
525                         print misctemplate($form->title, $form->render(submit => \@buttons));
526                         return;
527                 }
528                 
529                 my $content=$form->field('editcontent');
530
531                 $content=~s/\r\n/\n/g;
532                 $content=~s/\r/\n/g;
533
534                 $config{cgi}=0; # avoid cgi error message
535                 eval { writefile($file, $config{srcdir}, $content) };
536                 $config{cgi}=1;
537                 if ($@) {
538                         $form->field(name => "rcsinfo", value => rcs_prepedit($file),
539                                 force => 1);
540                         $form->tmpl_param("failed_save", 1);
541                         $form->tmpl_param("error_message", $@);
542                         $form->field("editcontent", value => $content, force => 1);
543                         $form->tmpl_param("page_select", 0);
544                         $form->field(name => "page", type => 'hidden');
545                         $form->field(name => "type", type => 'hidden');
546                         $form->title(sprintf(gettext("editing %s"), $page));
547                         printheader($session);
548                         print misctemplate($form->title, $form->render(submit => \@buttons));
549                         return;
550                 }
551                 
552                 my $conflict;
553                 if ($config{rcs}) {
554                         my $message="";
555                         if (defined $form->field('comments') &&
556                             length $form->field('comments')) {
557                                 $message=$form->field('comments');
558                         }
559                         
560                         if ($form->field("do") eq "create") {
561                                 rcs_add($file);
562                         }
563
564                         # Prevent deadlock with post-commit hook by
565                         # signaling to it that it should not try to
566                         # do anything (except send commit mails).
567                         disable_commit_hook();
568                         $conflict=rcs_commit($file, $message,
569                                 $form->field("rcsinfo"),
570                                 $session->param("name"), $ENV{REMOTE_ADDR});
571                         enable_commit_hook();
572                         rcs_update();
573                 }
574                 
575                 # Refresh even if there was a conflict, since other changes
576                 # may have been committed while the post-commit hook was
577                 # disabled.
578                 require IkiWiki::Render;
579                 refresh();
580                 saveindex();
581
582                 if (defined $conflict) {
583                         $form->field(name => "rcsinfo", value => rcs_prepedit($file),
584                                 force => 1);
585                         $form->tmpl_param("page_conflict", 1);
586                         $form->field("editcontent", value => $conflict, force => 1);
587                         $form->field("do", "edit", force => 1);
588                         $form->tmpl_param("page_select", 0);
589                         $form->field(name => "page", type => 'hidden');
590                         $form->field(name => "type", type => 'hidden');
591                         $form->title(sprintf(gettext("editing %s"), $page));
592                         printheader($session);
593                         print misctemplate($form->title, $form->render(submit => \@buttons));
594                         return;
595                 }
596                 else {
597                         # The trailing question mark tries to avoid broken
598                         # caches and get the most recent version of the page.
599                         redirect($q, "$config{url}/".htmlpage($page)."?updated");
600                 }
601         }
602 } #}}}
603
604 sub cgi_getsession ($) { #{{{
605         my $q=shift;
606
607         eval q{use CGI::Session};
608         CGI::Session->name("ikiwiki_session_".encode_utf8($config{wikiname}));
609         
610         my $oldmask=umask(077);
611         my $session = CGI::Session->new("driver:DB_File", $q,
612                 { FileName => "$config{wikistatedir}/sessions.db" });
613         umask($oldmask);
614
615         return $session;
616 } #}}}
617
618 sub cgi_savesession ($) { #{{{
619         my $session=shift;
620
621         # Force session flush with safe umask.
622         my $oldmask=umask(077);
623         $session->flush;
624         umask($oldmask);
625 } #}}}
626
627 sub cgi (;$$) { #{{{
628         my $q=shift;
629         my $session=shift;
630
631         if (! $q) {
632                 eval q{use CGI};
633                 error($@) if $@;
634         
635                 $q=CGI->new;
636         
637                 run_hooks(cgi => sub { shift->($q) });
638         }
639
640         my $do=$q->param('do');
641         if (! defined $do || ! length $do) {
642                 my $error = $q->cgi_error;
643                 if ($error) {
644                         error("Request not processed: $error");
645                 }
646                 else {
647                         error("\"do\" parameter missing");
648                 }
649         }
650         
651         # Things that do not need a session.
652         if ($do eq 'recentchanges') {
653                 cgi_recentchanges($q);
654                 return;
655         }
656
657         # Need to lock the wiki before getting a session.
658         lockwiki();
659         
660         if (! $session) {
661                 $session=cgi_getsession($q);
662         }
663         
664         # Auth hooks can sign a user in.
665         if ($do ne 'signin' && ! defined $session->param("name")) {
666                 run_hooks(auth => sub {
667                         shift->($q, $session)
668                 });
669                 if (defined $session->param("name")) {
670                         # Make sure whatever user was authed is in the
671                         # userinfo db.
672                         if (! userinfo_get($session->param("name"), "regdate")) {
673                                 userinfo_setall($session->param("name"), {
674                                         email => "",
675                                         password => "",
676                                         regdate => time,
677                                 }) || error("failed adding user");
678                         }
679                 }
680         }
681         
682         if (defined $session->param("name") &&
683             userinfo_get($session->param("name"), "banned")) {
684                 print $q->header(-status => "403 Forbidden");
685                 $session->delete();
686                 print gettext("You are banned.");
687                 cgi_savesession($session);
688         }
689
690         run_hooks(sessioncgi => sub { shift->($q, $session) });
691
692         if ($do eq 'signin') {
693                 cgi_signin($q, $session);
694                 cgi_savesession($session);
695         }
696         elsif (defined $session->param("postsignin")) {
697                 cgi_postsignin($q, $session);
698         }
699         elsif ($do eq 'prefs') {
700                 cgi_prefs($q, $session);
701         }
702         elsif ($do eq 'create' || $do eq 'edit') {
703                 cgi_editpage($q, $session);
704         }
705         elsif ($do eq 'postsignin') {
706                 error(gettext("login failed, perhaps you need to turn on cookies?"));
707         }
708         else {
709                 error("unknown do parameter");
710         }
711 } #}}}
712
713 sub userlink ($) { #{{{
714         my $user=shift;
715
716         eval q{use CGI 'escapeHTML'};
717         error($@) if $@;
718         if ($user =~ m!^https?://! &&
719             eval q{use Net::OpenID::VerifiedIdentity; 1} && !$@) {
720                 # Munge user-urls, as used by eg, OpenID.
721                 my $oid=Net::OpenID::VerifiedIdentity->new(identity => $user);
722                 my $display=$oid->display;
723                 # Convert "user.somehost.com" to "user [somehost.com]".
724                 if ($display !~ /\[/) {
725                         $display=~s/^(.*?)\.([^.]+\.[a-z]+)$/$1 [$2]/;
726                 }
727                 # Convert "http://somehost.com/user" to "user [somehost.com]".
728                 if ($display !~ /\[/) {
729                         $display=~s/^https?:\/\/(.+)\/([^\/]+)$/$2 [$1]/;
730                 }
731                 $display=~s!^https?://!!; # make sure this is removed
732                 return "<a href=\"$user\">".escapeHTML($display)."</a>";
733         }
734         else {
735                 return htmllink("", "", escapeHTML(
736                         length $config{userdir} ? $config{userdir}."/".$user : $user
737                 ), noimageinline => 1);
738         }
739 } #}}}
740
741 1