From: Arno H. <aho...@us...> - 2000-11-08 16:52:04
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory slayer.i.sourceforge.net:/tmp/cvs-serv25825 Modified Files: stdlib.php Log Message: added named internal links e.g. [wow|FrontPage] -- patch idea from Antti Kaihola Index: stdlib.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/stdlib.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** stdlib.php 2000/11/08 15:40:00 1.9 --- stdlib.php 2000/11/08 16:52:00 1.10 *************** *** 166,181 **** ! function LinkExistingWikiWord($wikiword) { global $ScriptUrl; $enc_word = rawurlencode($wikiword); ! $wikiword = htmlspecialchars($wikiword); ! return "<a href=\"$ScriptUrl?$enc_word\">$wikiword</a>"; } ! function LinkUnknownWikiWord($wikiword) { global $ScriptUrl; $enc_word = rawurlencode($wikiword); ! $wikiword = htmlspecialchars($wikiword); ! return "<u>$wikiword</u><a href=\"$ScriptUrl?edit=$enc_word\">?</a>"; } --- 166,183 ---- ! function LinkExistingWikiWord($wikiword, $linktext='') { global $ScriptUrl; $enc_word = rawurlencode($wikiword); ! if(empty($linktext)) ! $linktext = htmlspecialchars($wikiword); ! return "<a href=\"$ScriptUrl?$enc_word\">$linktext</a>"; } ! function LinkUnknownWikiWord($wikiword, $linktext='') { global $ScriptUrl; $enc_word = rawurlencode($wikiword); ! if(empty($linktext)) ! $linktext = htmlspecialchars($wikiword); ! return "<u>$linktext</u><a href=\"$ScriptUrl?edit=$enc_word\">?</a>"; } *************** *** 466,470 **** $linkname = htmlspecialchars(trim($matches[1])); // assert proper URL's ! if (preg_match("#^($AllowedProtocols):#", $URL)) { if (preg_match("/($InlineImages)$/i", $URL)) { $link['type'] = 'image-named'; --- 468,475 ---- $linkname = htmlspecialchars(trim($matches[1])); // assert proper URL's ! if (IsWikiPage($dbi, $URL)) { ! $link['type'] = 'wiki-named'; ! $link['link'] = LinkExistingWikiWord($URL, $linkname); ! } elseif (preg_match("#^($AllowedProtocols):#", $URL)) { if (preg_match("/($InlineImages)$/i", $URL)) { $link['type'] = 'image-named'; *************** *** 478,484 **** $link['link'] = "<a href=\"$ScriptUrl$match[1]\">$linkname</a>"; } else { ! $link['type'] = 'url-bad'; ! $link['link'] = "<b><u>BAD URL -- links have to start with one" . ! "of $AllowedProtocols followed by ':'</u></b>"; } return $link; --- 483,488 ---- $link['link'] = "<a href=\"$ScriptUrl$match[1]\">$linkname</a>"; } else { ! $link['type'] = 'wiki-unknown-named'; ! $link['link'] = LinkUnknownWikiWord($URL, $linkname); } return $link; |