XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
XCube_HttpContext.class.php
1<?php
12
13define( 'XCUBE_CONTEXT_TYPE_DEFAULT', 'web_browser' );
14define( 'XCUBE_CONTEXT_TYPE_WEB_SERVICE', 'web_service' );
15
16
26 public $mAttributes = [];
27
33 public $mRequest;
34
38 public $mUser;
39
44 public $mType = XCUBE_CONTEXT_TYPE_DEFAULT;
45
53
54 public function __construct() {
55 }
56
65 public function setAttribute( $key, $value ) {
66 $this->mAttributes[ $key ] = $value;
67 }
68
76 public function hasAttribute( $key ) {
77 return isset( $this->mAttributes[ $key ] );
78 }
79
88 public function getAttribute( $key ) {
89 //return isset( $this->mAttributes[ $key ] ) ? $this->mAttributes[ $key ] : null; gigamaster
90 return $this->mAttributes[$key] ?? null;
91 }
92
98 public function setRequest( &$request ) {
99 $this->mRequest =& $request;
100 }
101
107 public function &getRequest() {
108 return $this->mRequest;
109 }
110
117 public function setUser( &$principal ) {
118 $this->mUser =& $principal;
119 }
120
126 public function &getUser() {
127 return $this->mUser;
128 }
129
137 public function setThemeName(string $theme ) {
138 $this->mThemeName = $theme;
139 }
140
147 public function getThemeName() {
148 return $this->mThemeName;
149 }
150}
151
163 public function getRequest( $key ) {
164 return null;
165 }
166}
167
180 public function getRequest( $key ) {
181 if ( ! isset( $_GET[ $key ] ) && ! isset( $_POST[ $key ] ) ) {
182 return null;
183 }
184
185 return $_GET[ $key ] ?? $_POST[ $key ];
186 }
187
197 public function _getArrayRequest( $arr ) {
198 //trigger_error("assume magic_quotes_gpc is off", E_USER_NOTICE);
199 return $arr;
200 }
201}
202
212 public $mAttributes = [];
213
214 public function __construct( $arr = null ) {
215 if ( is_array( $arr ) ) {
216 $this->mAttributes = $arr;
217 }
218 }
219
220 public function getRequest( $key ) {
221 if ( ! isset( $this->mAttributes[ $key ] ) ) {
222 return null;
223 }
224
225 return $this->mAttributes[ $key ];
226 }
227}