[Fusionforge-commits] r14701 - trunk/src/common/include

Alain Peyrat aljeux at fusionforge.org
Mon Oct 24 15:29:28 CEST 2011


Author: aljeux
Date: 2011-10-24 15:29:28 +0200 (Mon, 24 Oct 2011)
New Revision: 14701

Modified:
   trunk/src/common/include/utils_crossref.php
Log:
Fix to allow spaces in wiki page names in crossref

Modified: trunk/src/common/include/utils_crossref.php
===================================================================
--- trunk/src/common/include/utils_crossref.php	2011-10-24 13:24:19 UTC (rev 14700)
+++ trunk/src/common/include/utils_crossref.php	2011-10-24 13:29:28 UTC (rev 14701)
@@ -39,7 +39,7 @@
 	$text = preg_replace('/\[\T(\d+)\]/e', "_taskid2url('\\1')", $text);
 
 	// Handle [wiki:<pagename>] syntax
-	$text = preg_replace('/\[wiki:(\S+)\]/', "<a href=\"/wiki/g/$prj/\\1\">\\1</a>", $text);
+	$text = preg_replace('/\[wiki:(.*?)\]/e', "_page2url('$prj','\\1')", $text);
 
 	// Handle [forum:<thread_id>] Syntax => links to forum.
 	$text = preg_replace('/\[forum:(\d+)\]/e', "_forumid2url('\\1')", $text);
@@ -47,6 +47,10 @@
 	return $text;
 }
 
+function _page2url($prj,$page) {
+	return '<a href="/wiki/g/'.$prj.'/'.rawurlencode($page).'">'.$page.'</a>';
+}
+
 function _artifactid2url ($id, $mode='') {
 	$text = '[#'.$id.']';
 	$res = db_query_params ('SELECT group_id, artifact.group_artifact_id, summary, status_id




More information about the Fusionforge-commits mailing list