user.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. // 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. /**
  23. * Access permissions check
  24. */
  25. api_block_anonymous_users();
  26. /**
  27. * Treat URL arguments
  28. */
  29. $array_keys = array_keys($_GET);
  30. if (!empty($array_keys)) {
  31. $username = substr($array_keys[0],0,20); // max len of an username
  32. $friend_id = UserManager::get_user_id_from_username($username);
  33. if ($friend_id) {
  34. SocialManager::display_individual_user($friend_id);
  35. } else {
  36. // we cant find your friend
  37. header('Location: whoisonline.php');
  38. exit;
  39. }
  40. } else {
  41. // we cant find your friend
  42. header('Location: whoisonline.php');
  43. exit;
  44. }