summaryrefslogtreecommitdiffstats
path: root/codebase/Data/CommonDataProcessor.php
diff options
context:
space:
mode:
Diffstat (limited to 'codebase/Data/CommonDataProcessor.php')
-rw-r--r--codebase/Data/CommonDataProcessor.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/codebase/Data/CommonDataProcessor.php b/codebase/Data/CommonDataProcessor.php
new file mode 100644
index 0000000..8f00b94
--- /dev/null
+++ b/codebase/Data/CommonDataProcessor.php
@@ -0,0 +1,55 @@
+<?php
+namespace DHTMLX\Connector\Data;
+
+use DHTMLX\Connector\XSSFilter\ConnectorSecurity;
+use DHTMLX\Connector\Tools\LogMaster;
+
+class CommonDataProcessor extends DataProcessor{
+ protected function get_post_values($ids){
+ if (isset($_GET['action'])){
+ $data = array();
+ if (isset($_POST["id"])){
+ $dataset = array();
+ foreach($_POST as $key=>$value)
+ $dataset[$key] = ConnectorSecurity::filter($value);
+
+ $data[$_POST["id"]] = $dataset;
+ }
+ else
+ $data["dummy_id"] = $_POST;
+ return $data;
+ }
+ return parent::get_post_values($ids);
+ }
+
+ protected function get_ids(){
+ if (isset($_GET['action'])){
+ if (isset($_POST["id"]))
+ return array($_POST['id']);
+ else
+ return array("dummy_id");
+ }
+ return parent::get_ids();
+ }
+
+ protected function get_operation($rid){
+ if (isset($_GET['action']))
+ return $_GET['action'];
+ return parent::get_operation($rid);
+ }
+
+ public function output_as_xml($results){
+ if (isset($_GET['action'])){
+ LogMaster::log("Edit operation finished",$results);
+ ob_clean();
+ $type = $results[0]->get_status();
+ if ($type == "error" || $type == "invalid"){
+ echo "false";
+ } else if ($type=="insert"){
+ echo "true\n".$results[0]->get_new_id();
+ } else
+ echo "true";
+ } else
+ return parent::output_as_xml($results);
+ }
+}; \ No newline at end of file