nid : $path; //multilink_set_message(sprintf('node %s -> node %s at %s', $nid, $link->nid, $rpath)); } // Otherwise this is a not a node/123 path so don't change it. else { $rpath = $path; } // If $rpath is actually the front-page, use an empty path instead. if ($rpath == $front) { $rpath = ''; } // Get final target url for any redirect. // Note: multilink_url() uses url() which gets the most recently added alias (if more than one.) $rpath = multilink_url($rpath, TRUE); // If requested and target urls are different then we need to redirect. // Note use rawurldecode to double-check, in case of any weird characters in request. if ($rpath != $qpath && rawurldecode($rpath) != $qpath) { // Only redirect if $_POST is empty, processing index.php and not under Drush [#1278930] if (empty($_POST) && $_SERVER['SCRIPT_NAME'] == '/index.php' && !function_exists('drush_main')) { // Fix some compatibility issues when SecurePages is active. if (function_exists('multilink_securepages_redirect_fix')) { multilink_securepages_redirect_fix($rpath); } // Get the Query String (minus the 'q'). $qstring = rawurldecode(drupal_query_string_encode($_GET, array('q'))); $perm = 'bypass multilink redirect'; // Bypass if user has permission - show message instead of redirecting. if (function_exists('user_access') && user_access($perm)) { if ($qstring) { $rpath .= (variable_get('clean_url', '0')? '?' : '&') . $qstring; } $tvars = array( '%module' => 'MultiLink Redirect', '!link' => sprintf('%s', $rpath, $rpath), '%perm' => $perm, ); drupal_set_message(t('%module: redirect to !link (not done due to %perm permission.)', $tvars), 'warning'); //multilink_set_message(t('%module: redirect to !link (not done due to %perm permission.)', $tvars), 'warning'); } // Else, do the redirect. else { drupal_goto($rpath, $qstring, null, 302); } } } } // --- Drupal docs advise NOT closing PHP tags ---