info.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.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. // Load translation files required by page
  28. $langs->load("users");
  29. // Security check
  30. $id = GETPOST('id','int');
  31. $object = new User($db);
  32. if ($id > 0 || ! empty($ref))
  33. {
  34. $result = $object->fetch($id, $ref, '', 1);
  35. $object->getrights();
  36. }
  37. // Security check
  38. $socid=0;
  39. if ($user->societe_id > 0) $socid = $user->societe_id;
  40. $feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
  41. if ($user->id == $id) // A user can always read its own card
  42. {
  43. $feature2='';
  44. }
  45. $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
  46. // If user is not user that read and no permission to read other users, we stop
  47. if (($object->id != $user->id) && (! $user->rights->user->user->lire))
  48. accessforbidden();
  49. /*
  50. * View
  51. */
  52. $form = new Form($db);
  53. llxHeader();
  54. $head = user_prepare_head($object);
  55. $title = $langs->trans("User");
  56. dol_fiche_head($head, 'info', $title, -1, 'user');
  57. $linkback = '';
  58. if ($user->rights->user->user->lire || $user->admin) {
  59. $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  60. }
  61. dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
  62. $object->info($id); // This overwrite ->ref with login instead of id
  63. print '<div class="fichecenter">';
  64. print '<div class="underbanner clearboth"></div>';
  65. print '<br>';
  66. dol_print_object_info($object);
  67. print '</div>';
  68. dol_fiche_end();
  69. // End of page
  70. llxFooter();
  71. $db->close();