user.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Clean URls for the Social Network
  5. *
  6. * The idea is to access to the user info more easily:
  7. * http://campus.chamilo.org/admin instead of
  8. * http://campus.chamilo.org/main/social/profile.php?1
  9. * To use this you should rename the htaccess to .htaccess and check your
  10. * virtualhost configuration
  11. *
  12. * More improvements will come in next versions of Chamilo maybe in the 1.8.8
  13. * @package chamilo.main
  14. */
  15. /**
  16. * Variables definitions and inclusions
  17. */
  18. $cidReset = true;
  19. require_once 'main/inc/global.inc.php';
  20. /**
  21. * Access permissions check
  22. */
  23. api_block_anonymous_users();
  24. /**
  25. * Treat URL arguments
  26. */
  27. $array_keys = array_keys($_GET);
  28. if (!empty($array_keys)) {
  29. $username = substr($array_keys[0],0,20); // max len of an username
  30. $friend_id = UserManager::get_user_id_from_username($username);
  31. if ($friend_id) {
  32. SocialManager::display_individual_user($friend_id);
  33. } else {
  34. // we cant find your friend
  35. header('Location: whoisonline.php');
  36. exit;
  37. }
  38. } else {
  39. // we cant find your friend
  40. header('Location: whoisonline.php');
  41. exit;
  42. }