Updated a few things

This commit is contained in:
2015-10-22 11:02:50 -05:00
parent eedba502d4
commit 48a9a1790c
5 changed files with 343 additions and 83 deletions

View File

@@ -11,6 +11,7 @@ class Request {
public $server;
public $uri_array;
public $original_uri_array;
private $_anvil;
@@ -19,6 +20,7 @@ class Request {
public function __construct($a) {
$this->_anvil = $a;
$this->createFromGlobals();
$this->clearFlashdata();
}
public function createFromGlobals() {
@@ -32,6 +34,7 @@ class Request {
$this->files = $_FILES;
$this->server = $_SERVER;
$this->uri_array = $this->uriToArray();
$this->original_uri_array = $this->uri_array;
}
/** Is this an HTTPS request? */
@@ -71,7 +74,11 @@ class Request {
}
public function process_data($index=NULL, $xss_clean=FALSE) {
$request_vars = (array)$this->json();
if(count($_FILES) > 0) {
$request_vars = $_POST;
} else {
$request_vars = (array)$this->json();
}
if($index==NULL && !empty($request_vars)) {
$post = array();
foreach(array_keys($request_vars) as $key) {
@@ -115,6 +122,23 @@ class Request {
$this->setCookie($key, '', time()-3600*24*365);
}
public function setFlashdata($key, $val) {
return $this->setCookie('flashdata_'.$key, $val);
}
public function getFlashdata($key) {
if(!isset($this->cookie['flashdata_'.$key])) { return false; }
return $this->cookie['flashdata_'.$key];
}
public function clearFlashdata() {
foreach($this->cookie as $k => $v) {
if(strpos($k, 'flashdata_') !== FALSE) {
$this->clearCookie($k);
}
}
}
/**
* URI Parsing Functions
*/