Menu

Breaking named links

2001-03-05
2012-10-11
  • David Marsh

    David Marsh - 2001-03-05

    Hi all :)

    I was wonder what the best way to stop named links inside the wiki?  I the best way to stop it so far is to change line 265 in stdlib.php from

    preg_match("/([^|]+)(\|)?([^|]+)?/", $match[2], $matches);

    to

    preg_match("/([^|]+)?([^|]+)?/", $match[2], $matches);

    This changes [ foo | FrontPage ] so instead of linking to "FrontPage" it now links to "foo" and everything after the pipe is hidden. (Ideally I'd like it to link to a page called "foo | FrontPage", but I can't see how to do that and it's probably be a "bad" url).

    Anyway, am I looking in the right place to stop named links, and is this the best way to do it?

    Thanks :)

     
    • Geoffrey T. Dairiki

      If you want to disallow external named links
      (like [ name | http://wazoo.com/ ]) as well as
      internal named links ([ name | WikiWord ]),
      replace (in lib/stdlib.php):

        preg_match("/([^|]+)(\|)?([^|]+)?/", $match[2], $matches);

      with

        $matches[1] = $match[2];

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.