user.php 1.0 KB

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