<?php // $Id: me.module,v 1.3.4.3 2007/04/24 15:18:50 ahoeben Exp $ /** * Implementation of hook_menu(). */ function me_menu($may_cache) { if ($may_cache) { foreach($aliases as $alias) { // check to see if there's a 'me' to replace; // either '.../me/...', 'me/...' or '.../me' but eg 'readme/...' does not count if(preg_match('/(/m|^m)(e$|e/)/',$alias,$matches)>0){ $items[] = array( 'path' => $alias, 'type' => MENU_CALLBACK, 'callback' => 'me_relay', 'access' => true, // we're handing over access control to the destiation page ); } } $items[] = array( 'path' => 'admin/settings/me', 'title' => t(''me' Aliases'), 'description' => t('Define URL paths for Me aliasing.'), 'callback' => 'drupal_get_form', 'callback arguments' => array('me_settings'), 'access' => user_access('administer site configuration'), 'type' => MENU_NORMAL_ITEM, // optional ); } return $items; } /** * Implementation of hook_settings(). * * Provide a single textbox that allows admins to enter any number of paths cont
aining 'me' */ function me_settings() { $form['me_aliases'] = array( '#type'=>'textarea', '#title'=>t('Aliases to create'), '#default_value'=>variable_get('me_aliases',"user/me"), '#cols'=>50, '#rows'=>6 , '#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.'), ); return system_settings_form($form); } /** * Forward to same url with proper uid this time. * * The paths have already been checked to contain 'me' in the _menu hook. * We don't have to check node access, drupal_goto will take care of that. */ function me_relay() { global $user; if($user->uid!=0) { if ($alias == "galerie") { header( 'Location: <a href=\"http://xxx.com/v/Utilisateurs/'\" target=\"_blank\">http://www.sve-connexion.fr/v/Utilisateurs/'</a> . $user->name ) ; } else { $index = 0; $destination = ''; $fragment = arg(0); while($fragment) { $destination.=(($destination=='')?'':'/').(($fragment=='me')?$user->uid:$fragment); $index++; $fragment = arg($index); } drupal_goto($destination); } } else { // user is not logged in drupal_set_message(t('Please login to access this personalised page.')); $destination = "destination=". drupal_urlencode($_GET['q']); drupal_goto('user/login', $destination); } } ?>
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"?