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