* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-function init_rss($template, $alias, $hash, $require_uid = true)
+function smarty_function_profile($params, &$smarty)
{
- $page =& Platal::page();
- $page->changeTpl($template, NO_SKIN);
- $user = Platal::session()->tokenAuth($alias, $hash);
- if (is_null($user)) {
- if ($require_uid) {
- exit;
- } else {
- $user = null;
- }
+ $params = new PlDict($params);
+ $with_promo = $params->b('promo', false);
+ $with_sex = $params->b('sex', true);
+ $with_link = $params->b('link', true);
+ $with_groupperms = $params->b('groupperms', true);
+ $user = $params->v('user');
+ if (ctype_digit($user)) {
+ $user = User::getWithUID($user);
}
- if ($template) {
- $page->assign('rss_hash', $hash);
- pl_content_headers("application/rss+xml");
+ $name = pl_entities($user->fullName());
+ if ($with_sex && $user->isFemale()) {
+ $name = '•' . $name;
+ }
+ if ($with_promo) {
+ $promo = $user->promo();
+ if ($promo) {
+ $name .= ' (' . pl_entities($promo) . ')';
+ }
+ }
+ if ($with_link) {
+ $profile = ($user instanceof Profile) ? $user : $user->profile();
+ if ($profile) {
+ $name = '<a href="profile/' . $profile->hrid() . '" class="popup2">' . $name . '</a>';
+ }
+ }
+ if ($with_groupperms && $user instanceof User && $user->group_perms == 'admin') {
+ $name = '<strong>' . $name . '</strong>';
}
- return is_null($user) ? null : $user->id();
+ return $name;
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: