summaryrefslogtreecommitdiffstats
path: root/codebase/connector/data_connector.php
diff options
context:
space:
mode:
Diffstat (limited to 'codebase/connector/data_connector.php')
-rw-r--r--codebase/connector/data_connector.php38
1 files changed, 29 insertions, 9 deletions
diff --git a/codebase/connector/data_connector.php b/codebase/connector/data_connector.php
index caa5369..7c9251d 100644
--- a/codebase/connector/data_connector.php
+++ b/codebase/connector/data_connector.php
@@ -113,6 +113,12 @@ class DataConnector extends Connector{
$this->sections[$name] = $string;
}
+ protected function parse_request_mode(){
+ if (isset($_GET['action']) && $_GET["action"] != "get")
+ $this->editing = true;
+ else
+ parent::parse_request_mode();
+ }
//parse GET scoope, all operations with incoming request must be done here
protected function parse_request(){
@@ -131,10 +137,10 @@ class DataConnector extends Connector{
//data saving
$this->editing = true;
}
+ parent::check_csrf();
} else {
if (isset($_GET['editing']) && isset($_POST['ids']))
$this->editing = true;
-
parent::parse_request();
}
@@ -146,7 +152,10 @@ class DataConnector extends Connector{
/*! renders self as xml, starting part
*/
protected function xml_start(){
- $start = parent::xml_start();
+ $start = "<data";
+ foreach($this->attributes as $k=>$v)
+ $start .= " ".$k."='".$v."'";
+ $start.= ">";
foreach($this->sections as $k=>$v)
$start .= "<".$k.">".$v."</".$k.">\n";
@@ -192,7 +201,7 @@ class JSONDataConnector extends DataConnector{
$name = $k;
$option="\"{$name}\":[";
if (!is_string($this->options[$name]))
- $option.=substr($this->options[$name]->render(),0,-2);
+ $option.=substr(json_encode($this->options[$name]->render()),1,-1);
else
$option.=$this->options[$name];
$option.="]";
@@ -260,7 +269,7 @@ class JSONCommonDataItem extends DataItem{
/*! return self as XML string
*/
function to_xml(){
- if ($this->skip) return "";
+ if ($this->skip) return false;
$data = array(
'id' => $this->get_id()
@@ -271,8 +280,11 @@ class JSONCommonDataItem extends DataItem{
}
if ($this->userdata !== false)
- foreach ($this->userdata as $key => $value)
+ foreach ($this->userdata as $key => $value){
+ if ($value === null)
+ $data[$key]="";
$data[$key]=$value;
+ }
return $data;
}
@@ -337,7 +349,7 @@ class TreeCommonDataItem extends CommonDataItem{
$str.=" ".$key."='".$this->xmlentities($value)."'";
if ($this->kids === true)
- $str .=" dhx_kids='1'";
+ $str .=" ".Connector::$kids_var."='1'";
return $str.">";
}
@@ -391,7 +403,11 @@ class TreeDataConnector extends DataConnector{
/*! renders self as xml, starting part
*/
protected function xml_start(){
- return "<data parent='".$this->request->get_relation()."'>";
+ $attributes = " parent='".$this->request->get_relation()."' ";
+ foreach($this->attributes as $k=>$v)
+ $attributes .= " ".$k."='".$v."'";
+
+ return "<data".$attributes.">";
}
}
@@ -417,6 +433,10 @@ class JSONTreeDataConnector extends TreeDataConnector{
if (!empty($this->options))
$data["collections"] = $this->options;
+
+ foreach($this->attributes as $k=>$v)
+ $data[$k] = $v;
+
$data = json_encode($data);
// return as string
@@ -472,7 +492,7 @@ class JSONTreeCommonDataItem extends TreeCommonDataItem{
/*! return self as XML string
*/
function to_xml_start(){
- if ($this->skip) return "";
+ if ($this->skip) return false;
$data = array( "id" => $this->get_id() );
for ($i=0; $i<sizeof($this->config->text); $i++){
@@ -486,7 +506,7 @@ class JSONTreeCommonDataItem extends TreeCommonDataItem{
$data[$key]=$value;
if ($this->kids === true)
- $data["dhx_kids"] = 1;
+ $data[Connector::$kids_var] = 1;
return $data;
}