forked from extern/egroupware
* InfoLog: fix SQL errors for custom types containing non-ascii chars (eg. German umlauts or Frensh acents
This commit is contained in:
parent
cc7ba1630e
commit
7efaea763d
@ -50,6 +50,23 @@ class contenthistory
|
|||||||
),__LINE__,__FILE__,'syncml');
|
),__LINE__,__FILE__,'syncml');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encode app-name for egw_api_content_history.sync_appname only allowing ascii
|
||||||
|
*
|
||||||
|
* We encode all non-ascii as "?" for MySQL, as it happend during schema update and for inserts.
|
||||||
|
*
|
||||||
|
* @param string $_appname
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function encode_appname($_appname)
|
||||||
|
{
|
||||||
|
if ($this->db->Type == 'mysql')
|
||||||
|
{
|
||||||
|
$_appname = preg_replace('/[\x80-\xFF]/u', '?', $_appname);
|
||||||
|
}
|
||||||
|
return $_appname;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the timestamp for action
|
* get the timestamp for action
|
||||||
*
|
*
|
||||||
@ -63,7 +80,7 @@ class contenthistory
|
|||||||
*/
|
*/
|
||||||
function getHistory($_appName, $_action, $_ts, $readableItems = false)
|
function getHistory($_appName, $_action, $_ts, $readableItems = false)
|
||||||
{
|
{
|
||||||
$where = array('sync_appname' => $_appName);
|
$where = array('sync_appname' => $this->encode_appname($_appName));
|
||||||
$ts = $this->db->to_timestamp($_ts);
|
$ts = $this->db->to_timestamp($_ts);
|
||||||
$idList = array();
|
$idList = array();
|
||||||
|
|
||||||
@ -129,7 +146,7 @@ class contenthistory
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$where = array (
|
$where = array (
|
||||||
'sync_appname' => $_appName,
|
'sync_appname' => $this->encode_appname($_appName),
|
||||||
'sync_contentid' => $_id,
|
'sync_contentid' => $_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -152,7 +169,7 @@ class contenthistory
|
|||||||
function updateTimeStamp($_appName, $_id, $_action, $_ts)
|
function updateTimeStamp($_appName, $_id, $_action, $_ts)
|
||||||
{
|
{
|
||||||
$newData = array (
|
$newData = array (
|
||||||
'sync_appname' => $_appName,
|
'sync_appname' => $this->encode_appname($_appName),
|
||||||
'sync_contentid' => $_id,
|
'sync_contentid' => $_id,
|
||||||
'sync_added' => $this->db->to_timestamp($_ts),
|
'sync_added' => $this->db->to_timestamp($_ts),
|
||||||
'sync_changedby' => $GLOBALS['egw_info']['user']['account_id'],
|
'sync_changedby' => $GLOBALS['egw_info']['user']['account_id'],
|
||||||
@ -168,7 +185,7 @@ class contenthistory
|
|||||||
case 'delete':
|
case 'delete':
|
||||||
// first check that this entry got ever added to database already
|
// first check that this entry got ever added to database already
|
||||||
$where = array (
|
$where = array (
|
||||||
'sync_appname' => $_appName,
|
'sync_appname' => $this->encode_appname($_appName),
|
||||||
'sync_contentid' => $_id,
|
'sync_contentid' => $_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -201,7 +218,7 @@ class contenthistory
|
|||||||
{
|
{
|
||||||
$max = 0;
|
$max = 0;
|
||||||
|
|
||||||
$where = array('sync_appname' => $_appName);
|
$where = array('sync_appname' => $this->encode_appname($_appName));
|
||||||
|
|
||||||
foreach (array('modified','deleted','added') as $action)
|
foreach (array('modified','deleted','added') as $action)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user