info.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/user/info.php
  20. * \ingroup core
  21. * \brief Page des informations d'un utilisateur
  22. */
  23. require '../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
  27. $langs->load("users");
  28. // Security check
  29. $id = GETPOST('id','int');
  30. $object = new User($db);
  31. if ($id > 0 || ! empty($ref))
  32. {
  33. $result = $object->fetch($id, $ref, '', 1);
  34. $object->getrights();
  35. }
  36. // Security check
  37. $socid=0;
  38. if ($user->societe_id > 0) $socid = $user->societe_id;
  39. $feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
  40. if ($user->id == $id) // A user can always read its own card
  41. {
  42. $feature2='';
  43. }
  44. $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
  45. // If user is not user that read and no permission to read other users, we stop
  46. if (($object->id != $user->id) && (! $user->rights->user->user->lire))
  47. accessforbidden();
  48. /*
  49. * View
  50. */
  51. $form = new Form($db);
  52. llxHeader();
  53. $head = user_prepare_head($object);
  54. $title = $langs->trans("User");
  55. dol_fiche_head($head, 'info', $title, -1, 'user');
  56. $linkback = '';
  57. if ($user->rights->user->user->lire || $user->admin) {
  58. $linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
  59. }
  60. dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
  61. $object->info($id); // This overwrite ->ref with login instead of id
  62. print '<div class="fichecenter">';
  63. print '<div class="underbanner clearboth"></div>';
  64. print '<br>';
  65. dol_print_object_info($object);
  66. print '</div>';
  67. dol_fiche_end();
  68. llxFooter();
  69. $db->close();