summaryrefslogtreecommitdiffstats
path: root/codebase
diff options
context:
space:
mode:
authorStanislau Wolski <stanislau.wolski@gmail.com>2016-01-14 18:10:58 +0300
committerStanislau Wolski <stanislau.wolski@gmail.com>2016-01-14 18:10:58 +0300
commit4a75329e2b743ece62d47439e8a1cfc1048e82cd (patch)
tree2b8f9d5f6754cc62000c40cd4401a22590d7d61c /codebase
parent709f7d2b048d2ad548b5f4d5fba43759e8c00283 (diff)
parentd6cc2827e356b4803d48bf66d1d95ddfb453343c (diff)
downloadconnector-php-4a75329e2b743ece62d47439e8a1cfc1048e82cd.zip
connector-php-4a75329e2b743ece62d47439e8a1cfc1048e82cd.tar.gz
connector-php-4a75329e2b743ece62d47439e8a1cfc1048e82cd.tar.bz2
Merge pull request #10 from slothfk/master
corrected live_update encoding
Diffstat (limited to 'codebase')
-rwxr-xr-xcodebase/base_connector.php8
-rwxr-xr-xcodebase/update.php23
2 files changed, 20 insertions, 11 deletions
diff --git a/codebase/base_connector.php b/codebase/base_connector.php
index 4e033b2..01a42ce 100755
--- a/codebase/base_connector.php
+++ b/codebase/base_connector.php
@@ -700,6 +700,9 @@ class Connector {
*/
public function set_encoding($encoding){
$this->encoding=$encoding;
+ if ($this->live_update !== false) {
+ $this->live_update->set_encoding($this->encoding);
+ }
}
/*! enable or disable dynamic loading mode
@@ -855,8 +858,9 @@ class Connector {
url used for update notifications
*/
public function enable_live_update($table, $url=false){
- $this->live_update = new $this->live_update_data_type($this->sql, $this->config, $this->request, $table,$url, array("connector" => $this));
- $this->live_update->set_event($this->event,$this->names["item_class"]);
+ $this->live_update = new $this->live_update_data_type($this->sql, $this->config, $this->request, $table,$url, array("connector" => $this));
+ $this->live_update->set_event($this->event,$this->names["item_class"]);
+ $this->live_update->set_encoding($this->encoding);
$this->event->attach("beforeOutput", Array($this->live_update, "version_output"));
$this->event->attach("beforeFiltering", Array($this->live_update, "get_updates"));
$this->event->attach("beforeProcessing", Array($this->live_update, "check_collision"));
diff --git a/codebase/update.php b/codebase/update.php
index 9ef12ac..07c154e 100755
--- a/codebase/update.php
+++ b/codebase/update.php
@@ -104,12 +104,13 @@ class DataUpdate{
protected $table; //!< table , where actions are stored
protected $url; //!< url for notification service, optional
- protected $sql; //!< DB wrapper object
- protected $config; //!< DBConfig object
- protected $request; //!< DBRequestConfig object
- protected $event;
- protected $item_class;
- protected $demu;
+ protected $sql; //!< DB wrapper object
+ protected $config; //!< DBConfig object
+ protected $request; //!< DBRequestConfig object
+ protected $encoding="utf-8";
+ protected $event;
+ protected $item_class;
+ protected $demu;
//protected $config;//!< DataConfig instance
//protected $request;//!< DataRequestConfig instance
@@ -141,6 +142,10 @@ class DataUpdate{
$this->event = $master;
$this->item_class = $name;
}
+
+ public function set_encoding($encoding){
+ $this->encoding = $encoding;
+ }
protected function select_update($actions_table, $join_table, $id_field_name, $version, $user) {
$sql = "SELECT $join_table.*, {$actions_table}.id, {$actions_table}.dataId, {$actions_table}.type as action_table_type, {$actions_table}.user FROM {$actions_table}";
@@ -218,8 +223,8 @@ class DataUpdate{
$output = $this->render_set($this->sql->select($sub_request), $this->item_class);
ob_clean();
- header("Content-type:text/xml");
-
+ header("Content-type:text/xml; charset=".$this->encoding);
+
echo $this->updates_start();
echo $this->get_version();
echo $output;
@@ -342,4 +347,4 @@ class JSONDataUpdate extends DataUpdate {
}
-?> \ No newline at end of file
+?>