user.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 http://campus.chamilo.org/main/social/profile.php?1
  8. * To use this you should rename the htaccess to .htaccess and check your virtualhost configuration
  9. *
  10. * More improvements will come in the next version of Chamilo maybe in the 1.8.8
  11. *
  12. */
  13. // name of the language file that needs to be included
  14. $language_file = array('index','registration','messages','userInfo');
  15. $cidReset = true;
  16. require_once 'main/inc/global.inc.php';
  17. require_once api_get_path(LIBRARY_PATH).'social.lib.php';
  18. require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  19. api_block_anonymous_users();
  20. $array_keys = array_keys($_GET);
  21. if (!empty($array_keys)) {
  22. $username = substr($array_keys[0],0,20); // max len of an username
  23. $friend_id = UserManager::get_user_id_from_username($username);
  24. if ($friend_id) {
  25. SocialManager::display_individual_user($friend_id);
  26. /*
  27. if (api_get_setting('allow_social_tool') =='true') {
  28. header('Location: main/social/profile.php?u='.$friend_id.'');
  29. exit;
  30. } else {
  31. header('Location: whoisonline.php?id='.$friend_id.'');
  32. exit;
  33. }*/
  34. } else {
  35. // we cant find your friend
  36. header('Location: whoisonline.php');
  37. exit;
  38. }
  39. } else {
  40. // we cant find your friend
  41. header('Location: whoisonline.php');
  42. exit;
  43. }
  44. ?>