1. <?php
  2. // $Id: me.module,v 1.3.4.3 2007/04/24 15:18:50 ahoeben Exp $
  3.  
  4. /**
  5.  * Implementation of hook_menu().
  6.  */
  7. function me_menu($may_cache) {
  8. $items=array();
  9.  
  10. if ($may_cache) {
  11. $aliases = explode("\n",variable_get('me_aliases','user/me'));
  12. foreach($aliases as $alias) {
  13. // check to see if there's a 'me' to replace;
  14. // either '.../me/...', 'me/...' or '.../me' but eg 'readme/...' does not count
  15. $alias = preg_split('/[?#]/',$alias);
  16. $alias = trim(check_url($alias[0]),"/ \t\nr\");
  17. if(preg_match('/(/m|^m)(e$|e/)/',$alias,$matches)>0){
  18. $items[] = array(
  19. 'path' => $alias,
  20. 'type' => MENU_CALLBACK,
  21. 'callback' => 'me_relay',
  22. 'access' => true, // we're handing over access control to the destiation page
  23. );
  24. }
  25. }
  26.  
  27. $items[] = array(
  28. 'path' => 'admin/settings/me',
  29. 'title' => t(''me' Aliases'),
  30. 'description' => t('Define URL paths for Me aliasing.'),
  31. 'callback' => 'drupal_get_form',
  32. 'callback arguments' => array('me_settings'),
  33. 'access' => user_access('administer site configuration'),
  34. 'type' => MENU_NORMAL_ITEM, // optional
  35. );
  36. }
  37.  
  38. return $items;
  39. }
  40.  
  41. /**
  42.  * Implementation of hook_settings().
  43.  *
  44.  * Provide a single textbox that allows admins to enter any number of paths cont
    aining 'me'
  45.  */
  46. function me_settings() {
  47. $form['me_aliases'] = array(
  48. '#type'=>'textarea',
  49. '#title'=>t('Aliases to create'),
  50. '#default_value'=>variable_get('me_aliases',"user/me"),
  51. '#cols'=>50,
  52. '#rows'=>6 ,
  53. '#description'=>t('The per-user aliases to create. Each alias must contain the 'me' fragment or it will be ignored. Enter one alias per line, and do not include tr
    ailing or leading slashes.'),
  54. );
  55.  
  56. return system_settings_form($form);
  57. }
  58.  
  59. /**
  60.  * Forward to same url with proper uid this time.
  61.  *
  62.  * The paths have already been checked to contain 'me' in the _menu hook.
  63.  * We don't have to check node access, drupal_goto will take care of that.
  64.  */
  65. function me_relay() {
  66. global $user;
  67.  
  68. if($user->uid!=0) {
  69.  
  70. if ($alias == "galerie") {
  71. header( 'Location: <a href=\"http://xxx.com/v/Utilisateurs/'\" target=\"_blank\">http://www.sve-connexion.fr/v/Utilisateurs/'</a> . $user->name ) ;
  72. }
  73.  
  74. else { 
  75.  
  76. $index = 0;
  77. $destination = '';
  78. $fragment = arg(0);
  79. while($fragment) {
  80. $destination.=(($destination=='')?'':'/').(($fragment=='me')?$user->uid:$fragment);
  81. $index++;
  82. $fragment = arg($index);
  83. }
  84. drupal_goto($destination);
  85. }
  86.  
  87. else {
  88. // user is not logged in
  89. drupal_set_message(t('Please login to access this personalised page.'));
  90. $destination = "destination=". drupal_urlencode($_GET['q']);
  91. drupal_goto('user/login', $destination);
  92. }
  93. }
  94. ?>


Mam alias: galerie/me, no i teraz dla user/me chce aby me zostalo zastapione przez user>uid, ale dla galerie/me uzywam cos zupelnie innego.
Co porownac do czego w linii 70 zeby to dzialalo. Gdzie jest ukryty alias wprowadzony w panelu admnistracyjnym drupala: "galerie/me"?