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