~ubuntu-qa-website-devel/ubuntu-qa-website/drupal7-rewrite

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/*
Copyright (C) 2008-2011 Stephane Graber <stgraber@ubuntu.com>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/


//Work around to fix lp:1194770
$path = drupal_get_path_alias($_GET['q']);

// Get the leading section of the path eg. /user /qatracker etc.
//$pathmain = explode("/", $path)[0];
//if($pathmain == "user"){
if($path == 'user' || $path == 'user/login' || $path == 'user/register' || $path == 'user/password'){
	$redirect = array(
		'#tag' => 'meta', // The #tag is the html tag - <link />
		'#attributes' => array( // Set up an array of attributes inside the tag
			'http-equiv' => 'refresh', 
			'content' => '0; url=https://login.ubuntu.com/',
			),
		);

	// Please note: this fix is purely a work around as a meta refresh is not reccomended by the W3C, so redirects should 
	// implemented on the server side however this work around provides the functionality neccesary.
	
	drupal_add_html_head($redirect, 'redirect');
}

?>