Merge commit 'origin/master' into account
[platal.git] / plugins / function.profile.php
index d686b1c..53f2a5d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2009 Polytechnique.org                              *
+ *  Copyright (C) 2003-2010 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
 
 function smarty_function_profile($params, &$smarty)
 {
-    $with_promo = isset($params['with_promo']) ? $params['with_promo'] : false;
-    $with_sex   = isset($params['with_sex']) ? $params['with_sex'] : true;
-    $with_link  = isset($params['with_link']) ? $params['with_link'] : true;
-    $with_groupperms = isset($params['with_groupperms']) ? $params['with_groupperms'] : true;
-    $user = $params['user'];
+    $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);
+    }
 
     $name = pl_entities($user->fullName());
     if ($with_sex && $user->isFemale()) {