diff options
author | Stanislav-Wolski <stanislau.wolski@gmail.com> | 2012-05-28 17:29:54 +0300 |
---|---|---|
committer | Stanislav-Wolski <stanislau.wolski@gmail.com> | 2012-05-28 17:29:54 +0300 |
commit | f412231c95a2d54a1061b597b4032227e5e0bdb5 (patch) | |
tree | 0a4b388edebba591e6fd19dbe1cea2f7978d7294 /codebase/data_connector.php | |
parent | 6c5b0c64092ad095d55412b5765c14bd121b508c (diff) | |
download | connector-php-f412231c95a2d54a1061b597b4032227e5e0bdb5.zip connector-php-f412231c95a2d54a1061b597b4032227e5e0bdb5.tar.gz connector-php-f412231c95a2d54a1061b597b4032227e5e0bdb5.tar.bz2 |
[add] csrf defense and render_array functionality
Diffstat (limited to 'codebase/data_connector.php')
-rw-r--r-- | codebase/data_connector.php | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/codebase/data_connector.php b/codebase/data_connector.php index a5419e0..f094fb8 100644 --- a/codebase/data_connector.php +++ b/codebase/data_connector.php @@ -102,7 +102,6 @@ class DataConnector extends Connector{ if (!$data_type) $data_type="CommonDataProcessor"; $this->sections = array(); - $this->attributes = array(); if (!$render_type) $render_type="RenderStrategy"; parent::__construct($res,$type,$item_type,$data_type,$render_type); @@ -114,11 +113,6 @@ class DataConnector extends Connector{ $this->sections[$name] = $string; } - protected $attributes; - public function add_top_attribute($name, $string){ - $this->attributes[$name] = $string; - } - protected function parse_request_mode(){ //do nothing, at least for now } @@ -150,9 +144,6 @@ class DataConnector extends Connector{ if (isset($_GET["start"]) && isset($_GET["count"])) $this->request->set_limit($_GET["start"],$_GET["count"]); - $key = ConnectorSecurity::checkCSRF($this->editing); - if ($key !== "") - $this->add_top_attribute("dhx_security", $key); } /*! renders self as xml, starting part @@ -167,7 +158,6 @@ class DataConnector extends Connector{ $start .= "<".$k.">".$v."</".$k.">\n"; return $start; } - }; class JSONDataConnector extends DataConnector{ @@ -232,10 +222,14 @@ class JSONDataConnector extends DataConnector{ $is_sections = sizeof($this->sections) && $this->is_first_call(); - if ($this->dload || $is_sections){ + if ($this->dload || $is_sections || sizeof($this->attributes)){ $start = $start.$end; $end=""; + $attributes = ""; + foreach($this->attributes as $k=>$v) + $end .= ", ".$k.":\"".$v."\""; + if ($is_sections){ //extra sections foreach($this->sections as $k=>$v) |