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