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