1 |
<?php |
---|
2 |
/** |
---|
3 |
* ExtractContext popup dialog |
---|
4 |
* |
---|
5 |
* @project CWC2 |
---|
6 |
* @revision $Id: ExtractContext.phtml,v 1.3 2004/05/03 19:10:42 pspencer Exp $ |
---|
7 |
* @purpose ExtractContext popup dialog |
---|
8 |
* @author DM Solutions Group (spencer@dmsolutions.ca) |
---|
9 |
* @copyright |
---|
10 |
* <b>Copyright (c) 2002, DM Solutions Group Inc.</b> |
---|
11 |
* Permission is hereby granted, free of charge, to any person obtaining a |
---|
12 |
* copy of this software and associated documentation files (the "Software"), |
---|
13 |
* to deal in the Software without restriction, including without limitation |
---|
14 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
15 |
* and/or sell copies of the Software, and to permit persons to whom the |
---|
16 |
* Software is furnished to do so, subject to the following conditions: |
---|
17 |
* |
---|
18 |
* The above copyright notice and this permission notice shall be included |
---|
19 |
* in all copies or substantial portions of the Software. |
---|
20 |
* |
---|
21 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
22 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
23 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
---|
24 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
25 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
---|
26 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
27 |
* DEALINGS IN THE SOFTWARE. |
---|
28 |
* |
---|
29 |
****************************************************************************** |
---|
30 |
* |
---|
31 |
* This dialog receives the extraction request and extracts the current context |
---|
32 |
* to a web-accessible location then passes the URL to get the context along to |
---|
33 |
* the extraction service. The only tricky bit is if the local setup doesn't |
---|
34 |
* include the server name/host, in which case we try to add it. |
---|
35 |
* |
---|
36 |
* I could potentially have written this the other way around. By this, I mean |
---|
37 |
* the extractcontext widget could have passed a URL with some ID in it to the |
---|
38 |
* extraction service. The URL would point to this script, which would use the |
---|
39 |
* ID to determine what previous state to return as a context. |
---|
40 |
*/ |
---|
41 |
$szLanguageResource = str_replace("\\","/",dirname(__FILE__))."/ExtractContext.dbf"; |
---|
42 |
|
---|
43 |
define("LOAD_MAPSESSION", 1); |
---|
44 |
include("../session.inc.php"); |
---|
45 |
|
---|
46 |
$szLocation = isset($_GET["EXTRACTURL"]) ? urldecode($_GET["EXTRACTURL"]) : ""; |
---|
47 |
|
---|
48 |
if ($szLocation != "") |
---|
49 |
{ |
---|
50 |
|
---|
51 |
|
---|
52 |
$szContextFile = md5(uniqid("", 1)).".cml"; |
---|
53 |
$szSavedContext = $_SESSION["gszTmpImgPath"].$szContextFile; |
---|
54 |
$oMapSession->oMap->saveMapContext( $szSavedContext ); |
---|
55 |
|
---|
56 |
if (substr($szLocation, -1) != "?") |
---|
57 |
{ |
---|
58 |
if (stristr($szLocation, "?") === false) |
---|
59 |
$szLocation .= "?"; |
---|
60 |
else |
---|
61 |
$szLocation .= "&"; |
---|
62 |
} |
---|
63 |
|
---|
64 |
$szContextURL = $_SESSION["gszTmpWebPath"].$szContextFile; |
---|
65 |
|
---|
66 |
if (strcasecmp(substr($szContextURL, 0, 4), "http") !== 0) |
---|
67 |
{ |
---|
68 |
//assume web path local to cwc2 server (that this file is running on) |
---|
69 |
if (isset($_SERVER['HTTPS']) && strcasecmp($_SERVER["HTTPS"], "on") == 0) |
---|
70 |
$http = "https://"; |
---|
71 |
else |
---|
72 |
$http = "http://"; |
---|
73 |
|
---|
74 |
$host = $_SERVER['HTTP_HOST']; |
---|
75 |
|
---|
76 |
$port = (isset($_SERVER["SERVER_PORT"]) && |
---|
77 |
$_SERVER["SERVER_PORT"] != "80") ? ":".$_SERVER["SERVER_PORT"] |
---|
78 |
: ""; |
---|
79 |
|
---|
80 |
$szContextURL = $http.$host.$port.$szContextURL; |
---|
81 |
} |
---|
82 |
|
---|
83 |
$szLocation .= "CONTEXT=".urlencode($szContextURL); |
---|
84 |
header( "Location: ".$szLocation); |
---|
85 |
echo $szLocation; |
---|
86 |
exit; |
---|
87 |
} |
---|
88 |
else |
---|
89 |
{ |
---|
90 |
?> |
---|
91 |
<HTML> |
---|
92 |
<BODY> |
---|
93 |
<P> |
---|
94 |
<? echo $oMLT->get("1", "Error: EXTRACTION SERVICE URL NOT SPECIFIED"); ?><BR> |
---|
95 |
</P> |
---|
96 |
</BODY> |
---|
97 |
</HTML> |
---|
98 |
<? |
---|
99 |
} |
---|
100 |
?> |
---|