Permalink
Browse files

Yet more minor problems fixed for hyperlink/mailto: conversion

difficulties
  • Loading branch information...
1 parent 08b6314 commit 464712ec77f602a949230e19d3f2f76239b63716 thepurpleblob committed Jul 22, 2003
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/wiki.php
View
@@ -245,7 +245,7 @@ function line_replace( $line ) {
"\\1<A HREF=\"http://www.\\2\\3\" TARGET=\"newpage\">www.\\2\\3</A>", $line);
// make email addresses into mailtos....
- $line = eregi_replace("([[:space:]]|^)([a-zA-Z0-9@.]+)\(([^)]+)\)",
+ $line = eregi_replace("([[:space:]]|^)([[:alnum:]._-]+@[[:alnum:]._-]+)\(([^)]+)\)",
"\\1<a href=\"mailto:\\2\">\\3</a>", $line);
// !# at the beginning of any lines means a heading
@@ -271,6 +271,15 @@ function line_replace( $line ) {
"<img src=\"$CFG->wwwroot/file.php\?file=$course->id/\\1\\2\" alt=\"\\3\" />", $line );
}
+ // Replace everything else resource link
+ if ($CFG->slasharguments) {
+ $line = eregi_replace( "file:/([[:alnum:]/._-]+)\(([^)]+)\)",
+ "<a href=\"$CFG->wwwroot/file.php/$course->id/\\1\" >\\2</a>", $line );
+ } else {
+ $line = eregi_replace( "file:/([[:alnum:]/._-]+)\(([^)]+)\)",
+ "<a href=\"$CFG->wwwroot/file.php\?file=$course->id/\\1\" >\\2</a>", $line );
+ }
+
replace_smilies( $line );
}

0 comments on commit 464712e

Please sign in to comment.