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