X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=plugins%2Ffunction.profile.php;h=fc7087fc61a02ad46a80b1aa2bbb42f4f3397a01;hb=3424387cde6c635ff16c3b5459c4caa88bb76e2e;hp=3a05b6148aa7e882489673bc409e19f3c0f7825e;hpb=245923e335d0da5bec9495991a7846be9f0563ab;p=platal.git diff --git a/plugins/function.profile.php b/plugins/function.profile.php index 3a05b61..fc7087f 100644 --- a/plugins/function.profile.php +++ b/plugins/function.profile.php @@ -1,6 +1,6 @@ b('promo', false) || $params->b('cat', false); @@ -27,7 +27,10 @@ function smarty_function_profile($params, &$smarty) $with_link = $params->b('link', true); $with_dir = $params->b('directory', true); $with_groupperms = $params->b('groupperms', true); + $raw = $params->b('raw', false); $user = $params->v('user'); + $profile = $params->v('profile'); + if (is_int($user) || ctype_digit($user)) { $user = User::getWithUID($user); } @@ -37,22 +40,31 @@ function smarty_function_profile($params, &$smarty) } else { $name = pl_entities($user->fullName()); } - if ($with_sex && $user->isFemale()) { - $name = '•' . $name; - } if ($with_promo) { $promo = $user->category(); if ($promo) { $name .= ' (' . pl_entities($promo) . ')'; } } + if ($raw) { + return $name; + } + + if ($with_sex && $user->isFemale()) { + $name = '•' . $name; + } if ($with_link) { - $profile = ($user instanceof Profile) ? $user : $user->profile(); + if (is_null($profile)) { + $profile = $user->profile(); + } + if ($profile) { $name = '' . $name . ''; } } - if ($user->lost) { + if ($profile && $profile->isDead()) { + $name .= ' †'; + } else if ($user->lost) { $name .= ' Patte cassée'; } if ($with_groupperms && $user instanceof User && $user->group_perms == 'admin' && !empty($name)) { @@ -61,5 +73,5 @@ function smarty_function_profile($params, &$smarty) return $name; } -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8: ?>