Project

General

Profile

« Previous | Next » 

Revision 13781

web/index.php: removed no longer used PHP redirects. these are now handled by Apache .htaccess files instead.

View differences:

index.php
16 16
		.$name.'">'.$name."</a></big><i>".$path_pat."</i></h".$h_level.">\n");
17 17
}
18 18

  
19
function custom_separator($url, $sep, $main_url=null)
20
{
21
	if (!isset($main_url)) $main_url = $url;
22
	
23
	return function($path) use($url, $sep, $main_url)
24
	{
25
		if ($path === "") return $main_url;
26
		$path = parse_dot_path($path);
27
		return $url.join_non_empty($sep, array($path->head, $path->tail));
28
	};
29
}
30

  
31
function fragment_override($url, $fragment=null)
32
{
33
	return function($path) use($url, $fragment)
34
	{
35
		if (!isset($fragment))
36
		{
37
			$path = parse_dot_path($path);
38
			$fragment = $path->head;
39
			$path = $path->tail;
40
		}
41
		if ($path !== "") $url .= "?".$path;
42
		return $url."#".$fragment;
43
	};
44
}
45

  
46
function phpPgAdmin($url, $table=null)
47
{
48
	return function($path) use($url, $table)
49
	{
50
		$path = join_non_empty(".", array($table, $path));
51
		$path = parse_dot_path($path);
52
		$subject = "schema";
53
		if ($path->head !== "")
54
		{
55
			$url .= "&table=".$path->head;
56
			if ($path->tail !== "")
57
			{
58
				$url .= "&column=".$path->tail;
59
				$subject = "column";
60
			}
61
			else $subject = "table";
62
		}
63
		$url .= "&subject=".$subject;
64
		return $url;
65
	};
66
}
67

  
68
function phpMyAdmin($url, $table=null)
69
{
70
	return function($path) use($url, $table)
71
	{
72
		$path = join_non_empty(".", array($table, $path));
73
		$path = parse_dot_path($path);
74
		$target = "db_structure";
75
		if ($path->head !== "")
76
		{
77
			$url .= "&table=".$path->head;
78
			if ($path->tail !== "") $url .= "&column=".$path->tail;
79
			$target = "tbl_structure";
80
		}
81
		$url .= "&target=".$target.".php";
82
		return $url;
83
	};
84
}
85

  
86 19
ob_start(); // delay output in case there is a redirect
87 20
?>
88 21
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
......
99 32
		<h1>VegPath&nbsp;&nbsp; <small><a href="http://en.wikipedia.org/wiki/PURL">persistent URLs</a> for vegetation resources</small></h1>
100 33
		<div>Supported URL patterns:&nbsp;&nbsp; <small>(elements in <i>italics</i> are optional)</small></div>
101 34
<?php
102
# add and list URLs
103

  
104
$Redmine = "https://projects.nceas.ucsb.edu/nceas/projects/bien";
105
$Redmine_svn = $Redmine."/repository/raw";
106

  
107
$nimoy = "http://nimoy.nceas.ucsb.edu/phpmyadmin/index.php";
108
function nimoy_db($db) { global $nimoy; return phpMyAdmin($nimoy."?db=".$db); }
109

  
110
$IH_db = phpMyAdmin($nimoy."?db=bien3_adb", "ih");
111

  
112
$SALVIAS = "http://salvias.net/Documents/salvias_data_dictionary.html";
35
# list URLs
113 36
?>
114 37
		<table border="0" cellspacing="0" cellpadding="0">
115 38
			<tr valign="top">
......
139 62
{
140 63
	print("<blockquote>\n");
141 64
	add_ns("TNRS", ".term");
142
	add_ns("VegBank", ".table.column", custom_separator("http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&entity=dba_tabledescription&where=where_tablename&wparam=",
143
		"#", "http://vegbank.org/get/index/dba_tabledescription"));
65
	add_ns("VegBank", ".table.column");
144 66
	add_ns("SALVIAS", ".table.column");
145 67
	{
146 68
		print("<blockquote>\n"); $h_level++;
......
180 102
	add_ns("Brad", "");
181 103
	{
182 104
		print("<blockquote>\n"); $h_level++;
183
		$Brad_Boyle_VegCore = $Redmine_svn."/exchange_schemas/VegCore/Brad_Boyle";
184 105
		add_ns("Brad.provenance", ".term");
185 106
		add_ns("Brad.identifiers", ".term");
186 107
		add_ns("Brad.identifier_examples", ".term");
......
198 119
print("<h3>Institutions</h3>");
199 120
{
200 121
	print("<blockquote>\n");
201
	add_ns("IH", ".herbarium_code", by_prefix("http://sweetgum.nybg.org/ih/herbarium_list.php?QueryName=DetailedQuery&Restriction=NamPartyType+%3D+%27IH+Herbarium%27&col_NamOrganisationAcronym=",
202
		"http://sweetgum.nybg.org/ih/"));
122
	add_ns("IH", ".herbarium_code");
203 123
	print("</blockquote>\n");
204 124
}
205 125
print("</blockquote>\n");

Also available in: Unified diff