Project

General

Profile

« Previous | Next » 

Revision 7967

web/vegpath/index.php: Use $alias whenever VegPath was reached via the machine's own name (vegbiendev.nceas.ucsb.edu) rather than via a shortened domain (path.vg), so that the right path root can seamlessly be used when path.vg is down

View differences:

web/vegpath/index.php
4 4
$self_dir = ensure_suffix("/", dirname($_SERVER["SCRIPT_NAME"]));
5 5

  
6 6
# config
7
$alias = $_SERVER["HTTP_HOST"].$self_dir;
8
#$alias = "j.mp/vegpath#";
7
$alias = "j.mp/vegpath#";
9 8

  
10 9
function by_prefix($url, $main_url=null)
11 10
{
......
18 17
}
19 18

  
20 19
$h_level = 5;
20
$root = $_SERVER["HTTP_HOST"] === $_SERVER["SERVER_NAME"]
21
	? $alias : $_SERVER["HTTP_HOST"].$self_dir;
21 22
# instead of PATH_INFO, to support the Apache ErrorDocument directive
22 23
$rel_fs_path = rm_prefix($self_dir, $_SERVER["REQUEST_URI"]);
23 24
$path = parse_dot_path($rel_fs_path);
......
25 26

  
26 27
function add_ns($name, $path_pat, $url_func)
27 28
{
28
	global $alias, $h_level, $path, $ns;
29
	global $root, $h_level, $path, $ns;
29 30
	if (is_string($url_func)) $url_func = by_prefix($url_func);
30 31
	
31
	print("<h".$h_level.' id="'.$name.'">'.$alias.'<big><a href="http://'.$alias
32
	print("<h".$h_level.' id="'.$name.'">'.$root.'<big><a href="http://'.$root
32 33
		.$name.'">'.$name."</a></big><i>".$path_pat."</i></h".$h_level.">\n");
33 34
	if ($ns === strtolower($name)) # found match, so redirect
34 35
	{
......
228 229
			</tr>
229 230
		</table>
230 231
<?php
231
if (ends_with($alias, '#')) # URL shortener requires fragment redirect
232
if (ends_with($root, '#')) # URL shortener requires fragment redirect
232 233
{
233 234
?>
234 235
		<script type="text/javascript">

Also available in: Unified diff