info.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 <https://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. $ref = GETPOST('ref', 'alpha');
  32. $object = new User($db);
  33. if ($id > 0 || !empty($ref)) {
  34. $result = $object->fetch($id, $ref, '', 1);
  35. $object->getrights();
  36. }
  37. // Security check
  38. $socid = 0;
  39. if ($user->socid > 0) {
  40. $socid = $user->socid;
  41. }
  42. $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
  43. $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
  44. // If user is not user that read and no permission to read other users, we stop
  45. if (($object->id != $user->id) && (!$user->rights->user->user->lire)) {
  46. accessforbidden();
  47. }
  48. /*
  49. * View
  50. */
  51. $form = new Form($db);
  52. llxHeader();
  53. $head = user_prepare_head($object);
  54. $title = $langs->trans("User");
  55. print dol_get_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/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  59. }
  60. $morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'" class="refid">';
  61. $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
  62. $morehtmlref .= '</a>';
  63. dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
  64. $object->info($id); // This overwrite ->ref with login instead of id
  65. print '<div class="fichecenter">';
  66. print '<div class="underbanner clearboth"></div>';
  67. print '<br>';
  68. dol_print_object_info($object);
  69. print '</div>';
  70. print dol_get_fiche_end();
  71. // End of page
  72. llxFooter();
  73. $db->close();