user.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. *
  14. */
  15. /**
  16. * Variables definitions and inclusions
  17. */
  18. // name of the language file that needs to be included
  19. $language_file = array('index','registration','messages','userInfo');
  20. $cidReset = true;
  21. require_once 'main/inc/global.inc.php';
  22. require_once api_get_path(LIBRARY_PATH).'social.lib.php';
  23. require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  24. /**
  25. * Access permissions check
  26. */
  27. api_block_anonymous_users();
  28. /**
  29. * Treat URL arguments
  30. */
  31. $array_keys = array_keys($_GET);
  32. if (!empty($array_keys)) {
  33. $username = substr($array_keys[0],0,20); // max len of an username
  34. $friend_id = UserManager::get_user_id_from_username($username);
  35. if ($friend_id) {
  36. SocialManager::display_individual_user($friend_id);
  37. } else {
  38. // we cant find your friend
  39. header('Location: whoisonline.php');
  40. exit;
  41. }
  42. } else {
  43. // we cant find your friend
  44. header('Location: whoisonline.php');
  45. exit;
  46. }