1 |
<? |
2 |
// ------------------------------------------------------------------------- |
3 |
// $Id: Request.php,v 1.1 2002/11/12 05:42:31 joko Exp $ |
4 |
// ------------------------------------------------------------------------- |
5 |
// $Log: Request.php,v $ |
6 |
// Revision 1.1 2002/11/12 05:42:31 joko |
7 |
// + initial checkin |
8 |
// |
9 |
// ------------------------------------------------------------------------- |
10 |
|
11 |
|
12 |
class Site_Request { |
13 |
|
14 |
var $site; |
15 |
|
16 |
function getRequest() { |
17 |
|
18 |
// shift external arguments |
19 |
$arg = $_GET[x]; |
20 |
if (!$arg) { $arg = $_POST[x]; } |
21 |
$externalpage = $_GET[p]; |
22 |
|
23 |
$this->site->log( get_class($this) . "->getRequest( arg $arg )", LOG_DEBUG ); |
24 |
|
25 |
// generic identifier |
26 |
//$ident = $this->_decodeIdentifier($arg); |
27 |
$ident = $this->site->decodeIdentifier($arg); |
28 |
|
29 |
// get handler for identifier |
30 |
//$handler = $this->getHandler($ident); |
31 |
$this->site->log( get_class($this) . "->getRequest: getHandler( ident $ident )", LOG_DEBUG ); |
32 |
$handler = $this->site->getHandler($ident); |
33 |
//print "handler: " . dumpvar($handler) . "<br>"; |
34 |
$handler[name] = $ident; |
35 |
|
36 |
// parse action from identifier |
37 |
if ($ident && substr($ident, -1) != '/') { |
38 |
$action = substr($ident, strrpos($ident, '/') + 1); |
39 |
} |
40 |
|
41 |
$result = array( |
42 |
'url_arg' => $arg, |
43 |
'ident' => $ident, |
44 |
'handler' => $handler, |
45 |
'externalpage' => $externalpage, |
46 |
'action' => $action, |
47 |
); |
48 |
|
49 |
return $result; |
50 |
} |
51 |
|
52 |
function getCachedRequest () { |
53 |
global $site_state; |
54 |
return $site_state[cachedRequest]; |
55 |
} |
56 |
|
57 |
function cacheThisRequest($request = array()) { |
58 |
global $site_state; |
59 |
if (!count($request)) { |
60 |
$request = $this->getRequest(); |
61 |
} |
62 |
//print Dumper($request); |
63 |
$site_state[cachedRequest] = $request; |
64 |
} |
65 |
|
66 |
function overrideRequestIdentifier($ident) { |
67 |
$pident = $this->site->encodeIdentifier($ident); |
68 |
// PATCH!!!! clean up!!! |
69 |
$_GET[x] = $pident; |
70 |
} |
71 |
|
72 |
|
73 |
} |
74 |
?> |