From: x2003bruneau Date: Mon, 31 Jul 2006 15:36:00 +0000 (+0000) Subject: Wiki allow [[~alias]] ==> Prenom NOM Xxxxx (aka Surnom) X-Git-Tag: xorg/0.9.11~167 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=fb7e68a264092430fc364a11979ff5adb614873a;p=platal.git Wiki allow [[~alias]] ==> Prenom NOM Xxxxx (aka Surnom) and [[~alias|title]] ==> title git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@748 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/plugins/pmwiki.config.php b/plugins/pmwiki.config.php index 9f6f8c6..a93ae66 100644 --- a/plugins/pmwiki.config.php +++ b/plugins/pmwiki.config.php @@ -51,8 +51,8 @@ $InputTags['e_form'] = array( type='hidden' name='basetime' value='\$EditBaseTime' />"); // set profiles to point to plat/al fiche -Markup('[[~platal', '<[[~', '/\[\[~([^|\]]*)\|([^\]]*)\]\]/e', - 'PreserveText("=", \'$2\', "")'); +Markup('[[~platal', '<[[~', '/\[\[~([^|\]]*)(?:\|([^\]]*))?\]\]/e', + 'PreserveText("=", doPlatalLink("$1", "$2"), "")'); // prevent restorelinks before block apply (otherwise [[Sécurité]] will give // .../Se9'>Sécurité @@ -78,6 +78,23 @@ function doBicol($column=false) } } +function doPlatalLink($link, $text) +{ + if (strlen(trim($text)) == 0) { + $res = XDB::query("SELECT u.nom, u.prenom, u.promo, q.profile_nick AS surnom + FROM auth_user_md5 AS u + INNER JOIN auth_user_quick AS q USING(user_id) + INNER JOIN aliases AS a ON u.user_id = a.id + WHERE a.alias = {?}", $link); + $row = $res->fetchOneAssoc(); + $text = $row['prenom'] . ' ' . $row['nom'] . ' X' . $row['promo']; + if ($row['surnom']) { + $text .= ' (aka ' . $row['surnom'] . ')'; + } + } + return '' . $text . ''; +} + // }}} $AuthFunction = 'ReadPage';